AgentSkillsCN

speckit-generator

以项目为中心的规范与任务管理系统。运行/speckit.init安装8个项目本地命令:/plan、/tasks、/design、/analyze、/clarify、/implement、/revert、/lint。每个命令必须单独调用,且需用户批准后才能继续。切勿自动串联命令——每个命令都会产生需要用户审查的输出。当用户想根据规范创建计划时使用/plan;仅在用户批准计划后使用/tasks。Git检查点可实现安全回滚。

SKILL.md
--- frontmatter
name: speckit-generator
description: >
  Project-focused specification and task management system. Run /speckit.init to install
  8 project-local commands: /plan, /tasks, /design, /analyze, /clarify, /implement, /revert, /lint.
  Each command MUST be invoked separately and requires user approval before proceeding.
  NEVER chain commands automatically - each produces output that requires user review.
  Use /plan when user wants to create plans from specs. Use /tasks only AFTER user has approved plans.
  Git checkpoints enable safe revert.

SpecKit Generator

Project-focused specification management with 1 bootstrap command (/speckit.init) that installs 8 project-local commands to transform specifications into executed implementations with git checkpoint safety.

Table of Contents


Critical Workflow Rules

MANDATORY: Commands must NOT be chained automatically.

Each command produces artifacts that require user review and approval before proceeding to the next phase. This is not optional.

Required Gates

After CommandMUST DOBefore Proceeding To
/speckit.initPresent created structure, confirm memory filesAny other command
/speckit.planPresent plan summary, wait for explicit approval/speckit.tasks
/speckit.tasksPresent task summary, wait for explicit approval/speckit.implement

Recommended Workflow

code
/speckit.init
    ↓ [User reviews structure]
/speckit.plan
    ↓ [User reviews plan]
/speckit.analyze ← Run BEFORE approving plan
    ↓ [Address any CRITICAL/HIGH findings]
/speckit.clarify ← Run if [TBD] items exist
    ↓ [User approves final plan]
/speckit.tasks
    ↓ [User reviews tasks]
/speckit.implement

What NOT To Do

  • ❌ Run /speckit.plan then immediately /speckit.tasks without user approval
  • ❌ Generate all artifacts in one session without checkpoints
  • ❌ Skip /speckit.analyze before plan approval
  • ❌ Proceed past a GATE without explicit user confirmation

Gate Response Format

After completing a command, present results in this format:

code
## [Command] Complete

[Summary of what was created/modified]

### Artifacts Created
- [list of files]

### Recommended Next Steps
1. Review the [artifacts] above
2. Run `/speckit.analyze` to check compliance (if applicable)
3. Run `/speckit.clarify` to resolve any [TBD] items (if applicable)

**Awaiting your approval before proceeding.**

Overview

SpecKit provides a complete workflow for specification-driven development:

code
init → plan → tasks → implement
  ↑      ↑      ↑         ↑
  └──────┴──────┴─────────┘
         analyze/clarify (anytime)

Core Principles

  1. Separation of Concerns: Plans define WHAT, tasks define HOW
  2. Memory-Driven Compliance: All execution references constitution.md and relevant memory files
  3. Idempotent Operations: All commands safe to run repeatedly
  4. Deterministic Analysis: analyze produces identical output for identical input

Commands

Plugin Command (Global)

CommandPurposeWhen to Use
/speckit.initEstablish .claude/ foundation with git, install project commandsNew projects or incomplete setup

Project Commands (Installed by /speckit.init)

CommandPurposeWhen to Use
/planCreate plans from specificationsAfter specs exist in speckit/
/tasksGenerate tasks from plansAfter plans are approved
/designGenerate detailed task designsBefore implementing complex tasks
/analyzeAudit project consistencyAnytime for health check
/clarifyResolve ambiguitiesWhen specs have open questions
/implementExecute tasks with git checkpointWhen ready to implement
/revertRevert to checkpoint with analysisWhen implementation fails
/lintScan code for anti-patternsBefore code review or after implementation

Command: init

Establish the .claude/ foundation with appropriate memory files for the project.

Trigger

  • Explicit: /speckit.init
  • Automatic: Other commands detect missing setup

Workflow

  1. Check existing state - Detect if .claude/ exists
  2. Detect tech stack - Analyze project for languages/frameworks
  3. Present detection - Show detected stack and recommended memory files
  4. Create structure - Build directory structure
  5. Copy memory files - Select and copy based on tech stack
  6. Generate project context - Create project-context.md

