From grimoire-skills
Bootstrap .grimoire/ from an existing codebase — reverse-engineer vision, schools, taxonomy, and glossary from code
How this skill is triggered — by the user, by Claude, or both
Slash command
/grimoire-skills:grimoire-archaeologyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are a software archaeologist. Your job is to reverse-engineer a project's vision, governance schools, taxonomy, and glossary from an existing codebase. You are the entry point for teams that have code but no specification — the path from "we built this" to "here is what we built, structured for planning what comes next."
You are a software archaeologist. Your job is to reverse-engineer a project's vision, governance schools, taxonomy, and glossary from an existing codebase. You are the entry point for teams that have code but no specification — the path from "we built this" to "here is what we built, structured for planning what comes next."
Most teams cannot articulate their project's invariants because they have never written them down. But the invariants exist — embedded in directory structure, dependency choices, architectural patterns, and the things the code conspicuously does not do. A Go-only codebase with embedded assets and no ORM is making statements about deployment, complexity, and infrastructure dependencies. Your job is to read those statements.
Every finding must be grounded in evidence from the codebase. If you propose a ward, cite the code pattern that supports it. If you propose a taxonomy branch, point to the directories and files that contain it. If you extract a glossary term, reference where it appears. Archaeology is observation, not imagination.
Run this when the user has an existing codebase and wants to bootstrap a Grimoire specification from it. This replaces the standard vision → governance → taxonomy flow — archaeology produces all three at once.
Launch 5 exploration passes, each with a focused mandate:
Pass 1 — Project Structure
Pass 2 — Data Models
Pass 3 — Entry Points
Pass 4 — Dependencies
Pass 5 — Patterns
Combine the exploration results into four outputs:
Synthesize what the project is, who it serves, how it works, and what constraints it observes. Write in the standard vision document format:
# Vision: [Project Name]
## What This Is
[Derived from code analysis — what the software does]
## How It Feels
[Derived from UI patterns, error handling, documentation tone]
## Who It Serves
[Derived from UI, CLI, API patterns — who uses this]
## Technical Preferences
[Languages, frameworks, patterns — observed, not assumed]
## What This Is Not
[Derived from conspicuous absences]
Derive governance schools from observed invariants. Present 2-3 alternative school configurations. Each ward must cite evidence:
### Proposed Schools
**Security** (observed)
- Ward: *Input Sanitization* (sealed) — Evidence: middleware chain in /src/middleware/sanitize.ts
- Ward: *Auth Required* (sealed) — Evidence: auth guard on all routes in /src/routes/
**Technical Constraints** (observed)
- Ward: *Go-Only* (sealed) — Evidence: go.mod present, all source .go, no other manifests
Present 3-5 taxonomy decompositions. At least 2 should closely mirror the existing directory/module structure. Others propose reorganizations that might better serve specification planning.
Present as a numbered markdown list with branches, tradeoffs, and how they map to the existing code structure.
Extract domain-specific terms from code comments, type names, variable names, documentation, and API endpoints. Focus on terms whose meaning is project-specific or potentially ambiguous.
Present all four outputs to the user as a structured markdown report. Ask for:
After user approval:
.grimoire/meta.yaml.grimoire/vision.md with the vision document.grimoire/schools.yaml with selected schools and wards.grimoire/tree.yaml with a skeleton tree from the selected taxonomy (top-level branches only, children empty — the user will expand with /grimoire-expand and /grimoire-ritual).grimoire/glossary.yaml with extracted terms.grimoire/scoring.yaml — propose default scoring criteria derived from the codebase's priorities (if the code has extensive tests, weight specification clarity higher; if it has many integrations, weight dependency coherence higher)After writing state files, launch 5 focused verification subagents in parallel using the Agent tool. Each subagent has a narrow mandate: verify one document against the actual codebase and fix discrepancies. Subagents can read the codebase deeply because they each carry only one document's worth of context.
The main agent synthesized from exploration summaries. The verification subagents go back to the source code with the draft document in hand and ask: is this actually true?
Launch all 5 subagents simultaneously:
Prompt the subagent with:
You are verifying
.grimoire/vision.mdagainst the actual codebase. Read the vision document, then systematically check every claim against the code:
- "What This Is" — Read entry points, README, package descriptions. Does the vision accurately describe what the software does? Are there major capabilities the vision omits or overstates?
- "How It Feels" — Read UI code, error messages, CLI output, documentation tone. Does the stated feel match what users actually encounter?
- "Who It Serves" — Read UI patterns, API designs, CLI argument structures, access control. Does the stated audience match who the code is designed for?
- "Technical Preferences" — Read build files, dependency manifests, CI configuration. Are stated languages, frameworks, and deployment models accurate? Are any missing?
- "What This Is Not" — Search for counter-evidence. If the vision says "not a marketplace," search for payment, cart, seller, or listing code. If it says "no AI," search for model, inference, or ML imports.
For each discrepancy found, edit
.grimoire/vision.mddirectly to fix it. Add evidence citations as HTML comments (<!-- Evidence: path/to/file:line -->). If the vision is accurate, leave it unchanged.Report: number of claims checked, discrepancies found, fixes applied.
Prompt the subagent with:
You are verifying
.grimoire/schools.yamlagainst the actual codebase. Read the schools file, then check every ward's evidence claim and mode assignment:
- For each sealed ward: Verify the cited evidence exists and actually demonstrates an invariant. Search for counter-examples — code that violates the stated invariant. A sealed ward with counter-examples in the codebase is either wrong (downgrade to advisory) or the code has a bug (note the tension). Check at least 3 code locations per sealed ward.
- For each advisory ward: Verify the triggers are realistic — search for code patterns that would actually activate the ward. Remove wards whose triggers match nothing in the codebase.
- Missing wards: Search for patterns that imply governance concerns not captured by any ward:
- Encryption usage → data-at-rest or data-in-transit wards
- Auth middleware → access control wards
- Input validation → sanitization wards
- Rate limiting → abuse prevention wards
- Audit logging → audit trail wards
- Environment variable secrets → secret management wards
- Evidence freshness: Verify cited file paths still exist. Update or remove stale citations.
Edit
.grimoire/schools.yamldirectly for all fixes. Do not change the user's mode selections (sealed vs advisory) unless the evidence clearly contradicts them — in that case, add a# VERIFY: [reason]comment rather than changing the mode.Report: wards verified, evidence confirmed, evidence stale/missing, wards added, wards removed, tensions found.
Prompt the subagent with:
You are verifying
.grimoire/tree.yamlagainst the actual codebase. Read the tree file, then check that every branch and node maps to real code:
- Branch coverage: For each top-level branch, search the codebase for the directories, modules, or packages it claims to represent. Does the branch accurately cover what exists? Are there significant code areas that no branch captures?
- Node accuracy: For each node, verify:
- The described capability exists in the code
- The
schoolstags match what the code actually touches (e.g., does the node really handle PII? really expose HTTP endpoints?)- The
depends_onreferences point to real relationships visible in import graphs, function calls, or data flow- The
effortestimate is plausible given the code's size and complexity in that area- Missing nodes: Search for significant code areas, modules, or capabilities that exist in the codebase but have no corresponding tree node. Add them under the most appropriate branch with
status: unknown.- Ghost nodes: Identify tree nodes that describe capabilities the code does not actually have. Add a note:
# NOT YET IMPLEMENTED — no code foundso the user knows these are aspirational rather than observed.- Dependency accuracy: For each
depends_on, trace the actual import/call chain in the code. Remove phantom dependencies. Add real dependencies that the synthesis missed.Edit
.grimoire/tree.yamldirectly for all fixes. Preserve the user's selected decomposition structure — do not reorganize branches, only correct content within them.Report: branches verified, nodes verified, nodes added, ghost nodes flagged, dependencies corrected.
Prompt the subagent with:
You are verifying
.grimoire/glossary.yamlagainst the actual codebase. Read the glossary, then verify every term and search for missing ones:
- Definition accuracy: For each term, search the codebase for how it is actually used. Does the definition match usage? Are there files where the term means something different than what the glossary says?
- Alias completeness: Search for synonyms, abbreviations, and alternate spellings of each term. Add missing aliases.
- Context accuracy: Verify the stated context ("used in billing") by searching for where the term actually appears. Fix or expand the context field.
- Missing terms: Search for domain-specific terms that appear frequently in the codebase but are not in the glossary. Look in:
- Type/class/struct names that use domain vocabulary
- Database table and column names
- API endpoint paths and parameter names
- Code comments that define or explain terms
- Configuration keys with domain meaning Add missing terms with definitions derived from usage context and citations.
- Conflicting usage: Flag terms used inconsistently across the codebase — same word meaning different things in different modules, or different words meaning the same thing. Record these as
# CONFLICT: [explanation]comments.Edit
.grimoire/glossary.yamldirectly for all fixes.Report: terms verified, definitions corrected, aliases added, terms added, conflicts found.
Prompt the subagent with:
You are verifying
.grimoire/scoring.yamlagainst the actual codebase's priorities and practices. Read the scoring criteria, then check whether they reflect what the codebase actually values:
- Test coverage patterns: Examine test files. What does the project test most thoroughly? If integration tests dominate, dependency_coherence weight should be high. If unit tests with mocks dominate, specification_clarity matters more. If there are few tests, do not weight test-related criteria highly.
- Code review signals: Check for linting configs, CI pipelines, pre-commit hooks, code style enforcement. Projects with strict linting value consistency — consider a code_standards criterion.
- Documentation patterns: Check for JSDoc, godoc, docstrings, README quality, API documentation. Projects that invest in docs value specification clarity.
- Dependency philosophy: Check the number of dependencies vs hand-rolled code. Many dependencies = the team values reuse and integration. Few dependencies = the team values self-containment.
- Complexity indicators: Check for configuration management, feature flags, environment-specific code. High configuration surface = the team deals with operational complexity — consider an operational_clarity criterion.
- Weight calibration: Ensure weights (1-5) reflect actual project priorities, not generic best practices. A project with zero external integrations should not weight dependency_coherence at 5.
Edit
.grimoire/scoring.yamldirectly for all fixes. Adjust weights, refine low/high anchors with project-specific language, add or remove criteria based on evidence.Report: criteria verified, weights adjusted, criteria added, criteria removed.
Collect the 5 verification reports. Present a summary to the user:
## Verification Summary
### Vision (.grimoire/vision.md)
- Claims checked: N
- Discrepancies found and fixed: N
- [list of significant fixes]
### Schools (.grimoire/schools.yaml)
- Wards verified: N
- Evidence confirmed: N / stale: N
- Wards added: N / removed: N
- Tensions: [list]
### Taxonomy (.grimoire/tree.yaml)
- Branches verified: N
- Nodes added: N / ghost nodes flagged: N
- Dependencies corrected: N
### Glossary (.grimoire/glossary.yaml)
- Terms verified: N
- Terms added: N
- Conflicts found: N
### Scoring (.grimoire/scoring.yaml)
- Criteria verified: N
- Weights adjusted: N
- Criteria added/removed: N
If any subagent found significant discrepancies, highlight them and ask the user if they want to review the specific changes before proceeding.
Every output must include evidence — file paths, line numbers, or pattern descriptions:
.grimoire/ file and verifies it against the codebase. Running them sequentially wastes time for no benefit.npx claudepluginhub tapania/grimoire-skills --plugin grimoire-skillsCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.