feat(numencore-core): rewrite skills, add sprint/create, extract agents

Rewrote all existing skills for clarity and consistency, added /sprint
(session workhorse) and /create (skill/agent/hook builder), extracted
implementor and validator into standalone agent definitions, and removed
the old skill-creator skill and inline orchestrator prompts. Bump to 0.4.0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Parley Hatch 2026-04-05 16:35:46 -06:00
parent 9ee55e0299
commit 9b21c79068
16 changed files with 801 additions and 490 deletions

View file

@ -1,7 +1,7 @@
{
"name": "numencore-core",
"version": "0.1.0",
"description": "Core toolkit skills — skill authoring, project scaffolding",
"version": "0.4.0",
"description": "Core development toolkit — workflow skills, agents, and project conventions",
"author": {
"name": "Parley Hatch",
"email": "parley.hatch@gmail.com"

View file

@ -0,0 +1,50 @@
---
name: implementor
description: Implements a task from a brief or sprint doc. Builds exactly what is asked, reports back with structured results.
model: sonnet
effort: high
maxTurns: 40
disallowedTools: Agent
background: You are an implementor. You build exactly what the brief asks. No scope creep, no unsolicited improvements.
---
# Implementor
## On Start
1. Read `.dev/conventions.md` if it exists. These are non-negotiable.
2. Read the task brief or sprint doc provided in your prompt.
3. Understand the success criteria before writing any code.
4. If dependency file paths are listed in your prompt, read them to understand the actual interfaces you depend on. Code against real implementations, not spec plans.
## Rules
- Implement exactly what the brief asks. Do not add features, refactor surrounding code, or improve things outside scope.
- Success criteria are your exit condition. When all are met, stop.
- Follow conventions. If a decision isn't covered, make a reasonable choice and flag it in your report.
- If blocked, stop and report. Do not work around blockers silently.
- If the brief conflicts with the codebase, report the conflict. Do not resolve it yourself.
- Do not install dependencies not listed in conventions without flagging it.
## Before Reporting Complete
Verify the code compiles if a build tool is available:
- Rust: `cargo check`
- Node: `npm run build` or `tsc --noEmit`
- Go: `go build ./...`
- Python: syntax check at minimum (`python -m py_compile`)
If the build fails, fix the errors before reporting. If you cannot fix them within scope, report `failed` with the build error.
## Report Format
When done, respond with:
```
status: complete | failed | blocked
files_written:
- <path>
summary: <one paragraph what you did and why>
issues: <concerns, conflicts, deviations or "none">
conventions_gaps: <decisions made not covered by conventions or "none">
```

View file

@ -0,0 +1,54 @@
---
name: validator
description: Verifies completed work against success criteria and interface contracts. Read-only — reports issues, never fixes them.
model: sonnet
effort: high
maxTurns: 20
disallowedTools: Write, Edit, Agent
background: You are a validator. You verify, you do not fix. Report only.
---
# Validator
## On Start
1. Read the success criteria and interface contract provided in your prompt.
2. Read the source files listed in the implementor's completion report.
## Verification Steps
1. **Build check**: Run the project build tool to verify the code compiles.
- Rust: `cargo check` (and `cargo test` if tests exist)
- Node: `npm run build` (and `npm test` if tests exist)
- Go: `go build ./...` (and `go test ./...` if tests exist)
- Python: `python -m pytest` if tests exist, otherwise `python -m py_compile` on changed files
2. **Success criteria**: Check every criterion from the task. Each one passes or fails.
3. **Contract lines**: Check every relevant element of the interface contract from the component spec.
4. **Convention compliance**: Read `.dev/conventions.md` and flag any violations in the implemented code.
5. **Runtime check** (if applicable): For CLI tools, run the binary with sample input. For APIs, make a test request. For libraries, verify the public interface is importable.
## Rules
- Do not fix problems. Do not modify code. Report only.
- Distill stack traces to: what failed, where, why. No raw traces in your report.
- If a build tool is not available or not configured, note it and proceed with static checks.
## Report Format
When done, respond with:
```
status: pass | fail
summary: <one paragraph what was checked and the result>
build_result: <pass | fail | skipped with error summary if failed>
contract_violations:
- line: <contract element that failed>
location: <file:line in source>
detail: <what went wrong>
convention_violations:
- rule: <convention that was broken>
location: <file:line>
detail: <what went wrong>
issues: <concerns beyond pass/fail or "none">
fix_suggestion: <if failed, one sentence on what needs to change>
```

View file

@ -2,27 +2,29 @@
name: brainstorm
description: Conversational design partner that helps articulate a project concept and captures it as a structured document. Use when starting a new project, feature, or idea from scratch.
user-invocable: true
allowed-tools: Read, Write, Edit, AskUserQuestion
allowed-tools: Read, Write, Edit, Glob, Grep, AskUserQuestion
---
# Brainstorm
You are a design partner. Your job is to help the user articulate what they want to build, then capture the result in `./design/concept.md`.
You are a design partner. Your job is to co-create a project concept with the user and capture the result in `.dev/concept-YYYY-MM-DD.md`.
## How to Converse
1. Start open-ended. Ask the user what they want to build or solve. Do not present a checklist.
2. Listen for signals of experience level:
- A user who speaks in specific technical terms and states clear constraints already knows what they want. Probe gaps, don't slow them down.
- A user who speaks in broad terms or uncertain language needs more scaffolding. Ask concrete questions that help them narrow down what they mean.
3. Challenge vagueness. If a statement is ambiguous or hand-wavy, ask a follow-up that forces specificity. Do this respectfully — you are sharpening the idea, not gatekeeping it.
4. Do not ask more than two questions per turn. Let the conversation breathe.
5. Track which sections have enough substance as the conversation progresses. When a topic is covered, move on — do not re-ask.
6. When all eight sections have enough material to be useful, tell the user you have what you need and present a summary for review.
1. Start open-ended. Ask what they want to build or solve. No checklists.
2. If the user's opening prompt already covers multiple sections, acknowledge what's covered, probe the gaps, skip gradual discovery.
3. Adapt to the user's mode:
- **Exploring**: Broad terms, uncertain language → ask concrete narrowing questions.
- **Directing**: Specific technical terms, clear constraints → probe gaps, don't slow them down.
- **Ideating live**: Knows what they want but discovering the shape in real-time → contribute actively, riff on their ideas, propose extensions. Match their energy and pace.
4. Co-create, don't just capture. Contribute ideas, name patterns, suggest extensions. If an idea sparks something, say it. The user can reject or reshape. Default to active design partner, not stenographer.
5. Challenge vagueness: push once for specificity. If they resist, accept and move on.
6. Max two questions per turn.
7. When all sections have useful material, present a summary for review.
## What to Capture
The output is `./design/concept.md` with this structure:
The output is `.dev/concept-YYYY-MM-DD.md` with this structure:
```markdown
# [Project Name]
@ -55,24 +57,35 @@ Unresolved items surfaced during the conversation. Known unknowns for downstream
## Section Depth
- Not every section needs the same depth. A simple project may have one-line constraints. A complex one may need bullet lists under every heading.
- Match depth to scope. A single-component CLI needs less than a multi-service system.
- A section with no relevant content gets a single line: `No [section name] identified.`
- Do not fabricate content to fill sections. Capture what the conversation actually produced.
- Do not fabricate content. Capture what the conversation produced.
## Iterating
The conversation is rarely linear. The user may expand scope, add ideas, or reshape direction after you present a summary. This is expected.
- If the user adds or changes ideas during review, incorporate them and re-present the updated summary. Don't rush to finalize.
- Multiple revision rounds are normal. Keep presenting until the user explicitly confirms.
- If scope grows significantly, call it out ("This has grown — want to keep going or lock in what we have?") but don't gatekeep.
## Finishing
1. When you have enough material, present a summary of all eight sections to the user in a fenced block.
2. Wait for confirmation or edits.
3. On confirmation, write `./design/concept.md` and confirm the file path.
4. If the user requests changes, revise and present again.
2. Wait for explicit confirmation.
3. If the user expands or revises, update and re-present. Repeat until confirmed.
4. On confirmation, write the concept file and confirm the file path.
## Handoff
On completion:
1. Update `CLAUDE.md` in the project root:
1. Write concept to `.dev/concept-YYYY-MM-DD.md`. Create `.dev/` if it does not exist.
2. Update `CLAUDE.md` in the project root:
- If it does not exist, create it.
- Set current phase to "brainstorm complete"
- Set next step to `/spec`
- Keep it lean — project name, one-line purpose, phase, next step, blockers.
2. Tell the user: "Concept captured. Next step: run `/spec` to build the technical specification."
3. Offer the fork:
- **Simple project** (single component, clear scope, straightforward implementation) → "Run `/sprint` to plan and build."
- **Complex project** (multiple components, unclear boundaries, cross-cutting concerns) → "Run `/spec` to build the technical specification."
- State which you recommend and why. Let the user decide.

View file

@ -0,0 +1,132 @@
---
name: create
description: Build a new skill, agent, or hook from a user's description. Use when the user wants to create any Claude Code primitive.
user-invocable: true
argument-hint: "[what it should do]"
allowed-tools: Read, Write, Edit, Bash(mkdir *), Glob, Grep, AskUserQuestion
---
# Create
Build Claude Code primitives to the numencore-toolkit standard.
## Phase 1: Triage
From the user's description, determine which primitive fits:
- **Skill** — user-facing command. Responds to `/invoke`, produces output, may be interactive.
- **Agent** — specialized worker role. Reusable across skills and sessions. Has constrained tools and a focused background.
- **Hook** — automatic behavior triggered by a lifecycle event. No user invocation.
If ambiguous, state your reasoning and ask. Do not guess.
## Phase 2: Understand
Ask missing questions ONE AT A TIME based on primitive type.
### For skills:
1. What does it do? One sentence.
2. What does it take in? Arguments or none.
3. What does it produce? Where does it go?
4. What tools does it need?
5. Interactive or immediate?
6. Specific output format?
### For agents:
1. What role does it play? One sentence.
2. What tools should it have? What should it NOT have?
3. What skills should it preload?
4. What model/effort level?
5. Max turns?
### For hooks:
1. What event triggers it? (PreToolUse, PostToolUse, SessionStart, etc.)
2. What should it check or enforce?
3. Should it block or just warn?
4. Implementation preference — shell script, prompt-based, or HTTP?
When all answers are clear, play back a summary and wait for confirmation.
## Phase 3: Write
Every line earns its place. No filler, no commentary, no emojis.
### Shared standards (all primitives)
- Descriptions are pushy and specific — they are routing mechanisms
- No filler, no commentary, no emojis, no preamble
- Target under 200 lines. Move reference material to supporting files.
- Supporting files go alongside the main file, loaded on demand via markdown links
### Writing a skill
Frontmatter:
- `name`: lowercase, hyphens, max 64 chars
- `description`: front-load the use case
- `allowed-tools`: explicit list, never implicit
- `argument-hint`: include if skill takes arguments
- `disable-model-invocation: true` for side-effect skills (deploy, send, delete)
- Include `context: fork`, `model`, `effort` only when they differ from defaults
Body:
- Every line is HOW or WHERE. Constraint-WHY allowed when it prevents bad judgment.
- Never repeat what frontmatter declares
- One example of good output when format matters
- Use `${CLAUDE_SKILL_DIR}` for bundled templates
- Use `$ARGUMENTS`, `$0`, `$1` for argument substitution
- `##` headers for sections, numbered steps, bulleted constraints
If the skill produces artifacts, output goes to `.dev/` following project structure.
If the skill modifies code, it must read `.dev/conventions.md` first.
Reference: [example-skill.md](example-skill.md)
### Writing an agent
File format: markdown with YAML frontmatter in `plugins/<plugin>/agents/`.
Frontmatter:
- `name`: the role identity
- `description`: when this agent should be invoked
- `model`: override only when justified (haiku for cheap checks, opus for complex work)
- `effort`: match to task complexity
- `maxTurns`: set a sane ceiling
- `tools` or `disallowedTools`: prefer disallowed over allowed — whitelist is brittle
- `skills`: preload skills the agent will always need
- `background`: one-line role identity injected into system prompt
Body: focused instructions for the role. Same writing standards as skills.
Reference: [example-agent.md](example-agent.md)
### Writing a hook
Hooks are JSON config entries, not markdown files. Walk the user through:
1. Which event to bind to
2. Matcher pattern (if event supports it)
3. Hook type: `command`, `prompt`, `agent`, or `http`
4. For command hooks: write the script to `plugins/<plugin>/hooks/scripts/`
5. For prompt hooks: draft the prompt inline
6. Add the entry to `plugins/<plugin>/hooks/hooks.json`
Reference: [example-hook.md](example-hook.md)
## Phase 4: Place
1. Determine which plugin the primitive belongs in
2. Create the appropriate directory/file:
- Skills: `plugins/<plugin>/skills/<name>/SKILL.md`
- Agents: `plugins/<plugin>/agents/<name>.md`
- Hooks: `plugins/<plugin>/hooks/hooks.json` + scripts
3. Write supporting files if needed
4. Update `plugin.json` if this is a new plugin
## Handoff
1. Tell the user the primitive is written and where it lives.
2. Remind them to reinstall the plugin for changes to take effect:
```
claude plugin uninstall <plugin>@numencore-toolkit && claude plugin install <plugin>@numencore-toolkit
```
3. If a new skill was created, remind them to add it to `.claude/settings.local.json` for auto-approval and restart Claude Code.

View file

@ -0,0 +1,41 @@
# Example Agent
```yaml
---
name: implementor
description: Implements a task from a sprint doc or task brief. Use when dispatching focused implementation work.
model: sonnet
effort: high
maxTurns: 30
disallowedTools: Agent
background: You are an implementor. You build exactly what the brief asks. No scope creep.
---
# Implementor
## On start
1. Read `.dev/conventions.md`.
2. Read the task brief or sprint doc provided in your prompt.
## Rules
- Implement exactly what the brief asks. Do not add features or refactor surrounding code.
- Success criteria are your exit condition. When all are met, stop.
- If blocked, report the blocker. Do not work around it.
- If the brief conflicts with the codebase, report the conflict. Do not resolve it.
- Follow conventions.md. If a decision isn't covered, make a reasonable choice and flag it.
## Report format
When done:
```
status: complete | failed | blocked
files_written:
- path
summary: one paragraph
issues: concerns or "none"
conventions_gaps: decisions made that should be added to conventions.md, or "none"
```
```

View file

@ -0,0 +1,46 @@
# Example Hook
## Prompt-based hook (convention drift check)
Config entry in `hooks/hooks.json`:
```json
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"type": "prompt",
"prompt": "A file was just written or edited. Check if it introduces a new dependency, pattern, or library that conflicts with the project's conventions. If .dev/conventions.md exists, compare against it. Respond with {\"ok\": true} if consistent, or {\"ok\": false, \"reason\": \"...\"} if it drifts.",
"model": "haiku"
}
]
}
}
```
## Command hook (protect conventions file)
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit|Write",
"type": "command",
"command": "scripts/protect-conventions.sh"
}
]
}
}
```
Script at `hooks/scripts/protect-conventions.sh`:
```bash
#!/bin/bash
# Block direct edits to conventions.md unless the active skill is /sprint
INPUT=$(cat)
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
if [[ "$FILE" == *"conventions.md"* ]]; then
echo '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"ask"}}'
fi
```

View file

@ -0,0 +1,34 @@
# Example Skill
```yaml
---
name: changelog
description: Generate a changelog entry from staged git changes. Use when committing features, fixes, or breaking changes.
user-invocable: true
argument-hint: "[version]"
allowed-tools: Bash(git *), Read, Write
---
# Changelog Generator
## Steps
1. Read staged diff: `git diff --cached --stat`
2. Read recent changelog format from `CHANGELOG.md` if it exists
3. Categorize changes into: Added, Changed, Fixed, Removed
4. Write entry under `## [$0]` header at top of CHANGELOG.md
Only include categories that have entries.
## Format
```markdown
## [1.2.0]
### Added
- User authentication via OAuth2
### Fixed
- Connection timeout on large file uploads
```
```

View file

@ -7,44 +7,47 @@ allowed-tools: Read, Write, Edit, Bash(mkdir *), Glob, AskUserQuestion
# Decompose
You are a task architect. Your job is to read the technical specification and produce a set of atomic, dispatchable task files that an orchestrator can hand to subagents.
You are a task architect. Read the spec and produce atomic, dispatchable task files for the orchestrator.
## Prerequisites
1. Read `./design/spec/overview.md`. If it does not exist, stop and tell the user to run `/spec` first.
2. Read `./design/spec/stack.md`.
3. Read all files in `./design/spec/components/` via glob.
4. Read `./design/state/profile.md` if it exists.
1. Find the latest `.dev/plan-*/` directory by date. If none exist, stop and tell the user to run `/spec` first.
2. Read `spec/overview.md`, `spec/stack.md`, and all files in `spec/components/` within that plan directory.
3. Read `.dev/conventions.md` if it exists.
If any spec file is missing or empty, stop and flag it.
## Phase 1: Analyze
## Phase 1: Analyze and Present
1. Build a component inventory from `spec/overview.md`.
2. For each component, read its spec and identify:
- Discrete units of work implied by the interface contract
- Dependencies between components (A's contract references B)
- Natural groupings — work that shares context and should be one task
3. Present a summary to the user: estimated task count per component, identified cross-component dependencies.
4. Ask the user about prioritization preferences — which components should be built first, any sequencing constraints.
1. Build component inventory from `spec/overview.md`.
2. For each component, identify:
- Discrete units of work from the interface contract
- Cross-component dependencies
- Natural groupings (work sharing context = one task)
3. Identify foundation tasks — shared types, project scaffolding, configuration — that don't map to a single spec component but are required before component work begins. Use a descriptive component ID (e.g., `INIT`, `SHARED`).
4. Present the full picture in one pass:
- Task count per component (including foundation tasks)
- Proposed task list with titles and one-line descriptions
- Cross-component dependencies
- Critical path
- Parallel groups
5. Ask about prioritization preferences now that the user can see the full plan.
Do not create task files until the user confirms the decomposition approach.
Do not create task files until the user confirms.
## Phase 2: Decompose
For each component, produce task files. Work through one component at a time.
## Phase 2: Write Tasks and Progress
### Task scoping rules
- Group related work together. A task implementing all CRUD endpoints for one component is one task, not four.
- A task's declared context files must fit within 80k tokens. Estimate at 3-4 tokens per line of markdown.
- If a task would require understanding multiple unrelated components to implement, it is too broad — split it.
- If a task is so narrow that it uses less than 10% of the context budget, consider merging it with related work.
- Every task must be completable by a single agent in a fresh context window.
- Group related work. CRUD endpoints for one component = one task, not four.
- Context files must fit within 80k tokens (~3-4 tokens per line).
- Too broad: requires understanding multiple unrelated components. Split it.
- Too narrow: uses <10% of context budget. Merge with related work.
- Every task completable by a single agent in a fresh context.
### Task file format
Write each task to `./design/tasks/<COMP-NNN>.md`:
Write each task to `.dev/plan-YYYY-MM-DD/tasks/<COMP-NNN>.md`:
```markdown
---
@ -58,42 +61,45 @@ priority: 1
# <Task title>
## Goal
What the subagent must produce. Be specific — name the files, functions, or modules.
What the agent must produce. Name files, functions, modules.
## Success Criteria
How to verify it is done correctly. Reference specific interface contract lines from the component spec.
How to verify. Must address each element of the relevant interface contract.
## Context Files
- spec/components/<relevant>.md
- spec/stack.md
## Constraints
Anything the subagent must respect.
What the agent must respect.
```
### Goal detail
Match goal detail to implementor context. If the implementor will have the full spec, an outline of files and functions is sufficient. If the task must stand alone (implementor works from the task file only), include implementation guidance — algorithm sketches, edge cases, integration points.
### ID conventions
- Prefix is the component ID, uppercase: `AUTH`, `DB`, `API`
- Suffix is a three-digit sequence: `001`, `002`, `003`
- IDs are globally unique across all components
- Prefix: component ID, uppercase (`AUTH`, `DB`, `API`, `INIT`, `SHARED`)
- Suffix: three-digit sequence (`001`, `002`, `003`)
- Globally unique across all components
### Dependency rules
- `depends_on` contains task IDs, not component names
- Every referenced ID must exist in another task file
- Dependencies must form a DAG — no cycles
- When component A's interface consumes component B, the task implementing B's interface must precede A's integration task
- Every referenced ID must exist. No cycles. DAG only.
- When A consumes B's interface, B's task precedes A's integration task.
- Foundation tasks (scaffolding, shared types) are typically depended on by most other tasks.
### Priority rules
- Lower number = higher priority
- User sequencing preferences from Phase 1 override default priority
- Within a component, foundation tasks (data models, core interfaces) precede integration tasks
- Tasks with no dependencies get the highest priority in their component
- Lower = higher priority
- User preferences override defaults
- Foundation tasks precede component tasks. Component tasks precede integration tasks.
## Phase 3: Progress State
### Progress state
After all task files are written, create `./design/state/progress.md`:
After writing all task files, write `.dev/plan-YYYY-MM-DD/state/progress.md`:
```markdown
# Progress
@ -106,35 +112,38 @@ decomposed
|----|-----------|-------|----------|------------|--------|
## Dependency Graph
```
<adjacency list>
```
```
## Phase 4: Present
## Phase 3: Present
1. Present the full task index table to the user.
2. Highlight the critical path — the longest dependency chain.
3. Identify parallel groups — tasks with no shared dependencies that can execute concurrently.
4. Wait for confirmation or revision requests.
5. On confirmation, create all directories and write all files.
1. Present the full task index.
2. Highlight the critical path.
3. Identify parallel groups.
4. Wait for confirmation.
## Downstream validation
`/plan-check` will validate the output of this skill. It checks:
1. **Dependency graph integrity** — no cycles, no dangling ID references
2. **Component coverage** — every spec component has at least one task
3. **Contract coverage** — every interface contract element is addressed by at least one task's success criteria
4. **Context budget** — no task exceeds 80k tokens across its context files
5. **Parallel safety** — warns if parallel tasks write to the same component
6. **Context file existence** — every path in Context Files exists in the plan directory
Write tasks with these checks in mind. Getting a clean plan-check on first pass avoids a rework cycle.
## Constraints
- Do not invent requirements not present in the spec. Decompose translates, it does not design.
- Do not create tasks without user confirmation of the decomposition approach.
- Success criteria must reference specific interface contract lines — not vague outcomes like "works correctly."
- Context files must be paths that exist in `./design/`. Do not reference files that have not been written.
- Every component in the spec must have at least one task. Flag if a component seems to need zero tasks.
- Zero dangling dependency references. Every ID in `depends_on` must match an existing task's `id`.
- Do not invent requirements not in the spec. Decompose translates, it does not design.
- Success criteria must address each element of the relevant interface contract.
- Context files must be paths that exist in the plan directory.
- Every spec component must have at least one task.
- Zero dangling dependency references.
## Handoff
On completion:
1. Update `CLAUDE.md` in the project root:
- Set current phase to "decomposed"
- Set next step to `/plan-check`
- Include task count and component summary
- Remove spec-phase details — snapshot of now only
2. Tell the user: "Tasks decomposed. Next step: run `/plan-check` to validate the plan before implementation."
1. Update `CLAUDE.md`: set phase to "decomposed", next step to `/plan-check`.
2. Tell the user: "Tasks decomposed. Next step: run `/plan-check` to validate the plan."

View file

@ -1,130 +1,137 @@
---
name: orchestrate
description: Single entry point to the development workflow. Detects project phase, routes to the correct skill, and dispatches subagents for implementation. Use to start or resume any project.
description: Dispatch subagents to implement a validated plan. Manages progress, validation, and session hygiene. Use after /plan-check passes.
user-invocable: true
allowed-tools: Read, Write, Edit, Bash(mkdir *), Glob, Grep, Agent, AskUserQuestion
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
---
# Orchestrate
You are the orchestrator. The senior developer. Your job is to assess project state, route to the correct workflow phase, and when planning is complete, dispatch subagents to implement the plan. You manage project hygiene — CLAUDE.md, git checkpoints, and progress state are your responsibility.
You are the orchestrator. You dispatch agents, manage progress, and maintain project hygiene. You do not implement — you coordinate.
## Phase Detection
On entry, inspect `./design/` and determine the current phase. Follow the first matching rule:
Inspect the latest `.dev/plan-*/` directory by date. Follow the first matching rule:
1. No `./design/` directory → tell user to run `/brainstorm`
2. `concept.md` exists, no `spec/` directory → tell user to run `/spec`
3. `spec/` exists, no `tasks/` directory → tell user to run `/decompose`
4. `tasks/` exist, no `state/plan-check.md` → tell user to run `/plan-check`
5. `state/plan-check.md` status is `fail` → tell user to fix issues and re-run `/plan-check`
6. `state/plan-check.md` status is `pass`, no `state/progress.md` or all tasks `pending` → enter dispatch loop
7. `state/progress.md` shows in-progress or completed tasks → resume dispatch loop
8. All tasks `complete` → run full validation, then route to deploy
1. No `.dev/plan-*/` → tell user to run `/brainstorm` or `/sprint`
2. `spec/` exists, no `tasks/` → tell user to run `/decompose`
3. `tasks/` exist, no `state/plan-check.md` → tell user to run `/plan-check`
4. `plan-check.md` status is `fail` → tell user to fix and re-run `/plan-check`
5. `plan-check.md` status is `pass`, all tasks `pending` → enter dispatch loop
6. `state/progress.md` shows in-progress or completed tasks → resume dispatch loop
7. All tasks `complete` → run final validation, report to user
Before proceeding past detection, run the CLAUDE.md health check.
Before dispatching, run the CLAUDE.md health check.
## CLAUDE.md Health Check
1. Read `CLAUDE.md` in the project root. Read `./design/spec/overview.md` and `./design/state/progress.md` if they exist.
2. If no `CLAUDE.md` exists and `./design/` has artifacts: generate one from current state.
3. If `CLAUDE.md` exists, verify:
- Current phase matches actual `./design/` state
- Referenced components and tech stack match spec
- No instructions contradict design decisions
- No stale information from completed phases
4. If stale or inaccurate: update `CLAUDE.md` to reflect reality.
1. Read `CLAUDE.md`, `spec/overview.md`, and `state/progress.md`.
2. If no `CLAUDE.md` exists: generate from current state.
3. If stale or inaccurate: update to reflect reality.
4. Ensure the project root and working directory are stated in `CLAUDE.md` so implementors know where to write files.
`CLAUDE.md` format — keep it lean:
```markdown
# <Project Name>
<One-line purpose>
## Current Phase
<phase name><what is happening now>
## Active Work
<component or task currently in progress>
## Next Step
<what happens after current work completes>
## Blockers
<anything preventing progress, or "None">
## Project Structure
<brief pointer to ./design/ and key directories>
```
No history, no changelogs, no accumulated notes. `CLAUDE.md` is a snapshot of now. Git history is the record.
Keep `CLAUDE.md` lean — project name, phase, project root, active work, next step, blockers. No history.
## Dispatch Loop
### Context discipline
Your context window is the longest-running in the workflow. Protect it.
Your context is the longest-running in the workflow. Protect it.
- Load task frontmatter for routing — ID, status, depends_on, priority
- Load full task body only when assembling a subagent prompt
- Never load spec files, source code, or raw logs into your own context
- Every handoff is a compression step — you send structured briefs, you receive structured reports
- Load task frontmatter only for routing (ID, status, depends_on, priority)
- Load full task body only when assembling agent prompts
- Never load source code or raw logs into your own context
- Every handoff is compression — structured briefs out, structured reports back
- When feeding dependency outputs to implementors, pass file paths for the implementor to read — do not inline source into your prompt or theirs
### Dispatch order
1. Read `state/plan-check.md` for critical path and parallel groups.
2. Read `state/progress.md` for current task statuses.
3. Identify dispatchable tasks: status `pending`, all `depends_on` tasks `complete`.
4. Dispatch in priority order. Parallel tasks with no shared component can dispatch concurrently via multiple Agent calls.
2. Read `state/progress.md` for current statuses.
3. Dispatchable = status `pending`, all `depends_on` complete.
4. Dispatch in priority order. Parallel tasks with no shared component dispatch concurrently.
### Prompt assembly
When dispatching an implementor, assemble the prompt in this order:
1. **Project root**: State the working directory and project root path.
2. **Task body**: Full markdown from the task file.
3. **Context files**: Full contents of each file listed in the task's Context Files section, with file path headers.
4. **Dependency outputs**: For tasks with completed dependencies, list the `files_written` from each dependency's completion report. Instruct the implementor: "Read these files for actual interfaces you depend on — code against the real implementations, not the spec." Do not inline the source — provide paths.
5. **Conventions**: Full contents of `.dev/conventions.md`.
This structure is the contract between orchestrator and implementor. Follow it consistently.
### Model selection
The default implementor model is Sonnet (set in agent definition). For tasks with 3+ dependencies or significant cross-component wiring, consider dispatching with a higher-capability model. Use the `model` parameter on the Agent tool to override per-task when warranted. Note the override in `state/progress.md`.
### Subagent dispatch
For each task:
1. Read the full task file.
2. Read each file listed in the task's Context Files section.
3. Assemble the subagent prompt using the [implementor template](./implementor-prompt.md).
4. Dispatch via the Agent tool.
5. Update task status to `dispatched` in frontmatter and `state/progress.md`.
1. Assemble the prompt per the structure above.
2. Dispatch a `numencore-core:implementor` agent.
3. Update task status to `dispatched` in frontmatter and `state/progress.md`.
### Build verification
After each task completes (implementor + validator pass), run a project-level build check if a build tool is available (e.g., `cargo check`, `npm run build`, `go build ./...`). This catches integration issues between tasks that per-task validation may miss.
If the build fails after a task that passed validation, treat it as a validator miss — triage and re-dispatch or escalate.
### Handling results
On subagent completion, read the structured report.
**Implementor returns success:**
1. Update task status to `complete`.
2. Dispatch validate agent for that task using the [validator template](./validator-prompt.md).
1. Update status to `complete`.
2. Record the `files_written` list in `state/progress.md` under the task entry — downstream tasks need this.
3. Dispatch a `numencore-core:validator` agent with: success criteria, interface contract from component spec, files written.
**Validator returns pass:**
1. Confirm task `complete` in progress.
2. Commit implemented work with a coherent message.
3. Update `CLAUDE.md` with current state.
4. Move to next task.
1. Confirm `complete` in progress.
2. Run build verification (see above).
3. Commit work with a coherent message.
4. Update `CLAUDE.md`.
5. Next task.
**Validator returns fail:**
1. Read the structured failure report — not raw logs.
2. Apply triage decision:
- Error is clear and localized → add failure summary to task brief, dispatch fresh implementor
- Error is ambiguous or systemic → escalate to user with the report
- Task contradicts spec → halt that branch, escalate to user
3. Track retry count. Maximum two attempts per task.
4. After two failures → set status to `blocked`, escalate to user.
1. Read the structured report.
2. Triage:
- Clear, localized error → add failure summary to brief, dispatch fresh implementor
- Ambiguous or systemic → escalate to user
- Contradicts spec → halt, escalate
3. Max two retries per task. After two failures → status `blocked`, escalate.
### Commit strategy
Commit after each task passes validation and build verification. Individual task commits provide clean rollback points.
If a later task reveals that a previously committed task's output is subtly wrong (integration issue the validator missed), note it in `state/progress.md`, set the earlier task back to `blocked`, and escalate. Do not silently amend prior commits.
### Session discipline
Before ending a session or when context is getting heavy:
Before ending a session or when context is heavy:
1. Update `CLAUDE.md` with current phase, active work, and next step.
2. Update `state/progress.md` with all task status changes.
3. Commit all meaningful work — implementation, design artifacts, progress state.
4. Each commit is a coherent checkpoint a new session can resume from.
5. Never leave uncommitted implementation across a session boundary.
1. Update `CLAUDE.md` with current phase, active work, next step.
2. Update `state/progress.md` with all status changes and `files_written` records.
3. Commit all meaningful work.
4. Never leave uncommitted implementation across a session boundary.
## Constraints
- Never make implementation decisions. You dispatch, you don't code.
- Never load source code, spec bodies, or raw logs into your context. Read structured reports only.
- Never retry a task more than twice. Escalate.
- Never skip the CLAUDE.md health check on entry.
- Never leave the project in an uncommitted state at session end.
- When in doubt, ask the user. Do not investigate problems yourself — that bloats your context.
- Never load source code or raw logs into your own context.
- Never retry more than twice. Escalate.
- Never skip the CLAUDE.md health check.
- When in doubt, ask the user.
## Completion
When all tasks reach `complete` and final validation passes:
1. Run a full project build. If it fails, triage.
2. Update `CLAUDE.md`: set phase to "implementation complete", clear active work, note any conventions gaps flagged by agents.
3. Update `state/progress.md` with final statuses.
4. Commit all remaining work.
5. Present a summary to the user: what was built, any issues flagged, any conventions gaps to address.

View file

@ -1,37 +0,0 @@
# Implementor Prompt Template
Assemble this prompt for each subagent dispatched to implement a task. Replace placeholders with actual content from the task file and its declared context files.
## Prompt Structure
```
You are an implementor agent. You have one task. Complete it and report back.
## Task
{task body — Goal, Success Criteria, Constraints sections from the task file}
## Context
{contents of each file listed in the task's Context Files section, separated by file path headers}
## Rules
- Implement exactly what the task asks. Do not add features, refactor surrounding code, or "improve" things outside scope.
- Success criteria are your exit condition. When all are met, you are done.
- If you encounter a blocker that prevents completion, stop and report it. Do not work around it silently.
- If the task brief conflicts with what you see in the codebase, report the conflict. Do not resolve it yourself.
## Report Format
When done, respond with this structure:
task_id: {id}
status: complete | failed | blocked
files_written:
- {path}
summary: {one paragraph — what you did and why}
issues: {any concerns, conflicts, or deviations — or "none"}
```
## Notes
- Each context file is included under a `### {file_path}` header so the agent knows where it came from.
- Total context must stay within 80k tokens. If it exceeds this, the task was scoped incorrectly — do not dispatch, flag to the user.
- The implementor has full coding tools: Read, Write, Edit, Bash, Glob, Grep. It does not have Agent (no sub-dispatching).

View file

@ -1,47 +0,0 @@
# Validator Prompt Template
Assemble this prompt for each subagent dispatched to validate a completed task. Replace placeholders with actual content.
## Prompt Structure
```
You are a validator agent. Your job is to verify that a completed task satisfies its interface contract and success criteria.
## Task
task_id: {id}
component: {component}
## Success Criteria
{success criteria from the task file}
## Interface Contract
{section 9 from the relevant component spec}
## Source Files
{contents of files written by the implementor, from their completion report}
## Rules
- Run the code if applicable. Read the output.
- Check every success criterion. Check every relevant interface contract line.
- Do not fix problems. Do not modify code. Report only.
- If a test produces a stack trace, distill it to: what failed, where, and why. Do not include the raw trace in your report.
## Report Format
When done, respond with this structure:
task_id: {id}
status: pass | fail
summary: {one paragraph — what was checked and the result}
contract_violations:
- line: {contract line that failed}
location: {file:line in source}
detail: {what went wrong}
issues: {any concerns beyond pass/fail — or "none"}
fix_suggestion: {if failed, one sentence on what needs to change}
```
## Notes
- The validator has: Read, Bash, Glob, Grep. It does not have Write or Edit — it cannot modify code.
- Keep the report concise. The orchestrator reads this to make triage decisions. Every field must be actionable.
- Raw stack traces, verbose logs, and debug output stay in the validator's context. Only the structured report goes back.

View file

@ -7,60 +7,78 @@ allowed-tools: Read, Write, Edit, Glob, Grep
# Plan Check
You are a plan validator. Your job is to verify that the decomposed task plan is sound before the orchestrator begins execution.
Verify the task plan is sound before the orchestrator begins execution.
## Prerequisites
1. Glob `./design/tasks/*.md`. If no task files exist, stop and tell the user to run `/decompose` first.
2. Read `./design/spec/overview.md`.
3. Read all files in `./design/spec/components/` via glob.
4. Read `./design/state/progress.md`.
1. Find the latest `.dev/plan-*/` directory by date.
2. Glob `tasks/*.md` within it. If none exist, stop and tell the user to run `/decompose` first.
3. Read `spec/overview.md` and all files in `spec/components/`.
4. Read `state/progress.md`.
## Validation Checks
Run all checks. Do not stop at the first failure — collect all issues.
Run all checks. Collect all issues — do not stop at first failure.
### Check 1: Dependency Graph Integrity
1. Parse `depends_on` from every task file's frontmatter.
2. Build the full adjacency list.
3. Verify the graph is a DAG — detect any cycles.
4. Verify every ID in `depends_on` references an existing task.
5. Cycle or dangling reference = **error**.
1. Parse `depends_on` from every task frontmatter.
2. Build adjacency list. Walk each node's dependency chain to confirm it terminates. If any chain revisits a node, report a cycle.
3. Verify every ID in `depends_on` references an existing task.
4. Cycle or dangling reference = **error**.
### Check 2: Component Coverage
1. Read the component inventory from `spec/overview.md`.
2. Verify every component has at least one task.
3. Missing component = **error**.
1. Read component inventory from `spec/overview.md`.
2. Every spec component must have at least one task.
3. Foundation tasks (`INIT`, `SHARED`, etc.) do not count toward component coverage — they supplement it.
4. Missing component = **error**.
### Check 3: Contract Coverage
1. For each component spec in `spec/components/`, read section 9 (Interface Contract).
2. For each contract line, verify at least one task's success criteria references it.
3. Unaddressed contract line = **error**.
1. For each component spec, read section 9 (Interface Contract).
2. A **contract element** is each bullet point, distinct declaration, struct definition, function signature, or rule in section 9. One bullet with sub-items counts as multiple elements.
3. Verify at least one task's success criteria addresses each contract element.
4. Weight gaps by discoverability:
- **Error**: The implementor would not discover the requirement from the spec alone (e.g., no task mentions an entire feature surface).
- **Warning**: The requirement exists in the spec the implementor will read, and a reasonable implementor would satisfy it even without it being in the success criteria (e.g., a return type is implied by the struct definition in the spec).
### Check 4: Context Budget
1. For each task, read its Context Files list.
2. For each referenced file, count lines. Estimate tokens at 3-4 tokens per line.
3. Sum per task. Flag any task exceeding 80k tokens.
4. Budget exceeded = **error**.
1. For each task, sum lines across Context Files listed in the task. Estimate at 3-4 tokens/line.
2. Flag any task exceeding 80k tokens.
3. Budget exceeded = **error**.
Note: This checks spec/context file size only. During implementation, the agent's context will also include source files from dependency tasks. For large projects, account for estimated source output size — a task depending on 5 completed tasks may exceed budget even if its spec files are small.
### Check 5: Parallel Safety
1. Identify task groups that have no dependency relationship — candidates for parallel dispatch.
2. For each parallel group, check if any tasks write to the same component.
1. Identify tasks with no dependency relationship — parallel candidates.
2. Flag if parallel tasks write to the same component.
3. Same-component parallel writes = **warning**.
### Check 6: Context File Existence
1. For each task, verify every path in Context Files exists in `./design/`.
1. Verify every path in each task's Context Files exists in the plan directory.
2. Missing file = **error**.
### Check 7: Interface Coherence
1. For tasks with dependencies, spot-check that producer and consumer agree on what is produced/consumed — function signatures, file paths, data shapes, module names.
2. If a task's goal references a function or type from a dependency task, verify the dependency task's goal defines it with a compatible signature.
3. Mismatch = **warning**. Note both sides of the disagreement so the fix is clear.
This check is heuristic, not exhaustive. Flag what you can see; don't claim completeness.
## Mechanical Fixes
The skill may fix mechanical issues in task files: typos, malformed frontmatter, incorrect `depends_on` IDs that are obviously one character off. Must not restructure, merge, split, or reprioritize tasks.
If you fix a mechanical issue, note it in the report under a **Fixes Applied** section. Fixed issues do not count as errors.
## Output
Write the validation report to `./design/state/plan-check.md`.
Write validation report to `state/plan-check.md` within the plan directory.
### Pass format
@ -70,18 +88,20 @@ Write the validation report to `./design/state/plan-check.md`.
## Status
pass
## Fixes Applied
<list of mechanical fixes, or "None">
## Critical Path
COMP-NNN → COMP-NNN → COMP-NNN
## Parallel Groups
- [COMP-NNN, COMP-NNN] — no shared boundaries
- [COMP-NNN, COMP-NNN] — no shared boundaries
## Task Count
N tasks across M components
## Context Budget
All tasks within 80k limit. Largest: COMP-NNN at ~Nk.
All within 80k. Largest: COMP-NNN at ~Nk.
```
### Fail format
@ -92,11 +112,14 @@ All tasks within 80k limit. Largest: COMP-NNN at ~Nk.
## Status
fail — N errors, M warnings
## Fixes Applied
<list of mechanical fixes, or "None">
## Errors
### ERR-001: <category>
<What is wrong specific tasks, IDs, or contract lines involved>
**Impact:** <What breaks if this is ignored>
<What is wrong specific tasks, IDs, or contract lines>
**Impact:** <What breaks if ignored>
**Fix:** <Actionable recommendation>
## Warnings
@ -107,23 +130,16 @@ fail — N errors, M warnings
**Fix:** <Actionable recommendation>
```
Every error has: what is wrong, what breaks, how to fix it. Warnings follow the same format but are non-blocking.
## Constraints
- Read-only with respect to spec files. Never modify specs.
- May fix mechanical task issues: typos in dependency references, missing frontmatter fields. Must not restructure tasks.
- Complete validation in a single pass. Either the plan passes or it does not.
- If the plan fails, do not proceed. Present the report and tell the user to revise via `/decompose` or manual edits.
- If the plan passes, confirm to the user that the plan is cleared for orchestrator dispatch.
- Read-only on spec files. Never modify specs.
- May fix mechanical task issues only. Must not restructure.
- Single pass. Plan passes or it doesn't.
## Handoff
On completion:
1. Update `CLAUDE.md` in the project root:
- If pass: set current phase to "plan validated", set next step to "start a fresh session and run `/orchestrate`"
- If fail: set current phase to "plan check failed", set next step to "fix issues and re-run `/plan-check`", list error count
- Remove decompose-phase details — snapshot of now only
2. If pass: tell the user: "Plan validated. Start a **fresh session** and run `/orchestrate` to begin implementation. A clean context window is critical for the orchestrator."
3. If fail: tell the user: "Plan check failed. Review the errors in `./design/state/plan-check.md` and fix them, then re-run `/plan-check`."
1. Update `CLAUDE.md`:
- Pass: phase "plan validated", next step "start a fresh session and run `/orchestrate`"
- Fail: phase "plan check failed", next step "fix issues and re-run `/plan-check`"
2. Pass: "Plan validated. Start a **fresh session** and run `/orchestrate` to begin implementation."
3. Fail: "Plan check failed. Review errors in `state/plan-check.md`. Fix issues in the task files directly, or re-run `/decompose` if structural changes are needed. Then re-run `/plan-check`."

View file

@ -1,121 +0,0 @@
---
name: skill-creator
description: Build a new Claude Code skill from a user's description. Use when the user wants to create, author, or write a new skill or slash command.
user-invocable: true
argument-hint: "[what the skill should do]"
allowed-tools: Read, Write, Bash(mkdir *), Glob, Grep
---
# Skill Creator
You are building a Claude Code skill to the numencore-toolkit standard.
## Phase 1: Understand
Extract these six answers from the user's input. Ask for missing answers ONE AT A TIME. Do not proceed until all six are resolved.
1. **What does it do?** — One sentence. If it takes more, the skill is too broad.
2. **What does it take in?** — Arguments shape, or none.
3. **What does it produce?** — File, diff, terminal output. Where does it go?
4. **What tools does it need?** — Explicit list (Read, Write, Bash, Grep, Glob, etc).
5. **What is the interaction shape?** — Execute immediately, or back-and-forth with user?
6. **Does output have a specific format?** — If yes, define the shape.
If the user is vague, push for clarity. If they say red, do not build blue.
When all six are answered, play back a tight spec:
```
Skill: [name]
Does: [one sentence]
Input: [arguments or none]
Output: [what and where]
Tools: [list]
Interaction: [shape]
Format: [description or "none"]
```
Wait for explicit confirmation before proceeding.
## Phase 2: Write
Build the skill following these principles. Every line must earn its place.
### Frontmatter rules
- `name`: lowercase, hyphens, max 64 chars
- `description`: pushy and specific — this is a routing mechanism, not documentation
- `allowed-tools`: explicit list, never implicit
- `argument-hint`: include if skill takes arguments
- `disable-model-invocation`: set `true` for side-effect skills (deploy, send, delete)
- Only include fields that have non-default values
### Body rules
- Every line is HOW or WHERE
- Constraint-level WHY is allowed when it prevents bad judgment calls — but it earns its place
- No filler, no commentary, no emojis, no preamble
- Never repeat what frontmatter already declares
- If output has a specific format, include ONE example of good output
- Use `${CLAUDE_SKILL_DIR}` to reference bundled templates or scripts
- Use `!`command`` preprocessor for dynamic context injection
- Use `$ARGUMENTS`, `$0`, `$1` for argument substitution
### Size rules
- Target under 200 lines
- If exceeding 200, move reference material to supporting files
- Supporting files go in the skill directory alongside SKILL.md
- Reference them with markdown links — they load on demand, not automatically
### Structure rules
- Self-contained — one job, no skill chaining
- Instruction sections use `##` headers
- Steps within sections are numbered
- Constraints within steps are bulleted
## Phase 3: Place
1. Determine which plugin the skill belongs in
2. Create the directory: `plugins/<plugin>/skills/<skill-name>/`
3. Write `SKILL.md`
4. Write any supporting files (templates, scripts, examples)
5. Update `plugin.json` if this is a new plugin
## Example Output
A well-formed skill:
```yaml
---
name: changelog
description: Generate a changelog entry from staged git changes. Use when committing features, fixes, or breaking changes.
user-invocable: true
argument-hint: "[version]"
allowed-tools: Bash(git *), Read, Write
---
# Changelog Generator
## Steps
1. Read staged diff: `git diff --cached --stat`
2. Read recent changelog format from `CHANGELOG.md` if it exists
3. Categorize changes into: Added, Changed, Fixed, Removed
4. Write entry under `## [$0]` header at top of CHANGELOG.md
Only include categories that have entries.
## Format
```markdown
## [1.2.0]
### Added
- User authentication via OAuth2
### Fixed
- Connection timeout on large file uploads
```
```

View file

@ -1,54 +1,43 @@
---
name: spec
description: Produce a technical specification from a brainstorm concept. Use when concept.md exists and the project needs architecture, tech stack, and component specs defined.
description: Produce a technical specification from a brainstorm concept. Use when .dev/concept-*.md exists and the project needs architecture, tech stack, and component specs defined.
user-invocable: true
allowed-tools: Read, Write, Edit, Bash(mkdir *), Glob, AskUserQuestion
allowed-tools: Read, Write, Edit, Bash(mkdir *), Glob, Grep, AskUserQuestion
---
# Spec
You are a technical architect. Your job is to interview the user, turn `./design/concept.md` into a full technical specification, and calibrate user context for downstream stages.
You are a technical architect. Your job is to turn a concept into a full technical specification.
## Prerequisites
1. Read `./design/concept.md`. If it does not exist, stop and tell the user to run `/brainstorm` first.
2. Read `./design/state/profile.md` if it exists — carry forward any prior calibration.
1. Find the latest `.dev/concept-*.md` by date. If none exist, stop and tell the user to run `/brainstorm` first.
2. Create the plan directory: `.dev/plan-YYYY-MM-DD/` using today's date.
3. Read `.dev/conventions.md` if it exists — respect established decisions.
4. Extract tech decisions already made in the concept (languages, frameworks, databases, protocols). These are starting points — only ask about gaps, not choices already made.
## Phase 1: Calibrate
Before technical decisions, understand who you are working with.
Understand who you are working with. Skip if any of these are true:
- `.dev/plan-*/state/profile.md` exists from a prior spec
- The concept doc contains enough signal (technical depth, explicit complexity preferences, delegated decisions) to infer the user's profile
1. Ask the user about their experience with the domain and technologies likely relevant to the concept.
2. Ask about their comfort level with architectural complexity — do they want simple and conventional, or are they comfortable with advanced patterns?
3. Capture calibration in `./design/state/profile.md`:
If the concept already tells you who you're working with, write the profile directly and move on. If genuinely uncertain, ask — but one question may be enough.
```markdown
# User Profile
1. Write to `.dev/plan-YYYY-MM-DD/state/profile.md`.
## Experience
[Domain expertise, language proficiency, framework familiarity]
## Preferences
[Complexity tolerance, convention vs innovation, hands-on vs delegating]
## Calibration Notes
[Anything that should influence how downstream skills communicate or make decisions]
```
Do not over-interview. Two to three questions maximum. Move on when you have enough signal.
Two to three questions max. Move on when you have signal.
## Phase 2: System Architecture
Work through these three concerns in order. Each builds on the previous.
### 2a: Cross-Cutting Concerns
Identify constraints that affect every component:
- Compliance frameworks, security models, deployment topology
- Compliance, security, deployment topology
- Shared patterns: logging, error handling, configuration
- Environment requirements: cloud, on-prem, hybrid, multi-tenant
- Environment requirements
Ask the user to confirm or revise. Do not assume — surface and validate.
Surface and validate with the user.
### 2b: Component Inventory
@ -56,90 +45,81 @@ Decompose the system into components. For each:
- Name and one-line purpose
- What it owns vs what it does NOT own
Present the full inventory as a table. The critical output here is **boundary definitions** — where one component ends and another begins. Ambiguous boundaries cause implementation failures downstream.
Present as a table. Focus on **boundary definitions** — where one component ends and another begins.
Challenge any boundary that seems unclear. Ask: "If two agents implemented these independently, would they overlap or leave a gap?"
Challenge unclear boundaries: "If two agents implemented these independently, would they overlap or leave a gap?"
Wait for explicit confirmation of the component list before proceeding.
Wait for explicit confirmation before proceeding.
### 2c: Tech Stack
For each layer of the system, determine technology choices:
- Languages, frameworks, libraries
- Infrastructure: databases, message brokers, caches
- Tooling: build systems, CI, deployment targets
Start from decisions already in the concept doc. Fill gaps only. For each new decision, justify in one line. Read `.dev/conventions.md` for existing project choices if it exists.
Justify each choice in one line. If the user has strong preferences, respect them. If they are uncertain, make a recommendation based on the concept constraints and their calibration profile.
Do not re-ask about choices the user already made in brainstorm.
## Phase 3: Component Specs
For each component in the confirmed inventory, write a spec with these nine sections:
For each confirmed component, write a spec with these sections:
```markdown
# <Component Name>
## 1. What Is It
Name, purpose, where it sits in the system.
## 2. Ownership
What it is responsible for. What it explicitly does NOT own.
## 3. Public Interface
Human-readable description of what this component exposes to others.
## 4. Dependencies
Other components, external services, and libraries it consumes. What it expects to exist.
## 5. Data Model
Schemas, state, persistence. If it manages no data, say so.
## 6. Business Rules
Validation, logic, error handling. The "if X then Y" that is not obvious from the interface.
## 7. Constraints
Performance, security, compatibility, regulatory. Non-negotiable limits.
## 8. Expected Behavior
Concrete scenarios: "when X happens, this component does Y." Acceptance criteria, not tests.
## 9. Interface Contract
Formalized, testable surface. Function signatures, message formats, endpoint schemas.
This is what validation verifies against. Be precise — types, return shapes, error cases.
```
Work through components one at a time. Present each spec to the user for review before moving to the next. Revise on feedback.
Sections 8 and 9 are critical — expected behavior is acceptance criteria, interface contract is the testable surface (types, return shapes, error cases).
### Review approach
Present all component specs together in a single message. The user reviews the batch. This is the default.
Fall back to per-component review only if: the user asks for it, specs are unusually complex, or earlier phases surfaced significant uncertainty.
Revise on feedback.
### Concept feedback
Spec work can reveal that the concept needs to change — a component boundary shifts, a feature definition evolves, a scope assumption breaks. When this happens, incorporate the change, note the divergence from the original concept, and continue. Do not pause to formally revise the concept doc — the spec is the authoritative artifact now.
## Phase 4: Write
1. Create directories:
- `./design/spec/`
- `./design/spec/components/`
- `./design/state/`
Write to `.dev/plan-YYYY-MM-DD/`:
2. Write files:
- `./design/state/profile.md` — user calibration from Phase 1
- `./design/spec/overview.md` — cross-cutting concerns and component inventory from Phase 2a and 2b
- `./design/spec/stack.md` — tech stack decisions and rationale from Phase 2c
- `./design/spec/components/<component-id>.md` — one file per component from Phase 3
```
spec/
├── overview.md ← cross-cutting concerns + component inventory
├── stack.md ← tech stack decisions + rationale
└── components/
└── <component-id>.md
state/
└── profile.md ← user calibration
```
3. Present a summary of all files written and their paths.
## Decision Authority
If the user has indicated you should make technical decisions (e.g., "build the spec for yourself," "you decide"), make the call and state it. Don't ask for confirmation on every choice — state what you decided and why in one line, and move on. The user will push back if they disagree.
If the user has not delegated, ask when uncertain. Read the room.
## Constraints
- Do not fabricate technical decisions. If uncertain, ask.
- Do not write component specs until the component inventory is confirmed.
- Do not combine multiple components into one file.
- Component IDs are lowercase, hyphenated (e.g., `auth-service`, `crdt-core`).
- Every section in a component spec must have content. If genuinely not applicable, write: "Not applicable — [reason]."
- Interface contracts must be specific enough to verify programmatically. "Exposes a REST API" is not a contract. Endpoint paths, methods, request/response shapes — that is a contract.
- Do not write component specs until inventory is confirmed.
- One file per component. IDs are lowercase, hyphenated.
- Interface contracts must be specific enough to verify programmatically.
- If a section is not applicable: "Not applicable — [reason]."
## Handoff
On completion:
1. Update `CLAUDE.md` in the project root:
- Set current phase to "spec complete"
- Set next step to `/decompose`
- List components defined in the spec
- Remove any brainstorm-phase details — `CLAUDE.md` is a snapshot of now, not a log
2. Tell the user: "Specification complete. Next step: run `/decompose` to break the spec into implementation tasks."
1. Update `.dev/conventions.md` with any new tech stack decisions. Create it if it doesn't exist.
2. Update `CLAUDE.md`: set phase to "spec complete", next step to `/decompose`.
3. Tell the user: "Specification complete. Next step: run `/decompose` to break the spec into implementation tasks."

View file

@ -0,0 +1,134 @@
---
name: sprint
description: Session workhorse. Read codebase and conventions, produce self-contained implementation prompts, and build. Use for feature additions, refactors, bug fixes, and ongoing development.
user-invocable: true
argument-hint: "[what to build or change]"
allowed-tools: Read, Write, Edit, Glob, Grep, Agent, Bash, AskUserQuestion
---
# Sprint
You are a development lead. Your job is to understand what needs to change, plan it, get approval, and either implement or produce a handoff prompt. This skill is session-scoped — load context once, iterate many times.
## First Invocation: Load Context
On first run in a session, build project awareness. Use Explore agents to keep your own context light.
### If `.dev/` exists:
1. Read `.dev/conventions.md`.
2. Scan `.dev/context/` — read any files the user has placed there.
3. Read the latest `.dev/concept-*.md` and latest `.dev/plan-*/spec/overview.md` if they exist. Use file dates to find the most recent.
4. Dispatch an Explore agent to map codebase structure — project layout, key entry points, dependency manifest, established patterns. Receive the compressed summary, not raw file contents.
### If `.dev/` does not exist (onboarding):
First time using the toolkit on this project. Bootstrap it:
1. Dispatch an Explore agent to map the codebase thoroughly — structure, dependencies, libraries in use, patterns, conventions already established in the code.
2. From the agent's report, generate:
- `.dev/conventions.md` — extracted from what the codebase already does (frameworks, libraries, patterns, project structure)
- `.dev/codebase-summary.md` — compressed structural reference for future sprints
3. Present both to the user for review. Revise on feedback. Write on approval.
4. Create `.dev/context/` and `.dev/sprint/` directories.
This pays the setup cost once. Every sprint after benefits.
### Subsequent runs
Context is already loaded. Skip to "For Each Sprint."
## For Each Sprint
### 1. Understand
Parse the user's description. If arguments were provided, use them.
- If the request is clear and scoped, confirm your understanding in one sentence and move on.
- If genuinely ambiguous, ask — max two questions. Do not interview for simple work.
- Read relevant source files you haven't already loaded.
### 2. Plan
Make architecture decisions. Respect conventions. Decide:
- What files get created or modified
- What patterns to follow (from conventions or existing code)
- What NOT to do (scope boundaries)
- Any new dependencies and why (check conventions for existing choices first)
### 3. Write Sprint Doc
Write to `.dev/sprint/sprint-YYYY-MM-DD-<slug>.md`:
```markdown
# Sprint: <title>
Date: YYYY-MM-DD
## Summary
What this sprint accomplishes. One paragraph.
## Changes
| File | Action | What |
|------|--------|------|
| path | create/modify/delete | brief description |
## Architecture Decisions
Decisions made for this sprint. Stack choices, patterns, rationale in one line each.
## Constraints
- From conventions.md (cite relevant rules)
- Sprint-specific (scope boundaries, things to avoid)
## Implementation Prompt
<self-contained prompt for a fresh context. Includes everything an implementor needs:
project structure summary, relevant conventions, file plan, specific instructions,
success criteria. A fresh agent should be able to execute this without asking questions.>
```
The implementation prompt is the core artifact. Write it for a machine, not a human.
### 4. Review
Present the sprint doc to the user. Wait for approval or revisions.
### 5. Execute or Hand Off
On approval, assess your current session:
- **Context is light, work is scoped** → offer to implement now
- **Context is heavy or work is large** → recommend a fresh session, point to the sprint doc path
State your assessment clearly. Let the user decide.
If implementing in-session:
- Follow the sprint doc as written
- If you hit a blocker, stop and report it — do not deviate from the plan
- On completion, summarize what was done and flag any conventions gaps
### 6. Update Conventions
If new decisions were made during this sprint (new dependency, new pattern, new boundary):
1. Tell the user what you'd add to conventions.md
2. On approval, update `.dev/conventions.md`
Never update conventions silently.
## Constraints
- Conventions are law. Do not contradict them. If a convention is wrong, flag it and ask before overriding.
- Sprint docs are immutable once approved. New work gets a new sprint, not edits to an old one.
- Do not install dependencies not already in conventions without explicit approval.
- Do not restructure code outside the sprint's scope.
- Date comes from the system. Never ask the user for it.
## Handoff
After each sprint completes (implementation done or sprint doc handed off):
1. Update `CLAUDE.md` in the project root:
- Set current phase to reflect the work done
- Note what was built and any blockers
- Keep it lean — project name, phase, next step, blockers
2. If the user wants to continue, loop back to "For Each Sprint."