Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:36:35 +08:00
commit 9951a55211
18 changed files with 1638 additions and 0 deletions

View File

@@ -0,0 +1,99 @@
---
name: code-review-checklist
description: Comprehensive code review checklist covering correctness, performance, security, and maintainability. Use when performing code reviews or preparing code for review.
---
# Code Review Checklist
This skill provides a systematic approach to code review, ensuring comprehensive quality assessment.
## Core Review Areas
### 1. Correctness
- [ ] **Logic**: Code implements requirements correctly
- [ ] **Edge Cases**: Handles boundary conditions and error cases
- [ ] **Data Validation**: Input validation is thorough
- [ ] **Error Handling**: Errors are caught and handled appropriately
- [ ] **Type Safety**: Types are used correctly (for typed languages)
### 2. Performance
- [ ] **Algorithmic Complexity**: Appropriate algorithms chosen (time/space)
- [ ] **Resource Usage**: No unnecessary memory allocations
- [ ] **Database Queries**: Efficient queries, proper indexing
- [ ] **Caching**: Appropriate use of caching strategies
- [ ] **Async Operations**: Non-blocking where appropriate
### 3. Security
- [ ] **Input Sanitization**: User input is sanitized
- [ ] **SQL Injection**: Parameterized queries used
- [ ] **XSS Protection**: Output is escaped properly
- [ ] **Authentication**: Auth checks are present and correct
- [ ] **Authorization**: Permission checks are enforced
- [ ] **Secrets**: No hardcoded credentials or API keys
- [ ] **HTTPS**: Secure communication enforced
### 4. Maintainability
- [ ] **Naming**: Clear, descriptive variable/function names
- [ ] **Function Length**: Functions are focused and concise
- [ ] **Duplication**: No unnecessary code duplication (DRY)
- [ ] **Comments**: Complex logic is documented
- [ ] **SOLID Principles**: Code follows good design principles
- [ ] **Testability**: Code structure supports testing
### 5. Testing
- [ ] **Unit Tests**: Core logic has unit test coverage
- [ ] **Integration Tests**: Component interactions are tested
- [ ] **Test Quality**: Tests are meaningful, not just for coverage
- [ ] **Edge Cases**: Tests cover boundary conditions
- [ ] **Mocking**: Appropriate use of mocks/stubs
### 6. Documentation
- [ ] **API Docs**: Public APIs are documented
- [ ] **README Updates**: Documentation reflects changes
- [ ] **Migration Guides**: Breaking changes documented
- [ ] **Inline Comments**: Complex logic explained
- [ ] **Changelog**: Changes noted in changelog
## Review Comments Template
Use this format for actionable feedback:
```markdown
**[Category]**: [Issue]
**Location**: file.js:123
**Current**:
```code snippet```
**Suggestion**:
```improved code```
**Rationale**: Why this change improves the code
**Priority**: [Critical|High|Medium|Low]
```
## Quick Wins
Fast improvements with high impact:
1. Remove unused imports/variables
2. Fix inconsistent formatting
3. Add missing error handling
4. Improve variable names
5. Extract magic numbers to constants
6. Add basic input validation
## Integration with Plugin
Works with:
- `code-reviewer` agent for automated review
- `senior-engineer` agent for implementation guidance
- Pre-PR review workflow

View File

