cc-spec-driven — Prompts
Prompt 1: PostToolUse Hook — File Operation Enforcement
Source: .claude-plugin/hooks/hooks.json
Technique: LLM-evaluated prompt hook — the hook sends a structured analysis prompt to Claude, which evaluates the file operation and returns a JSON decision with an optional systemMessage.
{
"matcher": "Write|Edit",
"hooks": [{
"type": "prompt",
"prompt": [
"You are a spec-driven workflow guardian. Analyze the completed file operation and enforce subsequent steps.",
"",
"**File just written**: $TOOL_INPUT",
"**Operation result**: $TOOL_RESULT",
"",
"## Path Validity Check (Priority)",
"First check if the written file path is within the spec framework's managed scope.",
"Valid paths should contain one of these structures: features/, changes/, specs/, cases/, project.yaml, glossary.yaml, overview.md",
"",
"## Enforcement Rules",
"Based on file path patterns, output corresponding systemMessage reminder:",
"",
"### 4. CR Moved to archive/ (`changes/archive/CR-*.md`)",
"→ You are completing /dd-done. This is the most critical step, must:",
" - **Rebuild features/_deps.yaml**",
" - Delete all RC files",
" - Update changes/_index.yaml (status→done)",
" - Archive specs and cases",
" - Check referenced_by, promote cases to blessed/",
"",
"## Output Format",
"Return JSON: { \"continue\": true, \"systemMessage\": \"Matched rule reminder, empty if no match\" }"
],
"timeout": 30
}]
}
Notable technique: The hook is itself a prompt to Claude — the AI evaluates its own file operations and injects workflow rule reminders into its own context. This is "LLM enforces LLM" — unprecedented in the seed frameworks.
Prompt 2: Stop Hook — Checklist Validation
Source: .claude-plugin/hooks/hooks.json
Technique: LLM-evaluated blocking gate — the hook presents a checklist to Claude and asks it to decide whether to approve or block the Stop event.
{
"matcher": "*",
"hooks": [{
"type": "prompt",
"prompt": [
"You are a spec-driven workflow completion validator. Before Claude stops, verify if the operation is complete.",
"",
"## Check Items",
"### /dd-done (Most Critical)",
"- [ ] RC files have been merged and deleted",
"- [ ] **features/_deps.yaml has been rebuilt**",
"- [ ] CR has been moved to archive/",
"- [ ] changes/_index.yaml status = done",
"- [ ] specs and cases have been archived",
"",
"## Output Format",
"Return JSON: { \"decision\": \"approve|block\", \"reason\": \"...\", \"systemMessage\": \"...\" }",
"",
"## Judgment Rules",
"- /dd-* operation detected but steps incomplete → block",
"- No /dd-* operation or all complete → approve",
"- Uncertain → approve (don't block non-framework operations)"
],
"timeout": 30
}]
}
Notable technique: The Stop hook uses "decision": "block" to prevent Claude from completing — a verifiable completion gate enforced by LLM reasoning, not shell logic.
Prompt 3: SessionStart Hook — Environment Check
Source: .claude-plugin/hooks/hooks.json
Technique: Proactive context validation — checks for project.yaml existence at session start and warns if not found.
The hook instructs Claude to output a warning message if project.yaml doesn't exist, directing users to run /dd-init. Silently passes if the product directory is valid.