You are executing the specumentation skill — a combined specification and documentation workflow for Claude Code projects.
Parameter Parsing
Parse $ARGUMENTS for:
- •Mode:
init,concept,epics,inbox,update,publish,work,whats-next(default if none given:full= all phases sequentially, excludingworkandwhats-next) - •Topic name: After
concept, e.g.concept auth-module - •Ticket ID: After
work, e.g.work E-02.03(default if none given: next open ticket by priority) - •Document type: After
publish, e.g.publish user-manual(default if none given: all available document types) - •Language:
lang=XX(e.g.lang=de,lang=fr; default:en)
All output (Markdown files, console messages, PDF content) MUST use the detected language.
Opinionated Directory Structure
This skill expects and enforces the following structure in every project:
docs/ ├── concept/ # Concept documents (functional & technical specifications) ├── epics/ # Epics with tickets, derived from concepts ├── documents/ # Generated documents (PDFs, HTML) + layout template │ └── document-layout.html ├── assets/ # Logos, color definitions, images for documentation └── in/ # Inbox: external concepts & change requests to be processed
Each directory has a distinct role. Files are NEVER deleted — only updated or superseded.
Document Types
The skill ships with predefined document types in its documents/ directory. Each document type is a Markdown file with frontmatter metadata and a generation prompt.
To list available document types, read all .md files from the skill's documents/ directory. Each file defines:
- •
name— identifier used inpublish [name] - •
title— human-readable title for the generated document - •
output— filename pattern ([project]and[date]are replaced) - •
description— what this document type produces - •Generation instructions — the body of the file
When publishing, read the document type definition and follow its instructions to compose the document from the project's concept documents and epics.
Phase 1 — Init (mode: init or full)
Goal: Set up the docs/ directory structure in the target project.
Steps:
- •Create directories if they don't exist:
docs/concept/,docs/epics/,docs/documents/,docs/assets/,docs/in/. - •Check if
docs/concept/00-overview.mdexists. If not, create it:
# [Project Name] — Project Overview > This document is the entry point for all project documentation. > Managed by [specumentation](https://github.com/McGo/claude-code-specumentation). ## Project Description [Brief description — read from README.md or package manager config if available] ## Concept Index | # | Concept | Status | Last Updated | |---|---------|--------|--------------| | — | — | — | — | ## Architecture Decisions [High-level architecture notes, key technology choices, constraints] ## Glossary | Term | Definition | |------|-----------| | — | — |
- •Check if
docs/documents/document-layout.htmlexists. If not, create it with a professional HTML/CSS layout for A4 PDF printing (title page, table of contents, chapter styling, code blocks, tables, print-optimized CSS with proper page breaks and margins). - •If
README.mdexists, extract project name and description to populate the overview. - •If a package manager config exists (
package.json,composer.json,pyproject.toml,Cargo.toml,go.mod), extract project metadata. - •Document specumentation assumptions in the project's
CLAUDE.md. If the file exists, append a## Specumentationsection (if not already present). If the file does not exist, create it. The section contains:
## Specumentation This project uses [specumentation](https://github.com/McGo/claude-code-specumentation) for spec-first development. ### Assumptions - **Document language**: [language, e.g. "German (de)" — derived from `lang=` parameter, existing docs, or README language] - **Concept language**: [same as document language unless explicitly different] - **Project name**: [detected project name] - **Project version source**: [e.g. "package.json", "Cargo.toml", "manual" — where the version is read from] ### Directory Structure - `docs/concept/` — Concept documents (specifications) - `docs/epics/` — Epics with tickets - `docs/documents/` — Generated documents (PDF, HTML) - `docs/assets/` — Branding resources (logos, colors) - `docs/in/` — Inbox for external documents
If the lang= parameter was provided, use it. Otherwise, detect the language from existing documentation, README, or code comments. If unclear, default to English and note it as an assumption.
Output: Confirm what was created and what already existed.
Phase 2 — Concept (mode: concept [topic] or full)
Goal: Create or update concept documents that describe the application functionally and technically.
When mode is concept [topic]:
Analyze the current codebase for the named topic and create/update its concept document. The code is the primary source — the concept is derived from what actually exists in the repository.
When mode is full:
- •Analyze the entire codebase structure.
- •Identify logical components/features that should be documented.
- •Read existing concepts in
docs/concept/to avoid duplication. - •Create or update concept documents for components that are missing or outdated.
Concept Document Format:
Each concept is saved as docs/concept/[NN]-[topic-slug].md where NN is a zero-padded sequence number.
# [Topic Name] > Concept document — Status: **draft** | **approved** | **implemented** ## Purpose [What this component/feature does and why it exists] ## Functional Description [Business logic, user stories, workflows, use cases] ## Technical Description ### Architecture [How this fits into the overall system] ### Interface [API surface, CLI commands, UI elements — whatever applies] ### Data Model [Relevant data structures, schemas, database tables] ### Behavior [State machines, algorithms, edge cases, error handling] ## Dependencies [Internal and external dependencies] ## Open Questions - [ ] [Unresolved questions that need answers before implementation] ## Change Log | Date | Change | Author | |------|--------|--------| | [today] | Initial concept | specumentation |
Rules:
- •NEVER delete existing concepts — update them.
- •When updating, add an entry to the Change Log.
- •Set status to
draftfor new concepts, keep existing status unless the user explicitly changes it. - •Cross-reference between concepts using relative Markdown links.
- •Update
docs/concept/00-overview.mdConcept Index after creating/updating any concept. - •If code exists but no concept exists, reverse-engineer the concept from the code and mark status as
implemented. - •If a concept exists but code has diverged, note the divergence and add entries to Open Questions.
Phase 3 — Epics (mode: epics or full)
Goal: Derive actionable epics with tickets from the concept documents.
Steps:
- •Read all concept documents in
docs/concept/. - •Read all existing epics in
docs/epics/to avoid duplication. - •For each concept (or changed concept), derive implementation tasks:
- •Break down functional and technical requirements into concrete, implementable tickets.
- •Group related tickets into epics.
- •Create or update epic files.
Epic File Format:
Each epic is saved as docs/epics/epic-[NN]-[slug].md.
# Epic [NN]: [Epic Title] > Derived from: [link to concept document(s)] > Status: **open** | **in progress** | **closed** ## Description [What this epic achieves as a whole] ## Tickets ### [E-NN.01] [Ticket Title] - **Status:** open | in progress | resolved - **Concept ref:** [link to concept, section] - **Description:** [What needs to be done] - **Acceptance Criteria:** - [ ] [Testable criterion] - [ ] [Testable criterion] - **Files:** [Expected files/modules to be touched] ### [E-NN.02] [Ticket Title] ...
Rules:
- •NEVER delete resolved tickets — they form an audit trail.
- •Resolved tickets get a
✓ RESOLVEDmarker and a brief resolution description. - •When concepts change, update affected epics: add new tickets, mark obsolete ones as superseded.
- •Ticket IDs are stable — never renumber existing tickets.
- •Each ticket must have concrete acceptance criteria that can be tested.
- •Reference the originating concept section for traceability.
Phase 4 — Inbox (mode: inbox or full)
Goal: Process external documents from docs/in/ and incorporate them into concepts and epics.
Steps:
- •Read all files in
docs/in/(Markdown, text, or any readable format). - •For each document: a. Analyze its content — is it a new concept, a change to an existing concept, a feature request, a bug description, or a specification from an external source (e.g. ChatGPT)? b. Determine which existing concept(s) it relates to, or if a new concept is needed.
- •Incorporate the content:
- •New concept: Create a new concept document in
docs/concept/with statusdraft, referencing the inbox document as source. - •Change to existing concept: Update the affected concept(s), add Change Log entries noting the inbox document as source.
- •New requirements: Add to the relevant concept's Functional/Technical Description and create corresponding epic tickets.
- •New concept: Create a new concept document in
- •After processing, delete the inbox document.
- •Update the Concept Index and affected epics.
Rules:
- •Always note the source in Change Log entries:
Source: docs/in/[filename]. - •If an inbox document is ambiguous or contradicts existing concepts, flag it in the Open Questions section of the affected concept.
- •Processed inbox documents are deleted — their content lives on in the concepts and epics they were incorporated into.
Phase 5 — Update (mode: update or full)
Goal: Synchronize documentation with the current state of the codebase.
Steps:
- •Read all existing concepts in
docs/concept/. - •Analyze the codebase for changes since the last concept update (use Change Log dates and git history if available).
- •For each concept: a. Verify that described interfaces still match the code. b. Verify that data models are current. c. Check if new features have been implemented that aren't documented. d. Check if documented features have been removed or changed.
- •Update concepts where divergence is found.
- •Add Change Log entries for all updates.
- •Update the Concept Index in
00-overview.md. - •Update affected epics — mark implemented tickets as resolved, flag new divergences.
Divergence Handling:
When code and concept diverge, add a notice block at the top of the affected section:
> **⚠ Divergence detected** ([date]): [brief description of what changed in code vs. concept]
Phase 6 — Work (mode: work [ticket-id])
Goal: Pick the next open ticket from the epics and implement it.
Important: This phase is NOT part of full mode — it must be invoked explicitly.
Ticket Selection:
- •If a ticket ID is given (e.g.
work E-02.03), use that ticket. - •If no ticket ID is given, select the next open ticket by priority:
a. Read all epics in
docs/epics/sorted by filename. b. Within each epic, find tickets by status priority:in progressfirst (resume), thenopen. c. Pick the first match. - •If no open tickets exist, inform the user and suggest running
epicsto generate new tickets.
Steps:
- •Read the selected ticket's full details (description, acceptance criteria, files, concept ref).
- •Read the referenced concept section(s) for context.
- •Display the ticket to the user:
── specumentation work ───────────────────────────── Ticket: [E-NN.XX] [Title] Epic: [Epic title] Concept: [Concept reference] ───────────────────────────────────────────────────── [Description] Acceptance Criteria: - [ ] [Criterion 1] - [ ] [Criterion 2] ─────────────────────────────────────────────────────
- •Mark the ticket as
in progressin the epic file. - •Implement the ticket:
- •Follow the description and acceptance criteria.
- •Touch only the files listed in the ticket, unless additional files are clearly necessary.
- •Write code that satisfies all acceptance criteria.
- •After implementation, verify each acceptance criterion.
- •Mark the ticket as
✓ RESOLVEDin the epic file with a brief resolution description. - •Update the related concept if the implementation revealed new information or divergence.
- •Git commit the code changes and the updated epic file separately:
- •Code:
feat|fix|refactor(...): [description](conventional commit based on change type) - •Docs:
docs(specumentation): resolve [E-NN.XX] [title]
- •Code:
Rules:
- •Only work on ONE ticket at a time.
- •If the ticket is blocked or cannot be completed, keep it as
in progressand add a note to the ticket explaining the blocker. - •Do NOT mark a ticket as resolved if acceptance criteria are not met.
- •If implementation requires changes not covered by the ticket, create a new ticket in the appropriate epic for the additional work.
Whats-Next (mode: whats-next)
Goal: Analyze the current project state and suggest exactly one next step.
Important: This mode is NOT part of full — it must be invoked explicitly. It never executes actions, only recommends.
Steps:
- •
Quickly assess the project state: a. Does
docs/exist with the expected structure? If not → suggestinit. b. Are there files indocs/in/? If yes → suggestinbox. c. Has the codebase changed since the last concept update (check git history and Change Logs)? If yes → suggestupdate. d. Are there concepts without corresponding epics, or concepts that changed since epics were last generated? If yes → suggestepics. e. Are there open tickets in the epics? If yes → suggestworkand name the next ticket. f. Are generated documents outdated (older than latest concept changes)? If yes → suggestpublish. g. If none of the above → report that everything is up to date. - •
Display the recommendation:
── specumentation whats-next ─────────────────────── Recommended: [mode] Reason: [one-line explanation] [If work: Next ticket: [E-NN.XX] [Title]] ───────────────────────────────────────────────────── Run /specumentation [mode] to proceed.
- •Ask the user if they want to execute the suggested step.
Rules:
- •Always suggest exactly ONE step — the most impactful one based on the priority order above.
- •Never suggest
full— always a specific mode. - •Keep the output short and actionable.
Phase 7 — Publish (mode: publish [document-type] or full)
Goal: Generate a document as PDF from the project's concepts and epics.
Document Type Resolution:
- •If a document type is specified (e.g.
publish user-manual), read the matching definition from the skill'sdocuments/directory. - •If no document type is specified, generate all available document types.
- •If the requested document type does not exist, list available types and abort.
Steps (per document type):
- •Read the document type definition from the skill's
documents/[type].mdfile. - •Read all concepts from
docs/concept/in order (sorted by filename). - •Read all epics from
docs/epics/if the document type requires them. - •Read
docs/documents/document-layout.htmlas the layout template.- •If the file does not exist, create it first (same as init phase).
- •Check
docs/assets/for branding resources (logos, color definitions, images). If present, incorporate them into the generated document (e.g. logo on title page, brand colors in styling). - •Follow the document type's generation instructions to compose the content.
- •Insert the composed content into the layout template.
- •Write the filled HTML to
docs/documents/. - •Auto-detect Chrome binary:
- •macOS:
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome - •Linux:
google-chromeorchromium-browser - •Windows/WSL:
/mnt/c/Program Files/Google*/Application/chrome.exe
- •macOS:
- •Generate PDF:
Wherecode
"[chrome-path]" --headless --disable-gpu --no-sandbox --print-to-pdf="docs/documents/[output-pattern].pdf" --print-to-pdf-no-header "docs/documents/[output-pattern].html"
[output-pattern]comes from the document type'soutputfrontmatter field with[project]and[date]replaced. - •Keep the HTML file alongside the PDF for reference.
Filename Strategy:
- •Pattern from document type: e.g.
[project]-user-manual-[date].pdf - •If a PDF with today's date exists, append time:
[project]-user-manual-YYYY-MM-DD-HHmmSS.pdf
Available Document Types:
List them by reading the skill's documents/ directory. Built-in types include:
- •
user-manual— End-user documentation - •
elevator-pitch— One-page product summary - •
executive-summary— Management overview with status and roadmap - •
architecture— Technical architecture document for developers
Git Integration
After each phase, if the project is a git repository:
- •Stage all new and modified files in
docs/(exceptdocs/documents/*.pdf). - •Commit with message:
docs(specumentation): [brief description of what changed] - •Do NOT stage or commit PDF files.
- •Do NOT push — leave that to the user.
Summary Output
After completing all requested phases, print a summary:
── specumentation complete ───────────────────────── Mode: [mode] Concepts created: [count] Concepts updated: [count] Epics created: [count] Epics updated: [count] Inbox processed: [count] Documents generated: - [document-type]: [path] - ... ────────────────────────────────────────────────────