MCP HubMCP Hub
返回技能列表

spec-kit

rhuss
更新于 Today
32 次查看
1
1
在 GitHub 上查看
automation

关于

The spec-kit skill provides the technical integration layer for spec-kit CLI, automatically handling initialization, installation validation, and project setup. It ensures proper file/directory layout and serves as the single source of truth for all SDD workflow skills. Developers should use this low-level technical skill when building workflow skills that require spec-kit integration.

技能文档

Spec-Kit Technical Integration

Purpose

This skill is the single source of truth for all spec-kit technical integration:

  • Automatic initialization and setup
  • Installation validation
  • Project structure management
  • CLI command wrappers
  • Layout and file path enforcement

This is a low-level technical skill. Workflow skills (brainstorm, implement, etc.) call this skill for setup, then proceed with their specific workflows.

Automatic Initialization Protocol

IMPORTANT: This runs automatically when called by any workflow skill.

Every SDD workflow skill calls this skill first via {Skill: spec-kit}. When called, execute this initialization sequence once per session.

Session Tracking

# Check if already initialized this session
# Use an environment variable or similar mechanism
# If "sdd_init_done" flag is set, skip to step 4

Step 1: Check spec-kit CLI Installation

which speckit

If NOT found:

❌ ERROR: spec-kit is required but not installed

spec-kit provides the templates, scripts, and tooling for SDD workflows.

Installation:
1. Visit: https://github.com/github/spec-kit
2. Follow installation instructions
3. Ensure 'speckit' is in your PATH
4. Verify: run 'which speckit'

After installation, restart this workflow.

STOP workflow. Do not proceed without spec-kit.

If found:

# Get version for logging
speckit --version

Proceed to step 2.

Step 2: Check Project Initialization

# Check if .specify/ directory exists
[ -d .specify ] && echo "initialized" || echo "not-initialized"

If NOT initialized:

Display message:

spec-kit is installed ✓

This project needs initialization...
Running: speckit init

Execute initialization:

speckit init

Check for errors:

  • Permission denied → suggest running with proper permissions
  • Command failed → display error and suggest manual init
  • Success → proceed to step 3

If already initialized: Skip to step 3.

Step 3: Check for New Commands (Restart Detection)

After speckit init runs, check if local commands were installed:

# Check if spec-kit installed Claude Code commands
if [ -d .claude/commands ]; then
  ls .claude/commands/ | grep -q speckit
  if [ $? -eq 0 ]; then
    echo "commands-installed"
  fi
fi

If commands were installed:

Display restart prompt:

✅ Project initialized successfully!

⚠️  RESTART REQUIRED ⚠️

spec-kit has installed local slash commands in:
  .claude/commands/speckit.*

To load these new commands, please:
1. Save your work
2. Close this conversation
3. Restart Claude Code application
4. Return to this project
5. Continue your workflow

After restart, you'll have access to:
- /sdd:* commands (from this plugin)
- /speckit.* commands (from local spec-kit installation)

[Workflow paused - resume after restart]

STOP workflow. User must restart before continuing.

If no new commands installed: Proceed to step 4.

Step 4: Verify Installation

Quick sanity check:

# Verify key files exist
[ -f .specify/templates/spec-template.md ] && \
[ -f .specify/scripts/bash/common.sh ] && \
echo "verified" || echo "corrupt"

If verification fails:

❌ ERROR: .specify/ exists but appears incomplete

This may be due to a failed initialization.

Please run: speckit init --force

Then restart this workflow.

STOP workflow.

If verification succeeds:

  • Set session flag: "sdd_init_done"
  • Return success to calling skill
  • Calling skill continues with its workflow

Layout Validation

Use these helpers to validate spec-kit file structure:

Check Constitution

# Constitution location (per spec-kit convention)
CONSTITUTION=".specify/memory/constitution.md"

if [ -f "$CONSTITUTION" ]; then
  echo "constitution-exists"
else
  echo "no-constitution"
fi

Get Feature Spec Path

# Validate feature spec path follows spec-kit layout
# Expected: specs/NNNN-feature-name/spec.md
# Or: specs/features/feature-name.md

validate_spec_path() {
  local spec_path=$1

  # Check if follows spec-kit conventions
  if [[ $spec_path =~ ^specs/[0-9]+-[a-z-]+/spec\.md$ ]] || \
     [[ $spec_path =~ ^specs/features/[a-z-]+\.md$ ]]; then
    echo "valid"
  else
    echo "invalid: spec must be in specs/ directory with proper naming"
  fi
}

