Library schema
A library is a repository whose manifest publishes its authored rule groups, skills, and shared assets for other repositories. Libraries are useful because projects take from them: you write rules and skills once and reuse them in every codebase that needs them. A project is a repository that takes rules and skills for its own work. A repository can be both.
Libraries live in Git repositories. This page covers what makes a repository a library. For the rule and rule group files inside it, see Rule and rule group format; for skill folders, see Skill format. For how each rule and skill is versioned, see Rule and skill versions.
Library layout
Section titled “Library layout”A library keeps its rules and skills at the repository root, where a visitor sees them first, and its manifest and change notes in the Trailguide directory, .trailguide/. The tree below shows a library repository named engineering-rules/; the name is an example. A project that uses it stores a vendor snapshot of what it publishes under .trailguide/vendor/<source-name>/; see Project files.
Directoryengineering-rules/
- LICENSE.md
Directoryrules/
Directoryassets/
- retry-lifecycle.svg
Directorytechs/
Directorytypescript/
- _group.yaml
- README.md
- prefer-type-aliases.md
Directorypractices/
Directorytesting/
- _group.yaml
- README.md
- verify-retry-limits.md
Directoryskills/
- README.md the index library build writes
Directorysrc/ the skills you write
Directoryskills/
Directoryreview-tests/
- SKILL.md
- README.md
Directoryimages/
- report.png
Directoryshow-me-your-work/ a fork
- SKILL.md
Directorystacks/
Directoryfk-stack/
- README.md
Directoryskills/
Directoryfk-build-ui/
- SKILL.md
Directoryshared/
Directorycomponents/
- Button.tsx
Directoryshared/
Directorybrand/
- tokens.css
Directorydist/ what library build makes from src/
- .gitattributes
Directoryfk-build-ui/
- SKILL.md
Directorycomponents/
- Button.tsx
Directoryreview-tests/
- SKILL.md
Directoryshow-me-your-work/
- SKILL.md
Directory.trailguide/
- library.yaml
- config.yaml the repository’s own project settings, if any
Directorychanges/
- 2026-09-29-verify-retry-limits-7f3a9c.yaml
- lock.json
- RULES.md
Directoryvendor/
- …
Directorygenerated/
- …
A library publishes exactly its authored content:
- Rule groups under
rules/techs/andrules/practices/, each with its rule group metadata and rules. - Skills, as
trailguide library buildbuilds them fromskills/src/intoskills/dist/, one folder per skill; see Skills. - Library-wide files: the manifest,
.trailguide/library.yaml, rule group metadata, shared files inrules/assets/, and the declared license and notice files.
skills/src/, the skills index skills/README.md, config.yaml, lock.json, RULES.md, SKILLS.md, vendor/, and generated/ aren’t published. They’re the library’s own project files, for the sources it takes from and the guidance its own agents read.
Trailguide discovers rule groups only under rules/techs/ and rules/practices/. A rule’s ID is its path in rules/ without .md, such as practices/testing/verify-retry-limits, and a skill’s ID is skills/<name>, wherever its source is.
Within a rule group, Markdown files outside reserved asset directories are rules. The README.md at the rule group’s root and declared license and notice files, which can’t use a rule’s path, are exempt. Rule group READMEs are authoring documentation, not generated rule guidance.
Change notes, which record how rules and skills changed, live in .trailguide/changes/. Projects never take them.
Library releases are Git tags, not files; see Library releases.
Other supporting files, including _README.md, must live in an asset directory.
Rules and rule group metadata must use valid paths; a prefix selector also rejects rules whose rule group metadata is missing.
The builder does not inspect the contents of rule groups a project doesn’t include.
A library in library schema version 2 keeps the same content in .trailguide/ instead.
library.yaml, config.yaml, change notes, and rule group metadata use one YAML document per file. Duplicate keys, anchors, aliases, and explicit tags are rejected. The lockfile and generated data files remain JSON.
The manifest
Section titled “The manifest”.trailguide/library.yaml is the library’s manifest. It makes the repository a library, and holds everything the library publishes about itself: its name, its license, the sources it takes skills from, the level of each skill it has an opinion about, the aliases of curated skills, and its forks:
schemaVersion: 3name: engineeringlicense: spdxExpression: MIT file: LICENSE.md notices: []sources: mattpocock: repository: https://github.com/mattpocock/skills.git ref: main pstack: repository: https://github.com/cursor/plugins.git ref: 699e1e7488c53c05ca13409f40da83cd37682091 path: pstackskills: required: [skills/ship-service] recommended: - skills/build-feature - mattpocock:skills/engineering/to-spec aliases: mattpocock:skills/engineering/to-spec: eng-to-spec forks: skills/show-me-your-work: from: pstack:skills/show-me-your-work basedOn: "699e1e7488c53c05ca13409f40da83cd37682091" reason: We log decisions in our own format.| Field | Meaning |
|---|---|
schemaVersion | Required. The library schema version, 3. |
minTrailguideVersion | Optional. The oldest Trailguide release the library’s authors may use on it, as in a project’s configuration. It isn’t published: projects that use the library ignore it. |
name | Required. The library’s name. |
license | Optional. The library’s license metadata. |
sources | Optional. The repositories the library curates or forks skills from, by name. |
skills.required, skills.recommended | Optional. The skills at each level. |
skills.aliases | Optional. The names projects install curated skills under; see Aliases. |
skills.forks | Optional. The library’s skills that are forks of other repositories’ skills; see Forks. |
skills.overviewPages | Optional. How library check treats skills and stacks without an overview page: required fails check, optional, the default, notes them, and off says nothing. With required, trailguide library add skill writes a starter page. It isn’t published: projects and catalogs ignore it. Releases before 0.14.0 reject it, so trailguide library build raises minTrailguideVersion to 0.14.0 when you set it, and library check fails with stale-build until the minimum is 0.14.0 or newer. |
library.yaml holds only what the library publishes. When the repository also uses rules and skills from other repositories for its own work, as a project, .trailguide/config.yaml holds those settings, as in any project; see Configuration. A library that takes nothing for itself has no config.yaml. trailguide library check fails when config.yaml still has a library section beside library.yaml, since nothing reads it.
Run trailguide library init to make a repository a library; it writes library.yaml with schemaVersion: 3 and the library’s name.
Library name
Section titled “Library name”name is required. The skills index names it as the origin of the skills the library writes, so a visitor can tell them from the skills it forks from other repositories; in library schema version 2, it also names the folder of those skills, .trailguide/skills/<name>/. It follows the source name grammar, such as engineering or fabrica; it can’t be local, which names a project’s own skills, or the name of one of the library’s sources. trailguide library init derives it from the repository’s folder name; pass --name to choose another.
The name is a label only. Projects still name the library by the source name they choose, and a skill’s ID doesn’t include it.
Sources
Section titled “Sources”sources declares, by name, each repository the library takes skills from: a skill it curates, one its own skills use, or one it forks. Each source has a repository, an optional ref, and an optional path:
repositoryfollows the repository address rules.refis the branch, tag, or full commit the library tracks, such asmain. Leave it out only for a repository that publishes library releases: the library then follows its newest library release.pathtakes one folder of the repository as the source, as in a project’s configuration. Skill IDs in the source then start from that folder. Library releases tag a whole repository, so a source with apathneeds a branch, tag, or commit as itsref.
A source’s name follows the source name grammar and can’t be local. The library names a skill from a source as <source>:<skill-id>, such as mattpocock:skills/engineering/to-spec. In the example above, pstack:skills/show-me-your-work is pstack/skills/show-me-your-work in the cursor/plugins repository.
Two sources can’t take the same folder of one repository, or both take the whole repository. One repository can supply several sources, one for each folder, and one for the whole repository too.
Projects need a Trailguide release that reads path before they update to a library release that uses it. An older release ignores the field and reads the whole repository, so it may fail to find the skills, refuse a library that declares one repository more than once, or install a skill with the same ID from the repository root instead.
These sources are for the library’s skills only. Rules aren’t curated, and what the repository takes from a repository for its own use goes in its config.yaml, even when library.yaml declares the same repository.
Schema version
Section titled “Schema version”schemaVersion is required. It names the version of the library schema: everything the library publishes, which this page and Rule and rule group format describe:
library.yaml, apart fromminTrailguideVersion;- rule files and rule group metadata;
- the library layout: where the manifest, rules, skill sources, built skills, and shared assets live.
Release records have their own schemaVersion, which changes independently, and so does a project’s configuration.
This version of Trailguide writes library schema version 3, and reads versions 2 and 3:
- Version
3keeps the manifest in.trailguide/library.yaml, rules inrules/and shared assets inrules/assets/at the repository root, the sources of skills inskills/src/, and the skills the library publishes inskills/dist/, whichtrailguide library buildmakes from them. It adds aliases for curated skills, and infers curated dependencies from what the library’s skills use. A link that starts with/resolves from the repository root. - Version
2keeps the manifest in thelibrarysection of.trailguide/config.yaml, and rules, shared assets, and skills in.trailguide/, each skill in a folder for its origin. A link that starts with/resolves from.trailguide/. Move a library from version2withtrailguide library migrate.
A library in schema version 1 keeps every skill directly in skills/; it fails with unsupported-library-schema until it moves to a version this Trailguide reads. A library without schemaVersion, or with one that isn’t a whole number, fails with a validation error at schemaVersion. A library in another library schema version fails with unsupported-library-schema, which names both versions: upgrade Trailguide to read a newer one. Trailguide doesn’t promise to read every earlier library schema version. It adds support for one when libraries still publish in it.
When a library moves to a new library schema version, the release notes of its next library release say so in a Library schema section, so projects check that their Trailguide supports it before they update; see GitHub Release pages.
What a library’s consumers read
Section titled “What a library’s consumers read”A project that imports a library, and a catalog that lists it, reads only what the library publishes: its library.yaml, without minTrailguideVersion, and never its config.yaml. It validates everything it reads, including each source’s repository and ref. The project’s vendor snapshot keeps only that published manifest, and offline builds read it the same way.
Within a library schema version, consumers ignore fields of library.yaml they don’t know, at any level, so a later Trailguide can add a field without a new library schema version when ignoring it keeps every reader correct, such as a description. A change that consumers must interpret, such as a new skill level that projects must install, needs a new library schema version, even if the new field is optional. trailguide library check is stricter: it fails on any field this version doesn’t know.
The manifest replaces rule-library.yaml, and the Trailguide directory replaces root-level techs/, practices/, skills/, assets/, and changes/ folders. A repository with a rule-library.yaml fails to load with a message that shows the new shape; see Move from version 2. Rule IDs don’t change when a library’s rules move.
Skills
Section titled “Skills”You write a library’s skills in skills/src/, and trailguide library build builds the skills it publishes into skills/dist/<name>/, one flat folder per skill. Commit both: projects install the built skills, and trailguide library check fails until skills/dist/ and skills/README.md are exactly what the sources build. Edit skills/src/, never skills/dist/.
skills/src/ holds three folders:
skills/<name>/holds a standalone skill, such asskills/src/skills/review-tests/. A skill the library forks goes here too;skills.forksinlibrary.yamlrecords where it came from.stacks/<stack>/holds a stack: skills that work together, such as the skills that build with one component library. A stack holds aREADME.mdthat describes it, an optional overview page inoverview.mdwith its images and video inmedia/, its skills inskills/<name>/, and ashared/folder of material only its skills use.shared/holds material any of the library’s skills may use, such as brand tokens.
A stack’s name follows the skill name grammar. Two skills can’t share a name, even in different stacks, because a skill’s ID is skills/<name>. trailguide library check reports a file or folder skills/src/ doesn’t define, such as a typo for skills/ in a stack, and a skill folder without a SKILL.md. Skills don’t belong to rule groups, so a skill folder is never inside rules/, or inside another skill. Curated skills aren’t copied into the library, so they have no folder.
What a built skill holds
Section titled “What a built skill holds”Links decide what a built skill holds. Library build starts from the skill’s folder and follows the links in its Markdown files:
- The skill’s own files ship as they are, keeping their links, except its
README.md, itsoverview.mdandmedia/folder, and the files only theREADME.mdlinks to. - The built
SKILL.mdrecords the skill’s provenance in itsmetadata:trailguide-stackfor a skill in a stack, andtrailguide-forked-fromfor a fork. - A link into the library’s
shared/, or its own stack’sshared/, copies that file or folder to the top of the built skill under its own name, and points the link at the copy. A copied Markdown file’s links to other shared files point at their copies too. - A link to another of the library’s skills points at that skill’s built folder, such as
../fk-review-ui/SKILL.md.
trailguide library check fails when a link would break in the built skill: a link to another stack’s shared/, to a file outside skills/src/, such as a rule, to a stack’s or the skill’s own README.md or overview.md, or into its media/ folder, to a file that doesn’t exist, and a shared copy whose name collides with another file or copy in the skill. Build copies files only; it runs no commands. skills/dist/.gitattributes marks the built skills as generated, so pull request diffs collapse them.
A skill’s version covers its built folder; see What a version covers. For the folder’s contents, the SKILL.md fields, and every check, see Skill format.
A skill can cite rules from any rule group in the library with trailguide-rules-used, and a project that installs it takes those rules too, for reference. Rules can’t link to skills: a skill cites rules by ID.
Skill pages
Section titled “Skill pages”A skill’s README.md is its page for people reading the repository: GitHub shows it when someone opens the skill’s folder, and catalogs such as Skillmart show it in a README tab. It never ships in the built skill, so agents don’t read it. trailguide library check fails when it shows an image without alt text, or a local image outside the skill’s folder, missing, or larger than 2 MB. An image on the web needs only alt text. Check also fails on an HTML <img> tag outside code, which it can’t verify, so write images in Markdown.
A skill or stack can also have an overview page, overview.md, a short page that sells it to someone deciding whether to install it: a tagline, a one-line summary for lists, a pitch, slides or screenshots, and a demo video, kept with its images in media/. Skillmart shows it as the skill’s Overview tab, and the README.md as its README tab. Like the README.md, it never ships. trailguide library check fails when the page’s front matter is invalid or a file it shows is missing, outside media/, in a format catalogs can’t show, or too large, and notes each skill and stack without one, unless skills.overviewPages says otherwise. See Overview page and Write the overview page.
The skills index
Section titled “The skills index”trailguide library build also writes skills/README.md, an index of the library’s skills that GitHub shows when someone opens skills/: a table for each stack, headed by the first heading of its README.md, one for the standalone skills, and one for the curated skills, each with the skill’s level and origin, the library’s name or the source a fork came from.
Skill levels
Section titled “Skill levels”skills.required and skills.recommended set how strongly the library asks its projects to install a skill:
| Level | A project that uses the library installs the skill |
|---|---|
required | Always, whatever it includes. It can’t exclude or fork the skill, but it can give it an alias. |
recommended | When it includes recommended or "*", or names the skill. |
available | When it includes "*", or names the skill. |
Every skill of the library’s own that no level lists is available, so list only the skills you have an opinion about. Each skill can appear in one level. Levels are library-wide settings: changing one needs no change note, and projects see the change, such as recommended -> required, in their update preview after the next library release.
A project sees only the levels of the libraries it names as sources. Levels don’t chain: when your library curates a skill from another library, your projects see the level you set, not the other library’s.
Curated skills
Section titled “Curated skills”A skill from one of the library’s sources reaches projects in one of three ways:
- A level lists it, as
<source>:<skill-id>, such asmattpocock:skills/engineering/to-spec. Projects choose it as they do the library’s own skills at that level. - The library’s own skills use it: a skill names it in its
trailguide-skills-used. It’s a dependency: a project installs it only with a skill that uses it,"*"andrecommendednever include it, and a project that names it inincludefails with a message naming the skills that use it. - A curated skill the library publishes uses it in its own repository. It installs with that skill.
A source’s other skills don’t reach projects. There’s no list of dependencies: they follow from what the skills use, so a dependency no skill uses anymore stops installing with the next library release.
Projects fetch a curated skill’s files from the original repository, not from the library, and record which library required, recommended, or used it. A library release doesn’t lock a source’s ref: each project resolves it when it runs trailguide project update, so moving a curated skill forward needs no new library release, and two projects on the same library release can hold different commits of it. A project overrides the ref by declaring the same repository, and the same path, as its own source. See Curated skills.
trailguide library check reads each source at its ref, and fails when it lacks a skill that a level lists or one of the library’s skills uses, naming the skill that uses it.
Aliases
Section titled “Aliases”A library can publish a curated skill under a name of its own, so every skill it publishes carries its prefix, such as mattpocock:skills/engineering/to-spec published as eng-to-spec. Map the skill’s ID to its alias in skills.aliases:
skills: recommended: [mattpocock:skills/engineering/to-spec] aliases: mattpocock:skills/engineering/to-spec: eng-to-spec mattpocock:skills/engineering/interview: eng-interviewAn alias works for any curated skill the library publishes: one a level lists, like to-spec, and a dependency that no level lists, like interview when one of the library’s skills uses it. Projects install the skill under its alias, record the alias in lock.json, and say in SKILLS.md which library offers it under that name. A project’s own skills.aliases still wins. Only curated skills take an alias, since you name your own skills as you like. trailguide library check fails on an alias for a skill the library doesn’t publish.
An alias changes the installed folder and the name in SKILL.md, not the skill’s text: if its repository’s other skills mention it by its old name, those mentions still use that name. Fork the skill when the text must change too.
A fork is the library’s own skill that started as a copy of another repository’s skill, published in that skill’s place. trailguide library fork skill <source>:<skill-id> copies the skill into skills/src/skills/<name>/ and records it in skills.forks, under the fork’s ID:
skills: forks: skills/show-me-your-work: from: pstack:skills/show-me-your-work basedOn: "699e1e7488c53c05ca13409f40da83cd37682091" reason: We log decisions in our own format.| Field | Meaning |
|---|---|
from | Required. The skill it forks, <source>:<skill-id>, from one of the library’s sources. |
basedOn | Optional. The full commit, in quotes, of the copy the fork was made from. |
reason | Required. Why the library publishes its own version. |
A level can list the fork, but not the skill it forks, since the library publishes the fork in its place. For the same reason, a skill of the library’s own that names the forked skill in trailguide-skills-used must name the fork instead, and trailguide library check fails until it does. When skills.aliases gives the forked skill an alias, trailguide library fork skill names the fork by the alias, so projects keep installing it under that name, and removes the alias. trailguide library check compares the fork with the source’s skill at the source’s ref, and lists what changed upstream since basedOn.
skills.forks is the only place you record where a fork came from. trailguide library build writes it into the fork’s built SKILL.md as trailguide-forked-from, with the source’s repository, the skill’s ID there, and basedOn, so every project that installs the fork, and every catalog that lists it, can name its origin without your writing it again; see Provenance.
Name clashes
Section titled “Name clashes”Agents find skills by name, so trailguide library check fails when two skills the library publishes, its own or curated, have the same name, counting each alias as its skill’s name. Every skill of the library’s own counts, since each is at least available. It reads each source at its ref to find the curated skills’ names. Fix the clash in the library, with an alias or by renaming your skill’s folder, so your projects never have to rename a skill to install both.
Shared assets
Section titled “Shared assets”Files that several rules use, such as a shared diagram, live in rules/assets/. A rule’s own supporting files live beside it instead. Supporting assets covers both locations and the rules for linking to them.
Shared files are library-wide files: they aren’t part of any rule or skill version, need no change note when they change, and reach projects with the next library release, when each project runs trailguide project update. See What a version covers.
License metadata
Section titled “License metadata”The optional license object declares the library-wide terms. Authors should use a LICENSE.md and optional NOTICE.md at the repository root; the manifest can identify other source locations:
| Field | Meaning |
|---|---|
license.spdxExpression | Declared SPDX expression, such as MIT or MIT OR Apache-2.0, or a LicenseRef-… for custom terms. |
license.file | Path to the actual license text, relative to the repository root. |
license.notices | Paths to accompanying notices, relative to the repository root; use an empty array when none apply. |
When license is present, all three fields are required and all declared files must exist within the repository.
Declared license and notice files are library-wide files, so they can’t be part of a rule’s or skill’s version: a declared path can’t be a rule’s Markdown file, lie in a rule’s asset directory, such as rules/practices/testing/assets/verify-retry-limits/LICENSE, or lie in a skill folder, such as skills/src/skills/build-feature/LICENSE. Otherwise a later library release could replace a file that a project’s pinned rule version covers. trailguide library check rejects such a declaration, and projects refuse to take a library release whose manifest has one.
A project’s vendor snapshot of the library stores a declared file from outside the library’s content folders at its path from the repository root, beside the library’s own files, so that path can’t start with a name the snapshot uses for those files, or that Trailguide 0.5 used for its records, in any letter case: _source.json, config.yaml, library.yaml, _repository/, assets/, curated/, changes/, rules/, or skills/. The snapshot of a library in schema version 2 keeps the files skills link to from outside .trailguide/ under _repository/.
Unknown fields in the license declaration are rejected so misspellings cannot silently discard intended metadata.
Trailguide retains the declared files from the resolved source commit and links generated rules to unchanged copies. Offline builds require those files in the stored snapshot.
If the declaration is absent, generated rules show no declared license. Trailguide never infers an identifier from a filename. It validates supplied SPDX expressions and identifiers using its bundled license list, while allowing LicenseRef- identifiers for custom terms. This validates the declaration format, not ownership, permissions, or agreement between the declaration and the retained text.
Every source a project uses has a generated libraries/<source-name>/README.md with its declared SPDX expression, when supplied, and links to the retained terms. Sources without a license declaration omit the licenses/ directory. The project’s lockfile records the source’s revision and rule versions, and trailguide project list rules shows them with how the project uses each rule; see Provenance.
The manifest paths select source files, not output locations. For declared terms, Trailguide uses these fixed destinations:
generated/libraries/<source-name>/licenses/LICENSE.mdgenerated/libraries/<source-name>/licenses/notices/001.mdgenerated/libraries/<source-name>/licenses/notices/002.md<source-name> is the name the project gave the source. Unique notice files are numbered in declaration order; repeated paths and a notice path identical to the license path are copied only once. No notice files are generated when none are declared. Contents, including whitespace and line endings, are preserved. Output paths are not configurable. Vendor snapshots retain the original names for traceability. Declared terms are retained even when exclusions or replacements leave no active rules from that library.
One library-wide license declaration covers every rule group, rule, and skill the library authors. A license or licenses field on a rule or rule group is rejected. A skill’s SKILL.md can carry the Agent Skills license field, but it’s informational: trailguide library check warns when it differs from the library’s SPDX expression; see Skill format. A curated skill keeps its own repository’s terms, which Trailguide finds as it does for any non-library source.
Keep original attribution with each rule and include required notices in the manifest. Material requiring a different declaration belongs in a separate library.
See License rules for publisher guidance and the boundary with the consuming project’s license.
Libraries in library schema version 2
Section titled “Libraries in library schema version 2”A library in schema version 2 keeps its manifest in the library section of .trailguide/config.yaml, beside the settings it uses as a project. Its curated and forked sources are ordinary entries of that file’s sources, each fork recorded in its source’s skills.forks with the fork’s ID in as. Its levels include offered, the level version 3 calls available, and it lists its dependencies in library.skills.dependencies; it has no aliases. It keeps its rules in .trailguide/rules/, its shared assets in .trailguide/assets/, and each skill in .trailguide/skills/<origin>/<name>/, where the origin is library.name for its own skills and a source’s name for the skills it forks. This version still reads and checks it, and projects still import it, but a later version will stop.
Move it to version 3 with trailguide library migrate, which moves:
| Schema version 2 | Schema version 3 |
|---|---|
The library section of .trailguide/config.yaml | .trailguide/library.yaml |
The repository and ref of each source the library curates or forks from | sources in library.yaml, which can also take a path |
skills.forks of a source, with as | skills.forks in library.yaml, under the fork’s ID, with from |
library.skills.offered, library.skills.dependencies | Nothing: own skills no level lists are available, and dependencies follow from trailguide-skills-used |
.trailguide/rules/techs/, .trailguide/rules/practices/ | rules/techs/, rules/practices/ |
.trailguide/assets/ | rules/assets/ |
.trailguide/skills/<origin>/<name>/ | skills/src/skills/<name>/, built to skills/dist/<name>/ |
Run trailguide library migrate --dry-run first to see the moves. Migrate rewrites the links the moved files make to each other, such as a rule’s link to a shared asset, which needs one fewer ../, and one that starts with /assets/, which becomes /rules/assets/. It removes from config.yaml the library section and each source it moved that the repository selects nothing else from, and removes config.yaml when nothing a project reads is left in it. A source the repository still selects skills from keeps them, and each skill the library forked from it is excluded there instead, with the fork’s reason, so the repository still doesn’t install it. It removes the files outside any rule group or skill, such as the old folders’ guides, and builds the skills. library.yaml gets the running release as minTrailguideVersion, since an older Trailguide can’t read it, and a check workflow that an earlier Trailguide wrote is changed to read the field from library.yaml; migrate warns about a workflow that pins a release instead.
Migrate lists what changes, for you to review: a curated skill the library only offered, which reaches projects in version 3 only when a level lists it or one of the library’s skills uses it, so list it in skills.recommended to keep offering it, and give it back any alias it had, which migrate drops with it; an own skill the library listed as a dependency, which becomes available; a forked skill that config.yaml now excludes; and each curated skill the library requires, which version 2 also installed in the library repository, but which a project’s configuration no longer gets from the manifest, so include it from its source in config.yaml to keep it. It also lists each skill link that leaves the skill’s folder for something library build can’t copy, such as a rule or a file elsewhere in the repository: move what it points to into skills/src/shared/, or link to a web address instead, then run trailguide library build. Migrate refuses, 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. Run it again to finish a migration that stopped after it wrote library.yaml: it removes the old folders only when what they hold is what it moved, and otherwise fails with migrate-conflict, naming the file that differs, and removes nothing.
Afterward, update the root README.md if it describes the old folders. Rule and skill IDs don’t change. A rule whose links changed needs a patch change note, trailguide library change RULE_ID --bump patch, once the library has a library release, as any changed rule does; a skill whose built folder is byte for byte its old folder keeps its version without one. Projects need a Trailguide that reads library schema version 3 before they update to the library’s first release in it, so say so in that release’s notes; see Schema version. trailguide library check fails on a library in version 3 that still has content in .trailguide/rules/, .trailguide/assets/, or .trailguide/skills/, which version 3 doesn’t read.
Libraries in the earlier layout
Section titled “Libraries in the earlier layout”Earlier versions of Trailguide read a library’s manifest from rule-library.yaml, and its groups, shared assets, and change notes from techs/, practices/, assets/, and changes/ at the repository root. This version doesn’t read that layout and doesn’t move it. Every library command fails, writing nothing, while rule-library.yaml, techs, or practices exists at the repository root, with a message that shows where each file moves:
| Earlier layout | This layout |
|---|---|
rule-library.yaml | The library section of .trailguide/config.yaml |
techs/<group>/, practices/<group>/ | .trailguide/rules/techs/<group>/, .trailguide/rules/practices/<group>/ |
assets/ | .trailguide/assets/ |
changes/ | .trailguide/changes/ |
Move the files with git mv into the schema version 2 layout above, then delete rule-library.yaml and write its license fields, without its formatVersion, in the library section of .trailguide/config.yaml, after schemaVersion: 2 and the library’s name, beside the sources the repository uses as a project, if any, and run trailguide library migrate to move it on to version 3. License and notice paths stay relative to the repository root, so they don’t change.
Rule IDs and versions don’t change. A moved rule sits two folders deeper, so its relative links to shared assets need one more ../, such as ../../../assets/retry-lifecycle.svg, and its links to license files at the repository root need two more. Links that start with /assets/ still work, because a link that starts with / resolves from .trailguide/. Once the library has a library release, record each rule whose links changed with trailguide library change RULE_ID --bump patch, then run trailguide library check. A rule whose bytes didn’t change needs no note, and moving the manifest isn’t a library-wide change unless its license fields changed.
Projects can’t import a library release in the earlier layout; sync and update fail with unsupported-library-layout until the library publishes a library release from the new layout and the project selects it. Rule versions that a library release in the earlier layout published still import when a later library release keeps them, unless one of their links resolves to another file in the new layout. A project that imported the library before it moved keeps a vendor/<source-name>/rule-library.yaml, which this version can’t read either: once the library has published a library release from the new layout, delete .trailguide/vendor/<source-name>/ and run trailguide project sync.
Read libraries from other tools
Section titled “Read libraries from other tools”Tools written in Go, such as a catalog of libraries, can read library release tags, release records, the library’s manifest, rule files, rule group metadata, and the canonical rule group list, and place each library file in its repository, with the github.com/fabricahq/trailguide/trailguide package, whose Go documentation describes its API. Trailguide reads libraries through the same package, so both read them the same way. The package only parses text the tool has already read, such as with a Git library; it has no Git, filesystem, or network access. ParseLibraryFile reads a library’s .trailguide/library.yaml, and ParseLibraryManifest the library section of a library in schema version 2, with the repository and ref of each source its skills curate from, not the settings that configure the repository as a project. Library.RepositoryPath places each library file in the layout the library’s schema version declares.
The github.com/fabricahq/trailguide/trailguide/skillcatalog package reads what a catalog shows for each skill a library of schema version 3 publishes: where its built and source folders are, its README.md and the images it shows, its overview page and the stack’s, with the files they show, where a forked skill came from, the commands that install it, and the files of a copy people can install by hand, with the rules it cites. Both packages follow Trailguide’s version, and their API may change before Trailguide 1.0.0.
Related guides
Section titled “Related guides”- Create your first library walks through organizing and sharing a library.
- Write a skill walks through adding a skill to a library and setting its level.
- Version your rules explains change notes and publishing library releases.
- License rules explains how to choose and declare terms.
- Configuration explains how a project includes rules and skills from its sources.