AgentSkillsCN

spec-init

采用规格驱动开发,快速初始化一个功能规格。在.Claude/specs文件夹中迅速创建一个.md文件,其中包含可供进一步完善的占位符。

SKILL.md
--- frontmatter
name: spec-init
description: Initialize a feature spec using spec-driven development. Quickly creates a .md file in .claude/specs folder with placeholders ready for refinement.

What to do when this skill is invoked

When the user invokes /spec-init, they will provide a description of the feature they want to plan (e.g., "Add real-time notifications", "Fix performance in search results").

Your job is to:

  1. Parse the feature description - Extract the key feature name/topic from what the user provided
  2. Count existing specs - Check .claude/specs/ to find the highest numbered spec
  3. Generate a spec filename - Convert the feature description to a valid markdown filename in kebab-case with an incrementing numeric prefix (e.g., 01-add-real-time-notifications.md, 02-fix-performance-search.md)
  4. Create the spec file - Create .claude/specs/{filename}.md with the template below
  5. Pre-fill basic info - Add the feature description/title at the top
  6. Leave placeholders - Keep all sections as scaffolding for the user to fill in

Spec Template to use

Use this exact template structure (with placeholders as shown):

markdown
# {Feature Title/Name}

> Based on: {Brief description from user input}

## 1. Problem Statement

- What problem does this solve?
- Who is affected?
- What happens if we don't solve it?

## 2. Proposed Solution

- High-level description of the approach
- Key user-facing behavior changes

## 3. Acceptance Criteria

- [ ] Given [context], when [action], then [result]
- [ ] ...

## 4. Technical Design

- Components/modules affected
- New interfaces or APIs needed
- Data flow changes

## 5. Dependencies & Risks

- External dependencies
- Breaking changes
- Edge cases to handle

## 6. Out of Scope

Explicitly list what this does NOT include to prevent scope creep.

## 7. Implementation Steps

Ordered list of discrete, mergeable chunks:

1. Step one (what it delivers)
2. Step two (what it delivers)
   ...

---

> **To refine this spec:** Use `/spec-refine` or simply comment on what you'd like to change. Claude will understand you're working on this spec.

Key points

  • Use the Write tool to create the file in .claude/specs/
  • Pre-fill only the title/description at the top - leave the rest as placeholders
  • Output a confirmation message showing the file path and next steps
  • Suggest that the user can edit it directly or use /spec-refine to flesh out details with codebase research
  • Do NOT ask for confirmation - just create the file immediately. The user can always edit or refine afterward.