Skip to content

CLI commands

Find each command’s syntax and options below. Every command also accepts --json and -h / --help; shared behavior and output formats are documented at the end.

trailguide project manages rules and skills for a project, the codebase whose rules and skills Trailguide manages. Initialize from the project root. In Git repositories, other project commands also work from subdirectories.

Configuration lives in .trailguide/config.yaml at the project root. See Working directories for repository discovery and input-file paths.

Terminal window
trailguide project init [options]

Create .trailguide/config.yaml, the authored rules/ and skills/ directories, and the managed Trailguide guide, and add the Trailguide section to the repository’s AGENTS.md, creating the file if needed. Rerunning init preserves valid configuration and authored content and refreshes an unmodified guide and section.

OptionMeaning
--install-for AGENTThe agents to install skills for: claude-code, codex, copilot, cursor, gemini-cli, opencode, or none. Repeat it or separate agents with commas. none can’t be combined with an agent.
--non-interactiveDon’t ask which agents to install for; use the default.

A new configuration gets schemaVersion: 3, the running release as minTrailguideVersion, and skills.installFor [claude-code, codex]. In a terminal, init asks which agents your team uses, with that list as the default; --install-for answers the question, and none writes []. Init creates no target folders: sync writes them when the repository first installs a skill.

Rerunning init on an existing configuration changes skills.installFor only when you pass --install-for, and doesn’t ask. A version 2 configuration fails with config-migration-needed until migrate moves it to version 3; see Move from version 2.

Init does not fetch sources or generate rule guidance. It refuses to overwrite a manually edited Trailguide guide or AGENTS.md section, and leaves an AGENTS.md that already points to RULES.md outside the section alone. For file locations and ownership, see Project and rule group guides.

Terminal window
trailguide add skill SOURCE:SELECTOR... [options]
trailguide add rule SOURCE:SELECTOR... [options]

Install a source’s skills or rules. trailguide project add skill and trailguide project add rule are the same commands. Each SOURCE:SELECTOR adds the selector to skills.include or rules.include in .trailguide/config.yaml, under the name of the source SOURCE names, such as public-library:skills/fk-build-ui for fabricahq/public-library:skills/fk-build-ui, then the project syncs, so what it names is installed when the command returns:

Terminal window
trailguide add skill fabricahq/public-library:skills/fk-build-ui
trailguide add skill fabrica:recommended
trailguide add rule 'fabrica:practices/testing/*'

SOURCE is the name of a source the project has, a GitHub repository written owner/name, such as fabricahq/public-library, or a repository address. When the project has no source for that whole repository, without a path, the command adds one at ref: latest-release, named after the repository, such as public-library, or after its owner for a repository named .trailguide, and says so. A repository without library releases fails with ref-required; add it with trailguide project add source and --ref, then name the source. SELECTOR is a skill selector or a rule selector in that source, written without the source’s name, such as fabrica:curated:skills/to-spec for a skill the library curates. A selector the list already has is left as it is. The command runs from anywhere in an initialized project. In a repository without .trailguide/, it runs trailguide project init first, at the repository root; a source name can’t resolve there yet, so it fails before initializing.

When the sync fails, or is interrupted, the command puts back the configuration it changed, so the project is as it was, apart from an initialization, which the error then names. An argument without a source, such as review, fails with exit code 2, naming trailguide project create skill or trailguide project create rule, which write your own; so does an option those commands take, such as --title or --description; --from does too, naming trailguide project fork skill or trailguide project fork rule. In JSON output, value.initialized reports an initialization, value.addedSources maps each source it added to its ref, value.included lists the selectors it added, as source:selector, and value.alreadyIncluded those the list already had, beside the added, changed, and removed lists that sync reports.

Terminal window
trailguide project add source NAME [options]

Record a source in configuration without fetching its files. NAME is the source name, such as team. Run trailguide project sync afterward to take the included rules and install the included skills. The same command adds a library or any other Git repository with skill folders: you don’t declare which it is, and sync detects whether the repository has a manifest.

