205 lines
6.1 KiB
Markdown
205 lines
6.1 KiB
Markdown
# Technical Standards Enforcement Task
|
|
|
|
## Purpose
|
|
Enforce technical standards across all development activities to ensure consistency, maintainability, and quality. This task provides systematic validation of code against established technical standards and best practices.
|
|
|
|
## Integration with Memory System
|
|
- **What patterns to search for**: Common standard violations, successful enforcement strategies, team compliance patterns, technical debt accumulation
|
|
- **What outcomes to track**: Standards compliance rates, technical debt trends, code quality metrics, team adoption success
|
|
- **What learnings to capture**: Effective enforcement approaches, standard evolution needs, team training requirements, automation opportunities
|
|
|
|
## Technical Standards Categories
|
|
|
|
### Code Standards
|
|
```yaml
|
|
code_standards:
|
|
naming_conventions:
|
|
- classes: PascalCase
|
|
- functions: camelCase
|
|
- constants: UPPER_SNAKE_CASE
|
|
- files: kebab-case
|
|
|
|
structure:
|
|
- max_file_length: 500
|
|
- max_function_length: 50
|
|
- max_cyclomatic_complexity: 10
|
|
- max_nesting_depth: 4
|
|
|
|
documentation:
|
|
- functions: required_jsdoc
|
|
- classes: required_comprehensive
|
|
- complex_logic: inline_comments_required
|
|
```
|
|
|
|
### Architecture Standards
|
|
- [ ] **Pattern Compliance**: Repository, Service, Controller patterns
|
|
- [ ] **Dependency Direction**: Clean architecture principles
|
|
- [ ] **Module Boundaries**: Clear separation of concerns
|
|
- [ ] **API Contracts**: Consistent interface design
|
|
- [ ] **Error Handling**: Standardized error propagation
|
|
|
|
### Security Standards
|
|
- [ ] **Authentication**: OAuth2/JWT implementation
|
|
- [ ] **Authorization**: RBAC implementation
|
|
- [ ] **Data Validation**: Input sanitization
|
|
- [ ] **Encryption**: Data at rest and in transit
|
|
- [ ] **Secrets Management**: No hardcoded credentials
|
|
|
|
### Performance Standards
|
|
- [ ] **Response Times**: <200ms for API calls
|
|
- [ ] **Query Optimization**: No N+1 queries
|
|
- [ ] **Caching Strategy**: Redis for hot data
|
|
- [ ] **Resource Limits**: Memory and CPU boundaries
|
|
- [ ] **Async Operations**: For long-running tasks
|
|
|
|
## Enforcement Process
|
|
|
|
### Step 1: Automated Validation
|
|
```python
|
|
def run_automated_checks():
|
|
checks = {
|
|
"linting": run_eslint_prettier(),
|
|
"type_checking": run_typescript_check(),
|
|
"test_coverage": run_coverage_report(),
|
|
"security_scan": run_security_audit(),
|
|
"performance": run_lighthouse_audit()
|
|
}
|
|
return aggregate_results(checks)
|
|
```
|
|
|
|
### Step 2: Manual Review Checklist
|
|
- [ ] **Architecture Alignment**: Follows established patterns
|
|
- [ ] **Code Clarity**: Self-documenting and readable
|
|
- [ ] **Error Scenarios**: All edge cases handled
|
|
- [ ] **Performance Impact**: No obvious bottlenecks
|
|
- [ ] **Security Considerations**: No vulnerabilities introduced
|
|
|
|
### Step 3: Standards Violation Tracking
|
|
```markdown
|
|
## Violation Report
|
|
**File**: {filepath}
|
|
**Standard**: {violated_standard}
|
|
**Severity**: {critical/high/medium/low}
|
|
**Description**: {what_is_wrong}
|
|
**Fix**: {how_to_fix}
|
|
**Reference**: {link_to_standard}
|
|
```
|
|
|
|
## Quality Gates
|
|
|
|
### Pre-Commit Gate
|
|
- [ ] Local linting passes
|
|
- [ ] Type checking passes
|
|
- [ ] Unit tests pass
|
|
- [ ] Commit message follows convention
|
|
|
|
### Pull Request Gate
|
|
- [ ] All automated checks pass
|
|
- [ ] Code coverage maintained
|
|
- [ ] No security vulnerabilities
|
|
- [ ] Performance benchmarks met
|
|
- [ ] Documentation updated
|
|
|
|
### Pre-Deploy Gate
|
|
- [ ] Integration tests pass
|
|
- [ ] Security scan clean
|
|
- [ ] Performance tests pass
|
|
- [ ] Rollback plan documented
|
|
|
|
## Enforcement Strategies
|
|
|
|
### Progressive Enhancement
|
|
1. **Warning Phase**: Notify but don't block
|
|
2. **Soft Enforcement**: Block with override option
|
|
3. **Hard Enforcement**: Block without override
|
|
4. **Continuous Monitoring**: Track compliance trends
|
|
|
|
### Team Enablement
|
|
```python
|
|
enablement_activities = {
|
|
"training": ["standards workshop", "best practices session"],
|
|
"documentation": ["standards wiki", "example repository"],
|
|
"tooling": ["IDE plugins", "pre-commit hooks"],
|
|
"mentoring": ["pair programming", "code review feedback"]
|
|
}
|
|
```
|
|
|
|
## Success Metrics
|
|
- Standards compliance rate >95%
|
|
- Technical debt ratio <5%
|
|
- Code review cycle time <2 hours
|
|
- Zero critical violations in production
|
|
- Team satisfaction with standards >80%
|
|
|
|
## Memory Integration
|
|
```python
|
|
# Standards enforcement memory
|
|
enforcement_memory = {
|
|
"type": "standards_enforcement",
|
|
"enforcement_run": {
|
|
"timestamp": run_timestamp,
|
|
"scope": files_checked,
|
|
"standards": standards_applied
|
|
},
|
|
"violations": {
|
|
"total": violation_count,
|
|
"by_severity": severity_breakdown,
|
|
"by_category": category_breakdown,
|
|
"repeat_offenders": frequent_violations
|
|
},
|
|
"trends": {
|
|
"compliance_rate": current_compliance,
|
|
"improvement": vs_last_period,
|
|
"problem_areas": persistent_issues
|
|
},
|
|
"actions": {
|
|
"automated_fixes": auto_fix_count,
|
|
"manual_fixes": manual_fix_count,
|
|
"exemptions": exemption_grants
|
|
},
|
|
"team_impact": {
|
|
"productivity": velocity_impact,
|
|
"satisfaction": developer_feedback
|
|
}
|
|
}
|
|
```
|
|
|
|
## Enforcement Output Template
|
|
```markdown
|
|
# Technical Standards Enforcement Report
|
|
**Date**: {timestamp}
|
|
**Scope**: {project/module}
|
|
**Compliance**: {percentage}%
|
|
|
|
## Summary
|
|
- **Files Scanned**: {count}
|
|
- **Standards Checked**: {count}
|
|
- **Violations Found**: {count}
|
|
- **Auto-Fixed**: {count}
|
|
|
|
## Violations by Category
|
|
| Category | Count | Severity | Trend |
|
|
|----------|-------|----------|--------|
|
|
| Code Style | {n} | {sev} | {trend} |
|
|
| Architecture | {n} | {sev} | {trend} |
|
|
| Security | {n} | {sev} | {trend} |
|
|
| Performance | {n} | {sev} | {trend} |
|
|
|
|
## Critical Issues
|
|
{list_of_critical_violations}
|
|
|
|
## Recommendations
|
|
1. **Immediate Actions**: {urgent_fixes}
|
|
2. **Training Needs**: {identified_gaps}
|
|
3. **Tool Improvements**: {automation_opportunities}
|
|
4. **Standard Updates**: {evolution_suggestions}
|
|
|
|
## Next Steps
|
|
{action_plan_with_owners}
|
|
```
|
|
|
|
## Brotherhood Collaboration
|
|
- Standards review with architecture team
|
|
- Enforcement strategy with tech leads
|
|
- Training plan with team leads
|
|
- Tool selection with DevOps team |