ワンクリックで
generate-spec
Generate Abstract Specification and Technical Design Document from input content
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Generate Abstract Specification and Technical Design Document from input content
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Analyze and extract requirements from use case diagram. Use when extracting UR/FR/NFR from use cases or when called by generate-prd.
Check consistency between implementation code and design documents (design), detecting discrepancies
Generate quality assurance checklists from specifications and plans with structured IDs and categories
Analyze specifications and generate clarification questions to eliminate ambiguity before implementation
Define and manage non-negotiable project principles (Constitution) and verify synchronization with other documents
Automatically executed during document updates or before implementation to check consistency between PRD ↔ *_spec.md ↔ *_design.md. Detects missing requirement ID (UR/FR/NFR) references, data model mismatches, API definition discrepancies, terminology inconsistencies, and ensures traceability between documents.
| name | generate-spec |
| description | Generate Abstract Specification and Technical Design Document from input content |
| argument-hint | <requirements-description> |
| license | MIT |
| user-invocable | true |
| allowed-tools | Read, Write, Edit, Glob, Grep, AskUserQuestion, Bash |
Generates the following documents from input content according to the AI-SDD workflow:
${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{feature-name}_spec.md - Abstract Specification (Specify Phase)${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{feature-name}_design.md - Technical Design Document (Plan Phase)Read the following prerequisite references before execution:
references/prerequisites_plugin_update.md - Check for plugin updatesreferences/prerequisites_principles.md - Read AI-SDD principles documentreferences/prerequisites_directory_paths.md - Resolve directory paths using SDD_* environment variablesPhase 1: Python Script - Execute python3 "${CLAUDE_PLUGIN_ROOT}/skills/generate-spec/scripts/prepare-spec.py" to pre-load templates and references.
This script:
${CLAUDE_PROJECT_DIR}/${SDD_ROOT}/SPECIFICATION_TEMPLATE.md and ${CLAUDE_PROJECT_DIR}/${SDD_ROOT}/DESIGN_DOC_TEMPLATE.md (project templates) firsttemplates/${SDD_LANG}/ to cache$CLAUDE_ENV_FILE:
GENERATE_SPEC_SPEC_TEMPLATE - Path to cached spec templateGENERATE_SPEC_DESIGN_TEMPLATE - Path to cached design templateGENERATE_SPEC_REFERENCES - Path to cached referencesPhase 2: Claude - Read from cache using environment variables instead of searching files
Templates are located under templates/${SDD_LANG:-en}/ within this skill directory.
The SDD_LANG environment variable determines the language (default: en).
Before generation, verify the following:
${SDD_ROOT}/ directory exist in the project?$ARGUMENTS
| Argument | Required | Description |
|---|---|---|
requirements-description | Yes | Feature description text. Feature name is extracted from description |
--ci | - | CI/non-interactive mode. Skips Vibe Coding check, auto-approves overwrites, skips spec-reviewer, always generates Design Doc |
Reference: examples/input_example.md
CI Mode: If
--ciflag is specified, skip this section entirely and proceed to step 4.
Analyze input content and assess risk based on the following criteria:
| Risk | Condition | Response |
|---|---|---|
| High | No specs + vague instructions | Confirm missing information with user before generating |
| Medium | Some requirements unclear | Clarify ambiguous points before generating |
| Low | Requirements clear | Can generate as-is |
Examples of Vague Input:
Extract/infer the following from input:
For Spec (Abstract Specification):
| Extraction Item | Description | Required |
|---|---|---|
| Feature Name | Identifier used for filename | Yes |
| Background | Why this feature is needed | Yes |
| Purpose | What to achieve | Yes |
| Functional Requirements | List of required functions | Yes |
| Public API | Interfaces users will use | |
| Data Model | Major types/entities | |
| Behavior | Major use cases/sequences |
For Design Doc (Technical Design Document):
| Extraction Item | Description | Required |
|---|---|---|
| Technology Stack | Technologies/libraries to use | Yes |
| Architecture Proposal | Module structure/layer design | Yes |
| Design Decisions | Reasons for technology selection/alternatives | |
| Non-Functional Requirements | Performance/security requirements |
If important items cannot be determined from input, confirm with user before generation:
Check the following before generation. Both flat and hierarchical structures are supported.
See references/existing_document_check.md for the list of paths to check for flat and hierarchical structures.
Note the difference in naming conventions:
index.md, {feature-name}.md)_spec or _design suffix required (index_spec.md, {feature-name}_spec.md)Hierarchical structure usage decision:
If PRD exists:
If spec/design exists:
--ci): Overwrite without confirmation.Follow these steps to prepare the template:
${CLAUDE_PROJECT_DIR}/${SDD_ROOT}/SPECIFICATION_TEMPLATE.md existstemplates/${SDD_LANG:-en}/spec_template.md from this skill directory and use it as the base
template to generate ${CLAUDE_PROJECT_DIR}/${SDD_ROOT}/SPECIFICATION_TEMPLATE.md{Feature Name}, etc.) based on input content<MUST> markers are required, <RECOMMENDED> are recommended, <OPTIONAL> are optional<MUST>/<RECOMMENDED>/<OPTIONAL>) from headings in the final output — they are author-facing guides only and must not appear in the generated documentSave Location:
${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{feature-name}_spec.md${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{parent-feature}/index_spec.md${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{parent-feature}/{feature-name}_spec.mdAfter abstract specification generation is complete, generate the technical design document.
Follow these steps to prepare the template:
${CLAUDE_PROJECT_DIR}/${SDD_ROOT}/DESIGN_DOC_TEMPLATE.md existstemplates/${SDD_LANG:-en}/design_template.md from this skill directory and use it as the
base template to generate ${CLAUDE_PROJECT_DIR}/${SDD_ROOT}/DESIGN_DOC_TEMPLATE.md<MUST>/<RECOMMENDED>/<OPTIONAL>) from headings in the final output — they are author-facing guides only and must not appear in the generated documentSave Location:
${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{feature-name}_design.md${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{parent-feature}/index_design.md${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{parent-feature}/{feature-name}_design.mdCI Mode: If
--ciflag is specified, always generate Design Doc (do not skip).
Skip Design Doc generation and confirm with user in the following cases:
Generated specs and design docs must include YAML front matter at the top of the file.
See references/front_matter_spec_design.md for full schema definition, dependency direction rules, and validation checklist.
| Field | Rule |
|---|---|
id | "spec-{feature-name}". For hierarchical: "spec-{parent}-{feature-name}" |
status | "draft" for new specs |
depends-on | PRD ID (e.g., ["prd-user-auth"]) |
priority | Inherit from PRD if exists, otherwise "medium" |
risk | Inherit from PRD if exists, otherwise "medium" |
| Field | Rule |
|---|---|
id | "design-{feature-name}". For hierarchical: "design-{parent}-{feature-name}" |
status | "draft" for new design docs |
impl-status | "not-implemented" for new design docs |
depends-on | Spec ID (e.g., ["spec-user-auth"]) |
tags | Inherit from spec |
category | Inherit from spec |
priority | Inherit from spec |
risk | Inherit from spec |
See references/generation_flow.md for the full step-by-step generation flow (input analysis through Design Doc front matter validation).
If PRD exists, perform the following consistency checks on generated spec and reflect results in spec:
| Check Item | Verification Content |
|---|---|
| Requirement Coverage | Are all PRD functional requirements (FR-xxx) covered in spec? |
| Requirement ID References | Do spec functional requirements appropriately reference PRD requirement IDs? |
| Non-Functional Requirement Reflection | Are PRD non-functional requirements (NFR-xxx) reflected in spec? |
| Terminology Consistency | Is the same terminology used in PRD and spec? |
Add the following to spec's end (if PRD exists):
Reference: examples/prd_reference_section.md
For hierarchical structure, parent feature PRD is ${CLAUDE_PROJECT_DIR}/${SDD_REQUIREMENT_PATH}/{parent-feature}/index.md
Save Files:
${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{feature-name}_spec.md, ${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{feature-name}_design.md${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{parent-feature}/index_spec.md,
${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{parent-feature}/index_design.md${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{parent-feature}/{feature-name}_spec.md,
${CLAUDE_PROJECT_DIR}/${SDD_SPECIFICATION_PATH}/{parent-feature}/{feature-name}_design.mdConsistency Check:
Use the templates/${SDD_LANG:-en}/spec_output.md template for output formatting.
The following verifications are automatically performed during generation:
<MUST>/<RECOMMENDED>/<OPTIONAL> markers are removed from headingsReference: examples/verification_commands.md
If Serena MCP is enabled, existing codebase semantic analysis can be leveraged to enhance specification generation.
serena is configured in .mcp.json| Feature | Usage |
|---|---|
find_symbol | Search existing function/class definitions for API spec reference |
find_referencing_symbols | Infer behavior from existing code usage patterns |
See references/serena_integration_flow.md for how the Serena-enabled codebase analysis step is inserted into the Generation Flow.
Even without Serena, specifications are generated based on input content and PRD. If existing code reference is needed, recommend manual verification to user.
Before spec/design generation, you must read ${CLAUDE_PROJECT_DIR}/${SDD_ROOT}/CONSTITUTION.md using the Read tool.
After loading CONSTITUTION.md, understand the following principles and ensure spec/design compliance:
For Abstract Specification (*_spec.md):
| Principle Category | Impact on Spec |
|---|---|
| Architecture Principles (A-xxx) | Architecture patterns, layer separation, interface design |
| Development Principles (D-xxx) | Testability, modularity, requirement traceability |
| Business Principles (B-xxx) | Business logic reflection, domain model |
For Technical Design Document (*_design.md):
| Principle Category | Impact on Design |
|---|---|
| Technical Constraints (T-xxx) | Technology selection, version constraints, platform |
| Architecture Principles (A-xxx) | Architecture implementation, design patterns |
| Development Principles (D-xxx) | Test strategy, CI/CD considerations |
/sdd-init or /constitution init to create project principles"CI Mode: If
--ciflag is specified, skip principle compliance check.
After spec and design generation, you must call the spec-reviewer agent to check principle compliance.
See references/spec_reviewer_check_flow.md for the full check flow (calling spec-reviewer through re-check and result reporting).
Include the following after spec generation:
Reference: examples/compliance_check_spec.md
Include the following after design doc generation:
Reference: examples/compliance_check_design.md