OptionMeaning
--repository URLRequired. An accepted HTTPS or SSH Git repository address.
--ref REFThe library release to take the source from, such as release/4, or latest-release to take the newest library release at each update, or a branch, tag, or commit, recorded as the source’s ref. Defaults to the library’s newest release, which the command reads from the repository. Required for a source without release/<number> tags, such as a non-library source. With a branch, such as main, update moves the source to the branch’s newest commit. On a library, a branch takes changes the library hasn’t released, without change notes, and sync and update warn about it. See Refs.
--path FOLDEROne folder of the repository to take as the source, such as pstack, recorded as the source’s path. Skill and rule IDs in the source, including those --rules and --skills name, are then relative to it. Needs --ref with a branch, tag, or commit, since library releases tag a whole repository; without one it fails with ref-required, and a library release or latest-release fails validation at --ref. Both write nothing.
--rules SELECTORA rule selector for rules.include: a rule ID, such as practices/testing/verify-retry-limits, a prefix, such as practices/testing/*, or *. Give it without the source name; the command writes it as NAME:SELECTOR. Repeat for several.
--skills SELECTORA skill selector for skills.include: recommended, *, or a skill ID, such as skills/build-feature. Give it without the source name; the command writes it as NAME:SELECTOR. Repeat for several.
--non-interactiveNever prompt. Supply all required inputs as flags.

Quote * and selectors that end in /* so your shell does not expand them. Pass each selector as a separate option, rather than a comma-separated flag value:

Terminal window
trailguide project add source team \
--repository https://github.com/example/rules.git \
--rules 'practices/testing/*' \
--rules 'techs/typescript/*' \
--skills recommended \
--non-interactive

The repository address and selectors are illustrative; replace them with a source you can access.

--rules and --skills are both optional: a source added with neither still installs the skills its library requires.

Without --ref, the command lists the repository’s release/<number> tags, writes the newest as the source’s ref, such as ref: release/4, and says so; trailguide project update later moves it to each newer release you confirm. A repository without library releases fails with ref-required and writes nothing; pass the branch, tag, or commit to take it from. To hold individual rules, add entries to rules.pins, naming each rule as source:id, or use trailguide project update --keep; see Choose versions.

Sync checks the source when it first reads it. A source without ref fails with ref-required, naming the library release to write when there is one. rules on a non-library source fails, because it has no rules. A --ref that names no branch, tag, or commit fails with version-not-found, a branch of a library warns that the source takes changes the library hasn’t released, and a skill from a non-library source with no license terms fails with license-not-found; see License rules. An existing source name, or a repository, or folder of one, that another source already takes fails before writing anything; declare each repository, or each folder of one, once.

To take one folder of a repository, such as a plugin a repository of plugins keeps in pstack/, add --path, then name its skills by their IDs in that folder:

Terminal window
trailguide project add source pstack \
--repository https://github.com/example/plugins.git \
--ref main --path pstack \
--skills skills/architect \
--non-interactive
Terminal window
trailguide project remove source NAME

Remove a source you no longer take skills or rules from. The command removes sources.NAME from config.yaml, with every entry of the skills and rules sections that names it as NAME:id: include selectors, exclude and pin entries, aliases, uses, and the forks whose from names it. Then it syncs, so the source’s installed skills, generated rules, and vendor snapshot leave the project when it returns. It lists each entry it removed, then the sync’s changes; in JSON output, value.entries lists them as objects with the field that held each and the entry, such as {"field": "rules.include", "entry": "team:techs/go/*"}.

A skill or rule of your own that forked one of the source’s keeps its files, and is yours alone from then on: the command says so for each, and lists them in value.skillForks and value.ruleForks. When the source supplied the metadata of a rule group that your own rules still use, sync writes that _group.yaml into your rules and warns. A name that is no source of the project fails, listing the project’s sources, and writes nothing. So does a skill of your own whose trailguide-skills-used or trailguide-rules-used names one of the source’s skills or rules, including a fork, whose citations of the source’s other skills and rules fork adds the source’s name to: remove those lines first, or replace them with skills and rules of your own. When the sync fails without changing any files, the command restores config.yaml and says so.

Terminal window
trailguide project create group ID [options]

Create an authored rule group in .trailguide/rules/ID/, with _group.yaml metadata and an authoring README. ID is a rule group path such as practices/testing or techs/typescript. In a repository that’s a library of library schema version 3, which keeps its own rules and skills at the repository root, it refuses with library-content-at-root and names the trailguide library command to use instead.

OptionMeaning
--name TEXTRequired. Rule group display name.
--description TEXTRequired. What the rule group covers.
--when-to-read TEXTRequired. When an agent should read the rule group.
--non-interactiveNever prompt. Supply all required inputs as flags.

A rule group can exist before it has rules. Authored rule groups need no source declaration. Existing rule group files are preserved.

Terminal window
trailguide project create rule ID [options]

Create a rule in an existing authored rule group, at .trailguide/rules/ID.md. ID includes the rule group path and rule name, such as practices/testing/check-retries, without .md. In a repository that’s a library of library schema version 3, which keeps its own rules and skills at the repository root, it refuses with library-content-at-root and names the trailguide library command to use instead.

OptionMeaning
--title TEXTRequired. Action-oriented rule title.
--when-to-read TEXTRequired. When an agent should read the rule.
--impact LEVELRequired. One of CRITICAL, HIGH, MEDIUM-HIGH, MEDIUM, LOW-MEDIUM, or LOW.
--impact-description TEXTRequired. The consequence the rule helps prevent.
--body-file PATHOptional UTF-8 Markdown body, without frontmatter. Relative paths start at your working directory. Omit to create an unfinished draft.
--non-interactiveNever prompt. Supply all required inputs as flags.

Create the rule group first with trailguide project create group. A missing rule group fails before metadata prompts. Without --body-file, complete the template and remove its trailguide:draft marker before building. Existing rules are not overwritten.

Terminal window
trailguide project fork rule SOURCE:ID[@VERSION] [options]

Copy one version of a library rule into .trailguide/rules/ so the project controls its text. Use a fork to change what a rule says. To take one rule without the rest of its rule group, include it by ID instead, and to keep a rule at an older version, pin it; both keep the rule’s identity and update reports. SOURCE is a configured source name, such as team, or a repository address, and ID is the library rule ID, such as practices/testing/verify-retry-limits, which the fork keeps: .trailguide/rules/practices/testing/verify-retry-limits.md. In a repository that’s a library of library schema version 3, which keeps its own rules and skills at the repository root, it refuses with library-content-at-root and names the trailguide library command to use instead.

OptionMeaning
@VERSIONOptional. One of the rule’s versions, such as 1.3.0. Without it, the command forks the version the project’s lock records for the source’s rule, which a repository address or a rule with unreleased changes can’t supply.
--reason TEXTWhy the project uses the fork instead of the library’s rule. Required when the fork adds an exclusion, as in step 4 below, and refused otherwise.
--non-interactiveNever prompt. Supply all required inputs as flags.

The command:

  1. Finds the library release that published <VERSION> from the release records in the library’s release/<number> tags, and reads the rule and its asset directory at that tag’s commit.
  2. Writes them under .trailguide/rules/. When neither authored rule group metadata nor a source the project includes supplies the rule’s rule group, it also creates the authored rule group from the library’s rule group metadata.
  3. Adds an attribution entry that links to the rule at the tag’s commit. Libraries hosted outside GitHub.com and GitLab.com get an attribution entry only when the repository address is an HTTPS URL, and the entry links to that address.
  4. When the SOURCE source includes the rule and its last sync took it, adds a rules.forks entry, keyed by the fork’s ID, with the rule as from, the forked version as basedOn, and your reason, so agents read only the fork, and updates list the library’s later changes to it. If the source pins the rule, the same edit removes the pin and warns that it did: the fork, not a pinned copy, now decides what agents read. If you changed that source’s configuration since its last sync, run trailguide project sync first.

If the rule links to files in the library’s shared .trailguide/assets/ directory, the fork copies them into its own asset directory and updates the links, because authored rules can’t depend on a source’s files. For the same reason, the command refuses a fork whose links would point outside the copied files, such as links to declared license or notice files, or raw HTML links. Existing authored rules and exclusions are never overwritten. A forked rule has no version in your project; it changes only when you edit it. Run trailguide project build afterward. The library’s license still applies to the copied text; see License rules.

Terminal window
trailguide project create skill NAME [options]

Create an authored skill in .trailguide/skills/NAME/, or .trailguide/skills/<library.name>/NAME/ when the repository is also a library of library schema version 2. NAME follows the skill name grammar, such as release-checklist; the skill’s ID is skills/NAME. In a repository that’s a library of library schema version 3, which keeps its own rules and skills at the repository root, it refuses with library-content-at-root and names the trailguide library command to use instead.

OptionMeaning
--description TEXTRequired. What the skill does and when to use it, at most 1,024 characters.
--type TYPEOptional. playbook or review, recorded as trailguide-skill-type. See Skill types.
--non-interactiveNever prompt. Supply all required inputs as flags.

The command writes SKILL.md with the name, description, and type in its frontmatter, and a body with the trailguide:draft marker. Complete it and remove the marker before building; an authored skill that still has the marker fails sync and build. An authored skill cites your own rules by their IDs and rules from sources by project ID, such as fabrica:practices/testing/verify-retry-limits; see Skills in a project. In a library, use library add skill instead, whose skills cite only the library’s own rules. Existing skills are not overwritten, and the command refuses a name that another of the repository’s skills has. In a project whose skills still sit in origin folders, as Trailguide 0.9 kept them, it fails with layout-migration-needed until migrate moves them. When a skill the repository installs from a source already has the name, the command warns that sync will fail with skill-name-clash until you rename or exclude one of them.

Terminal window
trailguide project fork skill SOURCE:SKILL [options]

Copy a skill the project installs into .trailguide/skills/, beside the project’s own skills, or into .trailguide/skills/<source>/ in a library of library schema version 2, so the project controls its steps. SOURCE:SKILL names a configured source and the skill’s ID in it, such as fabrica:skills/fix-bug, or a skill the source’s library curates, by its project ID without the source’s name repeated, such as fabrica:mattpocock:skills/to-spec. It must be a skill that the source’s last sync installed, whether the project included it or another skill uses it. A required skill is refused, naming the library that requires it, and so is a curated skill the library doesn’t list, which the project installs only because a listed skill uses it; fork the skill that uses it instead. The fork keeps the skill’s name. In a repository that’s a library of library schema version 3, which keeps its own rules and skills at the repository root, it refuses with library-content-at-root and names the trailguide library command to use instead.

OptionMeaning
--reason TEXTRequired. Why the project uses the fork instead of the source’s skill, recorded with the fork.
--non-interactiveNever prompt. Supply all required inputs as flags.

The command:

  1. Copies the skill’s folder from vendor/, exactly as the project installs it, with every file’s executable bit, to .trailguide/skills/<name>/, such as .trailguide/skills/fix-bug/, or .trailguide/skills/<source>/<name>/ in a library of library schema version 2: the version lock.json records for the source, or, for a non-library source, the locked commit. A curated skill comes from the commit the library’s entry holds for the repository the library curates it from. A renamed skill’s fork takes its install name, so the folder and name match what agents already see, and the fork’s entry in step 3 replaces the skill’s skills.aliases entry.
  2. Rewrites the fork’s trailguide-rules-used and trailguide-skills-used to project IDs, such as fabrica:practices/testing/verify-retry-limits, because an authored skill cites rules and skills from sources by project ID. For a non-library source, it writes the skills that skills.uses lists for the skill into trailguide-skills-used. A curated skill’s uses name skills of the repository it comes from, which the library curates with it, such as fabrica:mattpocock:skills/grilling; a curated skill that cites rules of a curated library is forked as a draft for you to remove them from, since a project takes no rules from a curated source.
  3. Adds a skills.forks entry keyed by skills/<name>, with the skill as from, such as from: fabrica:skills/fix-bug, the full commit SHA it copied as basedOn, and your reason. For a curated skill, from names it through the library, such as fabrica:mattpocock:skills/to-spec, and basedOn is the commit of the repository the library curates it from. If you changed that source’s configuration since its last sync, run trailguide project sync first.
  4. From a release, when minTrailguideVersion in config.yaml names a release before 0.13.0, or none, raises it to the running release, because older releases would strip the origin the fork’s installed copy records. The output says so, and warns when the repository’s check workflow installs an older release; in JSON, value.minimumRaised and value.raiseWarnings.

A link inside the skill’s folder keeps its text and still works. A link to another skill your project installs, from the same source or as your fork, is changed to name that skill by the name it installs as, such as ../review/SKILL.md, so the installed fork reaches its installed copy. Any other link that leaves the folder, such as to a shared file in the source’s repository or a skill the project doesn’t install, has nothing the fork can reach: the fork is marked as a draft, and its next steps list each such link, to copy the file into the fork and link to the copy, or remove the link. Its source’s last sync kept those files for the skill, so the next steps install the fork with trailguide project sync, which drops them, instead of build. A SKILL.md without frontmatter, which a repository that isn’t a library can supply, gets frontmatter with the skill’s name, and each list the fork changes becomes a block string. When the command can’t adapt the skill’s SKILL.md, because its frontmatter is written in a way it can’t edit, such as metadata as a flow mapping, or because the fork would fail the checks build applies to a skill you author, it still writes the fork, marked as a draft, and its next steps list what to fix. Build refuses the fork until you fix it and remove the <!-- trailguide:draft --> line. The command refuses a skill the source already excludes or forks, and a fork whose folder exists or that another fork’s entry already names. When an update moves the source while the command waits for your reason, it writes nothing; run it again. Existing authored skills, exclusions, and forks are never overwritten. A forked skill has no version; it changes only when you edit it. Run trailguide project build afterward. The source’s license still applies to the copied files; see License rules.

Terminal window
trailguide project sync [options]

Take the rule and skill versions recorded for each source, validate their files, and replace vendor/ and generated/ in the Trailguide directory with the complete result. Sync also writes each installed skill’s folder into the repository’s skill targets, removes the folders of skills it no longer installs, refreshes an older, unedited managed Trailguide guide, and adds or refreshes the Trailguide section of AGENTS.md, as build does.

Accepts the shared options and:

OptionMeaning
--retake SOURCEResolve SOURCE again at its ref, ignoring its entry in lock.json, as if you had just added it. Its unpinned rules move to the newest versions that ref offers. Repeat the option for more sources.

Sync needs access to every configured repository and uses your existing Git credentials. It takes the library release each source’s ref names, or a branch’s or tag’s recorded commit, and restores the rule versions recorded in lock.json. Sync chooses a version only when configuration asks for something the lockfile doesn’t have:

SituationWhat sync takes
A new source, or a changed repositoryThe source as trailguide project update would: the newest library release, or the commit the source’s ref names now.
A newly included rule or skillThe library release ref names, or the recorded commit. Each new rule gets the newest version that library release or an earlier one published. A rule or skill that isn’t there, such as one the library published later, fails with skill-not-in-revision, naming trailguide project update SOURCE.
A pin added or changedThe pinned version, up or down, when the library release ref names or an earlier one published it. A later version fails, naming the release to set ref to.
A pin removedThe recorded version, unchanged. The next update offers newer versions.
ref changed to another library releaseNothing: sync fails with ref-changed, naming trailguide project update SOURCE, which takes exactly that release when it’s newer than the recorded one. See Change a ref.
ref removedNothing: sync fails with ref-required, naming the release the project records.
A ref that isn’t a library release added or changedThe revision the configuration now names, as for a new source: a branch’s newest commit, or a tag’s or commit’s revision. Until sync takes it, offline checks report the entry as out of date and name trailguide project sync. A ref changed to another spelling of the recorded revision, such as refs/tags/release/2 for release/2, is current.

Sync refuses a lockfile entry changed outside Trailguide: an entry whose integrity doesn’t match, or that has none, such as after a hand edit or a merge resolution that combined both sides, fails, and sync writes nothing. Restore the entry Trailguide wrote, such as with git checkout -- .trailguide/lock.json, and sync again; or run trailguide project sync --retake SOURCE, which takes the source again at its ref. To resolve a merge conflict in lock.json, see Resolve a merge conflict in the lockfile. The first sync of a project that Trailguide 0.5 last synced migrates it to lock.json without moving any source. Before taking anything from an entry it wrote, sync also checks it against the library’s release records: each locked rule version must be the version its recorded library release publishes, and each locked library release must exist. A source using ref keeps the commit it locked, even after a tag moves or is gone, so sync checks it against the release records only when choosing versions reads them anyway.

A configuration of version 2, which Trailguide 0.10 and earlier wrote, moves to version 3 as sync takes it, as trailguide project migrate moves it, and a release build raises minTrailguideVersion to its own version. In a project that Trailguide 0.8 and 0.9 wrote, sync also moves vendor/ and generated/ out of _managed/, and the project’s skills out of their origin folders, as trailguide project migrate does, and other commands refuse the project until one of them does.

Sync installs the skills each source’s levels and skills.include bring in, every skill they use, transitively, and every rule an installed library skill cites; see Skill selectors. A skill curated by a library comes from the commit the library’s entry in lock.json holds for it. Sync writes a skill folder in a target only when generated/installed-skills.json records that Trailguide installed it there, or when no folder with that name exists. It fails, writing nothing, with skill-folder-not-managed when a folder with an installed skill’s install name exists in a target that Trailguide didn’t install, and with skill-name-clash when two skills would install under the same name, from any sources, authored skills, or both; give one of them an alias, or exclude it. See Who owns the target folders.

Sync also keeps every file an installed skill’s Markdown links reach, from the same revision, and points the installed links at those files; see Links. Before it writes anything, it checks every link, and fails, writing nothing, when one names a file the revision doesn’t have, with reference-missing; a folder, symbolic link, rule file, or other file the project can’t keep, with reference-unsupported; an absolute path or one outside the repository, with reference-escapes; or a file a forked skill’s fork lacks, with reference-replacement-missing. The message names the file with the link, the link, the source and revision, the chain of links that reached it, and the repairs. A link into a skill the configuration excludes, by ID or by level, doesn’t fail: sync keeps the files it reaches as reading copies and warns, naming the installed skill, the excluded skill, and the chain of files the link goes through, and lists the same facts under excludedSkillLinks in --json output; see When a skill links to a skill you exclude. project update checks the revisions it moves to the same way.

These changes come from edits you made to configuration, so sync applies them without a preview. To move sources to newer revisions, use project update. If a source fails, the previous complete output is preserved. For recovery behavior, see Sync and recovery.

Sync warns:

  • about a source that takes unreleased changes through ref, naming the source and its unreleased rules and skills;
  • when an exclusion, a rule included by ID, or a skill included by ID names a rule or skill the library retired, or a skill folder a non-library source no longer has, since the entry no longer does anything;
  • about a rule included by ID that a prefix in the same include already reaches, since the entry changes nothing;
  • for each place a skill from a non-library source breaks the skill format, and installs the skill as it is;
  • for each alias it applies, with the fixed text in Give a skill another name;
  • for each personal skill with the same name as an installed skill; see Personal skills with the same name;
  • when it installed no skill copies because skills.installFor is empty, though the repository has skills to install.
Terminal window
trailguide project update [SOURCE | SOURCE:RULE ...] [options]

Preview each source’s move along its ref: to the newest library release for a release such as release/4, or to a branch’s newest commit, with newer rule and skill versions, new rules and skills, level changes, and retirements, then apply it after you confirm, and regenerate guidance and installed skills like sync. With no arguments, every source is updated. SOURCE, such as team, limits the update to one source. SOURCE:RULE, such as team:techs/react/prefer-server-components, moves only that rule; nothing else changes, including new rules.

A source’s skills all come from one revision: the library release that supplies its library-wide files, or a non-library source’s commit. They move together, with those library-wide files or that commit, and trailguide project update SOURCE:SKILL, such as fabrica:skills/build-feature, is refused with a message asking you to update the whole source. --keep and --update-fork are for rules only. --exclude takes a skill as SOURCE:SKILL the same way it takes a rule, and --merge-fork takes only a forked skill. In a library of library schema version 3, --update-fork, --merge-fork, and answering yes to replace or merge a fork refuse with library-content-at-root: the library keeps its forks in skills/src/, so merge the source’s changes there by hand, update the fork’s basedOn in skills.forks, and run trailguide library build.

OptionMeaning
--yesApply the previewed changes without asking. Required to apply changes without a terminal, or with --json.
--keep SOURCE:RULEPin this rule at its current version before applying the update, so it stays where it is. Repeat for several. Requires --reason. Refused for a skill, which can’t be pinned.
--exclude SOURCE:RULEExclude this new rule or skill before applying the update, so it doesn’t join. Repeat for several. Requires --reason. Refused for a skill that becomes required.
--update-fork SOURCE:RULEReplace your authored rule for this replaced row with a fork of the library’s newest version, discarding your edits, and set its exclusion’s basedOn to that version. Repeat for several. Takes no --reason. Refused for a forked skill, naming --merge-fork. See Replace a fork with the newest version.
--merge-fork SOURCE:SKILLMerge the source’s changes into your forked skill, keeping your edits, and set the fork’s basedOn to the commit merged. Refused when the merge finds text conflicts, and for a rule, naming --update-fork. Repeat for several. Takes no --reason. See Merge a source’s changes into a forked skill.
--reason TEXTThe reason recorded with each pin that --keep writes and each exclusion that --exclude writes.

The preview lists, for each source:

ChangeMeaning
major, minor, or patchThe rule’s old and new versions, and the summary of every version in between.
newA rule the library added that your selectors reach, at its newest version.
retiredA rule the library retired, with its last version, its summary, and its replacement when there is one. When the library later retired the replacement too, the preview says so, and names the rule its replacements lead to, if any, instead of recommending the retired one. When your project already replaces the replacement with an authored rule, the preview names your rule instead of recommending the library’s. Applying the update drops it.
replacedA rule you replaced with an authored rule, with your rule’s path. When the rules.forks entry records basedOn, the row appears whenever the library’s newest version is newer than basedOn, and lists every change after it, labeled with its version when there are several, also when a pin keeps the vendored copy where it is. Without basedOn, it compares with the version the project’s lock records instead: it appears whenever the library’s newest version is newer, also when a pin keeps the vendored copy where it is, and lists the changes since, which your rule may already have. Your rule doesn’t change unless you pass --update-fork; compare the two to decide whether it needs the same change.
pinnedA pinned rule that has a newer version. It doesn’t move; the preview shows the pin’s reason.

Skills from a library appear in the same list, by their skill IDs, with the same changes except pinned. When the source’s library-wide files move to a newer library release, every installed skill moves with them, and the preview lists each skill whose version changed. A skill that a moving skill newly uses appears as new, naming the skill that uses it, and a rule it newly cites appears as new, at its newest version, marked reference-only unless your selectors also reach it. A skill or cited rule that no installed skill needs any longer is dropped.

A skill whose level changes shows the move under its row, such as level: recommended -> required, with what the change means for the project. A move that installs a skill, such as available -> required, or available -> recommended when you include recommended, appears under the skill’s added row, and a move that stops installing one, such as recommended -> available when you don’t name it, under its removed row; a skill you forked shows it under its replaced row. A skill whose level changes while its files don’t, and that the move neither installs nor removes, gets a level row of its own, so you can decide whether to include it. A skill that becomes required while your configuration excludes or forks it fails the update, naming the library and the exclusion to remove: required skills can’t be excluded.

Under each skill’s row, from a library or a non-library source, the preview flags every executable file that’s new or changed, on its own line, such as script added: scripts/setup.sh or script changed: scripts/verify.sh: a file whose executable bit is set at the new revision and that the update adds or changes, or a file whose executable bit changed. When it flags any, it prints one warning that Trailguide never runs these scripts but agents may, so read them before confirming. The warning doesn’t block the update.

A source whose ref names a branch, and a non-library source whose ref names a tag, lists its commit move on a line under the source’s name, such as main: 3f9c2e1a5b7d -> 8a41d07c2e9f, or main: no new commit. when the commit doesn’t move, and warns when a tag now names a different commit than at the last update. A curated source lists its move on a line of its own, under the library that curates it, such as fabrica curates mattpocock main: 3f9c2e1a5b7d -> 8a41d07c2e9f, or release 3 -> 4 for one that follows its newest library release, since each project resolves a curated ref when it updates. For a non-library source, and for curated skills, the preview lists one row for each installed skill folder that differs between the recorded and new commits:

ChangeMeaning
changedA skill folder whose files differ, with the paths of the files that changed, including a file whose executable bit changed.
addedA new skill folder that the source’s selectors include, such as with "*".
removedAn installed skill whose folder no longer exists. Applying the update stops installing it.

See Update rules and skills for examples.

In a terminal, trailguide project update shows the preview and asks for confirmation. Every question takes the same answers, yes or no, or y or n, and asks whether to take the library’s change now. For each major change of a rule, it asks whether to adopt the new version, and for each retired rule, whether to drop it; answering no keeps the rule at its current version, asks for a reason, and writes a pin. For each new rule, it asks whether to add it; answering no asks for a reason and writes an exclusion. Skill changes have no questions of their own: the preview lists them, a new skill installs as skills.include says, and confirming the update takes them all. To hold a skill back, decline, then exclude or fork the skill, or set the source’s ref. For each replaced rule, including one whose vendored copy a pin keeps, it names the authored files that replacing your rule would replace or remove, and asks whether to replace your rule with a fork of the newest version now, as --update-fork does; answering no leaves your rule for you to review later. For each forked skill whose source’s changes merge into your fork with no text conflicts, it asks whether to merge them now, as --merge-fork does; answering no leaves them for later. When your answers keep, exclude, or replace rules, or merge into forked skills, it lists them before you confirm, with the files each replaced fork replaces and those it removes. The terminal shows the preview once; the result after you confirm lists the files the update changed. Before each wait on the sources, such as reading their releases or fetching the update after you confirm, a terminal also shows a short status line, such as Fetching the update..., on standard error; JSON output and output that isn’t a terminal never include it. Without a terminal, or with --json, it shows the preview and writes nothing unless you pass --yes. The update applies exactly the versions the preview showed, and writes its pins, exclusions, basedOn versions, and replaced forks in the same step that replaces vendor/ and generated/. When the preview has no rule or skill to move, add, or drop, and no shared files or commits to move, a terminal update applies without asking, as sync would, and when that changes no files, says, as a preview would, that no updates are available and no files were written.

A preview that writes nothing exits 0, because available updates aren’t an error; so does declining the confirmation. In JSON output, value.applied is false for a preview and true once the update is applied, and value.sources lists each source’s rules, each with its id, change, versions (from, to, and, where they apply, newest or lastVersion), summaries, summaryVersions (the version each summary belongs to, in the same order), and, where they apply, replacedBy (with replacementRetired: true and any currentReplacement when the library retired the replacement too, and replacementAuthoredRule when your project already replaces that replacement with an authored rule), authoredRule, basedOn, pin, and the decision (keep, exclude, or update-fork) that --keep, --exclude, --update-fork, or your answers recorded, with the reason of a pin or exclusion. A row’s change is one of the preview’s changes: major, minor, patch, new, retired, replaced, or pinned. For an update-fork decision, a row’s overwrites lists the authored files that the new fork replaces with its own copies, and removes those it deletes because the new fork doesn’t have them, relative to the Trailguide directory; both are empty for other rows. A replaced row’s from is the version the project’s lock records and to the newest version, or newest instead when a pin keeps the vendored copy; with basedOn, its summaries are the library’s changes after basedOn, and otherwise the changes since from, not the changes its authoredRule lacks. The added, changed, and removed lists are empty for a preview; once applied, they include config.yaml when the update wrote a ref, pins, exclusions, basedOn versions or commits, or a higher minTrailguideVersion, and the files of each fork it replaced or merged into. Each source’s replacedSkills lists its forked skills that changed, and each curated source’s replaced those of the skills the library curates, each with its id, localSkill, basedOn, basedOnField (the configuration field that records basedOn, such as skills.forks.skills/review.basedOn), from, to, files, removed, and, for a fork with basedOn of a skill the source still has, merge, no-conflicts or conflicts, with the conflicting files in conflicts, and the merge-fork decision when the update merges into it.

In JSON output, each source in value.sources also has a skills list, whose rows have the same fields as its rules, and scripts, a list of the flagged scripts, each with its path, relative to the skill’s folder, and its change, added or changed, empty when the row flags none. Each source also has skillLevels, the skills whose level changes, each with its id and the levels from and to, empty on a side where the library has no such skill. A source whose ref names a branch, and a non-library source whose ref names a tag, has followsRef: true. Such a source, and each entry in a source’s curated list, has commit, with the commits from and to, absent when it doesn’t move, and tagMoved: true when a tag now names a different commit. A curated source’s commit leaves out from when the project didn’t take skills from it before, and to when it no longer does; one that follows its newest library release also has release, with the library releases from and to. Rows for skills from a non-library source or a curated source have a change of added, changed, or removed, and files, the paths of the changed files relative to the skill’s folder, empty for other rows. Each entry in curated also has replaced, the rows for curated skills the project replaces with a fork, each with its id, such as mattpocock:skills/to-spec, localSkill, basedOn, the commits from and to, and files.

The preview doesn’t list changes to rules or skills you excluded without a replacement. --keep and pins in configuration never change which rules are included. When a rule you exclude or include by ID is retired, the entry no longer does anything; update warns about it so you can delete it, and applies the rest of the update. When the update, or a sync, would leave your authored rules in a rule group with no metadata, such as a fork of a retired rule, it writes the rule group’s metadata to rules/<group-id>/_group.yaml in the same step, lists the file as added, and warns that it did; see Keep the rule group of an authored rule.

When a library source’s ref names a library release, an update that moves the source writes the release it installs to ref, keeping the spelling, such as release/5 for release/4, in the same step that replaces vendor/ and generated/. The preview says so on a line under the source, such as Sets sources.team.ref to release/5 in .trailguide/config.yaml., and JSON output as the source’s setsRef. A source whose ref is latest-release moves to the newest release, and its ref stays as it is. When you edited ref to name a newer release than the one the project records, the update takes exactly that release and leaves ref as written; when the library has a newer release still, the preview ends with a line such as Release 9 is available; run trailguide project update team again to move to it., and JSON output gives that release as the source’s available. An update refuses a ref edited to an older release with ref-changed.

An update raises minTrailguideVersion to the running release when the configuration names an older one or none, in the same step, so teammates with an older Trailguide get a clear error instead of different output. The preview says so after the sources, such as Sets minTrailguideVersion to 0.10.0 in .trailguide/config.yaml, and JSON output gives the release as value.setsMinTrailguideVersion. A raise counts as an update to apply: a terminal asks you to confirm it, and without a terminal it needs --yes, even when no rule or skill moves.

An update of a whole source also moves its library-wide files, such as the manifest, rule group metadata, shared assets, and the library’s license files, to the newest library release, or the commit its ref names now, even when no rule moves; the preview shows it as Shared files: release 3 -> 4, and JSON output as the source’s sharedFiles, with the library releases from and to, which is absent when they don’t move. A library source whose ref names a tag other than a library release, or a commit, doesn’t move, and neither does a non-library source whose ref names a commit; change ref and run trailguide project sync to take the revision it names. A library source whose ref names a branch moves its library-wide files with the branch’s newest commit. A SOURCE:RULE update leaves the library-wide files where they are, unless a rule it moves comes from a newer library release: then they move to that library release, since a rule version can rely on the shared files its library release published. The source’s skills and skill levels always move with its library-wide files.

A source’s skills come from the revision that supplies its library-wide files, so they move with them. For each source the update names, the preview compares the skills the source installs once updated with the copies its source record holds, and lists, after the rules, one row for each skill that differs:

ChangeMeaning
changedA skill whose files differ, with the paths of the files that changed, including a file whose executable bit changed.
addedA skill the update starts installing, such as one that skills.include newly names.
removedAn installed skill the update stops installing, because skills.include no longer names it, or, with *, the new revision no longer has it.

Under each skill’s row, the preview flags every executable script the update adds or changes, on its own line, such as script added: scripts/setup.sh or script changed: scripts/run.sh: a file whose executable bit is set at the new revision and that the update adds, changes, or makes executable. Every executable file of an added skill is flagged as added. A script the update leaves as it is isn’t flagged, and neither is a file that isn’t executable at the new revision, even when it changed. A script is any file with its executable bit set, which Git records as mode 100755, wherever it is in the skill’s folder; a file in scripts/ without the bit isn’t one.

When the preview flags any script, it ends with one warning:

Warning: some skills in this update add or change scripts. Trailguide never runs them, but your agents may; read them before you confirm.

In a terminal, the warning follows the preview, before any question. It doesn’t block the update. A skill row is a change to confirm, so a terminal asks before applying it. An applied update, such as one with --yes, lists the same rows and warns some skills in this update added or changed scripts. Trailguide never runs them, but your agents may; read them before you commit the update.

In JSON output, each source in value.sources has a skills list, empty when no skill differs. Each row has its id, change, files, the changed paths relative to the skill’s folder for a changed row and empty for other rows, and scripts, a list of the flagged scripts, each with its path, relative to the skill’s folder, and its change, added or changed, empty when the row flags none. The warning is in value.warnings.

When your decisions keep a SOURCE:RULE update’s library-wide files at an older library release, its skills stay there too, and the preview shows the skills at that release. A skill that skills.include names and the update’s revision lacks fails the update, as installing it would. A source that update doesn’t move, such as a library source whose ref names a tag or commit, still lists in its rows a skill that the update would add or remove because skills.include changed. Sync doesn’t flag scripts, because it never moves a source.

This section describes rule forks, whose update discards your edits. A skill fork’s update keeps them, so it takes its own flag, --merge-fork; see Merge a source’s changes into a forked skill.

--update-fork SOURCE:RULE replaces the authored rule that a replaced row names, the key of its rules.forks entry, with a fork of the version the row lists changes up to: the library’s newest version, also when a pin keeps the vendored copy at an older one. The new fork is exactly what trailguide project fork rule SOURCE:RULE writes, with its attribution, its assets, and the shared assets its links reach, placed at the path of that rule, with links rewritten for that path. The update sets the fork entry’s basedOn to that version, adding it to a replacement you wrote yourself, and installs the fork, config.yaml, vendor/, and generated/ in one step, so an interrupted update restores or finishes them together.

Passing --update-fork is your consent to overwrite the authored rule: your edits to it are lost, so commit them first if you want to compare. The preview, human and JSON, lists every file it replaces and, separately, every file it removes, reading the new fork from the library to tell them apart. The authored rule’s asset directory is replaced as a whole, including files you added to it, and the shared assets the new version links to are copied into it, as a fork copies them. Nothing outside the rule and its asset directory changes, because each rule owns its asset directory and no other rule may link into it. A pin stays: it governs only the vendored copy.

--update-fork refuses, as an invalid-arguments usage error that exits 2, a rule no rules.forks entry names as from, an unknown source, a --reason, and a rule that --keep or --exclude also names, before reading any source. It also refuses a rule the preview doesn’t list as replaced, because the library has nothing newer than the version your rule is based on or the update doesn’t include the rule, and a rule the library retired, which has no newest version to fork. Like the rest of the update, it fails with invalid-release-tag, writing nothing, when the library release tag that published the fork’s version names another commit than when the update previewed it, also when a pin or a SOURCE:RULE update keeps the vendored copy at an older version. Without --update-fork, --yes leaves every authored rule as it is.

Merge a source’s changes into a forked skill

Section titled “Merge a source’s changes into a forked skill”

A replaced row for a skill you forked with basedOn also says whether merging the source’s changes since basedOn into your fork finds text conflicts. Trailguide compares, file by file, three copies of the skill: the source’s copy at basedOn and at the revision the update takes, each as forking it would write it, and your fork. A file only one side changed takes that side’s copy. A text file both sides changed is merged line by line, as git merge-file merges it, and conflicts when your edits and the source’s touch the same or adjacent lines. A file that one side deleted and the other changed, one both added with different contents, and a binary file both changed conflict too. A fork with no edits of its own never conflicts. The merge compares text, not meaning: changes to different lines can still contradict each other, so review the merged skill.

When the merge finds no text conflicts, the preview says so, and --merge-fork SOURCE:SKILL, such as fabrica:skills/build-feature, or fabrica:pocock:skills/to-spec for a skill the library curates, writes the merged fork to the folder of the skill that the fork’s entry is keyed by and sets basedOn to the commit merged, in the same step that installs config.yaml, vendor/, and generated/. Your edits stay, and later updates list only newer changes. In a terminal, the update asks whether to merge each such skill now; answer no to review it later.

When it finds conflicts, the preview lists the conflicting files, and --merge-fork refuses as an invalid-arguments usage error that exits 2, naming the files and writing nothing. Merge the source’s changes into your fork by hand, then set basedOn to the commit the preview names. --merge-fork also refuses, before reading any source, a --reason, an unknown source, a skill the source doesn’t fork, a rule, which --update-fork replaces instead, and a fork without basedOn, since Trailguide then can’t tell your edits from the source’s changes, and, once the update reads the source, a skill the preview doesn’t list or that the source no longer has.

If you merged the library’s changes into your authored rule by hand, record the version you merged by editing basedOn in .trailguide/config.yaml, so later updates list only newer changes.

See Update rules and skills for the workflow.

Terminal window
trailguide project build [options]

Regenerate RULES.md, SKILLS.md, and generated/ from configuration, verified vendor snapshots, and authored rules and skills, and rewrite the installed skill folders in the repository’s skill targets. Build works offline and does not change recorded revisions. It also creates a missing managed Trailguide guide or refreshes an older, unedited guide alongside generated output, and adds or refreshes the Trailguide section of the repository’s AGENTS.md. A manually edited guide or section stops the build before it changes output. See Where agents start.

Accepts the shared options only.

Build points installed skills’ links at the files they reach, using only the vendor snapshots, and fails with the same reference- codes as sync. It gives sync’s warning for each installed skill that links to a skill the project excludes. When a snapshot lacks a linked file, such as one an older Trailguide synced, it fails with reference-not-retained; run trailguide project sync, which takes the file from the recorded revision without moving the source.

Run sync first if the recorded repository, selectors, pins, or ref no longer match configuration, or if the vendor snapshots need repair. Build validates authored skills, and fails on an unfinished draft, as sync does. In a project that forks a skill, build and sync raise minTrailguideVersion once, as project fork skill does, and warn that they did.

Terminal window
trailguide project check [options]

Check generated guidance, installed skills, the managed Trailguide guide, and the Trailguide section of AGENTS.md without writing files or contacting repositories. Reports stale, missing, or unexpected output and invalid inputs, including an installed skill folder that differs from what sync would write, a folder that generated/installed-skills.json records but that’s missing, such as when .gitignore excludes the target folders so they were never committed, a stale installed-skills.json, a missing or edited copy of a file an installed skill links to, a link that no longer reaches its file, with the same reference- codes as build, an authored skill that cites a rule its library retired, a missing or outdated AGENTS.md section, a lock.json entry that was changed outside Trailguide, which no command trusts until you restore it or take the source again, and a source whose ref names another library release than the lockfile records, which needs trailguide project update SOURCE; see Integrity. It warns about personal skills with the same name as installed skills, as sync does, without failing.

Accepts the shared options only.

Use check in CI to detect files that need regeneration. It uses recorded commits and rule and skill versions, and does not check whether remote tags or branches moved, or newer library releases exist. Success means the managed files agree with their inputs; it does not establish that application code follows the rules.

Terminal window
trailguide project migrate [--dry-run] [options]

Move a project to the configuration and layout this release writes. A configuration of version 2, which Trailguide 0.10 and earlier wrote, moves to version 3: each source’s rules and skills entries move to the top-level rules and skills sections, named source:id, skillTargets becomes skills.installFor, rename becomes skills.aliases, and forks are keyed by your own rule or skill, with comments kept. Sync moves it too, so a configuration you changed since the last sync can move and sync in one step; every other command refuses a version 2 configuration with config-migration-needed until migrate or sync moves it. A project that Trailguide 0.8 and 0.9 wrote also moves to the current layout: .trailguide/_managed/vendor/ and .trailguide/_managed/generated/ become .trailguide/vendor/ and .trailguide/generated/, RULES.md and SKILLS.md move beside config.yaml, README.md becomes a short page about the folder, with the full guide in generated/GUIDE.md, each skill in an origin folder, .trailguide/skills/<origin>/<name>/, moves to .trailguide/skills/<name>/ with its links rewritten for the move, and the AGENTS.md section and installed skills are refreshed, all in one transaction. Migrate makes only the moves a project needs: a project that Trailguide 0.10 wrote needs only the configuration move, one that Trailguide 0.8 wrote has no origin folders, and one already out of _managed/ needs only the skill moves. It rewrites links only in the skills it moves, so fix by hand a link to .trailguide/skills/<origin>/ from another file, such as a document at the repository root; a link from another skill fails the migrate, naming it. See Skills in a project folder. Migrate builds from the vendor snapshots the project already has, so it works offline and moves no source. A release build also sets minTrailguideVersion to its own version, when the configuration names none or an older one, so teammates on 0.10 or earlier are asked to upgrade instead of failing to read the project or moving it back. Run it once and commit the result. In a project that already has the current configuration and layout, it changes nothing. A config.yaml with a library section, of library schema version 2, stays at version 2, since only library migrate can move its manifest out: project migrate changes nothing and says to run trailguide library migrate, with value.libraryConfiguration true in JSON output. In JSON output, value.migrated is false for a project already current, value.dryRun is true for a dry run, and value.setsMinTrailguideVersion names the version it sets, when it sets one, beside the added, changed, and removed lists that sync reports. A version 2 configuration that version 3 can’t hold fails with config-migration-failed, writing nothing; see Move from version 2.

OptionMeaning
--dry-runList what would change without writing anything.

Accepts the shared options too. See Migrate from Trailguide 0.9.

Terminal window
trailguide project list skills

List the skills in the project: every skill its sources offer, whether the project installs it, and its level, followed by the project’s own authored skills, so you can see what you have and choose what to add. Lists never write files.

The listing reads .trailguide/lock.json, which the last sync or update wrote, so it works offline and shows the revisions the project uses, not newer ones. After changing the configuration, run trailguide project sync first. To take skills a newer library release adds, run trailguide project update SOURCE.

$ trailguide project list skills
SKILL LEVEL SET BY STATUS
fabrica:mattpocock:skills/engineering/to-spec recommended fabrica, release 7 installed
fabrica:skills/build-feature recommended fabrica, release 7 installed
fabrica:skills/deploy-preview available fabrica, release 7 excluded
fabrica:skills/review-change available fabrica, release 7 replaced by skills/review-change
fabrica:skills/ship-service required fabrica, release 7 installed
fabrica:skills/tdd available fabrica, release 7 not installed
tools:skills/changelog - tools, not a library installed
skills/check-release - this project installed
skills/review-change - this project installed
Forks:
skills/review-change forked from skills/review-change in https://github.com/fabricahq/public-library.git at commit 4f1c2a95e0b7

Each row shows:

  • SKILL: the skill’s project ID. A curated skill’s ID names the library and the curated source, such as fabrica:mattpocock:skills/engineering/to-spec; an authored skill’s ID is skills/<name>.
  • LEVEL: the level the library sets, required, recommended, or available; dependency for a skill the library installs only with the skills that call it; or - for an authored skill or a skill from a repository that isn’t a library.
  • SET BY: the library and the library release, or the commit, whose manifest set the level; not a library for a source without a manifest; or this project for an authored skill.
  • STATUS: installed for a skill the project installs, whether included, required, or used by another installed skill; excluded for one skills.exclude leaves out, by ID or by level; replaced by and the fork that skills.forks installs in its place; and not installed for one a source publishes that the project doesn’t install.

When an installed skill belongs to one of its library’s stacks, a STACK column names it, with - for skills in none and for skills the project doesn’t install. When an installed skill is a fork, a Forks list follows the table, with the skill it was forked from, that skill’s repository, and the commit the fork is based on: for a source’s skill, as its library’s build recorded it, and for one of your forks, its skills.forks entry.

SKILL STACK LEVEL SET BY STATUS
fabrica:skills/5k-build 5k recommended fabrica, release 15 installed
fabrica:skills/5k-grill-me 5k recommended fabrica, release 15 installed
fabrica:skills/ship-service - required fabrica, release 15 installed
Forks:
fabrica:skills/5k-build forked from pstack/skills/poteto-mode in https://github.com/example/pstack.git at commit 699e1e7488c5

Source skills are sorted by project ID, and authored skills follow them. To install a skill that isn’t installed, add it to skills.include and run trailguide project sync. A dependency can’t be included on its own: include a skill that calls it instead.

JSON output lists the skills in value.skills, each with its id, status (installed, excluded, replaced, or not-installed), and, where they apply, source, level, setBy (the source, release, and commit that set the level), replacedBy, stack, and forkedFrom (the repository, skill, and commit a fork came from).

Terminal window
trailguide project list rules

List the rules in the project: every rule it holds of its sources, with its version and how the project uses it, and the project’s own authored rules. Lists never write files.

Like list skills, the listing reads .trailguide/config.yaml and .trailguide/lock.json, so it works offline and shows the versions the project holds, not newer ones. After changing a source’s repository, ref, selectors, or pins, run trailguide project sync first; until then, the listing refuses the lockfile. To see what a newer library release changes, run trailguide project update SOURCE, which previews the changes before writing anything.

$ trailguide project list rules
RULE VERSION FROM STATUS
fabrica:practices/testing/check-retries 1.2.0 fabrica, release 7 replaced by local:practices/testing/service-retries
fabrica:practices/testing/cover-boundary-cases 1.1.0 fabrica, release 7 active
fabrica:practices/testing/test-observable-behavior 1.0.1 fabrica, release 3 active, pinned at 1.0.1
fabrica:techs/go/use-context-loggers 1.0.0 fabrica, release 2 excluded
local:practices/testing/service-retries - this project active, replaces fabrica:practices/testing/check-retries
local:techs/go/name-errors - this project active

Each row shows:

  • RULE: the rule’s project ID. A rule from a source starts with the source name; an authored rule starts with local:.
  • VERSION: the version the project holds, or - for an authored rule or a rule file with unreleased changes.
  • FROM: the source and the library release that published the version, or the commit for a rule with unreleased changes; or this project for an authored rule.
  • STATUS: active for a rule the configuration includes in the project’s guidance; excluded for one an exclusion leaves out; replaced by and the authored rule agents receive instead; or draft, not built for an authored rule that still has its draft marker, which build refuses until you complete it. It adds replaces and the rule an authored rule replaces, pinned at and the version a pin keeps, and retired for a rule its library has retired, which trailguide project update removes unless a pin keeps it. An authored rule keeps replaces after an update removes the rule it replaces.

Rules are sorted by project ID. To add or remove rules, edit rules.include or rules.exclude and run trailguide project sync.

JSON output lists the rules in value.rules, each with its id, path, active, and retired, and, where they apply, source, version, release, commit, pin (its version and reason), exclusion (its reason), replacedBy, replaces (the replaced rule’s id and the basedOn version), and draft. active describes the configuration and lockfile, not the generated files: trailguide project check reports whether those are current. Tools written in Go can compute the same view from a project’s configuration and lockfile with the github.com/fabricahq/trailguide/trailguide/projectview package; see Read a project from a tool.

trailguide library manages a library, a repository whose manifest publishes its authored rule groups and skills for projects to take. A library keeps its manifest in .trailguide/library.yaml, beside a project’s .trailguide/config.yaml, so a repository can be both, and keeps the rules and skills it publishes at the repository root, in rules/ and skills/; see Library layout. Library commands also work in a library of library schema version 2, which keeps its manifest in a library section of config.yaml and its rules and skills in .trailguide/, until you migrate it. Initialize from the repository root. Other library commands find that root from subdirectories. Use --directory PATH to target another library; see Working directories.

Terminal window
trailguide library init [options]

Write the manifest, .trailguide/library.yaml, with schemaVersion: 3, the library’s name, and the running release as minTrailguideVersion, and create an authoring README and a GitHub Actions workflow, without overwriting existing authored files. Optionally copy explicitly supplied license terms into the library and declare them in license. Init doesn’t touch .trailguide/config.yaml, which only a repository that’s also a project needs. A library that already has a manifest, in library.yaml or in a library section of config.yaml, keeps it.

In a repository that’s already a project with rules or skills of its own, in .trailguide/rules/, .trailguide/assets/, or .trailguide/skills/, init moves them to where a library keeps them, as library migrate does, builds the skills, and lists each move. It lists each skill link the build can’t keep instead of building; fix them, then run trailguide library build. The moved rules and skills become the library’s: rule and skill IDs don’t change, so the project’s configuration needs no edits. When the content can’t move, such as when rules/ already exists at the root, init fails with migrate-conflict and writes nothing.

The workflow, .github/workflows/trailguide.yml, runs trailguide library check on every pull request, using the release that the minTrailguideVersion in library.yaml names when it runs, or in config.yaml for a library of library schema version 2. Raise it yourself when the library starts relying on a newer Trailguide; trailguide project update raises only config.yaml’s. When the manifest names none, such as one a development build created, it uses the latest release. Either way, the workflow installs only that version’s archive, after verifying it against the release’s attested SHA256SUMS, and prints the version it installed in the job’s log and summary. Rerunning trailguide library init never changes an existing workflow, so one written by Trailguide 0.8 or earlier keeps installing the release it names; for a library of library schema version 2, trailguide project update warns when raising the minimum would make that release refuse the library. See Check changes in CI.

OptionMeaning
--directory PATHDirectory to operate in. Defaults to your working directory; repository discovery applies. Init must target the repository root.
--name NAMEThe library’s name. Defaults to the repository folder’s name, lowercased with each run of other characters turned into a hyphen, or library when that isn’t a valid name. Ignored when the repository already has a manifest.
--spdx EXPRESSIONLibrary SPDX expression. Must be supplied together with --license-file.
--license-file PATHUTF-8 license text to copy to LICENSE.md. Relative to your working directory, even with --directory.
--notice-file PATHOptional UTF-8 notice text to copy to NOTICE.md. Requires both license options. Relative to your working directory.
--non-interactiveAccepted; library init runs without prompts even when this flag is omitted.

If you omit the license options, the manifest leaves the license undeclared. Init does not infer license terms, create a Git repository, commit, or publish the library. A repository with a rule-library.yaml fails with a message that shows the manifest’s shape; see Move from version 2.

Terminal window
trailguide library add group ID [options]

Create a rule group in rules/ID/, with _group.yaml metadata and an authoring README, or in .trailguide/rules/ID/ in a library of library schema version 2. ID is a rule group path such as practices/testing or techs/typescript. It writes the same files as trailguide project create group.

OptionMeaning
--directory PATHDirectory to operate in. Defaults to your working directory; repository discovery applies.
--name TEXTRequired. Rule group display name.
--description TEXTRequired. What the rule group covers.
--when-to-read TEXTRequired. When an agent should read the rule group.
--non-interactiveNever prompt. Supply all required inputs as flags.

Empty rule groups are valid. Existing rule group files are preserved.

Terminal window
trailguide library add rule ID [options]

Create a rule in an existing rule group, at rules/ID.md, or .trailguide/rules/ID.md in a library of library schema version 2. ID includes the rule group path and rule name, such as techs/javascript/prefer-for-of, without .md.

OptionMeaning
--directory PATHDirectory to operate in. Defaults to your working directory; repository discovery applies.
--title TEXTRequired. Action-oriented rule title.
--when-to-read TEXTRequired. When an agent should read the rule.
--impact LEVELRequired. One of CRITICAL, HIGH, MEDIUM-HIGH, MEDIUM, LOW-MEDIUM, or LOW.
--impact-description TEXTRequired. The consequence the rule helps prevent.
--body-file PATHOptional UTF-8 Markdown body, without frontmatter. Relative paths start at your working directory. Omit to create an unfinished draft.
--non-interactiveNever prompt. Supply all required inputs as flags.

Create the rule group first with trailguide library add group; rule creation does not create missing rule groups. Without --body-file, complete the draft and remove its trailguide:draft marker before validation. Existing rules are not overwritten. After the first library release, the next steps include adding the new rule’s change note with trailguide library change. Like trailguide library check, it fails with instructions in a shallow clone, or a clone with change notes but no release tags, where it can’t tell whether the library has a library release.

Terminal window
trailguide library add skill NAME [options]

Create a standalone skill in skills/src/skills/NAME/, or, with --stack, a skill in a stack, in skills/src/stacks/STACK/skills/NAME/, then build the library’s skills. In a library of library schema version 2, the skill goes in .trailguide/skills/<library.name>/NAME/, the folder for the library’s own skills, with nothing to build. NAME follows the skill name grammar, such as fix-bug; the skill’s ID is skills/NAME. A new skill that the manifest’s levels don’t list is available: projects install it when they name it. To require or recommend it, add it to skills.required or skills.recommended in .trailguide/library.yaml. See Skill levels.

OptionMeaning
--directory PATHDirectory to operate in. Defaults to your working directory; repository discovery applies.
--description TEXTRequired. What the skill does and when to use it, at most 1,024 characters.
--type TYPEOptional. playbook or review, recorded as trailguide-skill-type. See Skill types.
--overviewOptional. Write a starter overview page, overview.md, the page catalogs such as Skillmart show. By default, the command writes one only when the library’s skills.overviewPages is required; --overview=false skips it then. Ignored in a library of library schema version 2.
--stack STACKOptional. The stack to add the skill to, in skills/src/stacks/STACK/skills/. The stack’s folder doesn’t need to exist yet. Leave it out for a standalone skill. Not accepted in a library of library schema version 2.
--non-interactiveNever prompt. Supply all required inputs as flags.

The command writes SKILL.md with the name, description, and type in its frontmatter, and a body with the trailguide:draft marker. Complete the draft and remove the marker before validation; see Write a skill. With --overview, or when the library’s skills.overviewPages is required, in a library of library schema version 3, it also writes a starter overview page, overview.md, with the same marker: library check fails until you write the page and remove the marker, or, unless pages are required, delete the file. Without it, the skill has no page, which library check notes, fails, or ignores as skills.overviewPages says. An invalid name, or a description that’s blank or too long, fails before prompts with exit code 2. Existing skills are not overwritten, and the command refuses a name that another of the library’s skills has, in any stack or origin folder. The built copy in skills/dist/ keeps the draft marker, so library check fails until you complete the skill and run trailguide library build again.

After the first library release, the next steps include adding the new skill’s change note with trailguide library change. Like trailguide library check, it fails with instructions in a shallow clone, or a clone with change notes but no release tags, where it can’t tell whether the library has a library release.

Terminal window
trailguide library fork skill SOURCE:SKILL [options]

Copy a skill from a source the library declares into skills/src/skills/, then build the library’s skills, so the library publishes its own version of it. In a library of library schema version 2, the fork goes in .trailguide/skills/<source>/, the folder for forks of that source’s skills. SOURCE:SKILL names a source in the manifest’s sources, or in the library’s configuration in library schema version 2, and the skill’s ID in the source, such as pstack:pstack/skills/show-me-your-work, or pstack:skills/show-me-your-work when the source’s path is pstack: a skill in the source’s repository at the revision its ref names now, or its newest library release when its ref is latest-release. The fork keeps the skill’s name.

OptionMeaning
--reason TEXTRequired. Why the library publishes its own version, recorded with the fork.
--directory PATHDirectory to operate in. Defaults to your working directory; repository discovery applies.
--non-interactiveNever prompt. Supply all required inputs as flags.

The command:

  1. Copies the skill’s folder from the source’s repository, with every file’s executable bit, to skills/src/skills/<name>/, such as skills/src/skills/show-me-your-work/, where <name> is the skill’s name, or, when skills.aliases gives the skill an alias, the alias, so projects keep installing it under that name, and the alias entry goes. In a library of library schema version 2, a name the source’s skills.rename gives the skill takes the place of an alias. It reads the source as library check does, so it needs access to the repository.
  2. Rewrites the fork’s trailguide-skills-used so each skill it uses, including those the source’s skills.uses adds for it, names the library’s fork of it, such as skills/tdd, when the library has forked it, and otherwise names it as a skill the library curates, with the source’s name, such as pstack:skills/tdd, which makes it a dependency projects install with the fork. In a library of library schema version 2, projects install a curated skill only when library.skills lists it, so a skill that uses one the library neither forked nor lists is refused there: list that skill in library.skills, at a level or as a dependency, or fork it first. A skill that cites rules of a library source is forked as a draft for you to remove them from, because a library’s skills cite only its own rules.
  3. Adds an entry to the manifest’s skills.forks, under skills/<name>, with the skill it forks as from, such as pstack:pstack/skills/show-me-your-work, the full commit SHA it copied as basedOn, and your reason. In a library of library schema version 2, the entry goes in the source’s skills.forks in config.yaml, with skills/<name> as as, so the library’s own agents use the fork in place of the source’s skill.
  4. When a level lists the skill as one the library curates, such as pstack:pstack/skills/show-me-your-work, lists skills/<name> in its place, at the same level. Otherwise the fork is available. Skills of the library that name the forked skill in trailguide-skills-used must name the fork instead; library check fails until they do.

When it can’t adapt the skill’s SKILL.md for the library, because its frontmatter can’t be read or edited, it cites rules of the source’s library, or the fork would fail library check’s skill checks, it still writes the fork and its configuration, marks the fork as a draft, and lists what to fix in SKILL.md. Library check fails, and projects can’t install the fork, until you fix it and remove the <!-- trailguide:draft --> line. It refuses a fork whose folder exists, a skill the source already excludes or forks, a source the configuration doesn’t declare, a skill the source’s library requires, and, in a library of library schema version 2, a skill that uses one of the source’s skills the library neither forked nor lists. In a library of library schema version 2, the next steps say how to install the fork in the library repository: trailguide project update SOURCE for a source without a ref, since the fork copied its newest library release, and otherwise trailguide project sync.

When the source’s ref later moves, library check lists the source’s changes to the skill since basedOn. The source’s license still applies to the copied files; credit it in your library’s notices, as License rules describes.

When the library forks a skill that another skill it curates from the same source uses, projects that install the curated skill would install the source’s copy of the forked skill beside the fork, under the same name. Library check fails then, and asks you to fork the skill that uses it too, so the fork uses your fork.

Terminal window
trailguide library build [options]

Build the library’s skills from skills/src/ into skills/dist/, and write the skills index, skills/README.md. Each skill in skills/src/skills/ or skills/src/stacks/<stack>/skills/ builds to skills/dist/<name>/: its folder without its README.md, overview.md, and media/, plus a copy of each shared file or folder its Markdown links to, in skills/src/shared/ or its stack’s shared/, with those links rewritten. A link to another of the library’s skills points at that skill’s built folder. See What a built skill holds.

OptionMeaning
--directory PATHDirectory to operate in. Defaults to your working directory; repository discovery applies.
--non-interactiveAccepted; library build does not prompt.

Build replaces skills/dist/ and skills/README.md with what the sources build, and lists each skill whose built folder changed or was removed; in JSON, value.changed and value.removed. It fails, writing nothing, with the same invalid-skill problems as library check when skills/src/ doesn’t build, such as a link to a file outside skills/src/. It writes each built skill’s provenance into its SKILL.md, and fails with invalid-skill when a source’s SKILL.md already has a provenance key, or has metadata written as a flow mapping that a stack skill or fork needs it added to. Otherwise it doesn’t validate the skills’ frontmatter or metadata; library check does. When the built skills record provenance and minTrailguideVersion in .trailguide/library.yaml names a release before 0.13.0, build raises it to the running release, says so, and lists library.yaml among the files to commit. It does the same when the sources have an overview page other than a starter page, or a file in a media/ folder, and the minimum names a release before 0.14.0, which would ship them in the built skills. Only a release of Trailguide raises the minimum; a development build leaves it, and library check then fails with stale-build until it names 0.14.0 or newer. In JSON, value.minimumRaised and value.minimumReason, with value.warnings saying when the check workflow installs an older release. A library of library schema version 2 has nothing to build, so build fails with needs-schema-3 and says to run trailguide library migrate. Build copies files only; it runs no commands.

Commit skills/dist/ and skills/README.md with the sources. trailguide library check fails with stale-build until they’re what the sources build.

Terminal window
trailguide library change ID... [options]

Write a new change note for one or more rules and skills. ID is a rule ID, such as practices/testing/verify-retry-limits, or a skill ID, such as skills/build-feature; name several to cover related changes in one note. Before the first library release, rules and skills need no notes, so the command fails and says so.

OptionMeaning
--bump LEVELmajor, minor, or patch. Required for rules and skills that have a version. Not accepted for new or retired ones.
--summary TEXTRequired. One line describing the change for project maintainers.
--retireRecord that the rules or skills are retired; see Retired rules and Retired skills. A rule’s Markdown file and asset directory, or a skill’s folder, must already be gone.
--replaced-by IDOptional with --retire and a single ID: the rule that replaces a retired rule, or the skill that replaces a retired skill. If it isn’t a rule or skill in the library yet, the command warns; add it before the next library release.
--non-interactiveNever prompt. Supply all required inputs as flags.

The command writes a new file in .trailguide/changes/ with a unique name, such as .trailguide/changes/2026-09-29-verify-retry-limits-7f3a9c.yaml, and never edits or deletes existing notes. Rule IDs go in the note’s rules map and skill IDs in its skills map. A rule or skill without any version is recorded as new. It rejects an ID that isn’t a rule or skill in the library, unless --retire is supplied for one that has a version. It also rejects a rule that has a version but whose Markdown file and asset directory are unchanged since the latest library release, and a skill whose folder’s tracked files and their modes are unchanged, apart from provenance the build wrote into its SKILL.md: edit it first, then record the change. A rule or skill that was never published can’t be retired: delete it, and remove it from any pending note.

--replaced-by must be the same kind as the retired ID: a rule for a rule, a skill for a skill. Naming a rule to replace a skill, or the reverse, fails as a usage error with exit code 2, such as --replaced-by practices/testing/verify-retries is a rule, but skills/triage-bug is a skill. A skill can only be replaced by a skill.

See Choose a version change for picking LEVEL for a rule, and Choose a skill’s version change for a skill.

Terminal window
trailguide library check [options]

Validate the manifest, all rule groups and rules, all skills and their levels, change notes, supporting assets, and declared license and notice files. In a library of library schema version 3, also check that skills/dist/ and skills/README.md are what skills/src/ builds, failing with stale-build when they aren’t, and that nothing is left in .trailguide/rules/, .trailguide/assets/, or .trailguide/skills/, failing with nested-content, and that each skill’s README.md and each skill’s and stack’s overview page are valid, noting each skill and stack without an overview page. After the first library release, also check that every changed rule and skill has a change note. Does not change files.

OptionMeaning
--directory PATHDirectory to operate in. Defaults to your working directory; repository discovery applies.
--non-interactiveAccepted; library check does not prompt.

Reports rule group, rule, and skill counts, value.groupCount, value.ruleCount, and value.skillCount in JSON, such as Library is valid: 3 group(s), 6 rule(s), 3 skill(s)., and file-specific errors. The human output leaves out the skill count when the library has no skills. Empty rule groups are valid. Unfinished marked drafts fail. Undeclared licenses produce warnings; invalid declarations, missing declared files, and declared files inside a rule’s version (a rule’s Markdown file or its asset directory) fail validation. Library check validates the format, not writing quality or legal permissions. Use the authoring rubric to review guidance quality.

Check validates every skill folder and its SKILL.md: the folder’s name and contents, each skill page’s images, the frontmatter fields, the trailguide-skill-type, trailguide-rules-used, and trailguide-skills-used metadata keys, and links. It lists every skill problem it finds and fails with the code invalid-skill. It warns when a skill’s license differs from the library’s SPDX expression, and about a file in a skill folder that Git neither tracks nor ignores. Validation lists each check and its message. In a library of library schema version 3, each link must work in the built skill, as Links in a library’s skills describes. In a library of version 2, each skill’s local links, and the links of the Markdown files they reach, must name files the repository has and Git doesn’t ignore, as a project that installs the skill keeps them; check fails on the first link that doesn’t, with its reference- code, the chain of links that reached it, and without reading the network. For a library that curates skills, check reads each curated skill’s links in the repository it comes from.

Check also validates the manifest’s skill levels. It fails when a level lists a skill the library doesn’t have, a skill appears in two levels, or two listed skills, authored or curated, have the same name. To check curated skills, it reads each curated source at the ref the library’s manifest names, so it needs access to those repositories; see Name clashes. Levels are library-wide settings, so changing one needs no change note.

Check also compares each skill the library forked from one of its sources, a skills.forks entry with basedOn in library.yaml, or in the source’s entry of config.yaml in library schema version 2, with the source’s copy at the revision its ref names now. For each one that differs, it lists the files that changed since basedOn, or says the source no longer has the skill, and the basedOn value to set once your fork has the changes you want; in JSON, value.forkedSkills lists each with its source, id, skill, basedOn, basedOnField (the manifest field that records basedOn), commit, revision, files, and removed. The listing doesn’t fail check, and check never changes the fork. trailguide library release --dry-run shows the same list. This also needs access to the sources’ repositories.

After the first library release, check compares each rule’s versioned content, meaning its Markdown file and its asset directory, and each skill’s, meaning the tracked files in its folder and their modes, with the latest release/<number> tag in the current branch’s history. Notes added since that tag are pending. Check fails when any of the following is true of a rule, and the same for a skill, with the message naming the skill:

  • A rule changed and no pending note names it. The error names the rule and its latest version, and gives the trailguide library change command to run.
  • A new rule has no pending note.
  • A published rule was deleted without a pending note that retires it.
  • A retired rule’s replacedBy isn’t a rule in the library, or a retired skill’s replacedBy isn’t a skill in it.
  • A rule reuses the ID of a retired rule.
  • A pending note names a rule that’s unchanged since the latest library release, so the note is stale.
  • A pending note names a rule that doesn’t exist and isn’t being retired.
  • A note is invalid, such as an unknown change, a blank summary, a skill ID under rules, or neither rules nor skills.

Check warns when a note that a library release already published was edited, because the edit has no effect. It also warns when such a note was deleted, because notes are never deleted; restore it. When a pending note retires a rule that an earlier library release named as a retired rule’s replacement, check warns about it: when the note names a replacement, that updates will point projects that still include the earlier rule on to it; otherwise, that they would be pointed at a retired rule, suggesting a replacement as replacedBy. A pending retirement whose replacedBy isn’t a rule in the library fails.

A skill is compared with the newest library release whose release record has a skills field; when a later library release lacks it, because an older Trailguide published it, check warns, as Skills in the release record describes.

This comparison needs the repository’s history and tags. Check fails with instructions in a shallow clone, with shallow-clone, and in a clone whose commit has change notes but no release/<number> tags, such as one made with git clone --no-tags, with missing-release-tags; fetch the tags with git fetch --tags. Check never fetches, so it refuses such a clone; trailguide library release fetches the remote’s release tags itself. In CI, check out with full history, such as fetch-depth: 0. Before the first library release, rules need no notes, and check validates everything else. A library outside a Git repository has no library releases.

When checks pass, the result previews the pending library release: each rule and skill, its change, and its current and next version, in one list with the rules first and then the skills, each sorted by ID. Each skill also shows its level, and a skill whose level changed, that became a fork or stopped being one, or whose fork moved to another basedOn commit, is listed with that change, and with - as its change when its files didn’t change. When no rule or skill change is pending and no library-wide file changed, it says there is nothing to publish, as trailguide library release does, except before the first library release, which always publishes the library-wide files, even without rules, so check says that instead. When library-wide files, such as the manifest, rule group metadata, shared assets, license files, or the overview pages and media/ files of skills and stacks, changed since the latest library release, the preview lists them too, so you know a library release would publish them even when no rule changed. JSON output includes this preview in value.pendingRelease, with its release number, a rules list, and a libraryFiles list of the changed library-wide files, which is empty before the first library release. Each rule has its id and change; from and to, its version before and after the library release (from is absent for a new rule); for a retired rule, lastVersion and any replacedBy instead; and summaries, one per change note that names it, in note order, as the release record and trailguide project update name them. value.pendingRelease.skills lists pending skill changes in the same form, with each skill’s level, its previousLevel when its level changed, and a fork with the source, id, basedOn, previousBasedOn, and whether the fork was added, when it’s new or moved, or with removed: true when the skill stopped forking that source skill; a skill whose only change is its level or fork has no change or summaries. trailguide library release reports the rules and skills it publishes in value.rules and value.skills the same way.

Terminal window
trailguide library migrate [options]

Move a library of library schema version 2 to version 3, with its content at the repository root:

FromTo
.trailguide/rules/rules/
.trailguide/assets/rules/assets/
.trailguide/skills/<origin>/<name>/skills/src/skills/<name>/
.trailguide/skills/<name>/, as a project keeps its skillsskills/src/skills/<name>/
OptionMeaning
--directory PATHDirectory to operate in. Defaults to your working directory; repository discovery applies.
--dry-runList what would move, without changing anything.
--non-interactiveAccepted; library migrate does not prompt.

Migrate moves the library section of .trailguide/config.yaml to .trailguide/library.yaml, at library schema version 3, with the sources the library curates and forks skills from and its forks, as Libraries in library schema version 2 describes, and removes config.yaml when nothing a project reads is left in it, or moves what’s left to configuration version 3, which a release also gives its own version as config.yaml’s minTrailguideVersion, when that names none or an older one. library.yaml gets the running release as minTrailguideVersion, so the library’s check workflow installs a Trailguide that reads it, or none from a development build, so the workflow installs the latest release. When an earlier Trailguide wrote the library’s check workflow, migrate changes the line that reads minTrailguideVersion from config.yaml to read it from library.yaml, and it warns about a workflow that pins a release, which can’t read library.yaml. Migrate lists what changes for projects and for the library repository, such as a curated skill the library only offered, under Review what changes. It rewrites the links the moved Markdown files make to each other, so each still names the same file, moves declared license and notice files that were in .trailguide/assets/, removes the files outside any rule group or skill, such as the old folders’ guides, and builds the skills. Rule and skill IDs don’t change. It lists each skill link library build can’t keep, such as a link to a rule or another file outside the skill’s folder, and doesn’t build: move what each link points to into skills/src/shared/, or link a web address, then run trailguide library build. In JSON, value.moves, value.rewritten, value.removed, value.problems, value.notes, and value.warnings list what it did, and value.configRemoved and value.workflowUpdated say whether it removed config.yaml and updated the workflow. Run it again to finish a migration that stopped after it wrote library.yaml: value.resumed is then true, and value.removed lists the old folders it removes once it confirms they hold what it moved; when a file there differs from its moved copy, it fails with migrate-conflict, naming both, and removes nothing. Its next steps say to update the root README.md if it describes the old folders and, once the library has a library release, to record each rule whose links it rewrote with trailguide library change RULE_ID --bump patch.

Migrate refuses, with migrate-conflict and writing nothing, when rules/, skills/src/, skills/dist/, or skills/README.md already exists, or when two origin folders hold a skill with the same name, and when library.yaml already exists beside a library section and says something else. It also moves a library section of version 3, as Trailguide wrote it before library.yaml, which has its content at the root already. A library whose manifest is already library.yaml has nothing to migrate; move content left in .trailguide/ yourself, as trailguide library check’s nested-content error explains. Projects need a Trailguide that reads library schema version 3 before they update to the library’s first library release in it; see Libraries in library schema version 2.

Terminal window
trailguide library release [options]

Publish the pending change notes for rules and skills, and any changes to library-wide files, as a library release. A library release that changes only skills publishes like any other. See Version your rules for the workflow.

OptionMeaning
--directory PATHDirectory to operate in. Defaults to your working directory; repository discovery applies.
--dry-runShow exactly what would be published, including the release notes, without creating a tag or a GitHub Release page.
--no-github-releaseSkip creating the GitHub Release page.
--non-interactiveAccepted; library release does not prompt.

Before publishing, the command fetches from the branch’s upstream remote. It refuses unless:

  • you’re on the remote’s default branch,
  • the branch matches the remote exactly, so the library release contains no unpushed commits and misses none, and
  • trailguide library check passes.

It then computes each changed rule’s and skill’s next version from the pending notes, using the largest change when several notes name the same rule or skill. The first library release gives every rule and skill version 1.0.0. The release record lists skills in its skills field, and the release notes list skill changes in a section of their own. It creates the annotated release/<number> tag on the current commit, with the release notes and release record as its message, and pushes it. No files change and nothing is committed. Finally, it creates the GitHub Release page.

--dry-run shows the repository, branch, commit, release number, each rule’s and skill’s change and versions, and the complete release notes.

If a run stops after pushing the tag, such as when the GitHub Release page can’t be created, run it again: it finds the tag on the current commit and creates what’s missing. A run that stopped before pushing leaves its tag only in your clone; the next run checks it against the library release the commit publishes after the remote’s latest one, pushes it only when its release notes and record match exactly, and otherwise refuses with release-tag-mismatch and asks you to delete it. A tag that a later Trailguide created in a newer release record format instead fails with unsupported-release-record: upgrade Trailguide and run it again rather than deleting the tag. The result reports separately whether the tag and the GitHub Release page were created. JSON output gives them as value.tagCreated and value.githubRelease.created, and describes the library release in value.release, value.rules, value.skills, value.libraryFiles, and value.notes. Like other optional values that aren’t lists, value.githubRelease is left out when the library release has no GitHub Release page: on a dry run, with trailguide library release --no-github-release, or for a repository that isn’t on GitHub.com. When the tag is published but the page can’t be created, the command fails with github-release-failed, and the JSON response still includes value, with tagCreated and without value.githubRelease, so a script can tell the tag is published and only the page is missing. With no pending notes and no library-wide changes, the command reports that there is nothing to publish, with value.release set to 0, value.rules, value.skills, and value.libraryFiles empty, and value.tag and value.notes left out, as optional values that don’t apply always are, and succeeds. A tool such as jq reads a left-out value as null.

The tag uses Git’s configured identity as its tagger, including the GIT_COMMITTER_* environment variables.

When the push fails, the command fails with push-failed and deletes the tag it created, so a rerun starts over. Trailguide doesn’t show what Git or the server printed, as Text from Git, servers, and the GitHub CLI explains; its message names the cause it recognizes in that text instead:

  • a repository rule or tag protection, such as a GitHub ruleset or a GitLab protected tag, with GitHub’s error code when the server gave GH006 or GH013,
  • the HTTPS server’s certificate or the SSH host key couldn’t be verified,
  • Git couldn’t connect to the server,
  • the server denied access, or authentication failed,
  • a hook on the server, such as a pre-receive or update hook, declined the tag,
  • the server refused the tag for a reason Trailguide doesn’t recognize, with GitHub’s error code when the server gave another one, such as GH001 for large files, or
  • the push failed before the server answered, such as when your pre-push hook stopped it.

To read the server’s own message, push a test tag that your tag rules cover yourself, such as release/0, which isn’t a library release tag:

Terminal window
git tag release/0
git push origin refs/tags/release/0
git tag --delete release/0

If that push succeeds, delete the test tag from the remote with git push origin --delete refs/tags/release/0.

trailguide library release refuses before creating anything, with exit code 1 and error.code in JSON output, when:

CodeRefusal
not-a-repositoryThe library isn’t the root of a Git repository.
shallow-cloneThe clone has partial history. Fetch it with git fetch --unshallow --tags, or check out with fetch-depth: 0 in CI.
missing-release-tagsThe commit has change notes, but neither the clone nor the remote has release/<number> tags. The command fetches the remote’s release tags before checking, so it doesn’t refuse a clone made with git clone --no-tags; that fetch adds them to the clone, also on a dry run.
detached-headHEAD isn’t on a branch.
no-upstreamThe branch has no upstream branch on a remote.
push-destinationThe remote pushes to several URLs, or to another repository than it fetches from.
fetch-failedGit couldn’t read or fetch from the remote. The message says whether the HTTPS server’s certificate or the SSH host key couldn’t be verified, Git couldn’t connect to the server, or the server denied access or has no such repository, when it recognizes one of them; run git fetch with the remote’s name to read Git’s message.
not-default-branchThe branch doesn’t track the remote’s default branch, or the remote reports none.
no-commitsThe library has no commits yet.
branch-differsThe branch has commits the remote lacks, the remote has commits the branch lacks, or the remote branch doesn’t exist.
remote-changedSomeone pushed to the branch, or changed a release tag, while the command ran.
release-tag-mismatchA release tag in the clone differs from the remote’s, exists only in the clone without being the next one on this commit, or doesn’t publish what this commit would.
invalid-release-tagA release tag reachable from the commit isn’t a valid annotated tag with a release record.
unsupported-release-recordA release tag uses a newer release record schema version. Upgrade Trailguide.
uncommitted-changesLibrary files, files a skill links to, or a skill file’s executable bit differ from the checked-out commit. Projects keep the files a skill links to from the published commit, so it must hold them as check read them.
change-notesChange notes don’t match the rule or skill changes, as trailguide library check reports; other check failures keep their own codes, such as invalid-skill.
version-limitA change would take a rule’s or skill’s version past the largest version number.
git-identityGit doesn’t know your name and email for the tag’s tagger.
github-cli-missingA GitHub Release page applies, but gh isn’t installed.
github-cli-signed-outA GitHub Release page applies, but gh isn’t signed in to GitHub.com.
release-too-largeThe release tag would exceed 8 MiB.
limit-exceededThe clone has more than 20,000 release tags, or gh printed more than its output limit.
changed-inputLibrary files changed while the command read them.

After it creates the tag, it can fail with:

CodeFailure
tag-failedGit couldn’t create the tag, such as when tag signing fails.
push-failedThe push failed, including when the remote refused it, with the cause described above. The command deletes the tag it created.
release-conflictSomeone else published the same release/<number> first.
github-cli-failedgh couldn’t run.
github-release-failedgh couldn’t look up or create the GitHub Release page. The message names the cause it recognizes: GitHub’s rate limit, gh signed out or its credentials refused, permission denied, or a repository GitHub can’t find. Otherwise, when the lookup failed, it says to run gh release view to read gh’s message; when creating the page failed, it suggests checks that change nothing, gh auth status and gh repo view, and running the command again, which creates the page with its generated notes only if it’s still missing. The tag is published; run the command again to create the page.

GitHub Release pages are created with the GitHub CLI, gh, for repositories on GitHub.com. Each library release gets one GitHub Release page on its release/<number> tag, with the release notes as its body. Before changing anything, trailguide library release checks that gh is installed and signed in, and refuses if it isn’t, unless you pass --no-github-release. trailguide library release --dry-run checks it too, and refuses the same way. Repositories hosted elsewhere get tags only. The page’s URL in the result is built from the repository and the tag, never taken from what gh printed.

Terminal window
trailguide --help
trailguide COMMAND --help
trailguide --version
trailguide --license

Use -h or --help to inspect command syntax and options. For example, run trailguide project --help to find project commands or trailguide library add rule --help for rule authoring options.

OptionMeaning
-h, --helpShow help for the selected command.
-v, --versionAt the root, print the executable’s version.
--licenseAt the root, print the full embedded MIT license and copyright notice.
--jsonReturn help, version, or license text in value.text inside a JSON response.

Running trailguide or a command group such as trailguide library without a subcommand displays help. The trailguide project, trailguide add, trailguide project add, trailguide project create, trailguide project fork, trailguide project remove, trailguide project list, trailguide library, trailguide library add, and trailguide library fork groups organize commands; they do not perform operations themselves. Help never prompts or writes files.

The root --version flag prints the tool version. To choose which versions of a library’s rules and skills to take, see Choose versions.

In Git repositories, run trailguide project init or trailguide library init from the repository root. Initialization from a subdirectory fails without writing files. This also applies to the target of trailguide library init --directory.

Other commands find the nearest ancestor containing a .git directory or file, including worktrees and submodules. Project commands use that root’s .trailguide/config.yaml, and library commands its .trailguide/library.yaml, or the library section of its config.yaml in a library of library schema version 2. They stop at that repository boundary, even if its configuration is missing. A nested .trailguide/ does not override the root’s configuration.

Outside Git, commands use the current directory, or the directory selected by --directory for library commands. They do not search parent directories for configuration. Custom project configuration locations are not supported.

Relative input paths such as --body-file, --license-file, and --notice-file resolve from the directory where you run the command. Paths inside project configuration remain relative to .trailguide/.

Every command accepts --json, which prints one JSON response and disables prompts. Every command also accepts -h / --help.

Authoring commands accept --non-interactive. Without it, commands can prompt for missing required metadata or source selections when running in a terminal. With --non-interactive, --json, or no terminal, missing required inputs cause an error. Positional arguments such as ID and ALIAS must always be supplied.

Invalid interactive answers repeat the same question while retaining earlier answers; for a choice, such as [yes/no], the error lists the valid answers. Without a terminal, or with --json or --non-interactive, a missing required input fails with exit code 2 and names the flag to pass, such as --summary. Explicit flags are validated without prompting for replacement values. Existing rule groups, rules, skills, and source names fail before prompts.

trailguide project init asks one question, which agents to install skills for, and only on a new project in a terminal without --install-for, --non-interactive, or --json. trailguide library init, both check commands, trailguide project remove source, trailguide project list skills, trailguide project list rules, and trailguide library release run without prompts. Of these, trailguide library check and trailguide library release accept --non-interactive; trailguide project check, trailguide project sync, trailguide project update, trailguide project build, trailguide project remove source, trailguide project list skills, and trailguide project list rules do not need or accept it.

String options accept one value and cannot be repeated, except --rules, --skills, --install-for, --keep, --exclude, --update-fork, and --merge-fork, which accept repeated values. For a value beginning with -, use the equals form, such as --description='-prefixed text'.

Scaffolding commands validate paths and detect collisions before writing. They preserve existing authored files and roll back failed creation attempts. They do not publish content or convert arbitrary third-party material. For the authoring workflow, see Set up your first project or Create your first library.

Human-readable output is the default. Add --json for scripts:

Terminal window
trailguide project check --json

JSON mode writes one response to stdout:

FieldMeaning
oktrue for success; false for failure or an out-of-date project check.
valueThe command’s result, when available. An out-of-date check still includes its report here.
errorOn failure, an object with kind (usage, validation, operation, cancelled, or out-of-date for a stale project check) and message, plus location when available. Domain failures include a stable code, such as needs-init, missing-group, guide-edited, or agents-section-edited, and every usage error has the code invalid-arguments. A failure about a skill’s link, with a code that starts with reference-, also has a reference object with the source, the revision, the file with the link, the link’s destination, its target path, and the chain of files whose links reached it. source, revision, and target are left out when they don’t apply.
warningsPresent only when there is a warning about how the command found the project, such as a project that still keeps its files in .code-rules/; see Upgrade from Code Rules. It accompanies success and failure alike. Human output prints these warnings to stderr.

Every list in a value is always present, empty when there’s nothing to report, including warnings. Enumerated values, such as statuses, kinds, changes, and codes, are kebab-case. Only optional values that aren’t lists, such as a ref or a githubRelease object, are left out when they don’t apply.

Project check returns value.status as up-to-date or out-of-date, and a value.problems list. Each problem has a kind (missing-file, stale-contents, unexpected-file, outdated-readme, or outdated-agents-section), path, message, and nextSteps, a list of repair steps in the same form as authoring results use. Paths are relative to the Trailguide directory, except paths in a skill target, which are relative to the project root, so the AGENTS.md problem’s path is ../AGENTS.md. Generated guidance, installed skills, the managed Trailguide guide, and the AGENTS.md section must all be current for success.

Authoring results include value.nextSteps, an ordered list of steps, each an instruction and its copyable commands. Human output shows those steps after initialization and rule or rule group creation.

Sync, update, build, add skill, add rule, and remove source report added, changed, and removed file lists, with paths relative to the Trailguide directory, except paths in a skill target, such as .claude/skills/build-feature/SKILL.md, which are relative to the project root. Authoring commands, such as init, add source, create group, create rule, create skill, fork rule, fork skill, and library change, report the absolute paths of the files they created in added and of those they modified, such as config.yaml, in changed. Their human output lists the same files under Added: and Changed:, relative to the working directory when they’re inside it. Update also reports each source’s rule changes in value.sources. Sync, update, add skill, add rule, and remove source list their warnings, such as for an unreleased ref, an entry naming a retired rule, a rename, a personal skill with the same name, or authored rule group metadata they wrote, in value.warnings, which is empty when there are none. Those commands and build also list each installed skill whose links reach a skill the project excludes in value.excludedSkillLinks, with its skill and the excluded skill’s project IDs, the chain of files, by path in the repository that supplied them, from the installed skill’s file to the excluded skill’s, and uses, which is true when the skill also calls the excluded skill; value.warnings has the matching warning. When they refresh the managed Trailguide guide, value.guide reports its path relative to the Trailguide directory and whether it was created. When they change the Trailguide section of AGENTS.md, value.agents reports the file’s path relative to the repository root and an action: created for a new file, added for a section added to an existing file, or updated. Init lists AGENTS.md among its added or changed files instead. Help, version, and license return their text in value.text.

In human mode, operational errors go to stderr. An out-of-date check prints its status, problems, and next steps on stdout. Human output, prompts, and errors show control characters, which could make a terminal clear or rewrite what it displays, as visible escapes: ESC as \x1b, other controls from \x00 to \x1f and \x7f the same way, C1 controls as \u0080 to \u009f, and bytes that aren’t valid UTF-8 as \xNN. Libraries supply much of that text, such as change summaries and rule IDs. JSON output encodes text as JSON strings instead. In JSON mode, errors go in the response; stderr is reserved for failures writing that response. Unreleased preview builds also print a non-production warning with their source commit to stderr before every command, including help, version, and JSON commands. JSON output on stdout is unchanged. See Test a PR build in the contributing guide.

Text from Git, servers, and the GitHub CLI

Section titled “Text from Git, servers, and the GitHub CLI”

Trailguide never shows text that Git, a Git server, or the GitHub CLI, gh, produced: not in human output, JSON output, or errors. That includes Git’s error messages, the lines a server or its hooks print, the reason in Git’s ! [remote rejected] line, the default branch a server advertises, and everything gh prints. Such text can hold anything, including credentials Trailguide can’t know about, such as one a Git credential helper, GIT_ASKPASS, or http.extraHeader supplies, so Trailguide doesn’t try to find and remove them. It reads the text privately to choose one of its own fixed messages and error codes, which name the likely cause and what to check. A message may name a GitHub error code it recognizes, such as GH013, because those are a fixed set. To read the original text, run the Git or gh command yourself; the message or this reference says which.

Trailguide also never shows credentials in a URL it displays. A repository address it shows, such as a library’s remote in trailguide library release, has any password, query, and fragment removed, and its user name too unless it’s an SSH user name, which names an account. An address it can’t parse is replaced by a note, including one with an authority but no scheme, such as //host/rules, and a user@host:path address with a colon before its @, which could start a password. The GitHub Release page URL is built from the repository and the tag, not taken from gh.

Trailguide shows some values that Git computes, after checking their form: commit and object IDs, which must be hexadecimal object IDs; commit counts, which must be nonnegative integers; and object types, which must be one of Git’s four. A value in any other form fails with code git-failed and a fixed message instead.

Trailguide shows as they are:

  • names you chose locally, such as branch and remote names,
  • the repository addresses in project configuration, which can’t contain credentials, and
  • library content, such as rule files, change notes, rule group descriptions, and release records.

Human output still shows control characters in that text as visible escapes, as Command output describes.

CodeMeaning
0Success.
1An operation failed, inputs are invalid, or a project check found stale output.
2Invalid command usage, such as an unknown command, unsupported option, missing required CLI input, or options the command can’t combine, such as trailguide library change --bump for a new rule, or a trailguide project update decision the preview doesn’t offer, such as --keep for a rule the update doesn’t move.
130The command was interrupted, such as with Ctrl-C, including at a prompt. It says it was cancelled; a command interrupted before writing files writes none, and one interrupted while replacing files is recovered by the next command, as Sync and recovery describes. JSON output reports error.kind as cancelled.

Usage errors point to the relevant help page. Operational errors identify the affected file or rule when available and describe the problem. A failure of trailguide project sync or trailguide project update that wrote nothing, including an update’s refusal of its arguments after the command line is parsed, ends with No files were written., or, when the command first recovered an interrupted earlier command, which restores or finishes that command’s files, says so instead, as an update’s preview and a declined or interrupted update do too, and names the source, as in source team:, when the problem doesn’t already. An interrupted one says cancelled; no files were written, or, after such a recovery, that it was cancelled and what the recovery did. For repair commands and interrupted updates, see Sync and recovery.

Only the project and library command trees, and the top-level add skill and add rule, are supported. Earlier command paths now fail with an unknown-command error, except the add forms that Trailguide 0.10 and earlier used to create and fork, which fail naming the command that replaced them: project add skill and project add rule now install a source’s skills and rules. Update existing scripts to use the scoped commands below. Use -h or --help for help; there is no help subcommand.

Earlier commandCanonical command
trailguide inittrailguide project init
trailguide add sourcetrailguide project add source
trailguide local add grouptrailguide project create group
trailguide local add ruletrailguide project create rule
trailguide synctrailguide project sync
trailguide buildtrailguide project build
trailguide checktrailguide project check
trailguide project add group IDtrailguide project create group ID
trailguide project add rule IDtrailguide project create rule ID
trailguide project add rule ID --from SOURCE@VERSIONtrailguide project fork rule SOURCE:ID@VERSION
trailguide project add skill NAMEtrailguide project create skill NAME
trailguide project add skill --from SOURCE:SKILLtrailguide project fork skill SOURCE:SKILL
trailguide library add skill --from SOURCE:SKILLtrailguide library fork skill SOURCE:SKILL

trailguide project add library and trailguide project add repository are replaced by trailguide project add source, which adds either kind of source. Library command paths are unchanged. For configuration fields that changed, see Move from version 2.

Fabrica TrailguideMIT licensedPrivacy

Built with Fabrica.