Skip to content

fix(#711): make .claude/.local skill overrides functional via runtime overlay - #716

Merged
admarble merged 10 commits into
mainfrom
feature/711-bug-customization-claude-local-skills-and-likely-h
Jun 4, 2026
Merged

admarble merged 10 commits into
mainfrom
feature/711-bug-customization-claude-local-skills-and-likely-h

Conversation

@admarble

@admarble admarble commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

docs/guides/customization.md promised that .claude/.local/skills/<name>/SKILL.md "takes precedence" — but Claude Code's skill discovery only scans user (~/.claude/skills/), project (.claude/skills/), and plugin scopes, never .local/skills/. The copy silently did nothing (same for .local/hooks/). This makes the headline customization use case (fork a skill, survive updates) functional via a runtime overlay, and corrects every documented override path so none is a dead promise.

  • Runtime overlay (AC-1): every managed SKILL.md across all 3 mirror dirs (.claude/skills, templates/skills, skills) now ends with a stable <!-- sequant:local-override --> directive telling the skill to honor .claude/.local/skills/<name>/overrides.md as authoritative. Users write small deltas, not a full fork — and overrides.md lives under .local/, which update/sync never write into.
  • Hooks (AC-2): no .local/hooks/ auto-discovery exists; hooks fire only from explicit settings.json command paths. Docs corrected to the real, update-safe mechanism: register the script in .claude/settings.local.json (Claude Code merges it; gitignored).
  • Net-new skills (AC-3): documented to live in project/user .claude/skills/ (scopes discovery actually scans). update/sync only touch package-managed paths and never delete unmanaged dirs — added a regression test proving a custom .claude/skills/foo/ is left intact.
  • Docs (AC-4): rewrote customization.md (+ fixed the same broken pattern in troubleshooting.md); added a manual invocation-verification recipe.

AC verification

AC Description Status Evidence
AC-1 .local/skills/<name> override takes effect ✅ Overlay directive in all 53 SKILL.md; presence asserted by local-override-directive.integration.test.ts; verified end-to-end (an overrides.md marker won at a live invocation)
AC-2 Hooks resolution verified + corrected ✅ Confirmed .local/hooks/ not auto-discovered; customization.md now documents settings.local.json registration
AC-3 Net-new skill home + update/sync never clobber unmanaged dirs ✅ Documented project/user .claude/skills/; unmanaged-skill-safety.integration.test.ts asserts update + sync --force leave .claude/skills/foo/ untouched
AC-4 No non-functional override instruction in docs ✅ Both docs rewritten; overlay verified by actual invocation, not file placement

Design note: the templates.ts .local/ parallel-file protection (shipped in #708) is kept intact — it correctly guards in-place edits (constitution). Under the new mechanism users write overrides.md (auto-skipped under .local/) and leave the managed SKILL.md unchanged, so that branch is inert for skills, not dead. Added a clarifying comment rather than gutting freshly-shipped #708 logic.

Test plan

  • npm run build — clean
  • npm run lint — clean
  • New tests pass: directive presence (×53) + unmanaged-dir safety (update & sync)
  • Existing templates/update/sync/behavior-rule-sync tests still green
  • lint:skill-calls clean (no new Skill() calls)
  • End-to-end: a skill body with the directive read overrides.md and honored it over its default
  • Reviewer: invoke a real skill (e.g. /spec) with a marker overrides.md present and confirm the marker appears

Coordination

Closes #711

… overlay

The documented `.claude/.local/skills/<name>/SKILL.md` override layer never
loaded — Claude Code's skill discovery only scans user/project/plugin scopes,
not `.local/skills/`. Ship a runtime overlay instead: every managed SKILL.md
(all 3 mirror dirs) now ends with a directive to honor
`.claude/.local/skills/<name>/overrides.md` as authoritative at invocation.

- AC-1/AC-4: overlay directive appended to all 53 SKILL.md; presence asserted by
  a new integration test; verified end-to-end (an overrides.md actually wins at
  invocation). Docs document a manual invocation-verification recipe.
- AC-2: hooks have no `.local/hooks/` auto-discovery; customization.md corrected
  to the real `.claude/settings.local.json` registration mechanism.
- AC-3: net-new skills documented to project/user `.claude/skills/`; update/sync
  only touch package-managed paths and never delete unmanaged dirs — regression
  test added.
- Reconcile templates.ts: clarify the `.local/` parallel-file protection guards
  in-place edits (constitution), not skill loading.
- Rewrite customization.md + troubleshooting.md so no documented override path
  is non-functional.

Entire-Checkpoint: 68263a11e03a
admarble added 9 commits June 3, 2026 23:05
… overlay

The documented `.claude/.local/skills/<name>/SKILL.md` override layer never
loaded — Claude Code's skill discovery only scans user/project/plugin scopes,
not `.local/skills/`. Ship a runtime overlay instead: every managed SKILL.md
(all 3 mirror dirs) now ends with a directive to honor
`.claude/.local/skills/<name>/overrides.md` as authoritative at invocation.

- AC-1/AC-4: overlay directive appended to all 53 SKILL.md; presence asserted by
  a new integration test; verified end-to-end (an overrides.md actually wins at
  invocation). Docs document a manual invocation-verification recipe.
- AC-2: hooks have no `.local/hooks/` auto-discovery; customization.md corrected
  to the real `.claude/settings.local.json` registration mechanism.
- AC-3: net-new skills documented to project/user `.claude/skills/`; update/sync
  only touch package-managed paths and never delete unmanaged dirs — regression
  test added.
- Reconcile templates.ts: clarify the `.local/` parallel-file protection guards
  in-place edits (constitution), not skill loading.
- Rewrite customization.md + troubleshooting.md so no documented override path
  is non-functional.

Entire-Checkpoint: 68263a11e03a
The overlay directive was appended at end-of-file, where it is unreliable to
fire in long skills — it landed at line 3136 of the 3138-line /qa skill and
1938 of /exec. An LLM deep in a 3000-line skill is unlikely to act on a
"check the filesystem for an override file first" instruction buried at the
very end.

Move the directive to the top of the body (right after the frontmatter,
before the first heading) in all 53 SKILL.md across the three mirror dirs, so
it is the first thing the executing agent reads. Verified end-to-end on the
worst case: a subagent running the full 3135-line /qa skill read
.claude/.local/skills/qa/overrides.md and honored a legitimate override delta.

Also:
- Strengthen local-override-directive.integration.test.ts to pin the directive
  BEFORE the first `#` heading (guards against regressing to end-of-file).
- Add local-hooks-not-autodiscovered.integration.test.ts: code-backs the docs'
  AC-2 claim that sequant never executes hooks from .claude/.local/hooks/.
- Add docs/examples/overrides.example.md as a copyable starting point, linked
  from the customization guide.
- Update prose in templates.ts, customization.md, troubleshooting.md, and the
  CHANGELOG from "ends with"/"at the end" to the top-of-file placement.

Entire-Checkpoint: d3e0b84b08b0
origin/feature/711-bug-customization-claude-local-skills-and-likely-h (b48c31d) is the pre-#707-rebase version of this work; it is fully
superseded by a32d876 (same change rebased onto #707) plus fd18c0e (top-directive
fix). Keep our tree (-s ours); record origin's commit as a parent so the push is
a fast-forward (force-push is hook-blocked).
local-hooks-not-autodiscovered is a pure static fs grep of src/ (no subprocess,
no chdir, no network) — a unit test, not an integration test. Filing it as
`*.integration.test.ts` put it in the `fileParallelism: false` integration
project, whose files share one forked process and run in glob order. Adding a
file there shifted that order and surfaced a latent isolation flake in the
chdir-based unmanaged-skill-safety test (CI build went red; locally the
order-sensitive tautology-detector-cli test flaked instead).

Rename to `*.test.ts` so it runs in the parallel unit project. This restores the
integration file-set to the green shape and removes the perturbation. Full suite
now passes twice in a row locally (173 files, 3636 tests), including both the
unmanaged-skill and tautology tests.
Root cause (proven via CI diagnostics): the non-force `updateCommand({})` path
is gated by an `inquirer.prompt` confirm. In the shared, sequential integration
worker the inquirer mock is not reliably active inside updateCommand, so in CI
the prompt resolved falsy and update aborted *before* applying — leaving the
managed spec at v1 and failing the sanity assertion. (cwd, SEQUANT_TEMPLATES_DIR,
template-on-disk, classify="modified", and fs.writeFile were all verified correct
in CI; only the prompt gate diverged. The `sync --force` sibling test, which
skips the prompt, always passed.)

Switch the update test to `updateCommand({ force: true })`: it bypasses the
prompt and is the STRICTER AC-3 assertion — even maximal-overwrite mode must
leave the unmanaged `foo` dir alone, since `foo` is not a template file and is
never in the change set. Removes the temporary diagnostics from the prior
commits.
…mization-claude-local-skills-and-likely-h

# Conflicts:
#	CHANGELOG.md
@admarble
admarble merged commit 512840f into main Jun 4, 2026
7 checks passed
@admarble
admarble deleted the feature/711-bug-customization-claude-local-skills-and-likely-h branch June 4, 2026 13:47
admarble added a commit that referenced this pull request Jun 4, 2026
#721)

PR #716 (512840f) committed package-lock.json with 9 unresolved
`git stash` conflict blocks (27 marker lines), leaving the lockfile
as invalid JSON. `npm ci` from a fresh clone fails. npm consumers were
unaffected (the lockfile isn't published) and `npm install`/tsc/vitest
tolerate the existing node_modules, so nothing flagged it — only a
strict `npm ci` parse does.

Regenerated via `npm install --package-lock-only`, which recomputes the
dependency tree and drops the spurious `"dev": true` flags on
production-reachable transitive deps (cross-spawn, debug, fast-deep-equal,
isexe, ms, path-key, shebang-command, +2).

Verified: 0 conflict markers, valid JSON, `npm ci --dry-run` parses clean.
Entire-Checkpoint: e6beafa2df2c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(customization): .claude/.local/skills (and likely hooks) never load — documented override layer is non-functional

1 participant