Get Plan Path

# Plan location (per spec-kit convention)
# Expected: specs/NNNN-feature-name/docs/plan.md

get_plan_path() {
  local feature_dir=$1  # e.g., "specs/0001-user-auth"
  echo "$feature_dir/docs/plan.md"
}

Ensure Directory Structure

# Create spec-kit compliant feature structure
ensure_feature_structure() {
  local feature_dir=$1  # e.g., "specs/0001-user-auth"

  mkdir -p "$feature_dir/docs"
  mkdir -p "$feature_dir/checklists"
  mkdir -p "$feature_dir/contracts"

  echo "created: $feature_dir structure"
}

Spec-Kit CLI Commands

Wrapper helpers for common spec-kit commands:

Initialize Project

# Already covered in automatic initialization
speckit init

Create Specification

# Interactive spec creation
speckit specify [feature-description]

# Uses template from .specify/templates/spec-template.md

Validate Specification

# Validate spec format and structure
speckit validate <spec-file>

# Example:
speckit validate specs/0001-user-auth/spec.md

Generate Plan

# Generate implementation plan from spec
speckit plan <spec-file>

# Example:
speckit plan specs/0001-user-auth/spec.md

Create Constitution

# Interactive constitution creation
speckit constitution

# Creates .specify/memory/constitution.md

Error Handling

spec-kit CLI Errors

Command not found after installation:

  • Check PATH configuration
  • Suggest shell restart
  • Provide which speckit output

Init fails:

  • Check write permissions
  • Check disk space
  • Suggest manual troubleshooting

Validation fails:

  • Display validation errors
  • Suggest fixes based on error type
  • Reference spec template

File System Errors

Permission denied:

Cannot write to project directory.

Please ensure you have write permissions:
  chmod +w .

Path not found:

Expected file not found: <path>

This suggests incomplete initialization.
Run: speckit init --force

Integration Points

Called by these workflow skills:

  • sdd:brainstorm (at start)
  • sdd:implement (at start)
  • sdd:evolve (at start)
  • sdd:constitution (at start)
  • sdd:review-spec (at start)
  • All workflow skills that need spec-kit

Calls:

  • spec-kit CLI (external command)
  • File system operations
  • No other skills (this is a leaf skill)

Session Management

First call in session:

  • Run full initialization protocol
  • Check installation, project, commands
  • Prompt restart if needed
  • Set session flag

Subsequent calls in session:

  • Check session flag
  • Skip initialization if already done
  • Optionally re-verify critical paths
  • Return success immediately

Session reset:

  • New conversation = new session
  • Re-run initialization protocol
  • Ensures project state is current

Remember

This skill is infrastructure, not workflow.

  • Don't make decisions about WHAT to build
  • Don't route to other workflow skills
  • Just ensure spec-kit is ready to use
  • Validate paths and structure
  • Handle technical errors

Workflow skills handle:

  • What to create (specs, plans, code)
  • When to use which tool
  • Process discipline and quality gates

This skill handles:

  • Is spec-kit installed?
  • Is project initialized?
  • Do files exist in correct locations?
  • Are commands available?

The goal: Zero-config, automatic, invisible setup.

快速安装

/plugin add https://github.com/rhuss/cc-superpowers-sdd/tree/main/spec-kit

在 Claude Code 中复制并粘贴此命令以安装该技能

GitHub 仓库

rhuss/cc-superpowers-sdd
路径: skills/spec-kit

相关推荐技能

sglang

SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。

查看技能

generating-unit-tests

该Skill能自动为源代码生成全面的单元测试,支持Jest、pytest、JUnit等多种测试框架。当开发者请求"生成测试"、"创建单元测试"或使用"gut"快捷指令时即可触发。它能智能识别合适框架或按指定框架生成测试用例,显著提升测试效率。

查看技能

business-rule-documentation

该Skill为开发者提供标准化的业务规则和领域知识文档模板,遵循领域驱动设计原则。它能系统化地捕获业务规则、流程、决策树和术语表,确保业务需求与技术实现的一致性。适用于创建领域模型、业务规则库、流程映射,以及改善业务与技术团队之间的沟通。

查看技能

orchestrating-test-workflows

该技能让开发者能通过Claude编排复杂测试工作流,包括定义测试依赖关系图、并行执行测试以及基于代码变更智能选择测试用例。适用于需要测试编排、依赖管理、并行测试或CI/CD集成测试的场景。当用户提及"orchestrate tests"、"parallel testing"等触发词时即可调用此技能。

查看技能