opencode-metis 0.1.0

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.
Files changed (156) hide show
  1. package/README.md +140 -0
  2. package/dist/cli.cjs +63 -0
  3. package/dist/mcp-server.cjs +51 -0
  4. package/dist/plugin.cjs +4 -0
  5. package/dist/worker.cjs +224 -0
  6. package/opencode/agent/the-analyst/feature-prioritization.md +66 -0
  7. package/opencode/agent/the-analyst/market-research.md +77 -0
  8. package/opencode/agent/the-analyst/project-coordination.md +81 -0
  9. package/opencode/agent/the-analyst/requirements-analysis.md +77 -0
  10. package/opencode/agent/the-architect/compatibility-review.md +138 -0
  11. package/opencode/agent/the-architect/complexity-review.md +137 -0
  12. package/opencode/agent/the-architect/quality-review.md +67 -0
  13. package/opencode/agent/the-architect/security-review.md +127 -0
  14. package/opencode/agent/the-architect/system-architecture.md +119 -0
  15. package/opencode/agent/the-architect/system-documentation.md +83 -0
  16. package/opencode/agent/the-architect/technology-research.md +85 -0
  17. package/opencode/agent/the-chief.md +79 -0
  18. package/opencode/agent/the-designer/accessibility-implementation.md +101 -0
  19. package/opencode/agent/the-designer/design-foundation.md +74 -0
  20. package/opencode/agent/the-designer/interaction-architecture.md +75 -0
  21. package/opencode/agent/the-designer/user-research.md +70 -0
  22. package/opencode/agent/the-meta-agent.md +155 -0
  23. package/opencode/agent/the-platform-engineer/ci-cd-pipelines.md +109 -0
  24. package/opencode/agent/the-platform-engineer/containerization.md +106 -0
  25. package/opencode/agent/the-platform-engineer/data-architecture.md +81 -0
  26. package/opencode/agent/the-platform-engineer/dependency-review.md +144 -0
  27. package/opencode/agent/the-platform-engineer/deployment-automation.md +81 -0
  28. package/opencode/agent/the-platform-engineer/infrastructure-as-code.md +107 -0
  29. package/opencode/agent/the-platform-engineer/performance-tuning.md +82 -0
  30. package/opencode/agent/the-platform-engineer/pipeline-engineering.md +81 -0
  31. package/opencode/agent/the-platform-engineer/production-monitoring.md +105 -0
  32. package/opencode/agent/the-qa-engineer/exploratory-testing.md +66 -0
  33. package/opencode/agent/the-qa-engineer/performance-testing.md +81 -0
  34. package/opencode/agent/the-qa-engineer/quality-assurance.md +77 -0
  35. package/opencode/agent/the-qa-engineer/test-execution.md +66 -0
  36. package/opencode/agent/the-software-engineer/api-development.md +78 -0
  37. package/opencode/agent/the-software-engineer/component-development.md +79 -0
  38. package/opencode/agent/the-software-engineer/concurrency-review.md +141 -0
  39. package/opencode/agent/the-software-engineer/domain-modeling.md +66 -0
  40. package/opencode/agent/the-software-engineer/performance-optimization.md +113 -0
  41. package/opencode/command/analyze.md +149 -0
  42. package/opencode/command/constitution.md +178 -0
  43. package/opencode/command/debug.md +194 -0
  44. package/opencode/command/document.md +178 -0
  45. package/opencode/command/implement.md +225 -0
  46. package/opencode/command/refactor.md +207 -0
  47. package/opencode/command/review.md +229 -0
  48. package/opencode/command/simplify.md +267 -0
  49. package/opencode/command/specify.md +191 -0
  50. package/opencode/command/validate.md +224 -0
  51. package/opencode/skill/accessibility-design/SKILL.md +566 -0
  52. package/opencode/skill/accessibility-design/checklists/wcag-checklist.md +435 -0
  53. package/opencode/skill/agent-coordination/SKILL.md +224 -0
  54. package/opencode/skill/api-contract-design/SKILL.md +550 -0
  55. package/opencode/skill/api-contract-design/templates/graphql-schema-template.md +818 -0
  56. package/opencode/skill/api-contract-design/templates/rest-api-template.md +417 -0
  57. package/opencode/skill/architecture-design/SKILL.md +160 -0
  58. package/opencode/skill/architecture-design/examples/architecture-examples.md +170 -0
  59. package/opencode/skill/architecture-design/template.md +749 -0
  60. package/opencode/skill/architecture-design/validation.md +99 -0
  61. package/opencode/skill/architecture-selection/SKILL.md +522 -0
  62. package/opencode/skill/architecture-selection/examples/adrs/001-example-adr.md +71 -0
  63. package/opencode/skill/architecture-selection/examples/architecture-patterns.md +239 -0
  64. package/opencode/skill/bug-diagnosis/SKILL.md +235 -0
  65. package/opencode/skill/code-quality-review/SKILL.md +337 -0
  66. package/opencode/skill/code-quality-review/examples/anti-patterns.md +629 -0
  67. package/opencode/skill/code-quality-review/reference.md +322 -0
  68. package/opencode/skill/code-review/SKILL.md +363 -0
  69. package/opencode/skill/code-review/reference.md +450 -0
  70. package/opencode/skill/codebase-analysis/SKILL.md +139 -0
  71. package/opencode/skill/codebase-navigation/SKILL.md +227 -0
  72. package/opencode/skill/codebase-navigation/examples/exploration-patterns.md +263 -0
  73. package/opencode/skill/coding-conventions/SKILL.md +178 -0
  74. package/opencode/skill/coding-conventions/checklists/accessibility-checklist.md +176 -0
  75. package/opencode/skill/coding-conventions/checklists/performance-checklist.md +154 -0
  76. package/opencode/skill/coding-conventions/checklists/security-checklist.md +127 -0
  77. package/opencode/skill/constitution-validation/SKILL.md +315 -0
  78. package/opencode/skill/constitution-validation/examples/CONSTITUTION.md +202 -0
  79. package/opencode/skill/constitution-validation/reference/rule-patterns.md +328 -0
  80. package/opencode/skill/constitution-validation/template.md +115 -0
  81. package/opencode/skill/context-preservation/SKILL.md +445 -0
  82. package/opencode/skill/data-modeling/SKILL.md +385 -0
  83. package/opencode/skill/data-modeling/templates/schema-design-template.md +268 -0
  84. package/opencode/skill/deployment-pipeline-design/SKILL.md +579 -0
  85. package/opencode/skill/deployment-pipeline-design/templates/pipeline-template.md +633 -0
  86. package/opencode/skill/documentation-extraction/SKILL.md +259 -0
  87. package/opencode/skill/documentation-sync/SKILL.md +431 -0
  88. package/opencode/skill/domain-driven-design/SKILL.md +509 -0
  89. package/opencode/skill/domain-driven-design/examples/ddd-patterns.md +688 -0
  90. package/opencode/skill/domain-driven-design/reference.md +465 -0
  91. package/opencode/skill/drift-detection/SKILL.md +383 -0
  92. package/opencode/skill/drift-detection/reference.md +340 -0
  93. package/opencode/skill/error-recovery/SKILL.md +162 -0
  94. package/opencode/skill/error-recovery/examples/error-patterns.md +484 -0
  95. package/opencode/skill/feature-prioritization/SKILL.md +419 -0
  96. package/opencode/skill/feature-prioritization/examples/rice-template.md +139 -0
  97. package/opencode/skill/feature-prioritization/reference.md +256 -0
  98. package/opencode/skill/git-workflow/SKILL.md +453 -0
  99. package/opencode/skill/implementation-planning/SKILL.md +215 -0
  100. package/opencode/skill/implementation-planning/examples/phase-examples.md +217 -0
  101. package/opencode/skill/implementation-planning/template.md +220 -0
  102. package/opencode/skill/implementation-planning/validation.md +88 -0
  103. package/opencode/skill/implementation-verification/SKILL.md +272 -0
  104. package/opencode/skill/knowledge-capture/SKILL.md +265 -0
  105. package/opencode/skill/knowledge-capture/reference/knowledge-capture.md +402 -0
  106. package/opencode/skill/knowledge-capture/reference.md +444 -0
  107. package/opencode/skill/knowledge-capture/templates/domain-template.md +325 -0
  108. package/opencode/skill/knowledge-capture/templates/interface-template.md +255 -0
  109. package/opencode/skill/knowledge-capture/templates/pattern-template.md +144 -0
  110. package/opencode/skill/observability-design/SKILL.md +291 -0
  111. package/opencode/skill/observability-design/references/monitoring-patterns.md +461 -0
  112. package/opencode/skill/pattern-detection/SKILL.md +171 -0
  113. package/opencode/skill/pattern-detection/examples/common-patterns.md +359 -0
  114. package/opencode/skill/performance-analysis/SKILL.md +266 -0
  115. package/opencode/skill/performance-analysis/references/profiling-tools.md +499 -0
  116. package/opencode/skill/requirements-analysis/SKILL.md +139 -0
  117. package/opencode/skill/requirements-analysis/examples/good-prd.md +66 -0
  118. package/opencode/skill/requirements-analysis/template.md +177 -0
  119. package/opencode/skill/requirements-analysis/validation.md +69 -0
  120. package/opencode/skill/requirements-elicitation/SKILL.md +518 -0
  121. package/opencode/skill/requirements-elicitation/examples/interview-questions.md +226 -0
  122. package/opencode/skill/requirements-elicitation/examples/user-stories.md +414 -0
  123. package/opencode/skill/safe-refactoring/SKILL.md +312 -0
  124. package/opencode/skill/safe-refactoring/reference/code-smells.md +347 -0
  125. package/opencode/skill/security-assessment/SKILL.md +421 -0
  126. package/opencode/skill/security-assessment/checklists/security-review-checklist.md +285 -0
  127. package/opencode/skill/specification-management/SKILL.md +143 -0
  128. package/opencode/skill/specification-management/readme-template.md +32 -0
  129. package/opencode/skill/specification-management/reference.md +115 -0
  130. package/opencode/skill/specification-management/spec.py +229 -0
  131. package/opencode/skill/specification-validation/SKILL.md +397 -0
  132. package/opencode/skill/specification-validation/reference/3cs-framework.md +306 -0
  133. package/opencode/skill/specification-validation/reference/ambiguity-detection.md +132 -0
  134. package/opencode/skill/specification-validation/reference/constitution-validation.md +301 -0
  135. package/opencode/skill/specification-validation/reference/drift-detection.md +383 -0
  136. package/opencode/skill/task-delegation/SKILL.md +607 -0
  137. package/opencode/skill/task-delegation/examples/file-coordination.md +495 -0
  138. package/opencode/skill/task-delegation/examples/parallel-research.md +337 -0
  139. package/opencode/skill/task-delegation/examples/sequential-build.md +504 -0
  140. package/opencode/skill/task-delegation/reference.md +825 -0
  141. package/opencode/skill/tech-stack-detection/SKILL.md +89 -0
  142. package/opencode/skill/tech-stack-detection/references/framework-signatures.md +598 -0
  143. package/opencode/skill/technical-writing/SKILL.md +190 -0
  144. package/opencode/skill/technical-writing/templates/adr-template.md +205 -0
  145. package/opencode/skill/technical-writing/templates/system-doc-template.md +380 -0
  146. package/opencode/skill/test-design/SKILL.md +464 -0
  147. package/opencode/skill/test-design/examples/test-pyramid.md +724 -0
  148. package/opencode/skill/testing/SKILL.md +213 -0
  149. package/opencode/skill/testing/examples/test-pyramid.md +724 -0
  150. package/opencode/skill/user-insight-synthesis/SKILL.md +576 -0
  151. package/opencode/skill/user-insight-synthesis/templates/research-plan-template.md +217 -0
  152. package/opencode/skill/user-research/SKILL.md +508 -0
  153. package/opencode/skill/user-research/examples/interview-questions.md +265 -0
  154. package/opencode/skill/user-research/examples/personas.md +267 -0
  155. package/opencode/skill/vibe-security/SKILL.md +654 -0
  156. package/package.json +45 -0
