Skip to content

Fork a skill

A skill you install from a library or another repository rarely fits your project exactly. Your team may fix bugs behind a feature flag, review migrations differently, or skip a step that doesn’t apply to you. You can’t just edit the installed copy in .claude/skills/: the next sync replaces it, and trailguide project check reports the difference.

Forking a skill gives your project its own copy to edit. Agents get your fork instead of the source’s skill. The source keeps improving the original, though, and you probably want those improvements without losing your edits. Trailguide records which copy your fork started from, its basedOn commit, so each update can show what the source changed since then and merge those changes into your fork.

In this guide, you’ll fork a skill, edit it, and bring in the source’s later changes, including changes that conflict with your edits. Start with a project that already installs the skill; see Install skills.

Fork skills/fix-bug from the fabrica source, and say why:

Terminal window
trailguide project fork skill fabrica:skills/fix-bug \
--reason 'We fix bugs behind a feature flag first.' \
--non-interactive

The command copies the skill your project installs into .trailguide/skills/fix-bug/, beside your own skills, and records the fork in .trailguide/config.yaml:

skills:
forks:
skills/fix-bug:
from: fabrica:skills/fix-bug
basedOn: "9f2c4e1a7b3d5f60817a2b4c6d8e0f1a3b5c7d9e"
reason: We fix bugs behind a feature flag first.
  • The key is your skill, skills/<name>, which agents get in place of the source’s skill. Its folder is .trailguide/skills/<name>/, beside your own skills; this entry records that it’s a fork and where it came from, and SKILLS.md lists it with its source.
  • from is the source’s skill your fork replaces.
  • basedOn is the commit the fork copied. It’s how Trailguide tells your edits apart from the source’s later changes.
  • reason tells the next person why your project doesn’t use the source’s skill as it is.

A fork doesn’t need a skills.include entry: forking the skill is enough to keep tracking it. You can’t fork a required skill, which your organization or library expects every project to use as it is. The source’s license still applies to the copied files; see License rules.

The fork rewrites the skill’s citations of other skills and rules to project IDs, such as fabrica:practices/testing/verify-retry-limits. When it can’t, because the skill’s frontmatter is written in a way Trailguide can’t edit, the fork is left as a draft, and the command lists what to fix. See Fork a skill for every step.

Edit .trailguide/skills/fix-bug/SKILL.md and any other files in its folder, then install the result:

Terminal window
trailguide project build

Build installs your fork into each skill target, such as .claude/skills/fix-bug/, where the source’s skill used to be. If the fork is a draft, build refuses it until you fix what the fork command listed and remove the <!-- trailguide:draft --> line. Commit the fork and config.yaml together.

When you update the source, the preview lists your fork as replaced if the source changed the skill since basedOn:

Terminal window
trailguide project update fabrica
fabrica
replaced skills/fix-bug commit 9f2c4e1a7b3d -> 4b8e0c2d6f1a
Your skill: skills/fix-bug, based on commit 9f2c4e1a7b3d.
Changed since commit 9f2c4e1a7b3d, the copy your skill is based on:
SKILL.md
scripts/reproduce.sh
Merging them into your skill finds no text conflicts with your edits. To merge
them and set basedOn to commit 4b8e0c2d6f1a, pass --merge-fork fabrica:skills/fix-bug.

The update never changes your fork unless you ask. If you confirm the rest of the update without merging, your fork stays as it is, and later previews keep listing the source’s changes until you take them in.

To merge, answer yes when a terminal update asks whether to merge the changes into your skill, or pass --merge-fork in a script:

Terminal window
trailguide project update fabrica --yes --merge-fork fabrica:skills/fix-bug

Trailguide compares three copies of each file: the source’s copy at basedOn, your fork, and the source’s newer copy. A file only you changed keeps your version. A file only the source changed takes the source’s version. A file you both changed is merged line by line, the way Git merges a branch. The merged fork, the new basedOn, and the installed copies are written together, so an interrupted update leaves either all of them old or all of them new.

“No text conflicts” means your edits and the source’s changes touch different lines. It doesn’t mean they agree. If you wrote “skip the regression test for UI bugs” and the source added “always add a regression test” ten lines away, both survive the merge and contradict each other. Read the merged SKILL.md, and check the diff before you commit it.

When you and the source changed the same lines, Trailguide can’t decide which version you want, so it doesn’t merge. The preview lists the files that conflict:

fabrica
replaced skills/fix-bug commit 9f2c4e1a7b3d -> 4b8e0c2d6f1a
Your skill: skills/fix-bug, based on commit 9f2c4e1a7b3d.
Changed since commit 9f2c4e1a7b3d, the copy your skill is based on:
SKILL.md
Your edits and these changes touch the same lines of:
SKILL.md
Merge them into your skill by hand, then set skills.forks.skills/fix-bug.basedOn
to "4b8e0c2d6f1a3e5c7b9d0f2a4c6e8b0d2f4a6c8e".

--merge-fork refuses such a skill and writes nothing. To bring the changes in yourself:

  1. Compare the source’s copy with yours. The source’s copy at the new commit is in .trailguide/vendor/fabrica/ after you apply the rest of the update, or in the source’s repository at that commit.
  2. Edit your fork to take the changes you want.
  3. Set basedOn to the commit the preview names, so later updates list only newer changes.
  4. Run trailguide project build.

If the source stops publishing the skill, your fork keeps working: sync and build install it as before, and the update preview says the source no longer has the skill. There’s nothing left to merge, so the fork is entirely yours from then on.

Rules can be forked too, but their updates work differently, and the flags keep the two apart:

Skill forkRule fork
Flag--merge-fork SOURCE:SKILL--update-fork SOURCE:RULE
Your editsKept. The source’s changes are merged in.Discarded. Your rule becomes a fresh fork of the newest version.
basedOnThe commit merged.The version forked.

--update-fork refuses a forked skill and --merge-fork refuses a rule, each naming the other flag, so you don’t discard edits by reaching for the wrong one. See Rules you replaced with your own.

A library can fork a skill from one of its own sources, such as a third party’s skill it publishes with changes, with trailguide library fork skill. The fork goes in skills/src/skills/<name>/, beside the library’s own skills, and the library’s skills index names the source it came from. When you move that source’s ref, trailguide library check lists what the source changed since basedOn. A library merges those changes by hand, runs trailguide library build, then sets basedOn; trailguide project update --merge-fork doesn’t merge into a library’s fork. See Write a skill.

Fabrica TrailguideMIT licensedPrivacy

Built with Fabrica.