Skip to content

Project files

Every repository that uses Trailguide, whether a project, a library, or both, has the same Trailguide directory, .trailguide/ at its root. It holds the configuration, a project’s own rules, skills, and assets, vendor snapshots of what it takes from each source, and generated guidance. A library keeps the rules and skills it publishes at the repository root instead, in rules/ and skills/; see Library layout. When the repository installs skills, Trailguide also writes them into target folders outside that directory, where agents look for skills.

The tree below shows the repository root, the top-level directory of your codebase. The leading / refers to the repository root, not your computer’s filesystem root.

  • Directory/.agents/skills/
    • Directorybuild-feature/
      • SKILL.md
      • Directoryscripts/
        • verify.sh
    • Directoryfix-bug/
      • …
  • Directory/.claude/skills/
    • Directorybuild-feature/
      • …
    • Directoryfix-bug/
      • …
    • Directoryrelease/ another tool’s skill, which Trailguide leaves alone
      • …
  • Directory/.trailguide/
    • README.md what each file and folder here is
    • config.yaml
    • lock.json
    • RULES.md
    • SKILLS.md
    • Directoryrules/
      • README.md
      • Directorypractices/testing/
        • _group.yaml
        • test-failure-paths.md
    • Directoryskills/
      • README.md
      • Directoryfix-bug/ a fork of the fabrica source’s skill
        • SKILL.md
      • Directoryrelease-checklist/ the repository’s own skill
        • SKILL.md
    • Directoryassets/
      • retry-lifecycle.svg
    • Directoryvendor/
      • .gitattributes
      • Directoryfabrica/
        • config.yaml
        • Directoryrules/
          • Directorypractices/testing/
            • …
        • Directoryassets/
          • …
        • Directoryskills/
          • Directoryfabrica/
            • Directorybuild-feature/
              • …
        • Directorycurated/
          • Directorymattpocock/
            • Directoryskills/engineering/to-spec/
              • …
      • Directorypstack/
        • Directoryskills/architect/
          • …
        • Directoryskills/build-feature/
          • SKILL.md
    • Directorygenerated/
      • .gitattributes
      • GUIDE.md
      • Directorygroups/
        • …
      • Directoryrules/
        • Directoryfabrica/
          • …
        • Directorylocal/
          • …
      • Directorylibraries/
        • …
      • Directoryreferences/
        • README.md
        • Directoryfabrica/
          • Directoryskills/fabrica/redesign/
            • SKILL.md
      • installed-skills.json

.claude/skills/ and .agents/skills/ exist only for the skill targets the repository configures, and only once it installs a skill. Your AGENTS.md stays outside the Trailguide directory, at the repository root. Trailguide maintains one section of it, between <!-- trailguide:begin --> and <!-- trailguide:end --> markers, and leaves the rest to you. A library also has changes/ in its Trailguide directory, for its change notes; see Library schema.

Initialize from the repository root. In Git repositories, other commands find the nearest Git root and use its .trailguide/ directory. Outside Git, run commands from the repository root. See Working directories.