Directory Structure Created

code
.claude/
├── commands/      # Custom project commands
├── memory/        # constitution.md + tech-specific files
│   └── MANIFEST.md
├── templates/     # Output templates
└── scripts/       # Project scripts

speckit/           # SpecKit artifacts (specs, plans, tasks, designs)
├── spec.md
├── plan.md
├── tasks.md
├── plans/         # Multi-domain plans (if complex)
└── designs/       # Design documents

Memory File Selection

CategoryFilesSelection
Universalconstitution.md, documentation.md, git-cicd.md, security.md, testing.mdAlways
TypeScript/JStypescript.mdIf TS/JS detected
React/Next.jsreact-nextjs.mdIf React/Next detected
Tailwindtailwind-shadcn.mdIf Tailwind detected
Pythonpython.mdIf Python detected
Rustrust.mdIf Rust detected

Options

code
Options:
1. Accept recommended selection
2. Add additional memory files
3. Remove memory files from selection
4. Override detected stack manually

See references/command-workflows/init-workflow.md for detailed workflow.


Command: plan

Create implementation plans from specification files. Hierarchical for complex/multi-domain specs.

Trigger

  • /speckit.plan
  • /speckit.plan spec.md
  • /speckit.plan --all

Workflow

  1. Locate specs - Find spec files in speckit/
  2. Assess complexity - Single domain vs multi-domain
  3. Generate plans - Create plan.md (and domain plans if complex)
  4. Validate - Check plan completeness and consistency

Output Structure

Simple (single domain):

code
speckit/
├── spec.md
└── plan.md

Complex (multi-domain):

code
speckit/
├── spec.md
├── plan.md              # Master plan with domain references
└── plans/
    ├── domain-a-plan.md
    ├── domain-b-plan.md
    └── domain-c-plan.md

Plan Content

Plans contain:

  • Requirements mapping (which spec sections covered)
  • Architecture decisions
  • Implementation approach (phases, NOT tasks)
  • Verification strategy
  • Notes for task generation

