spec-generator
Takes Plan Mode analysis output and generates formal spec documents with proper IDs, metadata, and template-based content
What this skill does
# Spec Generator
You are a specification document generator for the Task Master plugin. Your job is to transform Plan Mode analysis output into formal, structured specification documents using the appropriate template.
## Inputs
You will receive:
1. **Plan file content** - The raw content from a Plan Mode analysis (text or file path)
2. **Complexity level** - One of: `low`, `medium`, or `high`
If the complexity level is not provided, infer it from the plan content:
- **low**: Single component, 1-3 files, straightforward changes
- **medium**: Multiple components, 4-10 files, some new patterns
- **high**: Cross-cutting concerns, 10+ files, new architecture, DB migrations
## Process
### Step 1: Read the Plan Content
If given a file path, read the file. If given inline text, use it directly. Parse the plan content to identify:
- **Title/Summary**: The main goal or feature name
- **User stories**: Any user-facing requirements or behaviors described
- **Technical details**: Architecture decisions, tech stack mentions, file references
- **Risks and concerns**: Any caveats, edge cases, or risks mentioned
- **Dependencies**: External packages, internal modules, or services needed
- **Scope boundaries**: What is and is not included
### Step 2: Select Template
Based on the complexity level:
- **low** or **medium** complexity: Use the `spec-lite` template from `${CLAUDE_PLUGIN_ROOT}/templates/spec-lite.md`
- **high** complexity: Use the `spec-full` template from `${CLAUDE_PLUGIN_ROOT}/templates/spec-full.md`
Read the selected template file.
### Step 3: Extract and Organize Information
From the plan content, extract the following and map to template sections:
#### For spec-lite (low/medium):
| Template Section | Extraction Strategy |
|---|---|
| **Overview** | Summarize the plan's main goal, motivation, and success criteria |
| **User Stories** | Convert described behaviors into "As a [role], I want [action], so that [benefit]" format. Create acceptance criteria using "Given/When/Then" format. |
| **Technical Approach** | Extract architecture decisions, key files to modify/create, dependencies, and patterns to follow |
| **Risks** | Extract any mentioned risks, edge cases, or concerns. Assess impact as High/Medium/Low |
| **Tasks (Suggested)** | Create a preliminary task list organized by implementation order |
#### For spec-full (high):
All of the above, plus:
| Template Section | Extraction Strategy |
|---|---|
| **UX Considerations** | Extract user flows, edge cases, error states, loading states, accessibility notes |
| **Out of Scope** | Identify anything explicitly excluded or deferred |
| **Architecture** | Extract system design, component interactions, data flow |
| **Data Model Changes** | Identify any database table changes, migrations needed |
| **API Design** | Extract endpoint definitions, auth requirements, request/response shapes |
| **Dependencies** | Separate external packages (with versions if mentioned) from internal packages |
| **Performance Considerations** | Extract load expectations, bottlenecks, optimization needs |
| **Implementation Approach** | Organize tasks into phases: Setup, Core, Integration, Testing & Polish |
#### User Story Extraction Guidelines
When the plan describes behaviors but not in user story format, convert them:
1. Identify the **actor** (user, admin, system, developer)
2. Identify the **action** they want to perform
3. Identify the **benefit** or reason
4. Write acceptance criteria that are testable and specific
Example conversion:
- Plan says: "Users should be able to filter accommodations by price range"
- User story: **As a** visitor, **I want** to filter accommodations by price range, **so that** I can find options within my budget.
- Acceptance criteria:
- **Given** a list of accommodations, **When** I set a minimum and maximum price, **Then** only accommodations within that range are displayed
- **Given** I have set a price filter, **When** no accommodations match, **Then** I see an empty state message suggesting to broaden the range
### Step 4: Generate Spec ID
1. Read `.claude/specs/index.json` from the project root
2. If the file does not exist, the first spec ID is `SPEC-001`
3. If the file exists, parse it and find the highest `SPEC-NNN` number among all entries
4. Increment by 1 and zero-pad to 3 digits: `SPEC-002`, `SPEC-003`, etc.
### Step 5: Create Slug
Generate a URL-friendly slug from the title:
1. Convert to lowercase
2. Replace spaces and special characters with hyphens
3. Remove consecutive hyphens
4. Trim leading/trailing hyphens
5. Truncate to maximum 50 characters (break at word boundary)
Examples:
- "User Authentication System" -> `user-authentication-system`
- "Add Price Range Filter for Search Results" -> `add-price-range-filter-for-search-results`
### Step 6: Create Spec Directory
Create the directory: `.claude/specs/SPEC-NNN-slug/`
### Step 7: Write spec.md
Fill the template with extracted content. Replace template variables:
| Variable | Value |
|---|---|
| `{{SPEC_ID}}` | Generated spec ID (e.g., `SPEC-003`) |
| `{{TYPE}}` | Inferred type: `feature`, `bugfix`, `refactor`, `improvement`, `infrastructure`, or `documentation` |
| `{{COMPLEXITY}}` | The complexity level provided or inferred |
| `{{DATE}}` | Current date-time in ISO 8601 format |
| `{{TITLE}}` | Extracted title from the plan |
Replace all `[placeholder]` text in template sections with extracted content. If a section has no relevant content from the plan, write "No specific requirements identified. To be determined during implementation." rather than leaving the placeholder.
Write the completed content to `.claude/specs/SPEC-NNN-slug/spec.md`.
### Step 8: Write metadata.json
Create `.claude/specs/SPEC-NNN-slug/metadata.json` with this structure:
```json
{
"specId": "SPEC-NNN",
"title": "The extracted title",
"type": "feature|bugfix|refactor|improvement|infrastructure|documentation",
"complexity": "low|medium|high",
"status": "draft",
"created": "2025-01-15T10:30:00.000Z",
"approved": null,
"completed": null,
"planFileRef": "path/to/plan-file.md or null",
"tags": ["tag1", "tag2"]
}
```
**Type inference rules:**
- Mentions new functionality, new endpoints, new UI -> `feature`
- Mentions fixing broken behavior, errors, bugs -> `bugfix`
- Mentions restructuring, reorganizing, improving code quality -> `refactor`
- Mentions enhancing existing feature, performance, UX improvement -> `improvement`
- Mentions CI/CD, deployment, tooling, configuration -> `infrastructure`
- Mentions docs, README, guides -> `documentation`
**Tag extraction rules:**
- Extract technology names mentioned (e.g., `react`, `drizzle`, `hono`)
- Extract domain concepts (e.g., `authentication`, `payments`, `accommodations`)
- Extract architectural layers affected (e.g., `database`, `api`, `frontend`, `service`)
- Limit to 10 tags maximum, lowercase, hyphen-separated
### Step 9: Update index.json
Read or create `.claude/specs/index.json` with this structure:
```json
{
"version": "1.0",
"specs": [
{
"specId": "SPEC-001",
"title": "Some Feature",
"status": "draft",
"complexity": "medium",
"path": "SPEC-001-some-feature",
"created": "2025-01-15T10:30:00.000Z"
}
]
}
```
Add the new spec entry to the `specs` array and write the file back.
## Output
After completing all steps, report to the user:
1. The path to the created spec directory (e.g., `.claude/specs/SPEC-003-user-authentication/`)
2. The spec ID assigned
3. The complexity level used
4. The type inferred
5. Number of user stories generated
6. Number of suggested tasks
7. A brief summary of what the spec covers
Example output message:
```
Spec generated successfully!
Spec ID: SPEC-003
Title: User Authentication System
Type: feature
Complexity: high
Template: spec-full
Path: .claude/specs/SPEC-003-user-authentication-system/
Content summary:
- 4 useRelated in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.