Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 09:06:46 +08:00
commit 867df4fed0
20 changed files with 4979 additions and 0 deletions

114
commands/review.md Normal file
View File

@@ -0,0 +1,114 @@
---
description: Trigger comprehensive code review with quality checks
---
Activate the `code-quality` skill to perform systematic code review using comprehensive checklist covering code structure, error handling, security, performance, and testing.
## Review Process
1. **Ask What to Review**
Present options:
- Current staged changes (`git diff --cached`)
- Current unstaged changes (`git diff`)
- Specific file or directory
- Entire feature (all changes in current branch)
- Recent commits
2. **Run Appropriate Command**
```bash
# For staged changes
git diff --cached
# For unstaged changes
git diff
# For specific file
# Read the file directly
# For entire feature
git diff main...HEAD
```
3. **Perform Comprehensive Review**
Use checklist from `code-quality` skill:
- Code Structure (SRP, DRY, function length, naming, magic numbers)
- Error Handling (all errors caught, no silent failures, logging, edge cases)
- Security (input validation, SQL injection, XSS, sensitive data, secrets)
- Performance (N+1 queries, caching, indexes, unnecessary computations, memory leaks)
- Testing (tests exist, edge cases tested, happy path tested, error conditions, maintainability)
4. **Generate Review Report**
Format:
```markdown
## Code Review: [File/Feature Name]
### ✅ Strengths
[What's done well]
### ⚠️ Issues Found
#### Priority: High - Must Fix Before Merge
[Critical issues with location, problem, risk, and fix]
#### Priority: Medium - Should Address
[Important improvements]
#### Priority: Low - Consider Improving
[Optional enhancements]
### 💡 Refactoring Suggestions
[Specific improvements with before/after code examples]
### 📊 Code Metrics
- Complexity: [Low/Medium/High]
- Test Coverage: [X%]
- Maintainability: [A/B/C/D/F]
### 🎯 Action Items
- [ ] Fix high-priority issues
- [ ] Address medium-priority items
- [ ] Consider refactoring suggestions
**Overall Assessment:** [Summary]
**Recommendation:** [Approve/Request Changes/Reject]
[Confidence: X.X]
```
5. **Suggest Next Steps**
- If critical issues: Must fix before commit
- If medium issues: Should address before merge
- If low issues: Optional improvements
- If clean: Ready to commit/merge
## Argument Handling
**If user provides file path as argument:**
```
/dev-workflow:review src/auth/login.js
```
→ Review that specific file directly
**If user provides directory as argument:**
```
/dev-workflow:review src/auth/
```
→ Review all files in that directory
**If user provides "." as argument:**
```
/dev-workflow:review .
```
→ Review all changes in current directory (recursive)
**If no argument provided:**
```
/dev-workflow:review
```
→ Ask user what to review (staged, unstaged, specific file, etc.)
## Examples
**Example 1: Review staged changes**
```
User: /dev-workflow:review

124
commands/spec.md Normal file
View File

@@ -0,0 +1,124 @@
---
description: Launch spec-driven development workflow for features
---
Route to the appropriate spec-driven skill based on phase:
- **Planning phases** (create, requirements, design): Activate `spec-driven-planning` skill
- **Implementation phases** (tasks, execute): Activate `spec-driven-implementation` skill
- **Utility** (list): Show feature status directly
## Interactive Menu
Present this menu to the user:
```
📋 Spec-Driven Development Workflow
Planning Phase:
1. Create new feature
2. Define requirements (EARS format)
3. Generate technical design
Implementation Phase:
4. Break down into tasks (TDD)
5. Execute implementation
Utility:
6. List all features
What would you like to do? (1-6)
```
## Argument Handling & Routing
**Planning Phase Arguments:**
```
/dev-workflow:spec create → Activate spec-driven-planning (Phase 1)
/dev-workflow:spec "feature-name" → Activate spec-driven-planning (Phase 1)
/dev-workflow:spec requirements → Activate spec-driven-planning (Phase 2)
/dev-workflow:spec design → Activate spec-driven-planning (Phase 3)
```
**Implementation Phase Arguments:**
```
/dev-workflow:spec tasks → Activate spec-driven-implementation (Phase 4)
/dev-workflow:spec execute → Activate spec-driven-implementation (Phase 5)
```
**Utility Arguments:**
```
/dev-workflow:spec list → Show all features with status
```
## Routing Logic
**IMPORTANT:** Always use the Skill tool to explicitly invoke skills. This ensures correct skill activation even when conflicting global commands exist.
Based on user's menu choice or argument:
**Options 1-3** or args **[create, feature-name, requirements, design]:**
→ Use the Skill tool to invoke: `dev-workflow:spec-driven-planning`
**Options 4-5** or args **[tasks, execute]:**
→ Use the Skill tool to invoke: `dev-workflow:spec-driven-implementation`
**Option 6** or arg **[list]:**
→ List features directly with status (no skill needed)
## Phase Details
**Planning Phases (1-3)** are handled by `spec-driven-planning` skill:
- Phase 1: Feature Creation - Create directory structure and templates
- Phase 2: Requirements Definition - Use EARS format for clear requirements
- Phase 3: Technical Design - Propose architectural approaches with trade-offs
**Implementation Phases (4-5)** are handled by `spec-driven-implementation` skill:
- Phase 4: Task Breakdown - Break design into TDD tasks (Red-Green-Refactor)
- Phase 5: Execution - Execute tasks systematically with quality gates
See respective skill documentation for detailed phase execution instructions.
## Examples
**Example 1: Interactive Menu**
```
User: /dev-workflow:spec
Assistant presents interactive menu showing planning and implementation phases.
User selects option 1-3 → Assistant uses Skill tool to invoke spec-driven-planning
User selects option 4-5 → Assistant uses Skill tool to invoke spec-driven-implementation
```
**Example 2: Start Planning New Feature**
```
User: /dev-workflow:spec "user authentication"
Assistant uses Skill tool to invoke: dev-workflow:spec-driven-planning
Skill activates at Phase 1 (Feature Creation)
Creates feature structure and begins requirements gathering.
```
**Example 3: Jump to Design Phase**
```
User: /dev-workflow:spec design
Assistant uses Skill tool to invoke: dev-workflow:spec-driven-planning
Skill activates at Phase 3 (Design)
Finds most recent feature and proposes architectural approaches.
```
**Example 4: Start Implementation**
```
User: /dev-workflow:spec tasks
Assistant uses Skill tool to invoke: dev-workflow:spec-driven-implementation
Skill activates at Phase 4 (Task Breakdown)
Reads completed design and breaks into TDD tasks.
```
**Example 5: List Features**
```
User: /dev-workflow:spec list
Assistant lists all features in docx/features/ with current status.
```

55
commands/spec/create.md Normal file
View File

@@ -0,0 +1,55 @@
---
description: Create new feature specification
---
Activate the `spec-driven-planning` skill to execute Phase 1 (Feature Creation).
**Instructions:**
1. Extract feature name from $ARGUMENTS
- If $ARGUMENTS provided: Use it as the feature name
- If $ARGUMENTS empty: Ask user "What feature would you like to create?"
2. Use the Skill tool to invoke: `dev-workflow:spec-driven-planning`
3. Tell the skill:
"Create a new feature called [feature-name]. Execute Phase 1 (Feature Creation):
- Check existing features in docx/features/
- Create directory structure: docx/features/[NN-feature-name]/
- Copy all templates (requirements.md, design.md, tasks.md)
- Initialize with feature name
After creating the feature structure, ask if I'm ready to proceed with Phase 2 (Requirements Definition)."
**What Gets Created:**
The following files will be created with comprehensive templates:
1. **requirements.md** (135 lines)
- EARS format structure (Event, State, Ubiquitous, Conditional, Optional)
- Non-functional requirements (Performance, Security, Usability)
- Constraints, acceptance criteria, out-of-scope items
- Dependencies, risks, and assumptions
2. **design.md** (434 lines)
- Architecture overview and system context
- Component structure with interfaces
- Data flow diagrams and API contracts
- Error handling, security, and performance strategies
- Testing strategy and deployment plan
3. **tasks.md** (427 lines)
- TDD task breakdown (Red-Green-Refactor cycles)
- Integration, error handling, and performance tasks
- Documentation and quality assurance tasks
- Progress tracking with checkboxes
**After creation, show the user:**
```
✅ Created: docx/features/[NN-feature-name]/
- requirements.md (ready to fill in)
- design.md (ready to fill in)
- tasks.md (ready to fill in)
📋 Next: Define requirements using /dev-workflow:spec:requirements
```

26
commands/spec/design.md Normal file
View File

@@ -0,0 +1,26 @@
---
description: Generate technical design
---
Activate the `spec-driven-planning` skill to execute Phase 3 (Technical Design).
**Instructions:**
1. Determine target feature:
- If $ARGUMENTS provided: Use it as feature name/number
- If $ARGUMENTS empty: Find most recent feature in docx/features/
2. Use the Skill tool to invoke: `dev-workflow:spec-driven-planning`
3. Tell the skill:
"Execute Phase 3 (Technical Design) for feature [feature-name]:
- Read requirements from docx/features/[NN-feature-name]/requirements.md
- Propose 2-3 architectural approaches with trade-offs
- Recommend best approach with reasoning
- Update docx/features/[NN-feature-name]/design.md with comprehensive design
After design is complete, ask if I'm ready to proceed with Phase 4 (Task Breakdown)."
**Expected Outcome:**
- design.md populated with architecture, components, data flow, and API contracts
- User prompted for next phase

29
commands/spec/execute.md Normal file
View File

@@ -0,0 +1,29 @@
---
description: Execute implementation with TDD
---
Activate the `spec-driven-implementation` skill to execute Phase 5 (Execution).
**Instructions:**
1. Determine target feature:
- If $ARGUMENTS provided: Use it as feature name/number
- If $ARGUMENTS empty: Find most recent feature in docx/features/
2. Use the Skill tool to invoke: `dev-workflow:spec-driven-implementation`
3. Tell the skill:
"Execute Phase 5 (Implementation) for feature [feature-name]:
- Read tasks from docx/features/[NN-feature-name]/tasks.md
- Execute tasks systematically following TDD (Red-Green-Refactor)
- Update checkboxes as tasks complete
- Integrate with code-quality and git-workflow skills
- Run quality gates before marking tasks complete
Work through all tasks until feature is complete."
**Expected Outcome:**
- All tasks executed with TDD discipline
- Checkboxes updated in tasks.md
- Code quality verified
- Feature implementation complete

14
commands/spec/list.md Normal file
View File

@@ -0,0 +1,14 @@
---
description: List all features with status
---
List all features in `docx/features/` directory with their current status:
1. Find all feature directories: `docx/features/[NN-feature-name]/`
2. For each feature, show:
- Feature number and name
- Completion status (✅ Complete, 🔄 In Progress, ⏳ Not Started)
- Files present: requirements.md, design.md, tasks.md
- Task progress if tasks.md exists: X/Y tasks complete
Format as table or bulleted list.

View File

@@ -0,0 +1,25 @@
---
description: Define requirements using EARS format
---
Activate the `spec-driven-planning` skill to execute Phase 2 (Requirements Definition).
**Instructions:**
1. Determine target feature:
- If $ARGUMENTS provided: Use it as feature name/number
- If $ARGUMENTS empty: Find most recent feature in docx/features/
2. Use the Skill tool to invoke: `dev-workflow:spec-driven-planning`
3. Tell the skill:
"Execute Phase 2 (Requirements Definition) for feature [feature-name]:
- Use EARS format for all requirements
- Ask systematic questions to elicit clear requirements
- Update docx/features/[NN-feature-name]/requirements.md
After requirements are complete, ask if I'm ready to proceed with Phase 3 (Design)."
**Expected Outcome:**
- requirements.md populated with EARS-formatted requirements
- User prompted for next phase

26
commands/spec/tasks.md Normal file
View File

@@ -0,0 +1,26 @@
---
description: Break down design into TDD tasks
---
Activate the `spec-driven-implementation` skill to execute Phase 4 (Task Breakdown).
**Instructions:**
1. Determine target feature:
- If $ARGUMENTS provided: Use it as feature name/number
- If $ARGUMENTS empty: Find most recent feature in docx/features/
2. Use the Skill tool to invoke: `dev-workflow:spec-driven-implementation`
3. Tell the skill:
"Execute Phase 4 (Task Breakdown) for feature [feature-name]:
- Read design from docx/features/[NN-feature-name]/design.md
- Break down into TDD tasks following Red-Green-Refactor cycle
- Create checkbox list for tracking progress
- Update docx/features/[NN-feature-name]/tasks.md
After tasks are defined, ask if I'm ready to proceed with Phase 5 (Execution)."
**Expected Outcome:**
- tasks.md populated with TDD task breakdown and checkboxes
- User prompted for execution phase