Skip to content

Library

A library is an independently maintained collection of rule groups that projects can import. Libraries let you share engineering practices across projects, within your organization, or with third parties.

You can publish your team’s rules in a library or import libraries from others. Rules needed by only one project can stay local to that project.

A library lives in a Git repository. It contains:

  • Library metadata in rule-library.yaml, which declares the format and any license information.
  • Groups under techs/ and practices/, each with group metadata and Markdown rule files.

For example, a repository named “engineering-rules” might contain:

engineering-rules/
rule-library.yaml
practices/testing/
_group.yaml
test-changed-behavior.md

The repository name is your choice. Library groups live at its root; they don’t need a .code-rules/ directory. Rules can also include supporting assets.

Each project chooses which libraries, versions, and groups to import in .code-rules/config.yaml. A project can use several libraries and add its own local rules.

Running code-rules project sync downloads the selected rules and generates the guidance agents read. Groups with the same ID combine, and the project’s exclusions and replacements determine which rules appear.

Library authors publish updates as new versions. Each project chooses when to adopt them by syncing with an exact version or a version constraint. See Import rules and Update rules for the steps.

Libraries can be public or private. Imports copy their content into the consuming project, so use private libraries only in projects allowed to hold and share that content.

Code Rules preserves declared license text and notices with imported rules. For choosing terms, see License rules.

To publish your own, follow Create your first library. For file details, see Rule and library format.

Fabrica Code RulesMIT licensed

Designed in California. Built with Fabrica.