overlay-init
Skill3 starsChanged 9 days agoMITView on GitHub
Scaffold a new dotfiles-core overlay or extend an existing one. Use when the user types /overlay-init, asks to 'create an overlay', 'scaffold an overlay', 'set up a new overlay', 'add an overlay skill', 'configure my overlay', or 'add an overlay fragment'. Bare invocation scaffolds; add-skill / add-fragment / add-context configure.
In this repository36 other files it gives its agents.
- agent-statsSkill
- aristotle-deconstructorSkill
- babysit-prsSkill
- briefingSkill
- code-auditorSkill
- core-editSkill
- create-jira-ticketSkill
- create-tech-specSkill
- cyrus-tdd-engineerSkill
- doctorSkill
- dotfiles-syncSkill
- forgeSkill
- google-docsSkill
- google-driveSkill
- grill-meSkill
- handoffSkill
- lessons-reviewSkill
- mermaid-diagramsSkill
- metrics-emitSkill
- obligationsSkill
- optimus-plannerSkill
- performance-reviewSkill
- pr-create-from-commitsSkill
- ranger-reviewerSkill
- record-demoSkill
- review-contextSkill
- review-respondSkill
- scout-reviewerSkill
- self-evaluateSkill
- smart-compactSkill
- smart-statuslineSkill
- swarm-retroSkill
- team-leadSkill
- ticket-pickupSkill
- ticket-swarmSkill
- to-prdSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 8 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
If args begin with add-skill, add-fragment, or add-context → configure mode (requires an existing overlay.
- Distinctive: line 20
All other invocations → scaffold mode.
- Distinctive: line 32
If both conditions pass → running inside an overlay.
- Very specific: line 73
Reasoning layer added by this skill (not the engine): if --check exits non-zero, explain to the user the two most likely causes:
- Distinctive: line 85
Do NOT auto-fix beyond what the engine did.
- Distinctive: line 95
Create the skill stub in the overlay's own skill directory:
- Very specific: line 101
Write .claude/skills/<name>/SKILL.md with minimal correct frontmatter:
- Distinctive: line 131
Create the fragment directory:
- Very specific: line 165
If the manifest-append logic grows beyond a few lines, extract it into a focused helper in scripts/ and add bats coverage for that helper.
- Very specific: line 189
Known section:
## Repo registry: If <Section> is Repo registry, the section has a canonical machine-parsed format — it is the … - Distinctive: line 215
If absent, report the failure and stop.
- Very specific: line 232
Check whether any core SKILL.md contains a well-formed consult-instruction for this section.
- Distinctive: line 273
Do NOT auto-edit core. Do NOT auto-commit.
- Very specific: line 277
If scripts/lint-consult-blocks.sh exists in the overlay, offer to run it:
- Distinctive: line 284
If the script is absent, skip this offer silently.
- Very specific: line 292
Configure routes refuse outside an overlay: All three configure subcommands (add-skill, add-fragment, add-context) require overlay context …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
overlay-init — Overlay Scaffold & Configuration Skill
Scaffold a new dotfiles-core overlay from scratch, or extend an existing one by adding skills, skill-fragments, or overlay-context sections.
Step 1 — Parse subcommand and detect context
Determine mode from the arguments passed:
- If args begin with
add-skill,add-fragment, oradd-context→ configure mode (requires an existing overlay; refuses otherwise — see gate rules). - All other invocations → scaffold mode.
Overlay context detection (same check as /core-edit):
git rev-parse --show-toplevelConfirm two conditions:
- The toplevel has
.gitmodulesreferencingdotfiles-core. .claude/dotfiles-core/.gitexists (submodule initialized).
If both conditions pass → running inside an overlay. If either fails → not in an overlay.
Configure mode with no overlay context: refuse immediately:
ERROR: This subcommand requires an overlay context.
Current directory does not appear to be inside an overlay repo.
Hint: cd to your dotfiles overlay directory and re-run, or use bare
/overlay-init to scaffold a new overlay.Step 2 — Scaffold route (bare invocation)
Prompt for the two required values if not already supplied as arguments:
- Target directory — where to scaffold the overlay (default:
~/dotfiles) - Overlay name — human-readable name used in README and commit messages (default: basename of the target directory)
Optional flags passed through to the engine:
--force— overwrite a non-empty target dir instead of refusing--core-url <url>— explicit submodule URL (required when core'soriginis a local path)
Locate the core engine. The engine lives at:
CORE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
ENGINE="$CORE_DIR/scripts/new-overlay.sh"Invoke the engine:
bash "$ENGINE" "<target>" "<overlay-name>" [--force] [--core-url <url>]Surface the engine's output verbatim — this includes the next-step command block
and the --check result printed by the engine.
Reasoning layer added by this skill (not the engine): if --check exits non-zero,
explain to the user the two most likely causes:
- The submodule was not cloned with
--recurse-submodules, so.claude/dotfiles-core/is an empty dir without a valid HEAD. Remedy:git submodule update --init --recursiveinside the new overlay dir. - The install state that
--checkvalidates is the current~/.claudeinstall, not the freshly-scaffolded dir in isolation. A failure here means the existing dotfiles install has a broken symlink or missing tool — not that the scaffold itself is broken. Remedy: runbash <target>/install.shonce the overlay is fully set up (after commit + push).
Do NOT auto-fix beyond what the engine did. Surface the failure and stop.
Step 3 — add-skill route (overlay-local)
Usage: /overlay-init add-skill <name>
Refuse if not in an overlay (Step 1 gate).
Create the skill stub in the overlay's own skill directory:
mkdir -p ".claude/skills/<name>"Write .claude/skills/<name>/SKILL.md with minimal correct frontmatter:
---
name: <name>
description: "<name> — describe what this skill does and when to invoke it."
user-invocable: true
---
# <name>
TODO: Document this skill.Confirm to the user:
Created overlay skill: .claude/skills/<name>/SKILL.md
Next: edit the description and body, then run install.sh to symlink it.This is purely overlay-local. No core files are touched.
Step 4 — add-fragment route (overlay-local)
Usage: /overlay-init add-fragment <core-skill>
Refuse if not in an overlay (Step 1 gate).
Create the fragment directory:
mkdir -p ".claude/skill-fragments/<core-skill>"Append a complete, valid entry to .claude/overlay-fragments.yaml. The entry
must match the exact schema that apply_manifest parses (name / target / source):
- name: <core-skill>-overlay-ext
target: ~/.claude/skills/<core-skill>/SKILL.md
source: .claude/skill-fragments/<core-skill>/ext.mdA half-entry must never be written. If the manifest does not yet exist, create it with the empty manifest header first:
fragments: []Then append the entry. If it does exist, append after the last entry.
Confirm to the user:
Created fragment dir: .claude/skill-fragments/<core-skill>/
Appended entry to: .claude/overlay-fragments.yaml
name: <core-skill>-overlay-ext
target: ~/.claude/skills/<core-skill>/SKILL.md
source: .claude/skill-fragments/<core-skill>/ext.md
Next: write the fragment content to ext.md, then run install-overlay.sh.If the manifest-append logic grows beyond a few lines, extract it into a
focused helper in scripts/ and add bats coverage for that helper.
Step 5 — add-context route (THE CENTERPIECE — bilateral contract)
Usage: /overlay-init add-context <Section>
This is the fully decidable bilateral contract operation. <Section> is the
exact heading name (e.g., Jenkins MCP clone URL).
Refuse if not in an overlay (Step 1 gate).
5a — Write the overlay half
Append a stub section to the overlay's overlay-context.md:
## <Section>
TODO: Fill in your overlay-specific context for this section.Known section: ## Repo registry. If <Section> is Repo registry, the
section has a canonical machine-parsed format — it is the name→checkout oracle
read by .claude/skills/ticket-pickup/scripts/repo-registry.sh — so write real
entries in this shape instead of the TODO stub:
## Repo registry
- mc-omni-agent-ui: /Users/me/Development/mc-omni-agent-ui | components=Omni UI,Editor | prefixes=web/js/,src/ | depends_on=omni-agent
- omni-agent: /Users/me/Development/omni-agentGrammar: entries are - <name>: <absolute-path> optionally followed by
pipe-separated key=value fields (components, prefixes, depends_on;
comma-split lists). Unknown keys are ignored with a stderr warning. Paths
must be absolute. Duplicate names resolve first-wins with a stderr warning
naming the ignored later entry — keep names unique.
5b — Verify the overlay half is present
Confirm the section heading now exists:
grep -Fxq "## <Section>" .claude/overlay-context.mdIf absent, report the failure and stop.
5c — Check for the core-side gap
The bilateral contract requires two artifacts on the core side. Check them using the same method the linters use:
Artifact 1 — vocabulary entry:
grep -Fxq "## <Section>" <core>/scripts/consult-vocabulary.txtReports: PRESENT or MISSING.
Artifact 2 — core SKILL.md consult-instruction:
Check whether any core SKILL.md contains a well-formed consult-instruction for this section. The well-formed grammar is defined in PROTOCOL.md §Grammar. The section name is the only variable component; the file path is fixed.
# The grammar requires the full form — section name AND the fixed trailing
# path. See scripts/check-consult-grammar.sh ~line 52 for the authoritative
# regex. Matching section name alone gives a false "PRESENT" when the
# trailing path is absent (make check-consult-grammar would still reject it).
SUFFIX='in `~/.claude/overlay-context.md`'
grep -rlE "consult \`## <Section>\` $SUFFIX" <core>/.claude/skills/*/SKILL.md 2>/dev/nullReports: which core skill file contains it, or MISSING.
5d — Route core-side changes to /core-edit
Print the following TODO block verbatim, substituting <Section> with the
actual section name and <core> with the resolved core path:
add-context: wrote overlay half
## <Section> -> .claude/overlay-context.md [DONE]
CORE SIDE REQUIRED — use /core-edit to land both of these:
1. Add this line to <core>/scripts/consult-vocabulary.txt:
## <Section>
2. Add a consult-instruction to the relevant core SKILL.md.
The exact grammar is defined in PROTOCOL.md §Grammar:
consult `## <Section>` in
`~/.claude/overlay-context.md`
(That two-line representation is for readability; the actual
consult-instruction must appear on a single line in the core SKILL.md.)
Until both artifacts are present in core, `make check-consult-grammar`
(core) and the overlay's scripts/lint-consult-blocks.sh will report
## <Section> as an orphan.Do NOT auto-edit core. Do NOT auto-commit. Route only.
5e — Optional: run the overlay's orphan linter
If scripts/lint-consult-blocks.sh exists in the overlay, offer to run it:
Offer: Run scripts/lint-consult-blocks.sh to see ## <Section> flagged as
an orphan? This confirms the core side is still missing. [y/n]If the script is absent, skip this offer silently.
Gate rules
- Never auto-edit or auto-commit core. The
add-contextroute prints a TODO and routes to/core-edit; it never touches core files directly. - Configure routes refuse outside an overlay. All three configure subcommands
(
add-skill,add-fragment,add-context) require overlay context (Step 1 gate). Fail loudly with the hint from Step 1. - Scaffold never commits. The engine stages files (
git add -A) but does not commit. Never add a commit step to the scaffold route. add-contextalways prints the core-side TODO — even if both artifacts are already present in core (in that case, prefix with "Core side already wired:" and confirm both checks pass instead of marking them MISSING).- Never write a half-entry to overlay-fragments.yaml. The
add-fragmentroute either writes a completename/target/sourceentry or writes nothing.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

