🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
10 KiB
description
| description |
|---|
| Create documentation for existing implemented features from a natural language description. |
User Input
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
Outline
The text the user typed after /speckit.document in the triggering message is the feature description (summarized by the user). Assume you always have it available in this conversation even if $ARGUMENTS appears literally below. Do not ask the user to repeat it unless they provided an empty command.
Given that feature description, do this:
-
Generate a concise document name (2-4 words):
- Analyze the feature description and extract the most meaningful keywords
- Create a 2-4 word name that captures the essence of the feature
- Use noun format when possible (e.g., "cart-feature", "payment-system", "user-authentication")
- Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
- Keep it concise but descriptive enough to understand the feature at a glance
- Examples:
- "장바구니 기능입니다" → "cart-feature"
- "결제 시스템 구현" → "payment-system"
- "사용자 인증 OAuth2" → "oauth2-authentication"
- "리뷰 포인트 시스템" → "review-points-system"
-
Determine output location (NO script execution, NO branch creation):
- Create docs directory if needed:
docs/or.specify/docs/ - Generate filename:
[document-name].md(e.g.,cart-feature.md) - Full path example:
docs/cart-feature.md
- Create docs directory if needed:
-
Load
.specify/templates/docs-template.mdto understand required sections. -
Follow this execution flow:
- Parse user description from Input If empty: ERROR "No feature description provided"
- Extract key information from description:
- Feature overview and purpose
- Business policies mentioned
- Main logic flows
- Implemented features
- API endpoints (if mentioned)
- Known issues or improvements
- Related files (if mentioned)
- For unclear aspects:
- Make informed guesses based on context and industry standards
- Only mark with [NEEDS CLARIFICATION: specific question] if:
- The choice significantly impacts documentation completeness
- Multiple reasonable interpretations exist with different implications
- No reasonable default exists
- LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total
- Prioritize clarifications by impact: business policy > logic flow > feature details
- Fill all mandatory sections:
- Overview
- Business Policy (policies with reasons)
- Main Logic
- Feature List (completed and incomplete)
- API List (if applicable)
- Issues/Improvements
- Related Files
- Return: SUCCESS (documentation ready)
-
Write the documentation to the determined file path using the template structure, replacing placeholders with concrete details derived from the feature description while preserving section order and headings.
-
Documentation Quality Validation: After writing the initial docs, validate it against quality criteria:
a. Create Documentation Quality Checklist: Generate a checklist file at
docs/checklists/[document-name]-quality.md(or.specify/docs/checklists/[document-name]-quality.md) with these validation items:# Documentation Quality Checklist: [FEATURE NAME] **Purpose**: Validate documentation completeness and quality **Created**: [DATE] **Feature**: [Link to docs.md] ## Content Completeness - [ ] Overview clearly explains the feature purpose - [ ] All business policies documented with reasons - [ ] Main logic flows are described - [ ] Feature list includes both completed and incomplete items - [ ] API list is complete (if feature has APIs) - [ ] Issues/improvements are identified - [ ] Related files are listed ## Policy Documentation - [ ] No [NEEDS CLARIFICATION] markers remain - [ ] Each policy includes the reason/background - [ ] Policies are clear and unambiguous - [ ] Missing policies are identified in Issues/Improvements ## Documentation Quality - [ ] Written in clear, understandable language - [ ] Technical terms are used appropriately - [ ] Examples are provided where helpful - [ ] Document is well-structured and easy to navigate ## Notes - Items marked incomplete require docs updates or clarificationb. Run Validation Check: Review the docs against each checklist item:
- For each item, determine if it passes or fails
- Document specific issues found (quote relevant sections)
c. Handle Validation Results:
-
If all items pass: Mark checklist complete and proceed to step 7
-
If items fail (excluding [NEEDS CLARIFICATION]):
- List the failing items and specific issues
- Update the docs to address each issue
- Re-run validation until all items pass (max 3 iterations)
- If still failing after 3 iterations, document remaining issues in checklist notes and warn user
-
If [NEEDS CLARIFICATION] markers remain:
-
Extract all [NEEDS CLARIFICATION: ...] markers from the docs
-
LIMIT CHECK: If more than 3 markers exist, keep only the 3 most critical (by policy/logic/feature impact) and make informed guesses for the rest
-
CRITICAL - Korean Communication: Present all questions in Korean to the user
-
For each clarification needed (max 3), present options to user in this format:
## 질문 [N]: [주제] **문맥**: [문서의 관련 섹션 인용] **알아야 할 내용**: [NEEDS CLARIFICATION 마커의 구체적 질문] **제안 답변**: | 옵션 | 답변 | 문서화 영향 | |------|------|-------------| | A | [첫 번째 제안 답변] | [문서화에 미치는 영향] | | B | [두 번째 제안 답변] | [문서화에 미치는 영향] | | C | [세 번째 제안 답변] | [문서화에 미치는 영향] | | 직접입력 | 직접 답변 제공 | [사용자가 직접 입력하는 방법 설명] | **선택**: _[사용자 응답 대기]_ -
CRITICAL - Table Formatting: Ensure markdown tables are properly formatted:
- Use consistent spacing with pipes aligned
- Each cell should have spaces around content:
| Content |not|Content| - Header separator must have at least 3 dashes:
|--------| - Test that the table renders correctly in markdown preview
-
Number questions sequentially in Korean (질문1, 질문2, 질문3 - max 3 total)
-
Present all questions together before waiting for responses
-
Wait for user to respond with their choices for all questions (e.g., "질문1: A, 질문2: 직접입력 - [상세내용], 질문3: B")
-
Update the docs by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
-
Re-run validation after all clarifications are resolved
-
d. Update Checklist: After each validation iteration, update the checklist file with current pass/fail status
-
Report completion with document file path, checklist results, and any identified issues/improvements.
NOTE: This command does NOT create branches or run scripts - it only creates documentation files.
General Guidelines
Quick Guidelines
- Focus on documenting WHAT is implemented, WHY (business reasons), and HOW (main logic).
- Include both completed and incomplete features.
- Identify issues and improvements discovered during documentation.
- Written for both technical and non-technical stakeholders.
Section Requirements
- Mandatory sections: Must be completed for every feature
- Optional sections: Include only when relevant to the feature (e.g., API List)
- When a section doesn't apply, remove it entirely (don't leave as "N/A")
For AI Generation
When creating this documentation from a user prompt:
- Make informed guesses: Use context, industry standards, and common patterns to fill gaps
- Document what's known: Focus on information explicitly provided by the user
- Limit clarifications: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical information that:
- Significantly impacts documentation completeness
- Has multiple reasonable interpretations with different implications
- Lacks any reasonable default
- Prioritize clarifications: business policy > logic flow > feature details
- Think practically: Document what exists, flag what's missing in Issues/Improvements
- Common areas needing clarification (only if no reasonable default exists):
- Business policy reasons (why this implementation was chosen)
- Missing or unclear logic flows
- Incomplete feature status (implemented vs planned)
Examples of reasonable defaults (don't ask about these):
- Standard CRUD operations: If basic endpoints are mentioned, assume standard patterns
- Common business policies: Industry-standard practices unless specified otherwise
- File organization: Standard Rails/project conventions unless specified
- Error handling: Standard error responses unless specified
Documentation Structure Guidelines
Documentation should be:
- Clear: Use simple language, avoid jargon unless necessary
- Complete: All mandatory sections filled appropriately
- Accurate: Based on user's description, not assumptions
- Actionable: Issues/improvements are specific and practical
Good examples:
- "재고 차감 시점: 장바구니 추가 시 (이유: 한정 수량 선점 방지)"
- "만료 정책: 30일 후 자동 만료 (이유: 데이터 누적 방지)"
- "[ ] [P1] 재고 복구 배치 작업 미구현 (현재 재고가 복구되지 않음)"
Bad examples:
- "정책 있음" (not specific)
- "잘 작동함" (no business reason)
- "개선 필요" (not actionable)