The Trailguide directory holds three kinds of content. Trailguide writes vendor/, generated/, RULES.md, SKILLS.md, lock.json, and README.md for you; everything else is yours to edit:

  • Authored content: rules/, skills/, and assets/. The rules, rule group metadata, skills, and shared assets written in this project. Add your own rules and skills here, including replacements and forks of rules and skills you include from sources. Each skill sits in its own folder, skills/<name>/, forks included, whose skills.forks entry records the source; see Skill folders. You maintain these files; sync preserves them. In a repository that’s also a library, the library’s own rules and skills, at the repository root, are the project’s authored content too, and a library of library schema version 2 keeps them here, in skills/<library.name>/ for its skills.
  • Vendor snapshots: vendor/<source-name>/. A copy of what the repository takes from each source, at the library release or commit that lock.json records for it, along with every rule’s version and every file’s digest. A library’s snapshot mirrors the layout of a library of library schema version 2, whichever version the library uses, with rules/ and assets/ at the top of the snapshot and each skill the library builds directly in skills/, and the published manifest: a library.yaml that holds what the library’s .trailguide/library.yaml publishes, without its minTrailguideVersion, or, for a library of library schema version 2, a config.yaml that holds only the library section and its curated sources’ repositories and refs, so a rule’s relative links to the library’s shared assets work in the copy too; license and notice files from outside the library’s .trailguide/ keep their paths from its repository root. A non-library source’s files keep their paths in its repository. A snapshot also holds every file an installed skill’s links reach, such as a sibling skill or a shared checklist, so the links keep working offline; these files aren’t skills. In a library’s snapshot, a linked file from outside the library’s .trailguide/ is under _repository/, at its path from the repository root. Skills a library curates are stored with the library that listed them, under curated/<curated-source>/. Snapshots are kept per source because two sources can both have the same rule group ID. Do not customize them; put your changes in authored content instead. The folder’s .gitattributes marks the snapshots as vendored, so GitHub leaves them out of the repository’s language statistics. Sync writes it; a project Trailguide 0.9 or earlier synced has none until its next sync. Commands that read the snapshots refuse an edited copy until sync restores it, so keep attributes of your own in another .gitattributes file.
  • Generated guidance: RULES.md, SKILLS.md, and generated/. The resolved rules your agents read. Trailguide combines the included and authored rules according to config.yaml, applies exclusions and replacements, and writes the reading indexes: RULES.md, which lists the rule groups, and SKILLS.md, which lists the installed skills, sit beside config.yaml, where the AGENTS.md section points agents, and the group pages and resolved rules are in generated/. generated/GUIDE.md is the full guide to managing the project. references/<source-name>/ holds a reading copy of each file an installed skill links to outside its own folder, at its path in the source’s snapshot. Do not edit these files; rebuild them after changing your inputs. Its .gitattributes marks every file in it as generated, so GitHub collapses them in pull request diffs. Vendor snapshots stay expanded, so reviewers see what changed in a source.

Installed skills are output too: Trailguide writes a copy of each installed skill into every target folder, such as .claude/skills/build-feature/, from its vendored or authored source. See Installed skills.

Think of authored content and vendor/ as inputs, and generated/ and the installed skills as the output for your agents. For example, when you replace a library rule, its vendored copy stays in vendor/, your replacement lives in rules/, and generated/ presents the replacement to your agent.

A repository that’s a library of library schema version 3 keeps its own rules and skills at the repository root, in rules/ and skills/src/, not in the Trailguide directory. There, the project commands that write authored content, such as trailguide project create rule and trailguide project fork skill, refuse with library-content-at-root and name the trailguide library command to use instead.

File or directoryWho maintains itPurpose
AGENTS.mdYou, outside the Trailguide sectionYour instructions for agents.
The Trailguide section of AGENTS.mdtrailguide project init, trailguide project build, trailguide project sync, and trailguide project updateTell your agent to read the generated rules and skills.
.trailguide/config.yamlYouChoose sources, the skills and rules to include, versions, the agents to install skills for, and exceptions. A library of library schema version 2 also keeps its manifest here.
.trailguide/library.yamlYou, in a libraryThe library’s manifest: what it publishes, the level of each skill, the sources it curates and forks skills from, and the aliases it gives curated skills.
.trailguide/rules/, skills/, and assets/YouAdd authored rules, rule group metadata, replacements, skills, and shared assets.
.trailguide/README.mdtrailguide project init, trailguide project build, and trailguide project syncSay what each file and folder in the Trailguide directory is, and point to the full guide in generated/GUIDE.md.
.trailguide/RULES.md and SKILLS.mdtrailguide project sync, trailguide project update, and trailguide project buildList the rule groups and the installed skills, where the AGENTS.md section points agents.
.trailguide/lock.jsontrailguide project sync and trailguide project updateRecord each source’s revision, each rule’s version, each installed skill, and every vendored file’s digest.
.trailguide/vendor/trailguide project sync and trailguide project updateStore vendor snapshots of the files lock.json records.
.trailguide/generated/trailguide project sync, trailguide project update, and trailguide project buildProvide resolved rules, indexes, and the record of installed skills.
Skill folders that Trailguide installed in .claude/skills/ and .agents/skills/trailguide project sync, trailguide project update, and trailguide project buildProvide installed copies of skills where agents look for them.
Other folders in .claude/skills/ and .agents/skills/You, or the tool that installed themTrailguide never changes or removes them.

