internal/instructions/skills/kn-spec/SKILL.md
Use when creating a specification document for a feature (SDD workflow)
npx skillsauth add knowns-dev/knowns kn-specInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create a specification document for a feature using SDD (Spec-Driven Development).
Announce: "Using kn-spec to create spec for [name]."
Core principle: EXPLORE DECISIONS → SPEC → REVIEW → APPROVE → THEN PLAN TASKS.
--skip-explore to jump straight to spec writing (for trivial features)Extract decisions from the user BEFORE writing the spec. This prevents the agent from guessing wrong and writing a spec the user didn't want.
Assess from the request + a quick project scan:
--skip-explore).Classify what is being built — this determines which gray areas to probe:
| Type | What it is | Example | |------|-----------|---------| | SEE | Something users look at | UI, dashboard, layout | | CALL | Something callers invoke | API, CLI command, webhook | | RUN | Something that executes | Background job, script, service | | READ | Something users read | Docs, emails, reports | | ORGANIZE | Something being structured | Data model, file layout, taxonomy |
One feature can span types (e.g., SEE + CALL).
Generate 2–4 gray areas for this feature. A gray area is a decision that:
Quick codebase scout (grep only — no deep analysis):
mcp_knowns_search({ "action": "search", "query": "<feature keywords>", "type": "memory" })
Filter OUT:
Rules:
"More questions about [area], or move on? (Remaining: [unvisited areas])"
Scope creep response — when user suggests something outside scope:
"[Feature X] is a new capability — will be a separate work item. Noted. Back to [current area]: [question]"
Decision locking — after each gray area is resolved:
"Lock decision D[N]: [summary]. Confirmed?"
Assign stable IDs: D1, D2, D3... These IDs will be referenced in the spec.
After all gray areas resolved, summarize locked decisions:
Decisions locked:
- D1: [summary]
- D2: [summary]
- D3: [summary]
Writing spec based on these locked decisions...
If $ARGUMENTS provided, use it as spec name.
If no arguments, ask user:
What feature are you speccing? (e.g., "user-auth", "payment-flow")
Ask user to describe the feature:
Please describe the feature requirements. What should it do?
Listen for:
If requirements depend on large domain or architecture context:
@doc/<path> instead of dumping background material inlinemcp_knowns_docs({ "action": "create", "title": "<Feature Name>",
"description": "Specification for <feature>",
"folder": "specs",
"tags": ["spec", "draft"],
"content": "<spec content>"
})
Spec Template:
## Overview
Brief description of the feature and its purpose.
## Locked Decisions
Decisions extracted during exploring phase:
- D1: [Decision summary]
- D2: [Decision summary]
## Requirements
### Functional Requirements
- FR-1: [Requirement description]
- FR-2: [Requirement description]
### Non-Functional Requirements
- NFR-1: [Performance, security, etc.]
## Acceptance Criteria
- [ ] AC-1: [Testable criterion]
- [ ] AC-2: [Testable criterion]
- [ ] AC-3: [Testable criterion]
## Scenarios
### Scenario 1: [Happy Path]
**Given** [context]
**When** [action]
**Then** [expected result]
### Scenario 2: [Edge Case]
**Given** [context]
**When** [action]
**Then** [expected result]
## Technical Notes
Optional implementation hints or constraints.
## Open Questions
- [ ] Question 1?
- [ ] Question 2?
CRITICAL: After creating spec, validate to catch issues:
mcp_knowns_validate({ "entity": "specs/<name>" })
Present the spec and ask:
Please review this spec:
- Approve if requirements are complete
- Edit if you want to modify something
- Add more if requirements are missing
If approved:
mcp_knowns_docs({ "action": "update", "path": "specs/<name>",
"tags": ["spec", "approved"]
})
If edit requested: Update the spec based on feedback and return to Step 4.
If add more: Gather additional requirements and update spec.
All built-in skills in scope must end with the same user-facing information order: kn-init, kn-spec, kn-plan, kn-research, kn-implement, kn-verify, kn-doc, kn-template, kn-extract, and kn-commit.
Required order for the final user-facing response:
Keep this concise for CLI use. Skill-specific content may extend the key-details section, but must not replace or reorder the shared structure.
Out of scope: explaining, syncing, or generating .claude/skills/*. Runtime auto-sync already handles platform copies, so this skill source only defines the built-in output contract.
For kn-spec, the key details should cover:
If the spec uncovers cross-cutting or general knowledge work:
You MUST suggest the next action when a natural follow-up exists. User won't know what to do next.
After spec is approved:
✓ Spec approved: @doc/specs/<name>
Next step — choose one:
1. Task by task (review each step):
/kn-plan --from @doc/specs/<name>
2. Run all at once (auto pipeline, no review gates):
/kn-go specs/<name>
Option 1 (kn-plan --from):
/kn-plan <id> + /kn-implement <id> for each taskOption 2 (kn-go):
/kn-plan --from @doc/specs/<name> - Generate tasks from this spec (manual flow)/kn-go specs/<name> - Execute entire spec in one run (auto pipeline)/kn-plan <id> - Plan individual task/kn-verify - Verify implementation against spectesting
Use when running SDD verification and coverage reporting
development
Use when generating code from templates - list, run, or create templates
development
Use when reviewing implemented code before committing — multi-perspective review with severity-based findings
development
Use when you need to understand existing code, find patterns, or explore the codebase before implementation