adopt-spec
Skill15 starsChanged 5 months agoMITView on GitHub
Adopt a typed .spec.ts for an existing hand-written CLAUDE.md — start from the file you already have, non-destructively
- Installs packages
In this repository24 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- examples/CLAUDE.mdCLAUDE.md
- src/CLAUDE.mdCLAUDE.md
- add-a-linterSkill
- audience-checkSkill
- audit-feedback-loopSkill
- code-qualitySkill
- deep-researchSkill
- dogfood-cliSkill
- enforce-rules-formatSkill
- generate-logoSkill
- hexagonal-architectureSkill
- landing-siteSkill
- pr-to-lint-ruleSkill
- review-docsSkill
- screenshotSkill
- ship-a-featureSkill
- verify-docs-findableSkill
- pr-to-lint-ruleSkill
- debug-my-harnessSkill
- edit-specSkill
- linter-docsSkill
- strengthenSkill
- test-harnessSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 3 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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 8
Start a typed CLAUDE.md.spec.ts from an existing hand-written CLAUDE.md (or AGENTS.md).
- Very specific: line 15
Non-destructive: Never edit the original CLAUDE.md / AGENTS.md.
- Very specific: line 16
Don't escalate enforcement: Keep guidance() as guidance().
- Distinctive: line 25
Read the target instruction file (default: CLAUDE.md in the repo root).
- Very specific: line 52
Create CLAUDE.md.spec.ts (or the appropriate name based on the source file) with this structure:
- Very specific: line 86
Use file() refs in sections where file paths appear in backticks — this enables stale reference detection
- Very specific: line 88
Use cmd() refs for any npm run commands mentioned in sections
- Distinctive: line 91
Keep rule IDs as kebab-case versions of the heading text
- Very specific: line 93
If sections reference other files or skills, use ref() for cross-references
- Very specific: line 116
Ask if they want you to write the file.
- Distinctive: line 120
If the user wants CI integration, suggest adding to their GitHub Actions workflow:
≈ “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
Start a typed CLAUDE.md.spec.ts from an existing hand-written CLAUDE.md (or AGENTS.md). This is the non-destructive adoption path — you keep your existing instruction file as the starting point and get type safety going forward.
Adoption rules
Adoption is the safe, faithful on-ramp — never an upgrade in disguise. These are non-negotiable:
- Faithful. Preserve every rule, command, and prose section as-is. Invent nothing — the spec must compile back to ~the user's existing file. The one exception is a file map ("Key Files"): never emit the deprecated
keyFilesfield — see the guideline under Step 3. - Non-destructive. Never edit the original
CLAUDE.md/AGENTS.md. Only write the new.spec.ts. Never auto-compileover the file — switching it to spec-managed is a separate, explicit step the user runs with a diff to review. - Don't escalate enforcement. Keep
guidance()asguidance(). Upgrading toenforce()has a cost (config/plugins, possible false positives) and is a separate opt-in step — thestrengthenskill. Adoption is not turning on strict /workflowgating. - Reversible.
vigiles eject <file>hands the file back as plain hand-owned markdown anytime — it's never a one-way door. Tell the user this. - Ask before writing. Present the generated spec and a conversion summary first; write only on the user's yes.
- A lighter touch exists. For no spec at all, inline
<!-- vigiles:enforce ... -->comments are verified byvigiles lintwith the same engine.
Instructions
Step 1: Read the Existing File
Read the target instruction file (default: CLAUDE.md in the repo root). If the user specified a path, use that.
Also check if vigiles is installed: look for vigiles in package.json devDependencies. If not, suggest:
npm install -D vigilesStep 2: Parse the Structure
Identify these sections in the markdown:
- Commands — lines like
`npm run build` — descriptionor- `command` — description - A file map ("Key Files") — lines like
`src/foo.ts` — descriptionlisting important files. Never becomeskeyFiles(deprecated); see the guideline under Step 3 - Rules —
###headings with**Enforced by:**,**Claimed (unverified):**or**Guidance only**annotations - Prose sections — everything else (positioning, architecture, principles, etc.)
For each rule, classify it:
- Has
**Enforced by:** \linter/rule`→enforce("linter/rule", "why")` - Has
**Claimed (unverified):** \linter/rule`→enforce("linter/rule", "why")` too — the last compile could not verify it; the next one will say why - Has
**Enforced by:** \code-review`or similar non-linter →guidance("...")` - Has
**Guidance only**→guidance("...") - Has no annotation → mark as TODO for the user to classify
Step 3: Generate the Spec File
Create CLAUDE.md.spec.ts (or the appropriate name based on the source file) with this structure:
import {
claude,
enforce,
guidance,
file,
cmd,
ref,
instructions,
} from "vigiles/spec";
export default claude({
sections: {
// Prose sections here
},
// No `keyFiles`: the field is deprecated (removed next major). A "Key Files"
// list in the original file is NOT carried over as a map — see the
// guideline below.
commands: {
// Commands here
},
rules: {
// Rules here
},
});Important guidelines:
- Use
file()refs in sections where file paths appear in backticks — this enables stale reference detection - 🔴 Never emit
keyFiles. The field is deprecated and removed in the next major (vigiles lintwarns asdeprecated-key-files). For a "Key Files" / file-map section in the original, apply the migration recipe (docs/rules/deprecated-key-files.mdin the vigiles repository) and show the user, per entry, where it goes — the first that fits: (1) the file's header, the docs or the path already say it (or the path no longer exists) → delete it; (2) a fact about that one file → that file's header comment; (3) a rule for working in one folder → that folder's nestedCLAUDE.md(its own<folder>/CLAUDE.md.spec.ts); (4) nothing else would lead an agent to the file → a one-linefile()pointer in the section where the decision that needs it is written. Where each entry goes is the user's call; that the map does not becomekeyFilesis not. Until they decide, carry the list over as a plain prose section so adoption stays faithful - Use
cmd()refs for anynpm runcommands mentioned in sections - Convert
**Enforced by:** \code-review`rules toguidance()` — code review is not a mechanical enforcement - For rules with no annotation, add a
// TODO: classify as enforce() or guidance()comment - Keep rule IDs as kebab-case versions of the heading text
- Preserve the
**Why:**text as the second argument toenforce()orguidance() - If sections reference other files or skills, use
ref()for cross-references
Step 4: Verify the Spec Compiles
Run:
npm run build
npx vigiles compile CLAUDE.md.spec.tsCompare the compiled output against the original file. Key differences are expected (formatting, section ordering), but all rules, commands, and prose content should be preserved (a file map is the exception — see the keyFiles guideline above).
Step 5: Present the Result
Show the user:
- The generated spec file
- How many rules were converted (enforce vs guidance vs TODO)
- How many file/cmd refs were added for stale reference detection
- The command to compile:
npx vigiles compile - The command to verify:
npx vigiles lint
Ask if they want you to write the file. If yes, also suggest adding to .gitignore or updating CI to run vigiles compile and vigiles lint.
Step 6: Optional — Set Up CI
If the user wants CI integration, suggest adding to their GitHub Actions workflow:
- name: Compile specs
run: npx vigiles compile
- name: Verify references + integrity
run: npx vigiles lintOr using the vigiles GitHub Action:
- uses: zernie/vigiles@v1
with:
command: lintDoes 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.