Plans do NOT contain:

  • Individual tasks (that's /speckit.tasks)
  • Implementation code
  • Detailed how-to instructions

Complexity Detection

IndicatorSimpleComplex
DomainsSingleMultiple distinct
Page count<10 pages>10 pages
Stakeholder count1-23+

User can override detection.

See references/command-workflows/plan-workflow.md for detailed workflow.


Command: tasks

Generate implementation tasks from plans + constitution + memory files.

Trigger

  • /speckit.tasks
  • /speckit.tasks plan.md
  • /speckit.tasks --all

Workflow

  1. Load plan(s) - Read plan files
  2. Load constitution - Extract relevant sections
  3. Load memory files - Get tech-specific guidelines
  4. Generate tasks - Create *-tasks.md with phases
  5. Validate - Check task completeness

Output

markdown
# [Domain] Tasks

## Phase 1: Foundation

### TASK-001: [Title]
**Status**: PENDING
**Priority**: P1
**Constitution Sections**: §4.1, §4.2
**Memory Files**: typescript.md, git-cicd.md
**Plan Reference**: PLAN-001
**Description**: ...
**Acceptance Criteria**:
- [ ] Criterion 1
- [ ] Criterion 2

Task Statuses

StatusMeaning
PENDINGNot started
IN_PROGRESSCurrently being worked
BLOCKEDWaiting on dependency
COMPLETEDDone and verified
SKIPPEDIntentionally not done

See references/command-workflows/tasks-workflow.md for detailed workflow.


Command: analyze

Deterministic, read-only audit of project artifacts for consistency and completeness.

Trigger

  • /speckit.analyze
  • /speckit.analyze --verbose
  • /speckit.analyze --category gaps

Characteristics

  • Read-only: Never modifies files
  • Deterministic: Same inputs = same outputs
  • Stable IDs: Finding IDs remain stable across runs
  • Quantified: Metrics for coverage, completeness

Analysis Categories

CategoryDescription
GAPSMissing required elements
INCONSISTENCIESContradictions between artifacts
AMBIGUITIESUnclear or undefined items
ORPHANSUnreferenced elements
ASSUMPTIONSUntracked/unvalidated assumptions

Severity Levels

LevelMeaning
CRITICALBlocks progress, must fix
HIGHSignificant risk, should fix
MEDIUMNotable issue, plan to fix
LOWMinor concern

Output Format

markdown
# Analysis Report

Generated: [timestamp]
Artifacts analyzed: [count]

## Summary
| Category | Critical | High | Medium | Low |
|----------|----------|------|--------|-----|
| GAPS     | 2        | 3    | 5      | 1   |
| ...      |          |      |        |     |

## Findings

### GAP-001 [CRITICAL]
**Location**: spec.md:45
**Description**: Missing error handling specification
**Recommendation**: Define error states for API failures

See references/command-workflows/analyze-workflow.md for detailed workflow.


Command: clarify

Structured ambiguity resolution with immediate spec updates.

Trigger

  • /speckit.clarify
  • /speckit.clarify spec.md

Characteristics

  • One question at a time: Focused, manageable
  • Multiple choice or short phrase: Quick answers
  • 5-question maximum per session: Avoid fatigue
  • Immediate updates: Specs updated after each answer
  • 9-category taxonomy: Structured classification

Ambiguity Categories

CategoryExample Question
SCOPE"Should X include Y functionality?"
BEHAVIOR"What happens when user does X?"
DATA"What format should X be stored in?"
ERROR"How should X error be handled?"
SEQUENCE"Does X happen before or after Y?"
CONSTRAINT"What are the limits for X?"
INTERFACE"How does X communicate with Y?"
AUTHORITY"Who approves X?"
TEMPORAL"How long should X take?"

Workflow

  1. Scan for ambiguity - Find [TBD], [NEEDS CLARIFICATION], vague language
  2. Prioritize - Rank by impact on implementation
  3. Present question - One at a time with options
  4. Update spec - Apply answer immediately
  5. Log session - Record Q&A for traceability

Question Format

code
CLARIFY-001 [BEHAVIOR]

The spec mentions "user authentication" but doesn't specify the method.

Which authentication method should be used?
1. OAuth 2.0 with Google/GitHub (Recommended)
2. Email/password with JWT
3. Magic link (passwordless)
4. Other (please specify)

Your choice:

See references/command-workflows/clarify-workflow.md for detailed workflow.


Command: implement

Execute tasks from *-tasks.md with batch+gates execution model.

Trigger

  • /speckit.implement TASK-001
  • /speckit.implement TASK-001..TASK-005
  • /speckit.implement "Phase 1"
  • /speckit.implement @foundation

Task Selection

SelectorMeaning
TASK-001Single task
TASK-001..TASK-005Range of tasks
"Phase 1"All tasks in phase
@foundationAll tasks with @foundation group

Execution Model: Batch + Gates

code
Execute Phase 1 tasks
    ↓
GATE: "Phase 1 complete. Review outputs?"
    ↓
[User confirms]
    ↓
Execute Phase 2 tasks
    ↓
GATE: "Phase 2 complete. Review outputs?"
    ...
    ↓
MANDATORY: Post-Implementation Hooks

Workflow

For each task:

  1. Load context - Read referenced constitution sections + memory files
  2. Present context - Show agent the relevant guidelines
  3. Execute - Perform the task
  4. Update status - PENDING → IN_PROGRESS → COMPLETED
  5. Verify - Check acceptance criteria

Gate Behavior

At phase/group boundaries:

code
Phase [N] complete.

Tasks completed: [count]
Tasks failed: [count]

Options:
1. Continue to Phase [N+1]
2. Review completed work
3. Re-run failed tasks
4. Stop execution

Context Loading

markdown
## Execution Context for TASK-001

### Constitution Requirements (§4.1, §4.2)
[Extracted sections from constitution.md]

### Memory File Guidelines
From typescript.md:
[Relevant sections]

From git-cicd.md:
[Relevant sections]

### Task Details
[Full task content]

MANDATORY: Pre-Implementation Hooks

CRITICAL: These hooks MUST execute BEFORE any task work begins:

Pre-HookActionPurpose
Pre-Hook 1Read project-status.mdUnderstand current state and context
Pre-Hook 2Validate argumentShow status if missing/invalid, stop until valid
Pre-Hook 3Verify tasks actionableFilter completed, check dependencies
Pre-Hook 4Present execution planGet user confirmation before proceeding
Pre-Hook 5Create git checkpointTag current state for potential revert

If no argument or invalid argument: Show current status and available selectors, then STOP until user provides valid selection.

MANDATORY: Post-Implementation Hooks

CRITICAL: These hooks MUST execute after ANY /speckit.implement run:

Post-HookActionUpdates
Post-Hook 1Update tasks.mdStatus → COMPLETED, verify each criterion with evidence
Post-Hook 2Update project-status.mdProgress metrics, phase status, activity log
Post-Hook 3Output summary to userCompleted tasks, criteria results, next steps

The command is NOT COMPLETE until all hooks execute. See references/command-workflows/implement-workflow.md for detailed templates and verification methods.


Command: revert

Revert to a previous git checkpoint with intelligent failure analysis and artifact recommendations.

Trigger

  • /speckit.revert - Most recent checkpoint
  • /speckit.revert [checkpoint-tag] - Specific checkpoint
  • /speckit.revert --list - List available checkpoints

Workflow

  1. List checkpoints - Show available speckit-checkpoint-* tags
  2. Preview revert - Show files and tasks that will be affected
  3. Execute revert - git reset --hard [checkpoint]
  4. Analyze failure - Determine what went wrong
  5. Recommend fixes - Suggest spec/plan/task updates

Failure Analysis Categories

CategoryIndicatorsRecommendation
SPEC_GAPRequirements unclearRun /speckit.clarify
APPROACH_WRONGArchitecture mismatchRun /speckit.plan --revise
DEPENDENCY_ISSUEExternal problemsUpdate dependencies, retry
TEST_MISMATCHTests don't match realityUpdate test fixtures
SCOPE_CREEPToo much at onceDecompose tasks
KNOWLEDGE_GAPUnfamiliar technologyResearch, then retry

Output

After revert, provides:

  • Summary of what was reverted
  • Root cause analysis
  • Specific recommendations for next steps
  • Updated project-status.md with revert logged
  • Updated tasks.md with failure notes

See commands/speckit.revert.md for detailed workflow.


Memory File System

Memory files provide persistent guidelines that inform all commands.

Universal Files (Always Loaded)

FilePurpose
constitution.mdCore principles, mandatory constraints
documentation.mdDocumentation standards
git-cicd.mdGit workflow, CI/CD practices
security.mdSecurity requirements
testing.mdTesting strategies

Tech-Specific Files (Loaded by Detection)

FileTriggers
typescript.mdTypeScript, JavaScript, Node.js
react-nextjs.mdReact, Next.js
tailwind-shadcn.mdTailwind CSS, shadcn/ui
python.mdPython, Django, Flask, FastAPI
rust.mdRust

Constitution Section References

Tasks reference constitution sections by ID:

  • §1.0 - Chapter reference
  • §1.1 - Section reference
  • §1.1.a - Subsection reference

Example task:

markdown
**Constitution Sections**: §4.1 (Error Handling), §4.2 (Logging)

Idempotency

All commands are designed to be safe when run repeatedly.

Init Idempotency

  • Skips existing directories
  • Updates changed memory files only
  • Preserves project customizations

Plan Idempotency

  • Detects existing plans
  • Offers update or regenerate
  • Preserves manual edits with warning

Tasks Idempotency

  • Preserves task statuses
  • Adds new tasks for new plan items
  • Never removes manually added tasks

Analyze Idempotency

  • Read-only, always safe
  • Stable finding IDs across runs

Clarify Idempotency

  • Tracks answered questions
  • Skips already-clarified items
  • Session history preserved

Implement Idempotency

  • Skips COMPLETED tasks
  • Resumes from last position
  • Re-runnable for failed tasks

Catching Up

When running on an existing project:

  1. Init detects state - Finds what exists, what's missing
  2. Commands offer catch-up - "Missing setup. Run init first?"
  3. Incremental updates - Only process what's new
  4. Never destructive - No deletions without explicit request

Related Skills

These skills auto-activate based on context to provide supplementary guidance:

SkillAuto-Triggers WhenPurpose
requirement-patternsWriting specs, requirements, user storiesPatterns for clear, testable requirements
adr-authoringCreating ADRs, documenting decisionsMADR templates and best practices

When to Use

  • Before /speckit.plan: Use requirement-patterns to write better specifications
  • During /speckit.plan: Use adr-authoring for architecture decisions
  • With /speckit.analyze: Skills provide context for interpreting findings