@@ -0,0 +1,328 @@
1
+ # Constitution Validation Reference
2
+
3
+ Advanced patterns, rule types, and examples for constitution authoring.
4
+
5
+ ## Rule Types
6
+
7
+ ### Pattern Rules
8
+
9
+ Pattern rules use regex to match violations in source code. These are deterministic and fast.
10
+
11
+ **When to use:**
12
+ - Text patterns that can be matched literally
13
+ - Syntax violations (forbidden imports, banned functions)
14
+ - Secret detection (API keys, passwords)
15
+
16
+ **Regex Tips:**
17
+ - Escape special characters: `\.` for literal dot
18
+ - Use `\s*` for flexible whitespace
19
+ - Use `\b` for word boundaries
20
+ - Escape backslashes in YAML: `\\b` for `\b`
21
+
22
+ **Example - Detecting Barrel Exports:**
23
+
24
+ ```yaml
25
+ level: L1
26
+ pattern: "export \\* from"
27
+ scope: "src/**/*.ts"
28
+ exclude: "src/index.ts"
29
+ message: Barrel exports prohibited. Import from specific files.
30
+ ```
31
+
32
+ **Example - Detecting Direct DOM Manipulation:**
33
+
34
+ ```yaml
35
+ level: L1
36
+ pattern: "\\.(innerHTML|outerHTML)\\s*="
37
+ scope: "src/**/*.{ts,tsx,js,jsx}"
38
+ exclude: "**/*.test.*"
39
+ message: Direct innerHTML assignment risks XSS. Use framework's DOM methods.
40
+ ```
41
+
42
+ ### Check Rules
43
+
44
+ Check rules use semantic descriptions that the LLM interprets. These are flexible but non-deterministic.
45
+
46
+ **When to use:**
47
+ - Architectural patterns that require understanding context
48
+ - Rules that span multiple lines or files
49
+ - Semantic concepts (like "database calls only in repositories")
50
+
51
+ **Writing Good Check Descriptions:**
52
+ - Be specific about what constitutes a violation
53
+ - Include examples of valid and invalid patterns
54
+ - Mention file locations or naming conventions to check
55
+
56
+ **Example - Repository Pattern:**
57
+
58
+ ```yaml
59
+ level: L1
60
+ check: Database queries (Prisma, TypeORM, Knex, raw SQL) only in files matching *Repository.ts or *Repository.js
61
+ scope: "src/**/*.{ts,js}"
62
+ exclude: "**/repositories/**"
63
+ message: Direct database call outside repository layer.
64
+ ```
65
+
66
+ **Example - Hook Rules:**
67
+
68
+ ```yaml
69
+ level: L2
70
+ check: React hooks (useState, useEffect, useContext, custom use* hooks) only called in functional components or custom hooks
71
+ scope: "src/**/*.{tsx,jsx}"
72
+ message: Hooks must be called at the top level of functional components.
73
+ ```
74
+
75
+ ## Scope Patterns
76
+
77
+ The `scope` field uses glob patterns to determine which files to check.
78
+
79
+ ### Common Patterns
80
+
81
+ | Pattern | Matches |
82
+ |---------|---------|
83
+ | `**/*.ts` | All TypeScript files |
84
+ | `src/**/*.ts` | TypeScript files in src/ |
85
+ | `**/*.{ts,js}` | TypeScript and JavaScript |
86
+ | `packages/*/src/**` | All packages' src folders |
87
+ | `apps/web/**` | Only the web app |
88
+ | `!**/*.test.ts` | Exclude test files (use in `exclude`) |
89
+
90
+ ### Monorepo Scoping
91
+
92
+ For monorepos, scope to specific packages:
93
+
94
+ ```yaml
95
+ # Web package only
96
+ scope: "packages/web/src/**/*.{ts,tsx}"
97
+
98
+ # All packages
99
+ scope: "packages/*/src/**/*.ts"
100
+
101
+ # Shared libraries
102
+ scope: "libs/*/src/**/*.ts"
103
+
104
+ # Apps only
105
+ scope: "apps/*/src/**/*.ts"
106
+ ```
107
+
108
+ ## Exclude Patterns
109
+
110
+ The `exclude` field is comma-separated globs for files to skip.
111
+
112
+ **Common Excludes:**
113
+
114
+ ```yaml
115
+ exclude: "**/*.test.*, **/*.spec.*" # Test files
116
+ exclude: "**/__tests__/**, **/__mocks__/**" # Test directories
117
+ exclude: "**/node_modules/**" # Dependencies
118
+ exclude: "**/*.d.ts" # Type definitions
119
+ exclude: "**/*.example.*, .env.example" # Example files
120
+ exclude: "src/generated/**" # Generated code
121
+ ```
122
+
123
+ ## Category ID Prefixes
124
+
125
+ When parsing rules, IDs are auto-generated from category:
126
+
127
+ | Category | Prefix | Example |
128
+ |----------|--------|---------|
129
+ | Security | SEC | SEC-001 |
130
+ | Architecture | ARCH | ARCH-001 |
131
+ | Code Quality | QUAL | QUAL-001 |
132
+ | Testing | TEST | TEST-001 |
133
+ | Custom | CUST | CUST-001 |
134
+ | [Custom Name] | First 4 letters uppercase | PERF-001 |
135
+
136
+ ## Common Rule Patterns
137
+
138
+ ### Security
139
+
140
+ ```yaml
141
+ # SQL Injection Detection
142
+ level: L1
143
+ pattern: "\\.(query|execute|raw)\\s*\\([^)]*\\$\\{|\\+\\s*['\"]"
144
+ scope: "**/*.{ts,js}"
145
+ message: Potential SQL injection. Use parameterized queries.
146
+
147
+ # No Sensitive Data in Logs
148
+ level: L2
149
+ pattern: "console\\.(log|info|warn|error)\\([^)]*password|secret|token|key"
150
+ scope: "src/**/*.{ts,js}"
151
+ message: Sensitive data may be logged. Remove or redact.
152
+ ```
153
+
154
+ ### Architecture
155
+
156
+ ```yaml
157
+ # No Cross-Package Relative Imports
158
+ level: L2
159
+ check: Imports between packages must use package name, not relative path
160
+ scope: "packages/*/src/**"
161
+ message: Cross-package import must use package name, not relative path.
162
+
163
+ # Service Layer Boundaries
164
+ level: L1
165
+ check: HTTP calls (fetch, axios, got) only in files under services/ or api/
166
+ scope: "src/components/**"
167
+ message: API calls must go through service layer.
168
+ ```
169
+
170
+ ### Code Quality
171
+
172
+ ```yaml
173
+ # No TODO in Main Branch
174
+ level: L3
175
+ pattern: "TODO|FIXME|XXX|HACK"
176
+ scope: "src/**/*.{ts,js}"
177
+ message: Unresolved TODO marker. Complete or track in issue.
178
+
179
+ # Consistent Naming
180
+ level: L2
181
+ check: React component files must use PascalCase naming
182
+ scope: "src/components/**/*.tsx"
183
+ message: Component file should use PascalCase naming.
184
+ ```
185
+
186
+ ### Testing
187
+
188
+ ```yaml
189
+ # No console.log in Tests (should use test assertions)
190
+ level: L2
191
+ pattern: "console\\.log"
192
+ scope: "**/*.test.ts, **/*.spec.ts"
193
+ message: Use assertions instead of console.log in tests.
194
+
195
+ # No .only in Committed Tests
196
+ level: L1
197
+ pattern: "\\.(only|skip)\\s*\\("
198
+ scope: "**/*.test.*, **/*.spec.*"
199
+ message: Remove .only/.skip before committing tests.
200
+ ```
201
+
202
+ ### React Specific
203
+
204
+ ```yaml
205
+ # No Direct State Mutation
206
+ level: L1
207
+ pattern: "this\\.state\\s*\\."
208
+ scope: "src/**/*.{tsx,jsx}"
209
+ exclude: "**/*.test.*"
210
+ message: Use setState instead of direct state mutation.
211
+
212
+ # Key Prop in Lists
213
+ level: L2
214
+ check: Array.map rendering JSX must include key prop
215
+ scope: "src/**/*.{tsx,jsx}"
216
+ message: Missing key prop in list rendering.
217
+ ```
218
+
219
+ ### Node.js Specific
220
+
221
+ ```yaml
222
+ # No Sync Methods
223
+ level: L2
224
+ pattern: "\\.(readFileSync|writeFileSync|existsSync|mkdirSync)"
225
+ scope: "src/**/*.ts"
226
+ exclude: "scripts/**, cli/**"
227
+ message: Use async file operations in application code.
228
+
229
+ # Require Error Handling for Promises
230
+ level: L2
231
+ check: Async functions should have try-catch or .catch for error handling
232
+ scope: "src/**/*.ts"
233
+ message: Unhandled promise rejection possible. Add error handling.
234
+ ```
235
+
236
+ ## Inheritance and Overrides
237
+
238
+ ### Monorepo Pattern
239
+
240
+ In monorepos, place CONSTITUTION.md at root. Rules apply to all packages via scope:
241
+
242
+ ```markdown
243
+ ## Architecture
244
+
245
+ ### Package Boundaries
246
+
247
+ ```yaml
248
+ level: L2
249
+ check: Imports between packages must use package name
250
+ scope: "packages/*/src/**"
251
+ message: Cross-package import violation.
252
+ ```
253
+
254
+ ### Web-Specific Rules
255
+
256
+ ```yaml
257
+ level: L1
258
+ pattern: "document\\."
259
+ scope: "packages/server/src/**"
260
+ message: DOM access forbidden in server package.
261
+ ```
262
+ ```
263
+
264
+ ### Per-Package Exceptions
265
+
266
+ Use `exclude` to exempt specific packages:
267
+
268
+ ```yaml
269
+ level: L2
270
+ pattern: "console\\.log"
271
+ scope: "packages/*/src/**"
272
+ exclude: "packages/cli/src/**"
273
+ message: No console.log except in CLI package.
274
+ ```
275
+
276
+ ## Validation Modes
277
+
278
+ ### Full Validation
279
+
280
+ Check all rules against entire codebase:
281
+
282
+ ```
283
+ /validate constitution
284
+ ```
285
+
286
+ ### Targeted Validation
287
+
288
+ Check against specific files or directories:
289
+
290
+ ```
291
+ /validate constitution src/services/
292
+ ```
293
+
294
+ ### Implementation Validation
295
+
296
+ Called automatically during `/implement` phases.
297
+
298
+ ## Performance Considerations
299
+
300
+ 1. **Pattern rules are faster** than Check rules (no LLM needed)
301
+ 2. **Narrow scopes** reduce file scanning
302
+ 3. **Specific excludes** prevent unnecessary checks
303
+ 4. **Batch similar rules** under same scope for efficiency
304
+
305
+ ## Troubleshooting
306
+
307
+ ### Rule Not Matching
308
+
309
+ 1. Check regex escaping in YAML (double backslashes)
310
+ 2. Verify scope matches target files: `ls [scope-pattern]`
311
+ 3. Check if exclude is too broad
312
+ 4. For Check rules: verify description is specific enough
313
+
314
+ ### Too Many False Positives
315
+
316
+ 1. Add specific excludes for legitimate uses
317
+ 2. Narrow scope to problem areas
318
+ 3. Consider L3 (advisory) instead of L1/L2
319
+ 4. Refine pattern or check description
320
+
321
+ ### Invalid Regex Error
322
+
323
+ Common issues:
324
+ - Missing escape for special chars: `(`, `)`, `.`, `*`
325
+ - Unbalanced groups
326
+ - Invalid quantifiers
327
+
328
+ Test regex at regex101.com before adding to constitution.
@@ -0,0 +1,115 @@
1
+ # Project Constitution
2
+
3
+ > Version: 1.0.0 | Last Updated: [DATE]
4
+ > Project Type: [NEEDS DISCOVERY: Explore codebase to determine - single-app | monorepo | library | cli]
5
+
6
+ ## Security
7
+
8
+ [NEEDS DISCOVERY: Analyze codebase for security patterns]
9
+
10
+ Explore:
11
+ - Authentication mechanisms (JWT, sessions, OAuth)
12
+ - Secret handling (env vars, config files)
13
+ - Input validation patterns
14
+ - API security (CORS, rate limiting)
15
+
16
+ Generate rules for security patterns actually used in this project.
17
+
18
+ ### No Hardcoded Secrets
19
+
20
+ ```yaml
21
+ level: L1
22
+ pattern: "(api_key|apikey|secret|password|token|credential)\\s*[:=]\\s*['\"][^'\"]{8,}['\"]"
23
+ scope: "**/*.{ts,js,json,yaml,yml}"
24
+ exclude: "**/*.test.*, **/*.spec.*, **/*.example.*, .env.example"
25
+ message: Hardcoded secret detected. Use environment variables.
26
+ ```
27
+
28
+ Secrets must never be committed to source control. Use environment variables or secret management.
29
+
30
+ ### No Eval Usage
31
+
32
+ ```yaml
33
+ level: L1
34
+ pattern: "\\beval\\s*\\("
35
+ scope: "src/**/*.{ts,js}"
36
+ message: eval() is prohibited for security reasons.
37
+ ```
38
+
39
+ eval() enables code injection attacks. Use safer alternatives like JSON.parse().
40
+
41
+ ## Architecture
42
+
43
+ [NEEDS DISCOVERY: Analyze codebase for architectural patterns]
44
+
45
+ Explore:
46
+ - Layer structure (presentation, business, data)
47
+ - Module boundaries (packages, apps, libs)
48
+ - Dependency patterns (injection, imports)
49
+ - API patterns (REST, GraphQL, RPC)
50
+
51
+ Generate rules that enforce the architecture patterns discovered.
52
+
53
+ ## Code Quality
54
+
55
+ [NEEDS DISCOVERY: Analyze codebase for quality conventions]
56
+
57
+ Explore:
58
+ - Naming conventions (files, variables, functions)
59
+ - Import patterns (relative, absolute, aliases)
60
+ - Error handling patterns
61
+ - Logging conventions
62
+
63
+ Generate rules that enforce conventions already established.
64
+
65
+ ### No Console Statements in Production
66
+
67
+ ```yaml
68
+ level: L2
69
+ pattern: "console\\.(log|debug|info)"
70
+ scope: "src/**/*.{ts,js}"
71
+ exclude: "**/*.test.*, **/*.spec.*, src/utils/logger.ts"
72
+ message: Remove console statements. Use logger utility.
73
+ ```
74
+
75
+ Console statements should be replaced with the structured logger for production observability.
76
+
77
+ ## Testing
78
+
79
+ [NEEDS DISCOVERY: Analyze test setup and conventions]
80
+
81
+ Explore:
82
+ - Test framework(s) used
83
+ - Test file naming and location
84
+ - Coverage expectations
85
+ - Testing patterns (unit, integration, e2e)
86
+
87
+ Generate rules that align with existing test infrastructure.
88
+
89
+ ### Test File Recommended
90
+
91
+ ```yaml
92
+ level: L3
93
+ check: Every file in src/ should have corresponding .test.ts or .spec.ts
94
+ scope: "src/**/*.ts"
95
+ exclude: "src/**/*.d.ts, src/**/index.ts, src/**/*.test.ts"
96
+ message: Missing test file for this module.
97
+ ```
98
+
99
+ Test coverage is encouraged but not enforced at the constitution level.
100
+
101
+ ## [Project-Specific Category]
102
+
103
+ [NEEDS DISCOVERY: Based on codebase analysis, determine if additional categories are needed]
104
+
105
+ Consider:
106
+ - Domain-specific rules
107
+ - Framework-specific patterns (React hooks, FastAPI dependencies)
108
+ - Build/deployment conventions
109
+ - Documentation requirements
110
+
111
+ ## Custom Rules
112
+
113
+ This section is for user additions that don't fit standard categories.
114
+
115
+ <!-- Users can add custom rules here -->