feat: 更新章程和任务模板,增加 SOLID、KISS、YAGNI、DRY 原则合规性检查

This commit is contained in:
Rogee
2025-09-19 17:06:57 +08:00
parent 2befb513a8
commit 8c65c6a854
3 changed files with 166 additions and 43 deletions

View File

@@ -47,7 +47,41 @@
## Constitution Check
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
[Gates determined based on constitution file]
### SOLID Principles Compliance
- [ ] **Single Responsibility**: Each component has single, clear responsibility
- [ ] **Open/Closed**: Design allows extension without modification
- [ ] **Liskov Substitution**: Subtypes can replace base types seamlessly
- [ ] **Interface Segregation**: Interfaces are specific and focused
- [ ] **Dependency Inversion**: Depend on abstractions, not concrete implementations
### KISS Principle Compliance
- [ ] Design avoids unnecessary complexity
- [ ] CLI interface maintains consistency
- [ ] Code generation logic is simple and direct
- [ ] Solutions are intuitive and easy to understand
### YAGNI Principle Compliance
- [ ] Only implementing clearly needed functionality
- [ ] No over-engineering or future-proofing without requirements
- [ ] Each feature has explicit user需求支撑
- [ ] No "might be useful" features without justification
### DRY Principle Compliance
- [ ] No code duplication across components
- [ ] Common functionality is abstracted and reused
- [ ] Template system avoids repetitive implementations
- [ ] Shared utilities are properly abstracted
### Code Quality Standards
- [ ] **Testing Discipline**: TDD approach with Red-Green-Refactor cycle
- [ ] **CLI Consistency**: Unified parameter formats and output standards
- [ ] **Error Handling**: Complete error information and recovery mechanisms
- [ ] **Performance**: Generation speed and memory usage requirements met
### Complexity Tracking
| Violation | Why Needed | Simpler Alternative Rejected Because |
|-----------|------------|-------------------------------------|
| [Document any deviations from constitutional principles] | [Justification for complexity] | [Why simpler approach insufficient] |
## Project Structure
@@ -208,4 +242,4 @@ ios/ or android/
- [ ] Complexity deviations documented
---
*Based on Constitution v2.1.1 - See `/memory/constitution.md`*
*Based on Constitution v1.0.0 - See `/memory/constitution.md`*

View File

@@ -100,19 +100,39 @@ Task: "Integration test auth in tests/integration/test_auth.py"
## Task Generation Rules
*Applied during main() execution*
1. **From Contracts**:
1. **SOLID Compliance**:
- Single Responsibility: Each task focuses on one specific component
- Open/Closed: Design tasks to allow extension without modification
- Interface Segregation: Create focused interfaces for different task types
2. **KISS Compliance**:
- Keep task descriptions simple and direct
- Avoid over-complicating task dependencies
- Use intuitive file naming and structure
3. **YAGNI Compliance**:
- Only create tasks for clearly needed functionality
- Avoid speculative tasks without direct requirements
- Focus on MVP implementation first
4. **DRY Compliance**:
- Abstract common patterns into reusable task templates
- Avoid duplicate task definitions
- Consolidate similar operations where possible
5. **From Contracts**:
- Each contract file → contract test task [P]
- Each endpoint → implementation task
2. **From Data Model**:
6. **From Data Model**:
- Each entity → model creation task [P]
- Relationships → service layer tasks
3. **From User Stories**:
7. **From User Stories**:
- Each story → integration test [P]
- Quickstart scenarios → validation tasks
4. **Ordering**:
8. **Ordering**:
- Setup → Tests → Models → Services → Endpoints → Polish
- Dependencies block parallel execution