AgentSkillsCN

github-speckit

精通 GitHub Spec Kit,掌握以规格驱动开发的核心要领。当您依据规格创建应用、管理规格驱动的工作流程,或在“构想/明确/规划/执行/实施”各阶段中开展协作时,可使用此技能。

SKILL.md
--- frontmatter
name: github-speckit
description: Master GitHub Spec Kit for spec-driven development. Use when creating applications from specifications, managing spec-driven workflows, or working with constitution/specify/plan/tasks/implement phases.
execution_model: sonnet

GitHub Spec Kit Mastery

Enable structured spec-driven development using GitHub's Spec Kit toolkit. Transform vague ideas into executable specifications, then generate implementations through AI coding agents.

Core Philosophy

Specifications are executable artifacts that generate code—not documentation that follows it. Code serves specifications, not vice versa. This inverts traditional development by making specs primary and implementations derived.

When to Use This Skill

Activate when user mentions:

  • "spec-driven development" or "specification-driven"
  • "speckit" or "spec kit"
  • Working with /speckit.* commands
  • Creating applications from specifications
  • Initializing spec-driven projects
  • Managing constitution, specifications, plans, or tasks

Prerequisites

Before starting, verify installation:

bash
# Check if Spec Kit is installed
specify --version

# Install if missing
uv tool install specify-cli --from git+https://github.com/github/spec-kit.git

Core Workflow

Phase 0: Project Initialization

Initialize Spec Kit in the project:

bash
# New project
specify init <project-name> --ai claude

# Existing project
specify init . --ai claude

# Current directory, force overwrite
specify init --here --force --ai claude

Supported AI agents: claude, gemini, copilot, cursor-agent, windsurf, qwen-code

Phase 1: Constitution (/speckit.constitution)

Establish immutable architectural principles that govern all development.

Purpose: Define project-wide constraints, standards, and architectural decisions.

Key principles to include:

  1. Library-First Principle (features as reusable libraries)
  2. CLI Interface Mandate (text-based interfaces)
  3. Test-First Imperative (tests before implementation)
  4. Security Constitution (security constraints)
  5. Data Integrity Standards (data handling rules)
  6. Performance Baselines (non-functional requirements)
  7. Simplicity Gate (complexity limits)
  8. Anti-Abstraction Principle (direct framework usage)
  9. Integration-First Testing (real services, not mocks)

Output: Creates memory/constitution.md with project principles.

Phase 2: Specification (/speckit.specify)

Transform ideas into structured, executable specifications.

Key activities:

  • Define user stories and acceptance criteria
  • Specify feature requirements (WHAT and WHY, not HOW)
  • Mark uncertainties with [NEEDS CLARIFICATION] tags
  • Avoid implementation details (technology, architecture, APIs)

Best practices:

  • Focus on user needs, not technical solutions
  • Keep specifications abstract and stable
  • Force explicit reasoning for complexity
  • Document business justification, not code structure

Output: Creates memory/specs/SPEC-XXX-feature-name/ with:

  • specification.md - Feature requirements
  • acceptance-criteria.md - Success criteria
  • user-stories.md - User-facing scenarios

Phase 3: Planning (/speckit.plan)

Convert specifications into technical implementation strategies.

Key activities:

  • Choose technology stack with rationale
  • Design API contracts and data models
  • Define test scenarios
  • Create quickstart validation workflows

Outputs technical artifacts:

  • Architecture decisions with reasoning
  • API endpoint definitions
  • Database schemas
  • Integration test scenarios
  • Developer quickstart guides

Output: Creates memory/specs/SPEC-XXX-feature-name/plan.md

Phase 4: Task Generation (/speckit.tasks)

Break plans into executable, reviewable work items.

Key activities:

  • Derive tasks from contracts and entities
  • Identify parallelizable work (marked with [P])
  • Generate small, focused implementation units
  • Create task dependencies and ordering

Output: Creates memory/specs/SPEC-XXX-feature-name/tasks.md with numbered tasks.

Phase 5: Implementation (/speckit.implement)

Execute all tasks and build the feature according to plan.

Workflow:

  1. Read all specification artifacts (spec, plan, tasks)
  2. Implement tasks in order (parallelize [P] marked tasks)
  3. Follow constitution principles
  4. Run tests after each task
  5. Validate against acceptance criteria

Optional Enhancement Commands

/speckit.clarify - Resolve ambiguous specifications

  • Use when [NEEDS CLARIFICATION] tags appear
  • Prompts for specific details before proceeding

/speckit.analyze - Verify artifact consistency

  • Checks spec-plan-task alignment
  • Identifies contradictions or gaps

/speckit.checklist - Generate quality validation checklists

  • Creates comprehensive validation steps
  • Ensures requirements are testable and measurable

Workflow Patterns

0-to-1 Development (Greenfield)

code
specify init app --ai claude
→ /speckit.constitution
→ /speckit.specify
→ /speckit.plan
→ /speckit.tasks
→ /speckit.implement

Iterative Enhancement (Brownfield)

code
cd existing-project
specify init --here --ai claude
→ /speckit.specify (new feature)
→ /speckit.plan
→ /speckit.tasks
→ /speckit.implement

Creative Exploration

Generate multiple parallel implementations with different tech stacks:

code
→ /speckit.specify (once)
→ /speckit.plan (React version)
→ /speckit.plan (Vue version)
→ Compare and choose

Key Principles

DO:

  • Start with constitution to establish principles
  • Keep specifications abstract (user needs, not code)
  • Mark all uncertainties explicitly with [NEEDS CLARIFICATION]
  • Regenerate plans when requirements change
  • Follow the five-phase workflow in order
  • Use separate files for contracts, models, algorithms

DON'T:

  • Skip constitution phase on new projects
  • Include implementation details in specifications
  • Make assumptions—force clarification instead
  • Mix specifications and technical design
  • Manually edit generated task lists
  • Create deeply nested file references (max 1 level)

File Structure Reference

After initialization, projects contain:

code
project/
├── memory/
│   ├── constitution.md              # Architectural principles
│   └── specs/
│       └── SPEC-XXX-feature-name/
│           ├── specification.md      # Requirements
│           ├── plan.md              # Technical design
│           ├── tasks.md             # Work breakdown
│           ├── acceptance-criteria.md
│           └── user-stories.md
├── src/                             # Implementation code
└── tests/                           # Test suites

Supporting Resources

  • Detailed methodology: See references/spec-driven-methodology.md
  • Phase-by-phase guide: See references/workflow-guide.md
  • CLI command reference: See references/cli-reference.md
  • Writing specs: See references/best-practices.md
  • Constitution template: See assets/constitution-template.md
  • Quality checklist: See assets/specification-checklist.md

Common Issues

Spec Kit not found: Install with uv tool install specify-cli --from git+https://github.com/github/spec-kit.git

Commands not available: Reinitialize project with specify init --here --force --ai claude

Specifications too detailed: Remove implementation details, focus on user needs only

Unclear requirements: Use /speckit.clarify to resolve [NEEDS CLARIFICATION] tags

Plan-spec mismatch: Run /speckit.analyze to verify consistency

Official Documentation