cc-devflow 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/CLAUDE.md +83 -0
- package/.claude/agents/architecture-designer.md +443 -0
- package/.claude/agents/bug-analyzer.md +382 -0
- package/.claude/agents/checklist-agent.md +175 -0
- package/.claude/agents/clarify-analyst.md +50 -0
- package/.claude/agents/code-reviewer.md +71 -0
- package/.claude/agents/codex-analyzer.md +39 -0
- package/.claude/agents/compatibility-checker.md +580 -0
- package/.claude/agents/consistency-checker.md +532 -0
- package/.claude/agents/impact-analyzer.md +441 -0
- package/.claude/agents/planner.md +230 -0
- package/.claude/agents/prd-writer.md +320 -0
- package/.claude/agents/project-guidelines-generator.md +1329 -0
- package/.claude/agents/qa-tester.md +313 -0
- package/.claude/agents/release-manager.md +295 -0
- package/.claude/agents/security-reviewer.md +314 -0
- package/.claude/agents/style-guide-generator.md +458 -0
- package/.claude/agents/tech-architect.md +516 -0
- package/.claude/agents/ui-designer.md +485 -0
- package/.claude/commands/code-review-high.md +58 -0
- package/.claude/commands/core-architecture.md +429 -0
- package/.claude/commands/core-guidelines.md +486 -0
- package/.claude/commands/core-roadmap.md +439 -0
- package/.claude/commands/core-style.md +293 -0
- package/.claude/commands/flow-archive.md +245 -0
- package/.claude/commands/flow-checklist.md +260 -0
- package/.claude/commands/flow-clarify.md +136 -0
- package/.claude/commands/flow-constitution.md +82 -0
- package/.claude/commands/flow-dev.md +134 -0
- package/.claude/commands/flow-epic.md +150 -0
- package/.claude/commands/flow-fix.md +104 -0
- package/.claude/commands/flow-ideate.md +214 -0
- package/.claude/commands/flow-init.md +313 -0
- package/.claude/commands/flow-new.md +394 -0
- package/.claude/commands/flow-prd.md +131 -0
- package/.claude/commands/flow-qa.md +93 -0
- package/.claude/commands/flow-release.md +92 -0
- package/.claude/commands/flow-restart.md +98 -0
- package/.claude/commands/flow-status.md +64 -0
- package/.claude/commands/flow-tech.md +142 -0
- package/.claude/commands/flow-ui.md +189 -0
- package/.claude/commands/flow-update.md +111 -0
- package/.claude/commands/flow-upgrade.md +115 -0
- package/.claude/commands/flow-verify.md +96 -0
- package/.claude/commands/problem-analyzer.md +60 -0
- package/.claude/config/quality-rules.yml +161 -0
- package/.claude/docs/SPEC_KIT_CONSTITUTION_ANALYSIS.md +426 -0
- package/.claude/docs/design/consistency-conflict-detection-algorithms.md +658 -0
- package/.claude/docs/design/intent-driven-input-design.md +380 -0
- package/.claude/docs/design/prd-version-management-design.md +437 -0
- package/.claude/docs/guides/INIT_TROUBLESHOOTING.md +117 -0
- package/.claude/docs/guides/NEW_TROUBLESHOOTING.md +151 -0
- package/.claude/docs/guides/ROADMAP_TROUBLESHOOTING.md +188 -0
- package/.claude/docs/guides/TASK_COMPLETION_MARKING.md +338 -0
- package/.claude/docs/templates/ARCHITECTURE_TEMPLATE.md +633 -0
- package/.claude/docs/templates/BACKLOG_TEMPLATE.md +261 -0
- package/.claude/docs/templates/CHECKLIST_TEMPLATE.md +52 -0
- package/.claude/docs/templates/CLARIFICATION_REPORT_TEMPLATE.md +206 -0
- package/.claude/docs/templates/CODE_REVIEW_TEMPLATE.md +71 -0
- package/.claude/docs/templates/EPIC_TEMPLATE.md +805 -0
- package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +213 -0
- package/.claude/docs/templates/INTENT_CLARIFICATION_TEMPLATE.md +57 -0
- package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +148 -0
- package/.claude/docs/templates/PRD_TEMPLATE.md +562 -0
- package/.claude/docs/templates/RESEARCH_TEMPLATE.md +276 -0
- package/.claude/docs/templates/REVIEW-HIGH.md +57 -0
- package/.claude/docs/templates/ROADMAP_DIALOGUE_TEMPLATE.md +198 -0
- package/.claude/docs/templates/ROADMAP_TEMPLATE.md +310 -0
- package/.claude/docs/templates/STYLE_TEMPLATE.md +1266 -0
- package/.claude/docs/templates/TASKS_TEMPLATE.md +523 -0
- package/.claude/docs/templates/TECH_DESIGN_TEMPLATE.md +1019 -0
- package/.claude/docs/templates/UI_PROTOTYPE_TEMPLATE.md +1436 -0
- package/.claude/guides/agent-guides/agent-coordination-guide.md +459 -0
- package/.claude/guides/project-guidelines-system.md +463 -0
- package/.claude/guides/technical-guides/datetime-handling-guide.md +563 -0
- package/.claude/guides/technical-guides/git-github-guide.md +642 -0
- package/.claude/guides/technical-guides/test-execution-guide.md +618 -0
- package/.claude/guides/workflow-guides/bug-fix-orchestrator.md +217 -0
- package/.claude/guides/workflow-guides/flow-orchestrator.md +282 -0
- package/.claude/hooks/checklist-gate.js +397 -0
- package/.claude/hooks/error-handling-reminder.sh +12 -0
- package/.claude/hooks/error-handling-reminder.ts +459 -0
- package/.claude/hooks/post-tool-use-tracker.sh +280 -0
- package/.claude/hooks/pre-tool-use-guardrail.sh +36 -0
- package/.claude/hooks/pre-tool-use-guardrail.ts +342 -0
- package/.claude/hooks/skill-activation-prompt.sh +36 -0
- package/.claude/hooks/skill-activation-prompt.ts +214 -0
- package/.claude/hooks/state/skills-used-test-guard.json +3 -0
- package/.claude/rules/devflow-conventions.md +305 -0
- package/.claude/rules/project-constitution.md +748 -0
- package/.claude/schemas/constitution.schema.json +43 -0
- package/.claude/scripts/analyze-upgrade-impact.sh +200 -0
- package/.claude/scripts/archive-requirement.sh +351 -0
- package/.claude/scripts/calculate-checklist-completion.sh +243 -0
- package/.claude/scripts/calculate-quarter.sh +206 -0
- package/.claude/scripts/check-dependencies.sh +409 -0
- package/.claude/scripts/check-prerequisites.sh +232 -0
- package/.claude/scripts/check-task-status.sh +264 -0
- package/.claude/scripts/checklist-errors.sh +131 -0
- package/.claude/scripts/common.sh +570 -0
- package/.claude/scripts/consolidate-research.sh +182 -0
- package/.claude/scripts/create-requirement.sh +426 -0
- package/.claude/scripts/export-contracts.sh +117 -0
- package/.claude/scripts/extract-data-model.sh +78 -0
- package/.claude/scripts/generate-clarification-questions.sh +377 -0
- package/.claude/scripts/generate-clarification-report.sh +463 -0
- package/.claude/scripts/generate-quickstart.sh +146 -0
- package/.claude/scripts/generate-research-tasks.sh +157 -0
- package/.claude/scripts/generate-status-report.sh +523 -0
- package/.claude/scripts/generate-tech-analysis.sh +46 -0
- package/.claude/scripts/locate-requirement-in-roadmap.sh +233 -0
- package/.claude/scripts/manage-constitution.sh +602 -0
- package/.claude/scripts/mark-task-complete.sh +198 -0
- package/.claude/scripts/populate-research-tasks.sh +259 -0
- package/.claude/scripts/recover-workflow.sh +460 -0
- package/.claude/scripts/run-clarify-scan.sh +601 -0
- package/.claude/scripts/run-high-review.sh +62 -0
- package/.claude/scripts/run-problem-analysis.sh +68 -0
- package/.claude/scripts/setup-epic.sh +173 -0
- package/.claude/scripts/sync-roadmap-progress.sh +300 -0
- package/.claude/scripts/sync-task-marks.sh +199 -0
- package/.claude/scripts/test-clarify-scan.sh +515 -0
- package/.claude/scripts/update-agent-context.sh +806 -0
- package/.claude/scripts/validate-constitution.sh +567 -0
- package/.claude/scripts/validate-hooks.sh +487 -0
- package/.claude/scripts/validate-research.sh +332 -0
- package/.claude/scripts/validate-scope-boundary.sh +493 -0
- package/.claude/scripts/verify-setup.sh +37 -0
- package/.claude/settings.json +76 -0
- package/.claude/skills/_reference-implementations/README.md +96 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/SKILL.md +302 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/architecture-overview.md +451 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/async-and-errors.md +307 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/complete-examples.md +638 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/configuration.md +275 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/database-patterns.md +224 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/middleware-guide.md +213 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/routing-and-controllers.md +756 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/sentry-and-monitoring.md +336 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/services-and-repositories.md +789 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/testing-guide.md +235 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/validation-patterns.md +754 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/SKILL.md +399 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/common-patterns.md +331 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/complete-examples.md +872 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/component-patterns.md +502 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/data-fetching.md +767 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/file-organization.md +502 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/loading-and-error-states.md +501 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/performance.md +406 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/routing-guide.md +364 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/styling-guide.md +428 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/typescript-standards.md +418 -0
- package/.claude/skills/cc-devflow-orchestrator/SKILL.md +229 -0
- package/.claude/skills/constitution-guardian/SKILL.md +306 -0
- package/.claude/skills/devflow-constitution-quick-ref/SKILL.md +374 -0
- package/.claude/skills/devflow-file-standards/SKILL.md +353 -0
- package/.claude/skills/devflow-tdd-enforcer/SKILL.md +192 -0
- package/.claude/skills/skill-developer/ADVANCED.md +197 -0
- package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +306 -0
- package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +152 -0
- package/.claude/skills/skill-developer/SKILL.md +426 -0
- package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +315 -0
- package/.claude/skills/skill-developer/TRIGGER_TYPES.md +305 -0
- package/.claude/skills/skill-developer/TROUBLESHOOTING.md +514 -0
- package/.claude/skills/skill-rules.json +213 -0
- package/.claude/tests/README.md +300 -0
- package/.claude/tests/TODO.md +69 -0
- package/.claude/tests/__pycache__/test_analyze_upgrade_impact.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/__pycache__/test_consolidate_research.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/__pycache__/test_export_contracts.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/__pycache__/test_extract_data_model.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/__pycache__/test_generate_quickstart.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/__pycache__/test_generate_research_tasks.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/constitution/run_all_constitution_tests.sh +111 -0
- package/.claude/tests/constitution/test_agent_assignment.sh +207 -0
- package/.claude/tests/constitution/test_article_coverage.sh +201 -0
- package/.claude/tests/constitution/test_template_completeness.sh +150 -0
- package/.claude/tests/constitution/test_version_consistency.sh +120 -0
- package/.claude/tests/fixtures/spec_delta_full.md +16 -0
- package/.claude/tests/fixtures/tasks_progress_sample.md +5 -0
- package/.claude/tests/run-all-tests.sh +229 -0
- package/.claude/tests/scripts/run.sh +30 -0
- package/.claude/tests/scripts/test-framework.sh +128 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh +511 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh.bak +504 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh.bak2 +505 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh.bak3 +506 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh.bak4 +507 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh.bak5 +508 -0
- package/.claude/tests/scripts/test_check_task_status.sh +499 -0
- package/.claude/tests/scripts/test_common.sh +244 -0
- package/.claude/tests/scripts/test_generate_status_report.sh +71 -0
- package/.claude/tests/scripts/test_mark_task_complete.sh +441 -0
- package/.claude/tests/scripts/test_mark_task_complete.sh.backup +410 -0
- package/.claude/tests/scripts/test_recover_workflow.sh +304 -0
- package/.claude/tests/scripts/test_setup_epic.sh +437 -0
- package/.claude/tests/scripts/test_sync_task_marks.sh +196 -0
- package/.claude/tests/scripts/test_validate_constitution.sh +74 -0
- package/.claude/tests/scripts/test_validate_research.sh +462 -0
- package/.claude/tests/slugify.bats +82 -0
- package/.claude/tests/test-framework.sh +732 -0
- package/.claude/tests/test_analyze_upgrade_impact.py +34 -0
- package/.claude/tests/test_consolidate_research.py +48 -0
- package/.claude/tests/test_export_contracts.py +43 -0
- package/.claude/tests/test_extract_data_model.py +33 -0
- package/.claude/tests/test_generate_quickstart.py +50 -0
- package/.claude/tests/test_generate_research_tasks.py +52 -0
- package/.claude/tsc-cache/6e64f818-6398-49ca-8623-581a9af85c44/edited-files.log +1 -0
- package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/affected-repos.txt +1 -0
- package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/edited-files.log +1 -0
- package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/affected-repos.txt +1 -0
- package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/edited-files.log +1 -0
- package/CHANGELOG.md +507 -0
- package/LICENSE +21 -0
- package/README.md +534 -0
- package/README.zh-CN.md +530 -0
- package/bin/adapt.js +240 -0
- package/bin/cc-devflow-cli.js +185 -0
- package/bin/cc-devflow.js +78 -0
- package/config/adapters.yml +5 -0
- package/config/schema/adapters.schema.json +44 -0
- package/docs/CLAUDE.md +26 -0
- package/docs/commands/README.md +61 -0
- package/docs/commands/README.zh-CN.md +55 -0
- package/docs/commands/core-roadmap.md +106 -0
- package/docs/commands/core-roadmap.zh-CN.md +102 -0
- package/docs/commands/core-style.md +405 -0
- package/docs/commands/core-style.zh-CN.md +405 -0
- package/docs/commands/flow-init.md +134 -0
- package/docs/commands/flow-init.zh-CN.md +163 -0
- package/docs/commands/flow-new.md +274 -0
- package/docs/commands/flow-new.zh-CN.md +270 -0
- package/docs/guides/getting-started.md +204 -0
- package/docs/guides/getting-started.zh-CN.md +152 -0
- package/lib/adapters/adapter-interface.js +57 -0
- package/lib/adapters/claude-adapter.js +74 -0
- package/lib/adapters/codex-adapter.js +40 -0
- package/lib/adapters/config-validator.js +68 -0
- package/lib/adapters/logger.js +42 -0
- package/lib/adapters/registry.js +153 -0
- package/lib/compiler/CLAUDE.md +92 -0
- package/lib/compiler/__tests__/drift.test.js +215 -0
- package/lib/compiler/__tests__/errors.test.js +184 -0
- package/lib/compiler/__tests__/incremental.test.js +174 -0
- package/lib/compiler/__tests__/integration.test.js +174 -0
- package/lib/compiler/__tests__/manifest.test.js +233 -0
- package/lib/compiler/__tests__/parser.test.js +456 -0
- package/lib/compiler/__tests__/schemas.test.js +301 -0
- package/lib/compiler/__tests__/skills-registry.test.js +125 -0
- package/lib/compiler/__tests__/transformer.test.js +286 -0
- package/lib/compiler/emitters/antigravity-emitter.js +171 -0
- package/lib/compiler/emitters/base-emitter.js +73 -0
- package/lib/compiler/emitters/codex-emitter.js +52 -0
- package/lib/compiler/emitters/cursor-emitter.js +31 -0
- package/lib/compiler/emitters/index.js +50 -0
- package/lib/compiler/emitters/qwen-emitter.js +39 -0
- package/lib/compiler/errors.js +119 -0
- package/lib/compiler/index.js +256 -0
- package/lib/compiler/manifest.js +242 -0
- package/lib/compiler/parser.js +258 -0
- package/lib/compiler/platforms.js +113 -0
- package/lib/compiler/resource-copier.js +320 -0
- package/lib/compiler/rules-emitters/__tests__/antigravity-rules-emitter.test.js +191 -0
- package/lib/compiler/rules-emitters/__tests__/codex-rules-emitter.test.js +109 -0
- package/lib/compiler/rules-emitters/__tests__/cursor-rules-emitter.test.js +123 -0
- package/lib/compiler/rules-emitters/__tests__/qwen-rules-emitter.test.js +123 -0
- package/lib/compiler/rules-emitters/antigravity-rules-emitter.js +253 -0
- package/lib/compiler/rules-emitters/base-rules-emitter.js +83 -0
- package/lib/compiler/rules-emitters/codex-rules-emitter.js +116 -0
- package/lib/compiler/rules-emitters/cursor-rules-emitter.js +98 -0
- package/lib/compiler/rules-emitters/index.js +71 -0
- package/lib/compiler/rules-emitters/qwen-rules-emitter.js +70 -0
- package/lib/compiler/schemas.js +144 -0
- package/lib/compiler/skills-registry.js +225 -0
- package/lib/compiler/transformer.js +236 -0
- package/package.json +50 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: constitution-guardian
|
|
3
|
+
description: Real-time Constitution compliance checker for devflow documents. Blocks partial implementations and hardcoded secrets during file editing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Constitution Guardian
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Enforce CC-DevFlow Constitution compliance by detecting violations in real-time during document editing, preventing non-compliant content from being saved.
|
|
10
|
+
|
|
11
|
+
**Trigger**: PreToolUse hook when editing devflow documents (PRD.md, EPIC.md, TASKS.md, TECH_DESIGN.md)
|
|
12
|
+
|
|
13
|
+
## Enforcement Scope
|
|
14
|
+
|
|
15
|
+
**Focus Articles** (Real-time prevention):
|
|
16
|
+
- **Article I.1**: Quality First - No Partial Implementation
|
|
17
|
+
- **Article III.1**: Security First - No Hardcoded Secrets
|
|
18
|
+
|
|
19
|
+
**Note**: Full Constitution has 10 Articles. This guardrail focuses on the most critical real-time violations. Batch validation by `validate-constitution.sh` covers all Articles.
|
|
20
|
+
|
|
21
|
+
## Violation Patterns
|
|
22
|
+
|
|
23
|
+
### Article I.1: No Partial Implementation
|
|
24
|
+
|
|
25
|
+
#### Pattern 1: TODO placeholders
|
|
26
|
+
```markdown
|
|
27
|
+
# ❌ BLOCKED
|
|
28
|
+
## User Stories
|
|
29
|
+
### US1: User Registration
|
|
30
|
+
TODO later: Add email verification flow
|
|
31
|
+
FIXME: Implement password strength validation
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Regex Patterns**:
|
|
35
|
+
- `TODO.*later`
|
|
36
|
+
- `FIXME`
|
|
37
|
+
- `\[placeholder\]`
|
|
38
|
+
- `// TODO:.*later`
|
|
39
|
+
- `# FIXME:.*`
|
|
40
|
+
|
|
41
|
+
#### Pattern 2: Simplified/Partial notes
|
|
42
|
+
```markdown
|
|
43
|
+
# ❌ BLOCKED
|
|
44
|
+
## Implementation Notes
|
|
45
|
+
This is simplified for now, complete implementation would require...
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Regex Pattern**: `simplified for now`
|
|
49
|
+
|
|
50
|
+
#### Pattern 3: Version deferral
|
|
51
|
+
```markdown
|
|
52
|
+
# ❌ BLOCKED
|
|
53
|
+
## Acceptance Criteria
|
|
54
|
+
- [ ] Basic login (v1)
|
|
55
|
+
- [ ] Remember me (defer to v2)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Regex Pattern**: `defer to v\d|will complete in v\d`
|
|
59
|
+
|
|
60
|
+
### Article III.1: No Hardcoded Secrets
|
|
61
|
+
|
|
62
|
+
#### Pattern 1: Environment variables with secrets
|
|
63
|
+
```markdown
|
|
64
|
+
# ❌ BLOCKED
|
|
65
|
+
## Configuration
|
|
66
|
+
API_KEY=sk-abc123def456
|
|
67
|
+
JWT_SECRET=mysecretkey123
|
|
68
|
+
PASSWORD=admin123
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Regex Patterns**:
|
|
72
|
+
- `API_KEY\s*=\s*['"]?[a-zA-Z0-9_-]{10,}`
|
|
73
|
+
- `SECRET\s*=\s*['"]?[a-zA-Z0-9_-]+`
|
|
74
|
+
- `PASSWORD\s*=\s*['"]?[^\s]+`
|
|
75
|
+
- `TOKEN\s*=\s*['"]?[a-zA-Z0-9_-]{10,}`
|
|
76
|
+
|
|
77
|
+
#### Pattern 2: Code snippets with hardcoded secrets
|
|
78
|
+
```typescript
|
|
79
|
+
// ❌ BLOCKED
|
|
80
|
+
const config = {
|
|
81
|
+
apiKey: "sk-abc123def456",
|
|
82
|
+
dbPassword: "postgres123"
|
|
83
|
+
};
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Regex Patterns**:
|
|
87
|
+
- `apiKey:\s*['"][^'"]+['"]`
|
|
88
|
+
- `password:\s*['"][^'"]+['"]`
|
|
89
|
+
- `secret:\s*['"][^'"]+['"]`
|
|
90
|
+
|
|
91
|
+
## Blocking Message
|
|
92
|
+
|
|
93
|
+
When violation detected, PreToolUse hook returns **exit code 2** (blocks file save):
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
⚠️ BLOCKED - Constitution Violation
|
|
97
|
+
|
|
98
|
+
Detected:
|
|
99
|
+
- [Line 42] TODO placeholder (Article I.1 - No Partial Implementation)
|
|
100
|
+
- [Line 58] Hardcoded API key (Article III.1 - No Hardcoded Secrets)
|
|
101
|
+
|
|
102
|
+
📋 ACTION:
|
|
103
|
+
1. Complete all TODOs/FIXMEs before saving
|
|
104
|
+
2. Move secrets to environment variables (.env, not committed)
|
|
105
|
+
3. Review .claude/constitution/project-constitution.md v2.0.0
|
|
106
|
+
4. Run /flow-verify for comprehensive check
|
|
107
|
+
|
|
108
|
+
Source: Constitution Articles I.1, III.1
|
|
109
|
+
File: {file_path}
|
|
110
|
+
|
|
111
|
+
Constitutional Basis:
|
|
112
|
+
Article I.1: "NO PARTIAL IMPLEMENTATION: Complete implementation or no implementation"
|
|
113
|
+
Article III.1: "NO HARDCODED SECRETS: Use environment variables or secret management"
|
|
114
|
+
|
|
115
|
+
💡 SKIP: Add `@constitution-verified` comment or set SKIP_CONSTITUTION_CHECK=1
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Constitutional Basis
|
|
119
|
+
|
|
120
|
+
### Article I: Quality First
|
|
121
|
+
|
|
122
|
+
```yaml
|
|
123
|
+
I.1 Complete Implementation Mandate:
|
|
124
|
+
Prohibition: Any form of partial implementation or placeholder code
|
|
125
|
+
Requirement: Complete implementation or no implementation
|
|
126
|
+
Examples:
|
|
127
|
+
❌ Forbidden: "// TODO: Implement this later"
|
|
128
|
+
❌ Forbidden: "// Simplified for now, will complete in v2"
|
|
129
|
+
✅ Required: Fully functional, production-ready code
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Enforcement**:
|
|
133
|
+
- **Generation time**: prd-writer, tech-architect, planner agents check output
|
|
134
|
+
- **Edit time**: constitution-guardian guardrail blocks save (this skill)
|
|
135
|
+
- **Phase completion**: validate-constitution.sh batch validation
|
|
136
|
+
|
|
137
|
+
### Article III: Security First
|
|
138
|
+
|
|
139
|
+
```yaml
|
|
140
|
+
III.1 No Hardcoded Secrets:
|
|
141
|
+
Prohibited:
|
|
142
|
+
❌ API_KEY = "sk-abc123..." in source code
|
|
143
|
+
❌ PASSWORD = "admin123" in config files
|
|
144
|
+
❌ JWT_SECRET embedded in code
|
|
145
|
+
|
|
146
|
+
Required:
|
|
147
|
+
✅ Environment variables (.env files, not committed)
|
|
148
|
+
✅ Secret management services (AWS Secrets Manager, etc.)
|
|
149
|
+
✅ Configuration injection at runtime
|
|
150
|
+
|
|
151
|
+
Detection: Pre-push guard scans for secret patterns
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Enforcement**:
|
|
155
|
+
- **Generation time**: All agents avoid secrets in generated docs
|
|
156
|
+
- **Edit time**: constitution-guardian guardrail blocks save (this skill)
|
|
157
|
+
- **Pre-push**: Git pre-push hook scans for secrets
|
|
158
|
+
|
|
159
|
+
## Skip Conditions
|
|
160
|
+
|
|
161
|
+
Users can bypass Constitution guardian in specific scenarios:
|
|
162
|
+
|
|
163
|
+
### 1. Session Skip (One-time per session)
|
|
164
|
+
- **Mechanism**: `sessionSkillUsed: true` in skill-rules.json
|
|
165
|
+
- **Behavior**: Guardrail only triggers once per Claude session
|
|
166
|
+
- **Use case**: User acknowledged violation, working on fix
|
|
167
|
+
|
|
168
|
+
### 2. File Marker (Permanent skip for specific file)
|
|
169
|
+
- **Marker**: Add `@constitution-verified` comment in document
|
|
170
|
+
- **Example**:
|
|
171
|
+
```markdown
|
|
172
|
+
<!-- @constitution-verified: Legacy doc migration, compliance review completed -->
|
|
173
|
+
```
|
|
174
|
+
- **Use case**: Legacy documentation, special cases
|
|
175
|
+
|
|
176
|
+
### 3. Environment Variable (Temporary global skip)
|
|
177
|
+
- **Variable**: `SKIP_CONSTITUTION_CHECK=1`
|
|
178
|
+
- **Scope**: Current terminal session
|
|
179
|
+
- **Use case**: Bulk imports, automated migrations
|
|
180
|
+
|
|
181
|
+
## Relationship with Other Components
|
|
182
|
+
|
|
183
|
+
### validate-constitution.sh (Script)
|
|
184
|
+
- **Purpose**: Batch validation of all 10 Constitutional Articles
|
|
185
|
+
- **Scope**: Complete document/codebase scan
|
|
186
|
+
- **Timing**: Phase completion (e.g., /flow-prd Exit Gate)
|
|
187
|
+
- **Articles**: I, II, III, IV, V, VI, VII, VIII, IX, X
|
|
188
|
+
|
|
189
|
+
### constitution-guardian (Guardrail)
|
|
190
|
+
- **Purpose**: Real-time prevention of critical violations
|
|
191
|
+
- **Scope**: Single document being edited
|
|
192
|
+
- **Timing**: During file editing (PreToolUse hook)
|
|
193
|
+
- **Articles**: Focus on I.1, III.1 (most critical for documents)
|
|
194
|
+
|
|
195
|
+
**Relationship**: **Complementary (互补)**
|
|
196
|
+
- Guardrail: Real-time prevention (write-time, partial Articles)
|
|
197
|
+
- Script: Batch validation (phase-time, all Articles)
|
|
198
|
+
- Double insurance: Guardrail catches most issues, Script catches remaining
|
|
199
|
+
|
|
200
|
+
### Constitution Document
|
|
201
|
+
- **Source of Truth**: `.claude/constitution/project-constitution.md` v2.0.0
|
|
202
|
+
- **Contains**: All 10 Articles with detailed rules
|
|
203
|
+
- **This guardrail**: Extracts Articles I.1, III.1 prohibition rules only
|
|
204
|
+
|
|
205
|
+
## Configuration
|
|
206
|
+
|
|
207
|
+
In `.claude/skills/skill-rules.json`:
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"constitution-guardian": {
|
|
212
|
+
"type": "guardrail",
|
|
213
|
+
"enforcement": "block",
|
|
214
|
+
"priority": "critical",
|
|
215
|
+
"description": "Real-time Constitution compliance, extracted from Constitution v2.0.0",
|
|
216
|
+
"fileTriggers": {
|
|
217
|
+
"pathPatterns": [
|
|
218
|
+
"devflow/requirements/**/PRD.md",
|
|
219
|
+
"devflow/requirements/**/EPIC.md",
|
|
220
|
+
"devflow/requirements/**/TASKS.md",
|
|
221
|
+
"devflow/requirements/**/TECH_DESIGN.md",
|
|
222
|
+
"devflow/requirements/**/contracts/**/*.yaml",
|
|
223
|
+
"devflow/requirements/**/data-model.md"
|
|
224
|
+
],
|
|
225
|
+
"contentPatterns": [
|
|
226
|
+
"TODO.*later",
|
|
227
|
+
"FIXME",
|
|
228
|
+
"\\[placeholder\\]",
|
|
229
|
+
"simplified for now",
|
|
230
|
+
"defer to v\\d",
|
|
231
|
+
"API_KEY\\s*=\\s*['\"]?[a-zA-Z0-9_-]{10,}",
|
|
232
|
+
"SECRET\\s*=\\s*['\"]?[a-zA-Z0-9_-]+",
|
|
233
|
+
"PASSWORD\\s*=\\s*['\"]?[^\\s]+",
|
|
234
|
+
"TOKEN\\s*=\\s*['\"]?[a-zA-Z0-9_-]{10,}",
|
|
235
|
+
"apiKey:\\s*['\"][^'\"]+['\"]",
|
|
236
|
+
"password:\\s*['\"][^'\"]+['\"]"
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
"blockMessage": "⚠️ BLOCKED - Constitution Violation\n\nDetected:\n- Partial implementation (Article I.1)\n- Hardcoded secrets (Article III.1)\n\n📋 ACTION:\n1. Complete all TODOs/FIXMEs\n2. Move secrets to config system\n3. Run /flow-verify\n\nSource: .claude/constitution/project-constitution.md v2.0.0",
|
|
240
|
+
"skipConditions": {
|
|
241
|
+
"sessionSkillUsed": true,
|
|
242
|
+
"fileMarkers": ["@constitution-verified"],
|
|
243
|
+
"envOverride": "SKIP_CONSTITUTION_CHECK"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Line Number Reporting (Enhancement)
|
|
250
|
+
|
|
251
|
+
**Goal**: Precise violation location reporting
|
|
252
|
+
|
|
253
|
+
**Implementation** (in PreToolUse hook):
|
|
254
|
+
```typescript
|
|
255
|
+
function detectViolations(content: string, patterns: string[]) {
|
|
256
|
+
const lines = content.split('\n');
|
|
257
|
+
const violations: Array<{line: number, pattern: string, text: string}> = [];
|
|
258
|
+
|
|
259
|
+
lines.forEach((line, index) => {
|
|
260
|
+
patterns.forEach(pattern => {
|
|
261
|
+
if (new RegExp(pattern, 'i').test(line)) {
|
|
262
|
+
violations.push({
|
|
263
|
+
line: index + 1,
|
|
264
|
+
pattern: pattern,
|
|
265
|
+
text: line.trim()
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
return violations;
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Enhanced Blocking Message**:
|
|
276
|
+
```
|
|
277
|
+
⚠️ BLOCKED - Constitution Violation
|
|
278
|
+
|
|
279
|
+
Detected 3 violations:
|
|
280
|
+
[Line 42] TODO placeholder (Article I.1)
|
|
281
|
+
→ "TODO later: Add email verification"
|
|
282
|
+
|
|
283
|
+
[Line 58] Hardcoded API key (Article III.1)
|
|
284
|
+
→ "API_KEY=sk-abc123def456"
|
|
285
|
+
|
|
286
|
+
[Line 73] FIXME comment (Article I.1)
|
|
287
|
+
→ "FIXME: Complete error handling"
|
|
288
|
+
|
|
289
|
+
📋 ACTION: ...
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Design Principle
|
|
293
|
+
|
|
294
|
+
**This guardrail does NOT contain**:
|
|
295
|
+
- ❌ Complete Constitution (all 10 Articles are in project-constitution.md)
|
|
296
|
+
- ❌ All violation patterns (only Articles I.1, III.1)
|
|
297
|
+
- ❌ Batch validation logic (that's in validate-constitution.sh)
|
|
298
|
+
|
|
299
|
+
**This guardrail ONLY contains**:
|
|
300
|
+
- ✅ Articles I.1, III.1 prohibition rule extraction
|
|
301
|
+
- ✅ Real-time violation detection (content pattern matching)
|
|
302
|
+
- ✅ Blocking mechanism (PreToolUse hook, exit code 2)
|
|
303
|
+
- ✅ Precise line number reporting
|
|
304
|
+
- ✅ Links to full Constitution document
|
|
305
|
+
|
|
306
|
+
**Rationale**: Avoid duplication ("不重不漏" principle). Constitution document owns full text, guardrail owns real-time enforcement of critical rules.
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: devflow-constitution-quick-ref
|
|
3
|
+
description: Quick reference guide to CC-DevFlow Constitution v2.0.0 with links to full text. Covers all 10 Articles and Phase -1 Gates.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DevFlow Constitution Quick Reference
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Provide quick summaries of all 10 Constitutional Articles with links to full Constitution document. This skill does NOT duplicate the complete Constitution text.
|
|
10
|
+
|
|
11
|
+
**Full Constitution**: [.claude/constitution/project-constitution.md](.claude/constitution/project-constitution.md) v2.0.0
|
|
12
|
+
|
|
13
|
+
## Constitution Overview
|
|
14
|
+
|
|
15
|
+
**Version**: v2.0.0
|
|
16
|
+
**Effective Date**: 2025-01-10
|
|
17
|
+
**Authority**: Supreme Priority, Inviolable, Persistent, Universal
|
|
18
|
+
**Scope**: All requirements, all stages, all agents
|
|
19
|
+
|
|
20
|
+
## Article I: Quality First (质量至上)
|
|
21
|
+
|
|
22
|
+
### Summary
|
|
23
|
+
Quality is the non-negotiable baseline.
|
|
24
|
+
|
|
25
|
+
### Key Rules
|
|
26
|
+
- **I.1**: NO PARTIAL IMPLEMENTATION (no TODO/FIXME placeholders)
|
|
27
|
+
- **I.2**: Test coverage ≥80%
|
|
28
|
+
- **I.3**: No "simplified for now" excuses
|
|
29
|
+
- **I.4**: Must pass type checking, linting, security scanning, build verification
|
|
30
|
+
|
|
31
|
+
### Enforcement
|
|
32
|
+
- **Real-time**: constitution-guardian guardrail (blocks TODOs/FIXMEs)
|
|
33
|
+
- **Batch**: validate-constitution.sh --type all
|
|
34
|
+
- **Pre-push**: pre-push-guard.sh
|
|
35
|
+
|
|
36
|
+
### Example Violations
|
|
37
|
+
```markdown
|
|
38
|
+
❌ "TODO later: Add email verification"
|
|
39
|
+
❌ "// Simplified for now, will complete in v2"
|
|
40
|
+
❌ "defer to v2"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**For Details**: See [Constitution Article I](.claude/constitution/project-constitution.md#article-i-quality-first-质量至上)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Article II: Architectural Consistency (架构一致性)
|
|
48
|
+
|
|
49
|
+
### Summary
|
|
50
|
+
Maintain codebase uniformity and predictability.
|
|
51
|
+
|
|
52
|
+
### Key Rules
|
|
53
|
+
- **II.1**: No code duplication (search existing codebase first)
|
|
54
|
+
- **II.2**: Consistent naming (follow existing patterns)
|
|
55
|
+
- **II.3**: Anti-over-engineering (no BaseController, AbstractService)
|
|
56
|
+
- **II.4**: Single responsibility (≤500 lines per file)
|
|
57
|
+
|
|
58
|
+
### Enforcement
|
|
59
|
+
- **Phase -1 Gates**: planner agent checks before EPIC generation
|
|
60
|
+
- **Code review**: code-reviewer agent
|
|
61
|
+
|
|
62
|
+
### Example Violations
|
|
63
|
+
```typescript
|
|
64
|
+
❌ class BaseController {} // Over-abstraction
|
|
65
|
+
❌ function helperManager() {} // Vague naming
|
|
66
|
+
❌ 800-line file // Exceeds limit
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**For Details**: See [Constitution Article II](.claude/constitution/project-constitution.md#article-ii-architectural-consistency-架构一致性)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Article III: Security First (安全优先)
|
|
74
|
+
|
|
75
|
+
### Summary
|
|
76
|
+
Security is foundational, not an afterthought.
|
|
77
|
+
|
|
78
|
+
### Key Rules
|
|
79
|
+
- **III.1**: NO HARDCODED SECRETS (use env variables)
|
|
80
|
+
- **III.2**: All inputs must be validated BEFORE processing
|
|
81
|
+
- **III.3**: Principle of least privilege (deny by default)
|
|
82
|
+
- **III.4**: Secure by default (HTTPS, CORS whitelist, auth required)
|
|
83
|
+
|
|
84
|
+
### Enforcement
|
|
85
|
+
- **Real-time**: constitution-guardian guardrail (blocks hardcoded secrets)
|
|
86
|
+
- **Pre-push**: pre-push-guard.sh scans for secret patterns
|
|
87
|
+
- **QA**: security-reviewer agent
|
|
88
|
+
|
|
89
|
+
### Example Violations
|
|
90
|
+
```typescript
|
|
91
|
+
❌ const API_KEY = "sk-abc123..." // Hardcoded
|
|
92
|
+
❌ const PASSWORD = "admin123" // Hardcoded
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**For Details**: See [Constitution Article III](.claude/constitution/project-constitution.md#article-iii-security-first-安全优先)
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Article IV: Performance Accountability (性能责任)
|
|
100
|
+
|
|
101
|
+
### Summary
|
|
102
|
+
Performance is user experience; proactive optimization required.
|
|
103
|
+
|
|
104
|
+
### Key Rules
|
|
105
|
+
- **IV.1**: No resource leaks (always close connections)
|
|
106
|
+
- **IV.2**: Algorithm efficiency (avoid O(n²) when O(n) exists)
|
|
107
|
+
- **IV.3**: Lazy loading (pagination for large datasets)
|
|
108
|
+
- **IV.4**: Intelligent caching (with TTL and invalidation)
|
|
109
|
+
|
|
110
|
+
### Enforcement
|
|
111
|
+
- **QA**: qa-tester agent includes performance profiling
|
|
112
|
+
- **Code review**: code-reviewer agent checks resource management
|
|
113
|
+
|
|
114
|
+
### Example Violations
|
|
115
|
+
```typescript
|
|
116
|
+
❌ loadAllUsers() // Loads 1M users into memory
|
|
117
|
+
❌ nested loops over same dataset // O(n²)
|
|
118
|
+
❌ no connection.close() // Resource leak
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**For Details**: See [Constitution Article IV](.claude/constitution/project-constitution.md#article-iv-performance-accountability-性能责任)
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Article V: Maintainability (可维护性)
|
|
126
|
+
|
|
127
|
+
### Summary
|
|
128
|
+
Code must be understandable, modifiable, and extensible.
|
|
129
|
+
|
|
130
|
+
### Key Rules
|
|
131
|
+
- **V.1**: No dead code (delete unused imports, commented code)
|
|
132
|
+
- **V.2**: Separation of concerns (models, services, controllers, views)
|
|
133
|
+
- **V.3**: Documentation mandate (complex algorithms, business logic)
|
|
134
|
+
- **V.4**: File size limits (≤500 lines per file, ≤50 lines per function)
|
|
135
|
+
|
|
136
|
+
### Enforcement
|
|
137
|
+
- **Linting**: ESLint, Pylint rules
|
|
138
|
+
- **Code review**: code-reviewer agent
|
|
139
|
+
|
|
140
|
+
### Example Violations
|
|
141
|
+
```typescript
|
|
142
|
+
❌ // Commented-out code block // Dead code
|
|
143
|
+
❌ Unused import statements // Dead code
|
|
144
|
+
❌ 800-line function // Exceeds limit
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**For Details**: See [Constitution Article V](.claude/constitution/project-constitution.md#article-v-maintainability-可维护性)
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Article VI: Test-First Development (测试优先开发)
|
|
152
|
+
|
|
153
|
+
### Summary
|
|
154
|
+
Tests define behavior; implementation makes tests pass.
|
|
155
|
+
|
|
156
|
+
### Key Rules
|
|
157
|
+
- **VI.1**: TDD mandate (write tests FIRST, tests MUST fail initially)
|
|
158
|
+
- **VI.2**: Test independence (each test runs in isolation)
|
|
159
|
+
- **VI.3**: Meaningful tests (no `assert True`, test actual behavior)
|
|
160
|
+
|
|
161
|
+
### Enforcement
|
|
162
|
+
- **Real-time**: devflow-tdd-enforcer guardrail (blocks TDD violations)
|
|
163
|
+
- **TASKS.md**: TEST VERIFICATION CHECKPOINT between Phase 2 and Phase 3
|
|
164
|
+
- **planner agent**: Generates TASKS.md with TDD order
|
|
165
|
+
|
|
166
|
+
### TDD Sequence
|
|
167
|
+
```
|
|
168
|
+
Phase 2: Write Tests FIRST ⚠️
|
|
169
|
+
→ All tests MUST fail initially
|
|
170
|
+
→ TEST VERIFICATION CHECKPOINT
|
|
171
|
+
|
|
172
|
+
Phase 3: Write Implementation
|
|
173
|
+
→ Goal: Make tests pass
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**For Details**: See [Constitution Article VI](.claude/constitution/project-constitution.md#article-vi-test-first-development-测试优先开发)
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Article VII: Simplicity Gate (简单性闸门)
|
|
181
|
+
|
|
182
|
+
### Summary
|
|
183
|
+
Default to simplicity; complexity requires justification.
|
|
184
|
+
|
|
185
|
+
### Key Rules (Phase -1 Gates)
|
|
186
|
+
- **VII.1**: Maximum project count ≤3 simultaneously
|
|
187
|
+
- **VII.2**: Minimal dependencies (use standard library when possible)
|
|
188
|
+
- **VII.3**: Vertical slice first (full feature before next feature)
|
|
189
|
+
- **VII.4**: Direct framework usage (avoid custom abstractions)
|
|
190
|
+
|
|
191
|
+
### Enforcement
|
|
192
|
+
- **Phase -1 Gates**: planner agent enforces BEFORE generating EPIC
|
|
193
|
+
- **EPIC.md**: Contains "Phase -1 Simplicity Gate" check section
|
|
194
|
+
|
|
195
|
+
### Example Violations
|
|
196
|
+
```yaml
|
|
197
|
+
❌ 5 projects in scope # Exceeds limit
|
|
198
|
+
❌ Adding new framework for simple task # Over-dependency
|
|
199
|
+
❌ Custom ORM wrapper # Unnecessary abstraction
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**For Details**: See [Constitution Article VII](.claude/constitution/project-constitution.md#article-vii-simplicity-gate-简单性闸门)
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Article VIII: Anti-Abstraction (反抽象化)
|
|
207
|
+
|
|
208
|
+
### Summary
|
|
209
|
+
Prefer concrete code over abstractions until three+ use cases proven.
|
|
210
|
+
|
|
211
|
+
### Key Rules (Phase -1 Gates)
|
|
212
|
+
- **VIII.1**: No premature abstraction (Rule of Three)
|
|
213
|
+
- **VIII.2**: No generic layers (no GenericService<T>)
|
|
214
|
+
- **VIII.3**: Direct framework usage (Express, FastAPI, Flask)
|
|
215
|
+
- **VIII.4**: Inline before extract (copy-paste OK until 3rd repetition)
|
|
216
|
+
|
|
217
|
+
### Enforcement
|
|
218
|
+
- **Phase -1 Gates**: planner agent enforces BEFORE generating EPIC
|
|
219
|
+
- **EPIC.md**: Contains "Phase -1 Anti-Abstraction Gate" check section
|
|
220
|
+
|
|
221
|
+
### Example Violations
|
|
222
|
+
```typescript
|
|
223
|
+
❌ class BaseController {} // Premature abstraction
|
|
224
|
+
❌ GenericRepository<T> // Generic layer
|
|
225
|
+
❌ Custom framework wrapper // Over-abstraction
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**For Details**: See [Constitution Article VIII](.claude/constitution/project-constitution.md#article-viii-anti-abstraction-反抽象化)
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Article IX: Integration-First Testing (集成优先测试)
|
|
233
|
+
|
|
234
|
+
### Summary
|
|
235
|
+
Test contracts/integrations before internal logic.
|
|
236
|
+
|
|
237
|
+
### Key Rules (Phase -1 Gates)
|
|
238
|
+
- **IX.1**: Contract tests first (API contracts, GraphQL schemas)
|
|
239
|
+
- **IX.2**: Integration tests before unit tests (test boundaries first)
|
|
240
|
+
- **IX.3**: Test external dependencies (database, APIs, queues)
|
|
241
|
+
- **IX.4**: E2E critical paths (happy path + error path)
|
|
242
|
+
|
|
243
|
+
### Enforcement
|
|
244
|
+
- **Phase -1 Gates**: planner agent enforces BEFORE generating EPIC
|
|
245
|
+
- **TASKS.md Phase 2**: Lists contract/integration tests FIRST
|
|
246
|
+
- **TEST VERIFICATION CHECKPOINT**: Ensures Phase 2 tests run before Phase 3
|
|
247
|
+
|
|
248
|
+
### Test Order
|
|
249
|
+
```
|
|
250
|
+
1. Contract tests (API contracts, GraphQL)
|
|
251
|
+
2. Integration tests (DB, external APIs)
|
|
252
|
+
3. E2E tests (critical user paths)
|
|
253
|
+
4. Unit tests (internal logic)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**For Details**: See [Constitution Article IX](.claude/constitution/project-constitution.md#article-ix-integration-first-testing-集成优先测试)
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Article X: Requirement Boundary (需求边界)
|
|
261
|
+
|
|
262
|
+
### Summary
|
|
263
|
+
Prevent scope creep; enforce strict requirement boundaries.
|
|
264
|
+
|
|
265
|
+
### Key Rules
|
|
266
|
+
- **X.1**: One REQ-ID, one bounded context (no "also add X")
|
|
267
|
+
- **X.2**: No feature expansion during implementation
|
|
268
|
+
- **X.3**: Separate REQ-IDs for separate concerns
|
|
269
|
+
- **X.4**: Explicit scope documentation in PRD.md
|
|
270
|
+
|
|
271
|
+
### Enforcement
|
|
272
|
+
- **PRD generation**: prd-writer agent enforces Anti-Expansion mandate
|
|
273
|
+
- **Scope validation**: validate-scope-boundary.sh
|
|
274
|
+
- **Code review**: code-reviewer agent checks for scope violations
|
|
275
|
+
|
|
276
|
+
### Example Violations
|
|
277
|
+
```markdown
|
|
278
|
+
❌ PRD.md: "User Registration (also add social login)" # Scope creep
|
|
279
|
+
❌ Adding unplanned features during /flow-dev # Feature expansion
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**For Details**: See [Constitution Article X](.claude/constitution/project-constitution.md#article-x-requirement-boundary-需求边界)
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Phase -1 Gates
|
|
287
|
+
|
|
288
|
+
**Executed by**: planner agent BEFORE generating EPIC and TASKS
|
|
289
|
+
|
|
290
|
+
### Gate 1: Simplicity Check (Article VII)
|
|
291
|
+
- [ ] Project count ≤3
|
|
292
|
+
- [ ] Minimal dependencies
|
|
293
|
+
- [ ] Vertical slice approach
|
|
294
|
+
- [ ] Direct framework usage
|
|
295
|
+
|
|
296
|
+
### Gate 2: Anti-Abstraction Check (Article VIII)
|
|
297
|
+
- [ ] No premature abstractions
|
|
298
|
+
- [ ] No generic layers
|
|
299
|
+
- [ ] Inline before extract
|
|
300
|
+
- [ ] Direct framework calls
|
|
301
|
+
|
|
302
|
+
### Gate 3: Integration-First Check (Article IX)
|
|
303
|
+
- [ ] Contract tests listed first
|
|
304
|
+
- [ ] Integration tests before unit tests
|
|
305
|
+
- [ ] External dependency tests included
|
|
306
|
+
- [ ] E2E critical paths covered
|
|
307
|
+
|
|
308
|
+
**Documented in**: EPIC.md contains "Phase -1 Gates" check section
|
|
309
|
+
|
|
310
|
+
**For Details**: See [planner agent](.claude/agents/planner.md) Phase -1 Gates Enforcement Sequence
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Enforcement Summary
|
|
315
|
+
|
|
316
|
+
| Article | Real-time Guardrail | Phase Gate | Batch Validation | Pre-push |
|
|
317
|
+
|---------|---------------------|------------|------------------|----------|
|
|
318
|
+
| I | constitution-guardian | prd/tech/epic Exit | validate-constitution.sh | ✓ |
|
|
319
|
+
| II | — | Phase -1 (planner) | validate-constitution.sh | — |
|
|
320
|
+
| III | constitution-guardian | — | validate-constitution.sh | ✓ |
|
|
321
|
+
| IV | — | — | validate-constitution.sh (QA) | — |
|
|
322
|
+
| V | — | — | Linting + code review | — |
|
|
323
|
+
| VI | devflow-tdd-enforcer | TEST VERIFICATION | validate-constitution.sh | — |
|
|
324
|
+
| VII | — | Phase -1 (planner) | validate-constitution.sh | — |
|
|
325
|
+
| VIII | — | Phase -1 (planner) | validate-constitution.sh | — |
|
|
326
|
+
| IX | — | Phase -1 (planner) | validate-constitution.sh | — |
|
|
327
|
+
| X | — | PRD generation | validate-scope-boundary.sh | — |
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Quick Lookup by Scenario
|
|
332
|
+
|
|
333
|
+
### Scenario: "Can I add TODO for later?"
|
|
334
|
+
**Answer**: ❌ NO (Article I.1 - No Partial Implementation)
|
|
335
|
+
**Guardrail**: constitution-guardian blocks save
|
|
336
|
+
**Alternative**: Complete implementation now, or remove from scope
|
|
337
|
+
|
|
338
|
+
### Scenario: "Should I create BaseController?"
|
|
339
|
+
**Answer**: ❌ NO (Article II.3, VIII.2 - Anti-Abstraction)
|
|
340
|
+
**Phase Gate**: Phase -1 Gates block EPIC generation
|
|
341
|
+
**Alternative**: Use framework directly (Express, FastAPI)
|
|
342
|
+
|
|
343
|
+
### Scenario: "Can I hardcode API_KEY for testing?"
|
|
344
|
+
**Answer**: ❌ NO (Article III.1 - No Hardcoded Secrets)
|
|
345
|
+
**Guardrail**: constitution-guardian blocks save
|
|
346
|
+
**Alternative**: Use .env file with dotenv library
|
|
347
|
+
|
|
348
|
+
### Scenario: "Should I write implementation first?"
|
|
349
|
+
**Answer**: ❌ NO (Article VI.1 - TDD Mandate)
|
|
350
|
+
**Guardrail**: devflow-tdd-enforcer blocks TASKS.md edit
|
|
351
|
+
**Sequence**: Write failing test FIRST, then implementation
|
|
352
|
+
|
|
353
|
+
### Scenario: "Can I add social login to user registration?"
|
|
354
|
+
**Answer**: ❌ NO (Article X.1 - Requirement Boundary)
|
|
355
|
+
**Enforcement**: prd-writer agent Anti-Expansion mandate
|
|
356
|
+
**Alternative**: Create separate REQ-ID for social login
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Design Principle
|
|
361
|
+
|
|
362
|
+
**This skill does NOT contain**:
|
|
363
|
+
- ❌ Complete Constitution text (that's in project-constitution.md)
|
|
364
|
+
- ❌ Detailed Article explanations (that's in full Constitution)
|
|
365
|
+
- ❌ Implementation guidelines (those are in agent files)
|
|
366
|
+
|
|
367
|
+
**This skill ONLY contains**:
|
|
368
|
+
- ✅ Article summaries (quick reference)
|
|
369
|
+
- ✅ Key rules and examples
|
|
370
|
+
- ✅ Enforcement mechanisms
|
|
371
|
+
- ✅ Links to full Constitution document
|
|
372
|
+
- ✅ Quick lookup by scenario
|
|
373
|
+
|
|
374
|
+
**Rationale**: Avoid duplication ("不重不漏" principle). Constitution document owns full text, this skill owns quick reference and routing.
|