Keep your changes in configuration and authored content. Edits in vendor/, generated/, or an installed skill folder will be replaced or removed. To change a skill you include from a source, fork it into skills/. Commit configuration, authored content, lock.json, both managed directories, and the installed skill folders, so your team, CI, and every fresh checkout use the same rules and skills offline. Commit the project instructions and README as well. If your .gitignore excludes a target folder, such as with /.claude/, change the line to /.claude/* and add the exception !/.claude/skills/, or trailguide project check reports the missing folders. Git can’t re-include a folder inside an excluded folder, so !/.claude/skills/ alone doesn’t work after /.claude/.

Use trailguide project build to regenerate guidance from stored inputs, and trailguide project check to verify consistency without changing files. Missing or mismatched vendor snapshots require trailguide project sync. For recovery and file ownership details, see Sync and recovery.

Generated Markdown and the managed Trailguide guide include a “Generated by Trailguide” notice and regeneration instructions. generated/installed-skills.json stores that notice in generatedNotice. Copied license and notice files retain their original bytes. An installed SKILL.md carries a marker line instead, because its frontmatter must start at the first byte.

trailguide project init creates .trailguide/README.md, a short page that says what each file and folder in the Trailguide directory is and who edits it, with the most common commands. Build writes the full guide, with definitions and commands for managing rules and skills, to .trailguide/generated/GUIDE.md. Init preserves the repository’s own README.md at the repository root.

After upgrading Trailguide, run trailguide project build to regenerate guidance, including generated/GUIDE.md, and refresh the landing README.md, or rerun trailguide project init to refresh only the landing README.md and setup files. generated/GUIDE.md is generated output: build and sync rewrite it, so keep notes of your own elsewhere. Build, sync, and init preserve valid configuration and authored content but refuse to overwrite a manually edited landing README.md. Preserve those notes separately before refreshing it. trailguide project check reports a missing or outdated guide without changing it.

Managed guide format changes are breaking changes under the version policy: a new minor version of Trailguide before 1.0, and a new major version after 1.0. This guide is separate from your repository’s own README.

Creating a rule group also writes a README.md beside _group.yaml. Rule group guides explain how to add, edit, and validate rules. These are authoring documents, excluded from rule loading and generated guidance. Existing rule group files are preserved.

The Trailguide section of AGENTS.md points your agent to .trailguide/RULES.md. It lists the rule groups and explains when to read each one. Agents then open relevant rule groups and read the applicable rules in full. When the repository installs skills, RULES.md also has one line pointing to SKILLS.md, so the same instructions reach agents whose tools don’t load skills from the target folders. See Plan, write, and review for the section’s text and a workflow built on it.

The commands that write the section create AGENTS.md when it’s missing, and add the section after your text. Each refresh replaces only the lines between the markers. The begin marker records a digest of the section’s lines, so build, sync, update, and init refuse to replace a section edited by hand: move your text outside the markers and delete the section, then rerun the command. A begin marker that Trailguide 0.8 or earlier wrote also names its version, and those releases reject a marker without one. So later releases keep that version, and while the configuration has no minTrailguideVersion, which those releases refuse, a new section’s marker names the running version. trailguide project check reports a missing or outdated section. To manage AGENTS.md yourself, set manageAgentsFile: false.

When AGENTS.md already points to .trailguide/RULES.md outside the markers, Trailguide leaves the file alone and trailguide project check accepts it. To switch to the maintained section, delete your own pointer and run trailguide project build.

Trailguide 0.8 and 0.9 kept the rules in .trailguide/_managed/generated/RULES.md, and earlier versions kept them in .trailguide/generated/RULES.md and asked you to paste a pointer to them. Neither file exists now, so while AGENTS.md has such a pointer outside the markers, the commands that write or check the section fail with agents-pointer-outdated. Change the path to .trailguide/RULES.md, or delete the pasted section and rerun the command so Trailguide adds the maintained section in its place.

Path in .trailguide/Contents
RULES.mdThe entry point for discovering relevant rule groups.
SKILLS.mdOne entry per installed skill. Present only when the repository includes skills.
generated/GUIDE.mdThe full guide to managing the project’s rules and skills.
generated/groups/Rule group pages containing full rules or summaries with links to full definitions.
generated/rules/Individual resolved rules, available even when a rule group also includes them inline, and the reference-only rules that installed skills cite.
generated/libraries/Each source’s declared license terms and retained license and notice files.
generated/installed-skills.jsonThe skill folders Trailguide installed in the target folders. Present only when the repository includes skills.

Large indexes can span multiple pages. Follow the page directory and navigation links before selecting rules, and complete any truncated reads. Full rule definitions are never shortened to fit an index.

A rule’s source name appears in its generated path. For example, fabrica:practices/testing/test-failure-paths lives at rules/fabrica/practices/testing/test-failure-paths.md under generated/. Authored rules and replacements have no source name, so they sit under local/ beside the sources: practices/testing/test-failure-paths lives at rules/local/practices/testing/test-failure-paths.md. Excluded rules and replaced rule bodies have no generated rule file. A rule that only an installed skill cites has a generated rule file at the same kind of path, but no rule group page or RULES.md entry lists it.

For rule versions, replacement history, and retained license records, see Provenance.

For each installed skill, Trailguide writes the folder <target>/<install-name>/ in the folder of every agent the configuration installs skills for, such as .claude/skills/build-feature/. The folder holds every file of the skill as its source has it, with each file’s executable bit, except that Markdown links that leave the skill’s folder are changed to reach the same file from the installed copy: the installed copy of a linked skill, the project’s fork of it, or a reading copy in generated/references/. Every target gets the same links. SKILL.md has two changes, and a third when the repository gives the skill an alias: its name field becomes the install name. The installed copy of the project’s own fork also records where it came from, as trailguide-forked-from in its metadata.

First, a marker comment is the first line after the frontmatter:

---
name: build-feature
description: Build a feature from an agreed spec, one slice at a time. Use when starting implementation of a new feature or a change to an existing one.
metadata:
trailguide-skill-type: playbook
trailguide-rules-used: |
practices/testing/test-behavior-not-implementation
practices/verification/verify-on-the-surface-users-touch
trailguide-skills-used: |
skills/tdd
---
<!-- trailguide:installed fabrica:skills/build-feature 1.3.0. Do not edit; trailguide project sync replaces this copy. -->
1. Read the spec and name the slice you're building.

The marker names the skill’s project ID and its version. A skill from a non-library source shows its full commit SHA in place of a version. An authored skill has no version, and its marker says where to edit it instead: <!-- trailguide:installed skills/fix-bug. Do not edit; edit .trailguide/skills/fix-bug/ instead. -->, or, for a skill a library repository builds for itself, <!-- trailguide:installed skills/fix-bug. Do not edit; edit its source in skills/src/, then run trailguide library build. -->. A SKILL.md without frontmatter, which only a non-library source can supply, gets the marker as its first line. The marker never includes the Trailguide version, so upgrading Trailguide doesn’t change installed copies.

Second, a generated section is appended to the end of SKILL.md. When the skill cites rules, it lists each one’s project ID, version, and generated rule file:

## Rules this skill applies
Read each rule in full before the step that applies it.
- `fabrica:practices/testing/test-behavior-not-implementation` 2.0.0: [.trailguide/generated/rules/fabrica/practices/testing/test-behavior-not-implementation.md](../../../.trailguide/generated/rules/fabrica/practices/testing/test-behavior-not-implementation.md)
- `practices/verification/verify-in-staging`, which replaces `fabrica:practices/verification/verify-on-the-surface-users-touch`: [.trailguide/generated/rules/practices/verification/verify-in-staging.md](../../../.trailguide/generated/rules/practices/verification/verify-in-staging.md)
Skills this skill uses: `tdd`
  • A rule the repository replaced shows the replacement, its version when it has one, and the rule it replaces.
  • A rule the repository excluded without a replacement shows “excluded by this project” and the exclusion’s reason, with no link.
  • The “Skills this skill uses” line names each skill it calls by its install name, including those your configuration’s skills.uses adds, and those an authored skill replaces. It appears only when the skill calls others, and without a heading when the skill cites no rules.

Links are relative to the installed SKILL.md, so they work from either target. A skill that cites no rules and calls no skills gets no generated section.

The copy in .agents/skills/, which Codex reads, can also get a generated agents/openai.yaml with the text Codex shows for the skill, from the interface metadata in its SKILL.md. A skill that declares none of it gets no file, and a skill that ships its own agents/openai.yaml keeps it unchanged, in every target.

Trailguide records what it installed in generated/installed-skills.json:

{
"schemaVersion": 1,
"generatedNotice": "Generated by Trailguide. …",
"skills": [
{
"name": "build-feature",
"id": "fabrica:skills/build-feature",
"version": "1.3.0",
"commit": null,
"targets": [
".agents/skills/build-feature",
".claude/skills/build-feature"
],
"digest": "8c2f…d41a",
"forkedFrom": {
"repository": "https://github.com/example/pstack.git",
"skill": "pstack/skills/poteto-mode",
"commit": "699e1e7488c53c05ca13409f40da83cd37682091"
},
"stack": "5k"
}
]
}
FieldMeaning
schemaVersionThe record’s schema version, 1.
nameThe install name, which is the installed folder’s name.
idThe skill’s project ID.
versionThe installed version, or null for an authored skill, a skill from a non-library source, or one with unreleased changes.
commitFor a skill from a non-library source, including a curated one, the full commit SHA it came from; otherwise null.
targetsEach folder Trailguide installed the skill in, relative to the repository root, sorted. When one target folder links to the other, both paths are listed, though the files are written once. Empty when the repository has no skill targets.
digestThe SHA-256 checksum of the installed folder: every file’s path, executable bit, and contents, as sync wrote them. It leaves out a generated agents/openai.yaml, which only the .agents/skills/ copy has.
forkedFromFor a fork, where it came from: the repository, the skill’s ID there, and the commit the fork is based on, left out when the fork records none. For a library’s skill, it’s what the library’s build recorded; for the project’s own fork, its skills.forks entry. Left out for a skill that isn’t a fork. See Provenance.
stackThe stack a library’s skill belongs to, as its build recorded it. Left out for a skill in none.

This record is how Trailguide knows which folders it owns: it replaces and removes only the folders listed here, and refuses to write over any other. See Who owns the target folders.

SKILLS.md has one entry per installed skill, so people, and agents whose tools don’t load skills from the target folders, can see what’s installed, where it came from, and why:

### build-feature
Build a feature from an agreed spec, one slice at a time. Use when starting implementation of a new feature or a change to an existing one.
- **Skill:** `fabrica:skills/build-feature`, version 1.3.0
- **Level:** recommended by `fabrica`, release 7
- **Type:** playbook
- **Installed at:** `.agents/skills/build-feature/SKILL.md`, `.claude/skills/build-feature/SKILL.md`
- **Applies:** 2 rules
- **Uses:** `tdd`
- **Installed because:** included

Level names the skill’s level and the library and library release that set it, such as required by fabrica, release 7. It’s absent for an authored skill, and for one the repository named directly from a non-library source. A skill installed only because another one calls it says so, such as **Installed because:** used by build-feature. Type is absent for a skill without one, and Uses for a skill that calls none. A renamed skill’s heading is its install name, and its entry adds **Renamed from:** review-change. A skill from a non-library source shows its commit in place of a version. With no skill targets, Installed at gives the skill’s source folder in vendor/ or skills/ instead, and Applies lists the generated file of each rule it cites, because no installed copy carries that list.

SKILLS.md lists skills; it doesn’t tell agents to prefer them over skills a person installed. See Personal skills with the same name.

RULES.md points to this file with one line:

This project also installs agent skills. See [SKILLS.md](SKILLS.md) for what each one does and where it's installed.

These abbreviated excerpts show how an agent finds an authored rule. The full generated files also include reading instructions, metadata, and source information.

.trailguide/RULES.md is the starting point. Each entry tells the agent when to open a rule group:

### Testing
**When to read this group:** When adding or changing behavior, fixing bugs, or reviewing tests.
**Open group:** [Testing](generated/groups/practices/testing.md)

.trailguide/generated/groups/practices/testing.md contains the rule group’s rules. Small rule groups include full rule text; larger ones use summaries like this, linking to each full definition:

### Test changed behavior
Rule ID: `practices/testing/test-changed-behavior`
**When to read:** When adding or changing externally visible behavior.
**Read full rule:** [Test changed behavior](../../rules/practices/testing/test-changed-behavior.md)

A rule from a source also shows its version below its ID, so agents and reviewers can cite it:

Rule ID: `fabrica:practices/testing/verify-retry-limits`
Version: 1.3.0

Authored rules have no version.

.trailguide/generated/rules/practices/testing/test-changed-behavior.md contains the rule the agent follows:

# Test changed behavior
Rule ID: `practices/testing/test-changed-behavior`
## Guidance
### Overview
Add or update a test for any behavior a caller or user relies on that your change alters.

The authored version stays in .trailguide/rules/practices/testing/test-changed-behavior.md. Edit that source file and rebuild to update the generated copy.

  • Configuration: the sources, selectors, exclusions, and replacements declared in config.yaml.
  • Rule group metadata: the name and reading cues in _group.yaml.
  • Authored rule: the Markdown and metadata you write before building.
  • Lockfile: the revision, rule versions, and skills lock.json records for each source.
  • Provenance: how to trace a rule to its source through its generated page and lock.json.
Fabrica TrailguideMIT licensedPrivacy

Built with Fabrica.