Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:46:50 +08:00
commit a3a73d67d7
67 changed files with 19703 additions and 0 deletions

View File

@@ -0,0 +1,316 @@
# Agent Specification Template
Use this template when summoning specialized agents to ensure they have exactly what they need - no more, no less.
---
## Agent Specification: [AGENT NAME/ID]
**Created**: [DATE]
**Summoner**: [Who summoned this agent]
**Status**: [Active | Complete | Blocked]
---
## Agent Profile
### Specialization
[What this agent is expert in - e.g., "Frontend React Developer", "Database Optimization Specialist", "Security Auditor"]
### Assigned Tasks
- Task 1.2: [Task Name]
- Task 1.3: [Task Name]
- [List all tasks assigned to this agent]
### Expected Completion
[Date/time or "After Task X.Y completes"]
---
## Context Package
### What This Agent Needs to Know
[Provide ONLY the context necessary for their tasks. Link to full docs rather than duplicating.]
**Project Overview (Brief)**:
[2-3 sentences about the overall project - just enough to understand their role]
**Their Role**:
[1-2 sentences about what they're responsible for in the bigger picture]
**Specific Context**:
```
[The actual detailed context needed for their tasks:
- Relevant architecture decisions
- Tech stack specifics
- Existing patterns to follow
- Constraints to respect
- Examples to reference]
```
### What This Agent Does NOT Need
[Explicitly list what context you're NOT providing to avoid bloat:]
- ❌ [Irrelevant context 1]
- ❌ [Irrelevant context 2]
- ❌ [Information they can look up themselves]
---
## Task Details
### Task [ID]: [Name]
**Objective**:
[Clear statement of what needs to be accomplished]
**Current State**:
```
[What exists now - relevant files, implementations, issues]
File: path/to/file.ts:123
Current implementation: [brief description]
Problem: [what needs to change]
```
**Desired End State**:
```
[What should exist after this task]
- Deliverable 1
- Deliverable 2
- Tests passing
- Documentation updated
```
**Acceptance Criteria**:
- [ ] Criterion 1 (specific, testable)
- [ ] Criterion 2 (specific, testable)
- [ ] All tests pass
- [ ] Quality gates pass
- [ ] Documentation complete
**Constraints**:
- Must: [Things that must be done]
- Must NOT: [Things to avoid]
- Should: [Preferences/best practices]
**Reference Files**:
- `path/to/relevant/file.ts` - [Why this is relevant]
- `path/to/example.ts:45-67` - [What pattern to follow]
- `docs/architecture.md` - [Link to full docs]
---
## Inputs & Dependencies
### Inputs Provided
[What this agent is receiving to start their work:]
- ✅ Input 1: [Description and location]
- ✅ Input 2: [Description and location]
### Dependencies
[What must be complete before this agent can start:]
- Task X.Y: [Name] - Status: [Complete/In Progress]
- Decision Z: [Description] - Status: [Decided/Pending]
### Blockers
[Current blockers if any:]
- ❌ [Blocker description] - Owner: [Who's resolving]
- OR: None - Ready to proceed
---
## Outputs Expected
### Primary Deliverables
1. **[Deliverable 1]**
- Format: [e.g., "Modified file at path/to/file.ts"]
- Requirements: [Specific requirements]
- Validation: [How to verify it's correct]
2. **[Deliverable 2]**
- Format: [...]
- Requirements: [...]
- Validation: [...]
### Secondary Deliverables
- [ ] Tests for new functionality
- [ ] Documentation updates
- [ ] Updated MCD if any changes to plan
- [ ] Quality gate sign-off
### Handoff Protocol
[How to hand off to next agent or back to summoner:]
```
1. Complete all deliverables
2. Run quality gate checklist
3. Document any deviations from plan
4. Update MCD progress tracking
5. Report completion with summary
```
---
## Quality Standards
### Code Quality
- [ ] Follows DRY principle
- [ ] Follows CLEAN code practices
- [ ] Follows SOLID principles (applicable ones)
- [ ] Consistent with project style
- [ ] Properly documented
### Testing
- [ ] Unit tests written
- [ ] Integration tests if applicable
- [ ] All tests passing
- [ ] Edge cases covered
### Security
- [ ] No vulnerabilities introduced
- [ ] Input validation
- [ ] Proper error handling
- [ ] No sensitive data exposed
### Performance
- [ ] Meets performance requirements
- [ ] No unnecessary operations
- [ ] Efficient algorithms
- [ ] Resources properly managed
---
## Communication Protocol
### Status Updates
**Frequency**: [e.g., "After each task completion" or "Daily"]
**Format**: [How to report - e.g., "Comment in MCD"]
**Content**: [What to include - progress, blockers, questions]
### Questions/Clarifications
**How to Ask**: [Process for getting clarifications]
**Response SLA**: [When to expect answers]
**Escalation**: [When and how to escalate]
### Completion Report
When done, provide:
```markdown
## Completion Report: [Agent Name]
### Summary
[1-2 sentences on what was accomplished]
### Deliverables
- ✅ Deliverable 1: [Location/description]
- ✅ Deliverable 2: [Location/description]
### Quality Gates
- ✅ Code Quality: PASS
- ✅ Testing: PASS
- ✅ Documentation: PASS
### Deviations from Plan
- [None] OR
- [Deviation 1 - why it happened - impact]
### Blockers Encountered
- [None] OR
- [Blocker 1 - how it was resolved]
### Recommendations
[Any suggestions for next phases or improvements]
### Next Steps
[What should happen next]
```
---
## Tools & Resources
### Tools Available
- [Tool/Framework 1]: [Purpose]
- [Tool/Framework 2]: [Purpose]
- [Testing framework]: [How to run tests]
- [Linter]: [How to check style]
### Reference Documentation
- [Link to tech docs]
- [Link to internal docs]
- [Link to examples]
- [Link to style guide]
### Example Code
[Paste or link to example code that shows the pattern to follow]
```typescript
// Example of preferred pattern
function examplePattern() {
// This is how we do things in this project
}
```
---
## Emergency Contacts
**Summoner**: [How to reach the summoner]
**Technical Lead**: [If different from summoner]
**Domain Expert**: [For domain-specific questions]
**Blocker Resolution**: [Who to contact if blocked]
---
## Success Indicators
**This agent is succeeding if:**
- Delivering on time
- No out-of-scope work
- Quality gates passing
- No blockers or blockers being resolved quickly
- Clear communication
**Warning signs:**
- Asking for context that was already provided
- Scope creep
- Quality gate failures
- Long periods of silence
- Assumptions not validated
---
## Agent Activation
**Summoning Command**:
```
Using the Task tool with subagent_type="general-purpose":
"You are a [SPECIALIZATION] agent. Your mission is to [OBJECTIVE].
Context: [PROVIDE CONTEXT PACKAGE]
Your tasks:
[LIST TASKS WITH DETAILS]
Deliverables expected:
[LIST DELIVERABLES]
Quality standards:
[REFERENCE QUALITY GATES]
Report back when complete with a completion report."
```
**Estimated Duration**: [Time estimate]
**Complexity**: [Low/Medium/High]
**Priority**: [P0/P1/P2/P3]
---
## Notes
[Any additional notes, special considerations, or context that doesn't fit elsewhere]
---
**Template Version**: 1.0
**Last Updated**: [Date]

View File

@@ -0,0 +1,280 @@
# Mission Control: [TASK NAME]
**Created**: [DATE]
**Status**: [Planning | In Progress | Integration | Complete]
**Summoner**: [Agent/User Name]
---
## Executive Summary
[Provide a concise 1-2 paragraph overview of the entire initiative. Include:
- What is being built/changed
- Why it's important
- High-level approach
- Expected impact]
---
## Success Criteria
Define what "done" looks like:
- [ ] **Criterion 1**: [Specific, measurable success indicator]
- [ ] **Criterion 2**: [Specific, measurable success indicator]
- [ ] **Criterion 3**: [Specific, measurable success indicator]
- [ ] **All tests passing**: Unit, integration, and e2e tests pass
- [ ] **Documentation complete**: All changes documented
- [ ] **Quality gates passed**: DRY, CLEAN, SOLID principles followed
---
## Context & Constraints
### Technical Context
**Current Architecture:**
[Brief description of relevant architecture, tech stack, patterns in use]
**Relevant Existing Implementations:**
- `path/to/file.ts:123` - [What this does and why it's relevant]
- `path/to/other/file.ts:456` - [What this does and why it's relevant]
**Technology Stack:**
- [Framework/Library 1]
- [Framework/Library 2]
- [Database/Store]
- [Other relevant tech]
### Business Context
**User Impact:**
[How this affects end users]
**Priority:**
[High/Medium/Low and why]
**Stakeholders:**
[Who cares about this and why]
### Constraints
**Performance:**
- [Specific performance requirements]
**Compatibility:**
- [Browser support, API versions, etc.]
**Security:**
- [Security considerations and requirements]
**Timeline:**
- [Any time constraints]
**Other:**
- [Any other constraints or limitations]
---
## Task Index
### Phase 1: [PHASE NAME - e.g., "Foundation & Setup"]
#### Task 1.1: [Specific Task Name]
**Agent Type**: [e.g., Backend Engineer, Frontend Specialist, DevOps]
**Responsibility**:
[Clear, bounded description of what this agent is responsible for. Use active voice.]
**Context Needed**:
```
[ONLY the specific context this agent needs. Reference sections above or external docs.
DO NOT duplicate large amounts of text - point to it instead.]
```
**Inputs**:
- [What must exist before this task can start]
- [Files, data, decisions, or outputs from other tasks]
**Outputs**:
- [ ] [Specific deliverable 1]
- [ ] [Specific deliverable 2]
- [ ] [Tests for this component]
**Validation Criteria**:
```
How to verify this task is complete and correct:
- [ ] Validation point 1
- [ ] Validation point 2
- [ ] Tests pass
- [ ] Code review checklist items
```
**Dependencies**:
- None (for first task) OR
- Requires: Task X.Y to be complete
- Blocked by: [What's blocking this if anything]
**Estimated Complexity**: [Low/Medium/High]
---
#### Task 1.2: [Next Task Name]
[Repeat structure above]
---
### Phase 2: [NEXT PHASE NAME]
[Continue with tasks for next phase]
---
## Quality Gates
### Code Quality Standards
- [ ] **DRY (Don't Repeat Yourself)**
- No duplicated logic or code blocks
- Shared functionality extracted into reusable utilities
- Configuration centralized
- [ ] **CLEAN Code**
- Meaningful variable and function names
- Functions do one thing well
- Comments explain WHY, not WHAT
- Consistent formatting and style
- [ ] **SOLID Principles**
- Single Responsibility: Each module/class has one reason to change
- Open/Closed: Open for extension, closed for modification
- Liskov Substitution: Subtypes are substitutable for base types
- Interface Segregation: No client forced to depend on unused methods
- Dependency Inversion: Depend on abstractions, not concretions
- [ ] **Security**
- No injection vulnerabilities (SQL, XSS, Command, etc.)
- Proper authentication and authorization
- Sensitive data properly handled
- Dependencies checked for vulnerabilities
- [ ] **Performance**
- Meets stated performance requirements
- No unnecessary computations or renders
- Efficient algorithms and data structures
- Proper resource cleanup
### Process Quality Standards
- [ ] **Testing**
- Unit tests for all new functions/components
- Integration tests for component interactions
- E2E tests for critical user paths
- Edge cases covered
- All tests passing
- [ ] **Documentation**
- Public APIs documented
- Complex logic explained
- README updated if needed
- Migration guide if breaking changes
- [ ] **Integration**
- No breaking changes (or explicitly documented with migration path)
- Backwards compatible where possible
- All integrations tested
- Dependencies updated
- [ ] **Code Review**
- Self-review completed
- Peer review if applicable
- All review comments addressed
---
## Agent Roster
### [Agent Role/Name 1]
**Specialization**: [What domain expertise this agent brings]
**Assigned Tasks**:
- Task 1.1
- Task 2.3
**Context Provided**:
- Section: [Reference to MCD sections this agent needs]
- Files: [Key files this agent will work with]
- External Docs: [Any external documentation needed]
**Communication Protocol**:
- Reports to: [Who/what]
- Updates: [When and how to provide status updates]
- Blockers: [How to escalate blockers]
---
### [Agent Role/Name 2]
[Repeat structure above]
---
## Risk Register
| Risk | Likelihood | Impact | Mitigation |
|------|-----------|--------|------------|
| [Risk description] | Low/Med/High | Low/Med/High | [How we're mitigating this] |
| [Risk description] | Low/Med/High | Low/Med/High | [How we're mitigating this] |
---
## Progress Tracking
### Phase 1: [PHASE NAME]
- [x] Task 1.1: [Name] - ✅ Complete
- [ ] Task 1.2: [Name] - 🔄 In Progress
- [ ] Task 1.3: [Name] - ⏸️ Blocked by X
- [ ] Task 1.4: [Name] - ⏳ Pending
### Phase 2: [PHASE NAME]
- [ ] Task 2.1: [Name] - ⏳ Pending
---
## Decision Log
| Date | Decision | Rationale | Impact |
|------|----------|-----------|--------|
| [DATE] | [What was decided] | [Why this decision] | [What this affects] |
---
## Integration Checklist
Final integration before marking complete:
- [ ] All tasks completed and validated
- [ ] All tests passing (unit, integration, e2e)
- [ ] No breaking changes or migration guide provided
- [ ] Performance benchmarks met
- [ ] Security review passed
- [ ] Documentation complete
- [ ] Quality gates all green
- [ ] Stakeholder acceptance (if applicable)
---
## Lessons Learned
[To be filled at completion - what went well, what could improve for next time]
---
## References
- [Link to relevant docs]
- [Link to design docs]
- [Link to related issues/PRs]

View File

@@ -0,0 +1,282 @@
# Quality Gates Checklist
This document provides detailed quality gates for validating work at task, phase, and project levels.
---
## Task-Level Quality Gates
Run these checks after completing each individual task:
### ✅ Functional Requirements
- [ ] All specified outputs delivered
- [ ] Functionality works as described
- [ ] Edge cases handled
- [ ] Error cases handled gracefully
- [ ] No regression in existing functionality
### ✅ Code Quality
- [ ] Code is readable and self-documenting
- [ ] Variable/function names are meaningful
- [ ] No magic numbers or strings
- [ ] No commented-out code (unless explicitly documented why)
- [ ] Consistent code style with project
### ✅ DRY (Don't Repeat Yourself)
- [ ] No duplicated logic
- [ ] Shared functionality extracted to utilities
- [ ] Constants defined once, referenced everywhere
- [ ] No copy-paste code blocks
### ✅ Testing
- [ ] Unit tests written for new code
- [ ] Tests cover happy path
- [ ] Tests cover edge cases
- [ ] Tests cover error conditions
- [ ] All tests pass
- [ ] Test names clearly describe what they test
### ✅ Documentation
- [ ] Complex logic has explanatory comments
- [ ] Public APIs documented (JSDoc, docstrings, etc.)
- [ ] README updated if user-facing changes
- [ ] Breaking changes documented
---
## Phase-Level Quality Gates
Run these checks after completing a phase (group of related tasks):
### ✅ Integration
- [ ] All components integrate correctly
- [ ] Data flows between components as expected
- [ ] No integration bugs
- [ ] APIs between components are clean
- [ ] Interfaces are well-defined
### ✅ CLEAN Principles
- [ ] **C**lear: Code is easy to understand
- [ ] **L**imited: Functions/methods have single responsibility
- [ ] **E**xpressive: Naming reveals intent
- [ ] **A**bstracted: Proper level of abstraction
- [ ] **N**eat: Organized, well-structured code
### ✅ Performance
- [ ] No obvious performance issues
- [ ] Efficient algorithms used
- [ ] No unnecessary computations
- [ ] Resources properly managed (memory, connections, etc.)
- [ ] Meets stated performance requirements
### ✅ Security
- [ ] No injection vulnerabilities (SQL, XSS, Command, etc.)
- [ ] Input validation in place
- [ ] Output encoding where needed
- [ ] Authentication/authorization checked
- [ ] Sensitive data not logged or exposed
- [ ] Dependencies have no known vulnerabilities
---
## Project-Level Quality Gates
Run these checks before marking the entire project complete:
### ✅ SOLID Principles
#### Single Responsibility Principle
- [ ] Each class/module has one reason to change
- [ ] Each function does one thing well
- [ ] No god objects or god functions
- [ ] Responsibilities clearly separated
#### Open/Closed Principle
- [ ] Open for extension (can add new behavior)
- [ ] Closed for modification (don't change existing code)
- [ ] Use abstractions (interfaces, base classes) for extension points
- [ ] Configuration over hardcoding
#### Liskov Substitution Principle
- [ ] Subtypes can replace base types without breaking
- [ ] Derived classes don't weaken preconditions
- [ ] Derived classes don't strengthen postconditions
- [ ] Inheritance is "is-a" relationship, not "has-a"
#### Interface Segregation Principle
- [ ] Interfaces are focused and cohesive
- [ ] No client forced to depend on methods it doesn't use
- [ ] Many small interfaces > one large interface
- [ ] Clients see only methods they need
#### Dependency Inversion Principle
- [ ] High-level modules don't depend on low-level modules
- [ ] Both depend on abstractions
- [ ] Abstractions don't depend on details
- [ ] Details depend on abstractions
- [ ] Dependencies injected, not hardcoded
### ✅ Architecture Quality
- [ ] Architecture supports future growth
- [ ] Clear separation of concerns
- [ ] Proper layering (presentation, business logic, data)
- [ ] No architectural violations
- [ ] Design patterns used appropriately
### ✅ Testing Coverage
- [ ] Unit test coverage meets threshold (e.g., 80%)
- [ ] Integration tests for key workflows
- [ ] E2E tests for critical user paths
- [ ] All tests passing consistently
- [ ] No flaky tests
### ✅ Documentation Completeness
- [ ] README is current and accurate
- [ ] API documentation complete
- [ ] Architecture documented
- [ ] Setup/installation instructions clear
- [ ] Troubleshooting guide if applicable
- [ ] Inline documentation for complex code
### ✅ Production Readiness
- [ ] No breaking changes (or migration guide provided)
- [ ] Error handling comprehensive
- [ ] Logging appropriate (not too much, not too little)
- [ ] Monitoring/observability in place
- [ ] Configuration externalized
- [ ] Secrets/credentials properly managed
### ✅ User Impact
- [ ] User-facing features work as expected
- [ ] UX is intuitive
- [ ] Error messages are helpful
- [ ] Performance is acceptable to users
- [ ] Accessibility considerations addressed (if applicable)
---
## Quality Gate Severity Levels
When a quality gate fails, assess severity:
### 🔴 Critical (MUST FIX)
- Security vulnerabilities
- Data loss or corruption
- Breaking changes without migration path
- Production crashes or errors
- Major performance degradation
### 🟡 Warning (SHOULD FIX)
- SOLID principle violations
- Missing tests for complex logic
- Poor performance (but not critical)
- Missing documentation
- Code duplication
### 🟢 Info (NICE TO FIX)
- Minor style inconsistencies
- Optimization opportunities
- Refactoring suggestions
- Documentation enhancements
---
## Remediation Process
When quality gates fail:
1. **Document the Issue**
- What gate failed
- Severity level
- Impact assessment
2. **Create Remediation Task**
- Add to task index
- Assign to appropriate agent
- Provide context and acceptance criteria
3. **Revalidate**
- After fix, re-run quality gate
- Ensure no new issues introduced
- Update MCD with results
4. **Learn**
- Why did this get through?
- How to prevent in future?
- Update checklist if needed
---
## Automated Checks
Where possible, automate quality gates:
### Recommended Tools
**Linting:**
- ESLint (JavaScript/TypeScript)
- Pylint/Flake8 (Python)
- RuboCop (Ruby)
- Clippy (Rust)
**Testing:**
- Jest, Vitest (JavaScript)
- pytest (Python)
- RSpec (Ruby)
- cargo test (Rust)
**Security:**
- npm audit, yarn audit
- Snyk
- OWASP Dependency-Check
- Trivy
**Coverage:**
- Istanbul/nyc (JavaScript)
- Coverage.py (Python)
- SimpleCov (Ruby)
- Tarpaulin (Rust)
**Type Checking:**
- TypeScript
- mypy (Python)
- Sorbet (Ruby)
---
## Sign-Off Template
```markdown
## Quality Gate Sign-Off
**Task/Phase/Project**: [Name]
**Date**: [Date]
**Reviewed By**: [Agent/Person]
### Results
- ✅ Functional Requirements: PASS
- ✅ Code Quality: PASS
- ✅ DRY: PASS
- ✅ Testing: PASS
- ✅ Documentation: PASS
- ✅ SOLID Principles: PASS
- ✅ Security: PASS
- ✅ Performance: PASS
### Issues Found
- [None] OR
- [Issue 1 - Severity - Status]
- [Issue 2 - Severity - Status]
### Recommendation
- [ ] Approved - Ready to proceed
- [ ] Approved with conditions - [List conditions]
- [ ] Rejected - [List blockers]
### Notes
[Any additional notes or observations]
```
---
**Remember: Quality is not negotiable. It's faster to build it right than to fix it later.**