@@ -0,0 +1,104 @@
---
name: refactoring-patterns
description: Common refactoring patterns and techniques for improving code quality, reducing complexity, and enhancing maintainability. Use when planning or executing code refactoring.
---
# Refactoring Patterns
This skill provides proven patterns for safe, effective code refactoring.
## Core Refactoring Principles
### Design Principles
1. **SOLID**: Single responsibility, Open-closed, Liskov substitution, Interface segregation, Dependency inversion
2. **KISS** (Keep It Simple, Stupid): Favor simplicity over complexity
3. **YAGNI** (You Aren't Gonna Need It): Don't add functionality until necessary
4. **DRY** (Don't Repeat Yourself): Avoid code duplication
### Refactoring Guidelines
1. **Red-Green-Refactor**: Ensure tests pass before and after refactoring
2. **Small Steps**: Make incremental changes, commit frequently
3. **One Thing at a Time**: Refactor OR add features, not both
4. **Maintain Behavior**: External behavior stays the same
5. **Avoid Premature Optimization**: Focus on clarity first, optimize when needed based on metrics
## Refactoring Approaches
### Architectural Level
- Restructure system components and module boundaries
- Refactor service boundaries in microservices/modular monoliths
- Redesign database schema and data access patterns
- Improve system scalability and performance architecture
### Module/Package Level
- Reorganize package structure for better cohesion
- Extract shared libraries or utilities
- Improve dependency management and reduce coupling
- Refactor cross-cutting concerns
### Class/Component Level
- Apply SOLID principles to class design
- Extract interfaces and abstractions
- Reduce class complexity and responsibilities
- Improve encapsulation and information hiding
### Method/Function Level
- Simplify complex logic
- Extract reusable functions
- Improve naming and readability
- Reduce parameter lists
## Refactoring Strategy
### 1. Understand the Code
Before refactoring:
- [ ] Read and understand the existing code
- [ ] Identify all test coverage
- [ ] Document current behavior
- [ ] Note any dependencies
### 2. Ensure Test Coverage
- [ ] Add tests if missing to cover refactored parts
- [ ] Verify all tests pass
- [ ] Focus on testing the specific code being refactored (no specific coverage percentage target)
### 3. Plan Refactoring
Create a markdown file documenting:
- [ ] What needs to be refactored and why
- [ ] Sequence of small, incremental steps
- [ ] Checklist format with tasks that can be marked as done (- [x]) before moving to next task
- [ ] Dependencies and potential risks
### 4. Execute Incrementally
- [ ] Make one change at a time
- [ ] Run tests after each change
- [ ] Commit working code frequently
- [ ] Roll back if tests fail
### 5. Verify and Clean Up
- [ ] All tests pass
- [ ] Code is clearer and simpler
- [ ] Update documentation
## Safe Refactoring Checklist
- [ ] Tests exist and pass before starting
- [ ] Each refactoring step is small and focused
- [ ] Tests pass after each step
- [ ] Behavior remains unchanged
- [ ] Code is more maintainable
- [ ] Team has reviewed changes
- [ ] **Never remove existing tests** - only add new tests for refactoring validation
## Integration Points
Works with:
- `senior-engineer` agent for refactoring execution
- `technical-architecture-advisor` for large-scale refactoring
- `/refactoring-plan` command for structured refactoring
- `code-reviewer` agent for validating improvements

View File

@@ -0,0 +1,152 @@
---
name: workflow-orchestration
description: Coordinate multi-step workflows involving multiple agents, commands, and validation points. Use when managing complex development workflows that require coordination between different specialized agents.
---
# Workflow Orchestration
This skill provides patterns for orchestrating complex workflows with multiple agents and validation points.
## Workflow Patterns
### Sequential Workflow
For workflows where each step depends on the previous one:
```markdown
1. Initial Analysis → 2. Planning → 3. Implementation → 4. Validation
```
**When to use**: Linear dependencies, each step builds on previous results
### Parallel Workflow
For independent tasks that can run concurrently:
```markdown
┌→ Task A ┐
Start → ├→ Task B ├→ Merge → Continue
└→ Task C ┘
```
**When to use**: Independent components, can be developed/tested separately
### Iterative Workflow
For workflows requiring refinement:
```markdown
Plan → Implement → Review → [Refine Plan] → Loop until criteria met
```
**When to use**: Exploratory tasks, requirements evolve during execution
## Agent Coordination
### Handoff Pattern
Clear transitions between specialized agents:
```markdown
1. github-issue-analyzer: Extract requirements
2. prp-generator: Create structured plan
3. executor: Implement solution
4. Code review (external): Validate quality
```
**Handoff checklist**:
- [ ] Previous agent completed all deliverables
- [ ] Next agent has required context
- [ ] Success criteria clearly defined
### Delegation Pattern
Main orchestrator delegates to specialists:
```markdown
Orchestrator
├→ Technical research → Report findings
├→ Implementation → Deliver code
└→ Documentation → Update docs
```
**Delegation checklist**:
- [ ] Clear scope and boundaries for each agent
- [ ] Expected outputs defined
- [ ] Time/resource constraints communicated
## Progress Tracking
Use structured tracking for visibility:
```markdown
## Workflow Status
### Phase 1: Analysis ✅
- [x] GitHub issue analyzed
- [x] Requirements extracted
- [x] PRP generated
### Phase 2: Implementation 🔄
- [x] Core functionality implemented
- [ ] Edge cases handled
- [ ] Tests written
### Phase 3: Validation ⏸️
- [ ] Code review
- [ ] Integration tests
- [ ] Documentation updated
```
Symbols: ✅ Complete | 🔄 In Progress | ⏸️ Blocked | ❌ Failed
## Error Handling
Define fallback strategies:
```markdown
## Contingency Plans
### If implementation fails:
1. Rollback to previous stable state
2. Analyze failure root cause
3. Adjust plan based on learnings
4. Retry with updated approach
### If validation fails:
1. Document specific failures
2. Create targeted fixes
3. Re-run validation subset
4. Escalate if pattern of failures
```
## Workflow Templates
### Bug Fix Workflow
```markdown
1. Issue Analysis → Reproduce bug
2. Root Cause → Identify problem
3. Fix Design → Plan solution
4. Implementation → Apply fix
5. Testing → Verify resolution
6. Regression Check → Ensure no side effects
```
### Feature Development Workflow
```markdown
1. Requirements → Define scope
2. Design Review → Architecture validation
3. Prototype → Quick proof of concept
4. Implementation → Full feature build
5. Testing → Comprehensive validation
6. Documentation → User-facing docs
7. Deployment → Staged rollout
```
## Integration with Plugin Components
- **Orchestrator agent**: Uses these patterns for workflow management
- **Executor agent**: Follows orchestration directives
- **Commands**: `/generate-prp`, `/execute-prp` implement workflow steps