@ryuenn3123/agentic-senior-core 3.0.49 → 4.0.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 (84) hide show
  1. package/.agent-context/prompts/bootstrap-design.md +2 -1
  2. package/.agent-context/review-checklists/pr-checklist.md +1 -0
  3. package/.agent-context/rules/api-docs.md +63 -45
  4. package/.agent-context/rules/architecture.md +133 -118
  5. package/.agent-context/rules/database-design.md +36 -16
  6. package/.agent-context/rules/docker-runtime.md +66 -43
  7. package/.agent-context/rules/efficiency-vs-hype.md +38 -17
  8. package/.agent-context/rules/error-handling.md +35 -14
  9. package/.agent-context/rules/event-driven.md +35 -18
  10. package/.agent-context/rules/frontend-architecture.md +103 -74
  11. package/.agent-context/rules/git-workflow.md +81 -197
  12. package/.agent-context/rules/microservices.md +42 -41
  13. package/.agent-context/rules/naming-conv.md +27 -6
  14. package/.agent-context/rules/performance.md +32 -10
  15. package/.agent-context/rules/realtime.md +26 -9
  16. package/.agent-context/rules/security.md +39 -19
  17. package/.agent-context/rules/testing.md +36 -15
  18. package/AGENTS.md +9 -9
  19. package/README.md +10 -1
  20. package/lib/cli/commands/init.mjs +1 -0
  21. package/lib/cli/compiler.mjs +1 -0
  22. package/lib/cli/detector/constants.mjs +135 -0
  23. package/lib/cli/detector/design-evidence/collector.mjs +256 -0
  24. package/lib/cli/detector/design-evidence/constants.mjs +39 -0
  25. package/lib/cli/detector/design-evidence/file-traversal.mjs +83 -0
  26. package/lib/cli/detector/design-evidence/structured-attribute-evidence.mjs +117 -0
  27. package/lib/cli/detector/design-evidence/summary.mjs +109 -0
  28. package/lib/cli/detector/design-evidence/utility-helpers.mjs +122 -0
  29. package/lib/cli/detector/design-evidence.mjs +25 -610
  30. package/lib/cli/detector/stack-detection.mjs +243 -0
  31. package/lib/cli/detector/ui-signals.mjs +150 -0
  32. package/lib/cli/detector/workspace-scan.mjs +177 -0
  33. package/lib/cli/detector.mjs +20 -688
  34. package/lib/cli/memory-continuity.mjs +1 -0
  35. package/lib/cli/project-scaffolder/design-contract/sections/audits.mjs +96 -0
  36. package/lib/cli/project-scaffolder/design-contract/sections/conceptual-anchor.mjs +116 -0
  37. package/lib/cli/project-scaffolder/design-contract/sections/execution-handoff.mjs +211 -0
  38. package/lib/cli/project-scaffolder/design-contract/seed-signals.mjs +79 -0
  39. package/lib/cli/project-scaffolder/design-contract/signal-vocab.mjs +64 -0
  40. package/lib/cli/project-scaffolder/design-contract/validation/anchor-validators.mjs +222 -0
  41. package/lib/cli/project-scaffolder/design-contract/validation/audit-validators.mjs +117 -0
  42. package/lib/cli/project-scaffolder/design-contract/validation/completeness.mjs +83 -0
  43. package/lib/cli/project-scaffolder/design-contract/validation/execution-validators.mjs +328 -0
  44. package/lib/cli/project-scaffolder/design-contract/validation/helpers.mjs +8 -0
  45. package/lib/cli/project-scaffolder/design-contract/validation/structural-validators.mjs +79 -0
  46. package/lib/cli/project-scaffolder/design-contract/validation/system-validators.mjs +256 -0
  47. package/lib/cli/project-scaffolder/design-contract/validation.mjs +59 -896
  48. package/lib/cli/project-scaffolder/design-contract.mjs +147 -557
  49. package/mcp.json +30 -9
  50. package/package.json +17 -2
  51. package/scripts/audit-cache-layer-contract.mjs +258 -0
  52. package/scripts/audit-caching-scope-hygiene.mjs +263 -0
  53. package/scripts/audit-file-size.mjs +219 -0
  54. package/scripts/audit-reflection-citations.mjs +163 -0
  55. package/scripts/audit-release-bundle.mjs +170 -0
  56. package/scripts/audit-rule-id-uniqueness.mjs +313 -0
  57. package/scripts/benchmark-evidence-bundle.mjs +1 -0
  58. package/scripts/build-release-benchmark-bundle.mjs +204 -0
  59. package/scripts/context-triggered-audit.mjs +1 -0
  60. package/scripts/documentation-boundary-audit.mjs +1 -0
  61. package/scripts/explain-on-demand-audit.mjs +2 -1
  62. package/scripts/frontend-usability-audit.mjs +10 -10
  63. package/scripts/llm-judge/checklist-loader.mjs +45 -0
  64. package/scripts/llm-judge/constants.mjs +66 -0
  65. package/scripts/llm-judge/diff-collection.mjs +74 -0
  66. package/scripts/llm-judge/prompting.mjs +78 -0
  67. package/scripts/llm-judge/providers.mjs +111 -0
  68. package/scripts/llm-judge/verdict.mjs +134 -0
  69. package/scripts/llm-judge.mjs +21 -482
  70. package/scripts/mcp-server/tool-registry.mjs +55 -0
  71. package/scripts/mcp-server/tools.mjs +137 -1
  72. package/scripts/migrate-rule-format/id-prefix-table.mjs +37 -0
  73. package/scripts/migrate-rule-format/parse-legacy.mjs +180 -0
  74. package/scripts/migrate-rule-format/render-new.mjs +169 -0
  75. package/scripts/migrate-rule-format/roundtrip-validate.mjs +89 -0
  76. package/scripts/migrate-rule-format.mjs +192 -0
  77. package/scripts/release-gate/constants.mjs +1 -1
  78. package/scripts/release-gate/static-checks.mjs +1 -1
  79. package/scripts/rules-guardian-audit.mjs +5 -2
  80. package/scripts/single-source-lazy-loading-audit.mjs +2 -1
  81. package/scripts/ui-design-judge/git-input.mjs +3 -0
  82. package/scripts/validate/config.mjs +3 -2
  83. package/scripts/validate/coverage-checks.mjs +1 -1
  84. package/scripts/validate.mjs +93 -1
@@ -1,200 +1,84 @@
1
- # Git Workflow — Clean History, Atomic Commits
2
-
3
- > Your git log is a changelog. If it reads like gibberish, your team is lost.
4
-
5
- ## Commit Message Format: Conventional Commits (Enforced)
6
-
7
- ```
8
- <type>(<scope>): <description>
9
-
10
- [optional body — explain WHY, not WHAT]
11
- [optional footer — Breaking changes, issue references]
12
- ```
13
-
14
- ### Types (Strict Set)
15
- | Type | When | Example |
16
- |------|------|---------|
17
- | `feat` | New feature | `feat(auth): add JWT refresh token rotation` |
18
- | `fix` | Bug fix | `fix(payment): handle race condition in checkout` |
19
- | `refactor` | Code restructuring (no behavior change) | `refactor(user): extract validation to separate service` |
20
- | `docs` | Documentation only | `docs(api): add OpenAPI schema for /orders endpoint` |
21
- | `test` | Adding/fixing tests | `test(cart): add edge case for empty cart discount` |
22
- | `chore` | Build, CI, config, dependencies | `chore(deps): upgrade prisma to 5.x` |
23
- | `perf` | Performance improvement | `perf(search): add index on users.email column` |
24
- | `style` | Formatting, semicolons (no logic change) | `style: apply prettier formatting` |
25
- | `ci` | CI/CD changes | `ci: add Node 20 to test matrix` |
26
-
27
- ### Rules
28
- 1. **Type is mandatory.** No commits without a type prefix.
29
- 2. **Scope is required for module or feature changes.** Use the module/feature name.
30
- 3. **Description is imperative mood.** "add", not "added" or "adds".
31
- 4. **Max 72 characters** for the subject line.
32
- 5. **Body explains WHY,** not what. The diff shows what.
33
-
34
- ### ❌ BANNED Commit Messages
35
- ```
36
- fix bug
37
- updates
38
- WIP
39
- asdf
40
- misc changes
41
- working now
42
- final fix
43
- fix fix fix
44
- ```
45
-
46
1
  ---
47
-
48
- ## Branching Model
49
-
50
- ### Main Branches
51
- | Branch | Purpose | Merge Strategy |
52
- |--------|---------|---------------|
53
- | `main` | Production-ready code | Merge commit or squash |
54
- | `develop` | Integration branch (if using GitFlow) | Merge commit |
55
-
56
- ### Feature Branches
57
- ```
58
- Pattern: <type>/<ticket-id>-<short-description>
59
-
60
- Examples:
61
- feat/AUTH-123-jwt-refresh
62
- fix/PAY-456-checkout-race-condition
63
- refactor/USER-789-extract-validation
64
- chore/INFRA-101-upgrade-node-20
65
- ```
66
-
67
- ### Rules
68
- 1. Branch from `main` (or `develop` if using GitFlow)
69
- 2. Keep branches short-lived (max 2-3 days)
70
- 3. Rebase on `main` before creating PR — don't merge main into your branch
71
- 4. Delete branch after merge
72
-
2
+ id_prefix: GIT
3
+ domain: git-workflow
4
+ priority: medium
5
+ scope: governance
6
+ applies_to:
7
+ - backend
8
+ - frontend
9
+ - fullstack
10
+ keywords:
11
+ - git-workflow
12
+ - git
13
+ - commit
14
+ - branch
15
+ - pull-request
16
+ - gitignore
73
17
  ---
74
18
 
75
- ## Pull Request Standards
76
-
77
- ### PR Size
78
- | Size | Lines Changed | Verdict |
79
- |------|--------------|---------|
80
- | Small | 1-100 | ✅ Ideal — easy to review |
81
- | Medium | 100-300 | ⚠️ Acceptable split if possible |
82
- | Large | 300-500 | 🔶 Needs justification |
83
- | Massive | 500+ | MUST be split into smaller PRs |
84
-
85
- **Rule:** If a PR touches more than 5 files across different modules, it's doing too much. Split it.
86
-
87
- ### PR Description Template
88
- ```markdown
89
- ## What
90
- Brief description of what this PR does.
91
-
92
- ## Why
93
- Why this change is needed. Link to issue/ticket.
94
-
95
- ## How
96
- High-level approach. Mention any non-obvious design decisions.
97
-
98
- ## Testing
99
- - [ ] Unit tests added/updated
100
- - [ ] Integration tests (if applicable)
101
- - [ ] Manual testing steps
102
-
103
- ## Screenshots (if UI change)
104
- Before | After
105
- ```
106
-
107
- ### PR Review Rules
108
- 1. Every PR needs at least 1 approval
109
- 2. Author resolves all comments before merge
110
- 3. CI must pass (lint, test, build)
111
- 4. No `// TODO` without a linked issue
112
- 5. No `console.log` debugging statements in production code
113
-
114
- ---
115
-
116
- ## Commit Atomicity
117
-
118
- ### Rule: Each Commit Must Be a Complete, Working Unit
119
-
120
- ```
121
- BANNED sequence:
122
- 1. feat(user): add user model ← compiles? maybe
123
- 2. fix: fix import ← fixing previous commit
124
- 3. feat(user): add user service ← compiles? probably
125
- 4. fix: fix typo ← fixing previous commit
126
- 5. feat(user): add user controller ← finally works together
127
-
128
- REQUIRED:
129
- 1. feat(user): add user registration module
130
- Model, Service, Controller, Tests all in one complete, working commit
131
- Or split into logical chunks that each compile and pass tests independently
132
- ```
133
-
134
- **Rule:** Every commit on `main` should compile, pass lint, and pass tests. Use interactive rebase (`git rebase -i`) to squash fix-up commits before merging.
135
-
136
- ---
137
-
138
- ## .gitignore Standards
139
-
140
- ### MUST Ignore
141
- ```
142
- # Dependencies
143
- node_modules/
144
- vendor/
145
- venv/
146
- __pycache__/
147
- .gradle/
148
- target/
149
-
150
- # Environment
151
- .env
152
- .env.local
153
- .env.*.local
154
-
155
- # IDE
156
- .idea/
157
- .vscode/settings.json
158
- *.swp
159
- *.swo
160
- .DS_Store
161
- Thumbs.db
162
-
163
- # Build output
164
- dist/
165
- build/
166
- out/
167
- *.min.js
168
- *.min.css
169
-
170
- # Logs
171
- *.log
172
- npm-debug.log*
173
-
174
- # OS
175
- .DS_Store
176
- Thumbs.db
177
- ```
178
-
179
- ### MUST Commit
180
- ```
181
- .env.example # Template with placeholder values
182
- .editorconfig # Consistent formatting across IDEs
183
- .prettierrc # Formatter config
184
- .eslintrc.* # Linter config
185
- tsconfig.json # TypeScript config
186
- docker-compose.yml # Dev environment
187
- Makefile / Taskfile # Standard commands
188
- ```
189
-
190
- ---
191
-
192
- ## The Git Health Check
193
-
194
- Before pushing:
195
- - [ ] All commits follow Conventional Commits format
196
- - [ ] No fixup commits (squash them)
197
- - [ ] Branch is rebased on latest main
198
- - [ ] CI passes locally (lint, test, build)
199
- - [ ] No secrets in any commit (check with `git log -p | grep -i "password\|secret\|key"`)
200
- - [ ] No merge commits in feature branch (rebase instead)
19
+ # Git Workflow - Clean History, Atomic Commits
20
+
21
+ Your git log is a changelog. If it reads like gibberish, your team is lost.
22
+
23
+ ## GIT-001: Commit Message Format (Conventional Commits Enforced)
24
+
25
+ 1. Use Conventional Commits for every commit: `<type>(<scope>): <description>`.
26
+ 2. Use the optional body to explain WHY, not WHAT.
27
+ 3. Use the optional footer for breaking changes and issue references.
28
+ 4. Use only the strict types set: `feat` for new feature, `fix` for bug fix, `refactor` for code restructuring with no behavior change, `docs` for documentation only, `test` for adding or fixing tests, `chore` for build, CI, config, or dependencies, `perf` for performance improvement, `style` for formatting and semicolons with no logic change, and `ci` for CI/CD changes.
29
+ 5. Type is mandatory. No commits without a type prefix.
30
+ 6. Scope is required for module or feature changes. Use the module or feature name.
31
+ 7. Description must use imperative mood: "add", not "added" or "adds".
32
+ 8. Keep the subject line at max 72 characters.
33
+ 9. Body explains WHY; the diff shows what.
34
+ 10. Reject banned commit messages: `fix bug`, `updates`, `WIP`, `asdf`, `misc changes`, `working now`, `final fix`, and `fix fix fix`.
35
+
36
+ ## GIT-002: Branching Model and Merge Strategy
37
+
38
+ 1. Keep `main` production-ready; its purpose is production-ready code, and its merge strategy is merge commit or squash according to project policy.
39
+ 2. Use `develop` as an integration branch only when the project uses GitFlow; its purpose is integration.
40
+ 3. Name feature branches with the pattern `<type>/<ticket-id>-<short-description>`.
41
+ 4. Example branch names include `feat/AUTH-123-jwt-refresh`, `fix/PAY-456-checkout-race-condition`, `refactor/USER-789-extract-validation`, and `chore/INFRA-101-upgrade-node-20`.
42
+ 5. Branch from `main`, or from `develop` when using GitFlow.
43
+ 6. Keep branches short-lived, max 2-3 days.
44
+ 7. Rebase on `main` before creating a PR; do not merge main into your branch.
45
+ 8. Delete the branch after merge.
46
+
47
+ ## GIT-003: Pull Request Standards
48
+
49
+ 1. Keep PR size reviewable: small is 1-100 lines changed and ideal because it is easy to review; medium is 100-300 and acceptable, split if possible; large is 300-500 and needs justification; massive is 500+ and must be split into smaller PRs. Treat these thresholds as the PR size verdict.
50
+ 2. Split a PR when it touches more than 5 files across different modules; it is doing too much.
51
+ 3. PR descriptions must follow the PR Description Template: What, Why, How, Testing, and Screenshots when the change affects UI.
52
+ 4. What gives a brief description of what the PR does.
53
+ 5. Why explains why the change is needed and links to the issue or ticket.
54
+ 6. How gives the high-level approach and mentions non-obvious design decisions.
55
+ 7. Testing lists unit tests, integration tests when applicable, and manual testing steps.
56
+ 8. Every PR needs at least 1 approval, author resolves all comments before merge, CI must pass lint, test, and build, no `// TODO` appears without a linked issue, and production code contains no `console.log` debugging statements.
57
+
58
+ ## GIT-004: Commit Atomicity
59
+
60
+ 1. Each commit must be a complete, working unit.
61
+ 2. Reject banned sequences where a feature commit is followed by fix imports, fix typos, or other fix-up commits needed to make the previous commit work.
62
+ 3. Prefer one complete working commit for a cohesive module, such as model, service, controller, and tests for user registration.
63
+ 4. Split into logical chunks only when each chunk compiles and passes tests independently.
64
+ 5. Every commit on `main` should compile, pass lint, and pass tests.
65
+ 6. Use interactive rebase (`git rebase -i`) to squash fix-up commits before merging.
66
+
67
+ ## GIT-005: .gitignore Standards
68
+
69
+ 1. Ignore dependency and cache directories: `node_modules/`, `vendor/`, `venv/`, `__pycache__/`, `.gradle/`, and `target/`.
70
+ 2. Ignore environment files: `.env`, `.env.local`, and `.env.*.local`.
71
+ 3. Ignore IDE and OS artifacts: `.idea/`, `.vscode/settings.json`, `*.swp`, `*.swo`, `.DS_Store`, and `Thumbs.db`.
72
+ 4. Ignore build output: `dist/`, `build/`, `out/`, `*.min.js`, and `*.min.css`.
73
+ 5. Ignore logs: `*.log` and `npm-debug.log*`.
74
+ 6. Commit configuration templates and formatter or linter config: `.env.example`, `.editorconfig`, `.prettierrc`, `.eslintrc.*`, and `tsconfig.json`.
75
+ 7. Commit standard development commands and environments when they are part of the project contract: `docker-compose.yml`, `Makefile`, or `Taskfile`.
76
+
77
+ ## GIT-006: Git Health Check
78
+
79
+ 1. Before pushing, verify all commits follow Conventional Commits format.
80
+ 2. Before pushing, verify there are no fixup commits; squash them.
81
+ 3. Before pushing, verify the branch is rebased on latest main.
82
+ 4. Before pushing, verify CI passes locally: lint, test, and build.
83
+ 5. Before pushing, verify there are no secrets in any commit; check with `git log -p | grep -i "password\|secret\|key"`.
84
+ 6. Before pushing, verify there are no merge commits in the feature branch; rebase instead.
@@ -1,43 +1,44 @@
1
- # Service Boundary Rule
2
-
3
- Do not ask for or force "monolith vs microservices" as an init default. Do not start with microservices by fashion, fear, or habit. The agent must infer the right topology from the user brief, repo evidence, team/runtime constraints, and live official docs when technology choices matter.
4
-
5
- ## Monolith Boundary
6
-
7
- Use a single deployable system when:
8
-
9
- - one team or one delivery stream owns most changes
10
- - feature boundaries can stay clear inside one repo/process
11
- - synchronous data consistency is more valuable than distributed autonomy
12
- - observability, CI/CD, and operational maturity are still forming
13
-
14
- Hard rules:
15
-
16
- - Keep feature/domain boundaries explicit.
17
- - Do not let one giant shared module become the real architecture.
18
- - Keep contracts clear between modules.
19
- - Refactor toward cleaner seams before extracting services.
1
+ ---
2
+ id_prefix: SVC
3
+ domain: microservices
4
+ priority: medium
5
+ scope: backend
6
+ applies_to:
7
+ - backend
8
+ - fullstack
9
+ keywords:
10
+ - microservices
11
+ - svc
12
+ - monolith
13
+ - contracts
14
+ ---
20
15
 
21
- ## Service Split Boundary
22
-
23
- Split a service only when current evidence justifies the operational cost.
24
-
25
- Valid split signals:
26
-
27
- - independent deploy cadence is already painful
28
- - one domain has materially different scale, latency, security, or compliance needs
29
- - ownership boundaries are stable and repeated coupling is causing delivery risk
30
- - failure isolation is a real product or business requirement
31
- - the service contract and data ownership can be documented before extraction
32
-
33
- Hard rules:
34
-
35
- - Each service owns its data boundary.
36
- - Public service contracts must be documented before implementation or extraction.
37
- - Cross-service calls need timeout, retry, idempotency, observability, and recovery behavior.
38
- - Independent services must not use shared tables as their integration contract; communicate through documented APIs, events, or async workflows owned by the source domain.
39
- - Avoid synchronous call chains that turn services into a distributed monolith.
40
- - Critical cross-service mutations should prefer local transactions plus outbox, saga, choreography, orchestration, or compensating actions over two-phase commit by default.
41
- - Prefer incremental extraction over rewrites.
16
+ # Service Boundary Rule
42
17
 
43
- If the evidence is unclear, document the uncertainty and keep the topology agent-recommended instead of pretending an offline default is correct.
18
+ The agent must infer the right topology from the user brief, repo evidence, team/runtime constraints, and live official docs when technology choices matter.
19
+
20
+ ## SVC-001: Monolith Boundary
21
+
22
+ 1. Do not ask for or force "monolith vs microservices" as an init default.
23
+ 2. Do not start with microservices by fashion, fear, or habit.
24
+ 3. Use a single deployable system when one team or one delivery stream owns most changes.
25
+ 4. Use a single deployable system when feature boundaries can stay clear inside one repo/process.
26
+ 5. Use a single deployable system when synchronous data consistency is more valuable than distributed autonomy.
27
+ 6. Use a single deployable system when observability, CI/CD, and operational maturity are still forming.
28
+ 7. Keep feature/domain boundaries explicit.
29
+ 8. Do not let one giant shared module become the real architecture.
30
+ 9. Keep contracts clear between modules.
31
+ 10. Refactor toward cleaner seams before extracting services.
32
+
33
+ ## SVC-002: Service Split Boundary and Hard Rules
34
+
35
+ 1. Split a service only when current evidence justifies the operational cost.
36
+ 2. Valid split signals include independent deploy cadence that is already painful; materially different scale, latency, security, or compliance needs in one domain; stable ownership boundaries plus repeated coupling causing delivery risk; failure isolation as a real product or business requirement; and service contract plus data ownership documentation before extraction.
37
+ 3. Hard rules: each service owns its data boundary.
38
+ 4. Public service contracts must be documented before implementation or extraction.
39
+ 5. Cross-service calls need timeout, retry, idempotency, observability, and recovery behavior.
40
+ 6. Independent services must not use shared tables as their integration contract; communicate through documented APIs, events, or async workflows owned by the source domain.
41
+ 7. Avoid synchronous call chains that turn services into a distributed monolith.
42
+ 8. Critical cross-service mutations should prefer local transactions plus outbox, saga, choreography, orchestration, or compensating actions over two-phase commit by default.
43
+ 9. Prefer incremental extraction over rewrites.
44
+ 10. If the evidence is unclear, document the uncertainty and keep the topology agent-recommended instead of pretending an offline default is correct.
@@ -1,11 +1,32 @@
1
+ ---
2
+ id_prefix: NAME
3
+ domain: naming-conv
4
+ priority: medium
5
+ scope: all-tasks
6
+ applies_to:
7
+ - backend
8
+ - frontend
9
+ - fullstack
10
+ keywords:
11
+ - naming-conv
12
+ - name
13
+ - naming
14
+ - comments
15
+ - intent
16
+ - conventions
17
+ ---
18
+
1
19
  # Naming Boundary
2
20
 
3
21
  Use the target language and framework conventions. Do not invent a naming style from this repo.
4
22
 
5
- Reject only these common LLM bad habits:
6
- - vague names that hide meaning, such as `data`, `result`, `item`, `thing`, `temp`, `handle`, or `process` when a precise domain name exists
7
- - names that require reading the implementation to understand the value
8
- - mixed file or directory naming styles inside the same feature without a framework reason
9
- - booleans, units, and side-effect functions whose names hide what they represent or change
23
+ ## NAME-001: Naming and Comment Rules
10
24
 
11
- Prefer names that explain domain intent, user action, state, and boundary responsibility.
25
+ 1. Prefer names that explain domain intent, user action, state, and boundary responsibility.
26
+ 2. Reject these common LLM bad habits: vague names that hide meaning, such as `data`, `result`, `item`, `thing`, `temp`, `handle`, or `process` when a precise domain name exists.
27
+ 3. Reject names that require reading the implementation to understand the value.
28
+ 4. Keep file and directory naming styles consistent inside the same feature unless a framework reason requires mixed styles.
29
+ 5. Reject booleans, units, and side-effect functions whose names hide what they represent or change.
30
+ 6. Inline comments must explain why, not what.
31
+ 7. Put a one-line rationale near non-obvious choices that deserve explanation, such as retry strategy, index column order, denormalized field, intentional swallow with named recovery, or magic constant tied to an external system.
32
+ 8. Treat comments that paraphrase the code as noise.
@@ -1,14 +1,36 @@
1
- # Performance Boundary
1
+ ---
2
+ id_prefix: PERF
3
+ domain: performance
4
+ priority: medium
5
+ scope: all-tasks
6
+ applies_to:
7
+ - backend
8
+ - frontend
9
+ - fullstack
10
+ keywords:
11
+ - performance
12
+ - perf
13
+ - caching
14
+ - bottleneck
15
+ - runtime
16
+ - payload
17
+ ---
2
18
 
3
- Do not over-optimize by habit. Do reject obvious scale and runtime failures.
19
+ # Performance Boundary
4
20
 
5
- Performance is a decision input, not a blanket veto against modern libraries, motion, richer UI, or maintained tooling. Compare the real cost of the dependency or implementation against the cost of custom code, lost accessibility, weaker UX, duplicated maintenance, and slower delivery.
21
+ Performance is a decision input, not a blanket veto against modern libraries, motion, richer UI, or maintained tooling.
6
22
 
7
- Hard rejections:
8
- - repeated network, database, filesystem, or model calls inside loops without batching, limits, or caching rationale
9
- - unbounded reads, renders, exports, or searches when the data can grow
10
- - shipping large client/runtime payloads without a reason, split point, or loading strategy
11
- - synchronous blocking work in request, UI, worker, or async paths where it can stall the product
12
- - caches without invalidation, expiry, ownership, and staleness trade-offs
23
+ ## PERF-001: Hard Performance Rejections and Caching
13
24
 
14
- When performance matters, measure the real bottleneck, change the smallest useful thing, and verify the result. Do not downshift product quality, UI ambition, or library fit from performance fear alone; name the concrete budget, bottleneck, device limit, or runtime evidence.
25
+ 1. Do not over-optimize by habit.
26
+ 2. Reject obvious scale and runtime failures.
27
+ 3. Compare the real cost of the dependency or implementation against the cost of custom code, lost accessibility, weaker UX, duplicated maintenance, and slower delivery.
28
+ 4. Reject repeated network, database, filesystem, or model calls inside loops without batching, limits, or caching rationale.
29
+ 5. Reject unbounded reads, renders, exports, or searches when the data can grow.
30
+ 6. Reject shipping large client/runtime payloads without a reason, split point, or loading strategy.
31
+ 7. Reject synchronous blocking work in request, UI, worker, or async paths where it can stall the product.
32
+ 8. Reject caches without invalidation, expiry, ownership, and staleness trade-offs.
33
+ 9. When performance matters, measure the real bottleneck, change the smallest useful thing, and verify the result.
34
+ 10. Do not downshift product quality, UI ambition, or library fit from performance fear alone; name the concrete budget, bottleneck, device limit, or runtime evidence.
35
+ 11. Treat caching as a tier decision before a technology decision: prefer browser, CDN, or HTTP cache layers when data is shared and public; prefer in-process caches for hot per-instance data; reach for distributed caches such as Redis or Memcached only when shared mutable state across instances is the actual requirement.
36
+ 12. Record cache-aside, write-through, or write-behind shape, invalidation strategy, and stampede prevention such as request coalescing or stale-while-revalidate when the cache fronts an expensive backend.
@@ -1,14 +1,31 @@
1
+ ---
2
+ id_prefix: RT
3
+ domain: realtime
4
+ priority: medium
5
+ scope: backend
6
+ applies_to:
7
+ - backend
8
+ - fullstack
9
+ keywords:
10
+ - realtime
11
+ - rt
12
+ - transport
13
+ - streaming
14
+ - connection
15
+ - delivery
16
+ ---
17
+
1
18
  # Realtime Boundary
2
19
 
3
20
  Use realtime only when the user experience needs live state, collaboration, streaming progress, notifications, or low-latency feedback. Do not add sockets by habit.
4
21
 
5
- Hard rules:
6
- - choose the transport from product needs and current official docs: polling, server-sent events, WebSockets, WebRTC, managed realtime, or queue-backed push
7
- - authenticate every connection or subscription at a trusted boundary
8
- - validate every inbound message and keep message contracts typed
9
- - keep business logic out of transport callbacks
10
- - define reconnect, heartbeat, backpressure, rate-limit, and abuse behavior
11
- - plan horizontal scaling before relying on in-memory connection state
12
- - document ordering, delivery guarantees, offline behavior, and failure recovery
22
+ ## RT-001: Hard Realtime Transport and Delivery Rules
13
23
 
14
- If realtime infrastructure is unresolved, the LLM must recommend the smallest current project-fit option instead of assuming WebSockets.
24
+ 1. Choose the transport from product needs and current official docs: polling, server-sent events, WebSockets, WebRTC, managed realtime, or queue-backed push.
25
+ 2. Authenticate every connection or subscription at a trusted boundary.
26
+ 3. Validate every inbound message and keep message contracts typed.
27
+ 4. Keep business logic out of transport callbacks.
28
+ 5. Define reconnect, heartbeat, backpressure, rate-limit, and abuse behavior.
29
+ 6. Plan horizontal scaling before relying on in-memory connection state.
30
+ 7. Document ordering, delivery guarantees, offline behavior, and failure recovery.
31
+ 8. If realtime infrastructure is unresolved, recommend the smallest current project-fit option instead of assuming WebSockets.
@@ -1,25 +1,45 @@
1
+ ---
2
+ id_prefix: SEC
3
+ domain: security
4
+ priority: critical
5
+ scope: all-tasks
6
+ applies_to:
7
+ - backend
8
+ - frontend
9
+ - fullstack
10
+ keywords:
11
+ - security
12
+ - sec
13
+ - boundary
14
+ - hard
15
+ - rules
16
+ - zero-trust
17
+ ---
18
+
1
19
  # Security Boundary
2
20
 
3
21
  Use the security model and libraries already present in the project. If security tooling is unresolved, the LLM must recommend current, maintained options from official docs and OWASP-aligned guidance before implementation.
4
22
 
5
- Hard rules:
6
- - validate and normalize all data crossing a trust boundary
7
- - never interpolate untrusted input into queries, shell commands, file paths, templates, logs, or HTML
8
- - never commit secrets, tokens, credentials, private keys, or production identifiers
9
- - never invent custom crypto, session, token, or password handling when maintained standards exist
10
- - enforce authorization at the server or trusted boundary, not only in UI state
11
- - return safe client-facing errors and keep sensitive detail in protected logs
12
- - document auth, permission, data exposure, rate-limit, and abuse assumptions before changing sensitive flows
13
- - apply least privilege to service accounts, API tokens, database users, background jobs, and operator/admin actions
14
- - retrieve secrets through environment, runtime secret injection, or the project's secret manager; do not store static secrets in source or plaintext config
15
- - keep `.env` and local secret files covered by `.gitignore`; commit only safe examples such as `.env.example`
16
- - treat transport encryption, secure cookies, and trusted proxy boundaries as deployment assumptions that must be documented when sensitive traffic is involved
23
+ ## SEC-001: Hard rules
24
+
25
+ 1. validate and normalize all data crossing a trust boundary
26
+ 2. never interpolate untrusted input into queries, shell commands, file paths, templates, logs, or HTML
27
+ 3. never commit secrets, tokens, credentials, private keys, or production identifiers
28
+ 4. never invent custom crypto, session, token, or password handling when maintained standards exist
29
+ 5. enforce authorization at the server or trusted boundary, not only in UI state
30
+ 6. return safe client-facing errors and keep sensitive detail in protected logs
31
+ 7. document auth, permission, data exposure, rate-limit, and abuse assumptions before changing sensitive flows
32
+ 8. apply least privilege to service accounts, API tokens, database users, background jobs, and operator/admin actions
33
+ 9. retrieve secrets through environment, runtime secret injection, or the project's secret manager; do not store static secrets in source or plaintext config
34
+ 10. keep `.env` and local secret files covered by `.gitignore`; commit only safe examples such as `.env.example`
35
+ 11. treat transport encryption, secure cookies, and trusted proxy boundaries as deployment assumptions that must be documented when sensitive traffic is involved
36
+ 12. when a public surface exists, record explicit decisions for: CORS allow-list (not `*` for credentialed requests), security headers (CSP, HSTS, `X-Content-Type-Options`, `Referrer-Policy`, `Permissions-Policy`), JWT pitfalls (algorithm pinning, expiration, refresh rotation, storage location), webhook signature verification with timing-safe compare, SSRF defense (egress allow-list or URL validation) when the server fetches user-supplied URLs, and per-resource authorization (not role-only) when records have owners
17
37
 
18
- Zero-trust API input rules:
19
- - Treat body, query, params, headers, cookies, uploaded files, webhook payloads, and background job payloads as untrusted until validated.
20
- - Validate and normalize input at the outer boundary before it reaches service, use-case, repository, or domain logic.
21
- - Services should receive typed, already-validated values and still enforce domain invariants for security-sensitive rules.
22
- - Sanitization must match the sink: SQL, shell, file path, log, HTML, template, and URL contexts need different protections.
23
- - Authorization must be resource-aware when data ownership matters. Prefer row, tenant, account, organization, or resource-level checks over role-only checks for sensitive records.
38
+ ## SEC-002: Zero-trust API input rules
24
39
 
25
- For high-risk changes, check current framework security docs and record the relevant source or assumption in the implementation notes.
40
+ 1. Treat body, query, params, headers, cookies, uploaded files, webhook payloads, and background job payloads as untrusted until validated.
41
+ 2. Validate and normalize input at the outer boundary before it reaches service, use-case, repository, or domain logic.
42
+ 3. Services should receive typed, already-validated values and still enforce domain invariants for security-sensitive rules.
43
+ 4. Sanitization must match the sink: SQL, shell, file path, log, HTML, template, and URL contexts need different protections.
44
+ 5. Authorization must be resource-aware when data ownership matters. Prefer row, tenant, account, organization, or resource-level checks over role-only checks for sensitive records.
45
+ 6. For high-risk changes, check current framework security docs and record the relevant source or assumption in the implementation notes.
@@ -1,21 +1,42 @@
1
+ ---
2
+ id_prefix: TEST
3
+ domain: testing
4
+ priority: high
5
+ scope: all-tasks
6
+ applies_to:
7
+ - backend
8
+ - frontend
9
+ - fullstack
10
+ keywords:
11
+ - testing
12
+ - test
13
+ - behavior
14
+ - contract
15
+ - failure
16
+ - boundaries
17
+ ---
18
+
1
19
  # Testing Boundary
2
20
 
3
- Use the test runner and style already present in the repo. If no test setup exists, the LLM must recommend a current, lightweight, project-fit setup from official docs before adding one.
21
+ Use the test runner and style already present in the repo.
4
22
 
5
- Test what can break:
6
- - business rules, validation, authorization, state transitions, and error paths
7
- - public APIs, UI flows, integration boundaries, and data contracts touched by the change
8
- - regressions around bugs being fixed
9
- - critical accessibility or responsive behavior when UI is in scope
23
+ ## TEST-001: Test Scope
10
24
 
11
- Backend/API test rules:
12
- - API tests must cover request validation, authorization boundaries, success responses, documented error shapes, pagination defaults, and empty states for touched endpoints.
13
- - Sensitive mutations such as payments, orders, status changes, inventory adjustments, and account/security changes must include duplicate-submit or retry tests when idempotency is required.
14
- - Data-access changes must include evidence for query shape, transaction behavior, rollback or recovery paths, and N+1 prevention when relational reads are touched.
15
- - Event or worker changes must test retry, duplicate-message handling, dead-letter or recovery behavior, and outbox relay semantics when those paths exist.
16
- - Distributed consistency changes must test the local transaction, publish/retry behavior, and compensating action or recovery path rather than only the happy path.
17
- - Tests should make the API contract obvious from the fixture names, inputs, and expected response shape.
25
+ 1. If no test setup exists, recommend a current, lightweight, project-fit setup from official docs before adding one.
26
+ 2. Test what can break: business rules, validation, authorization, state transitions, and error paths.
27
+ 3. Test public APIs, UI flows, integration boundaries, and data contracts touched by the change.
28
+ 4. Test regressions around bugs being fixed.
29
+ 5. Test critical accessibility or responsive behavior when UI is in scope.
30
+ 6. Do not test framework internals, third-party library behavior, private implementation trivia, or snapshots that only freeze noise.
31
+ 7. Tests should describe behavior, keep setup readable, and mock only at real boundaries such as network, filesystem, clock, database, or external services.
18
32
 
19
- Do not test framework internals, third-party library behavior, private implementation trivia, or snapshots that only freeze noise.
33
+ ## TEST-002: Backend and API Test Rules
20
34
 
21
- Tests should describe behavior, keep setup readable, and mock only at real boundaries such as network, filesystem, clock, database, or external services.
35
+ 1. API tests must cover request validation, authorization boundaries, success responses, documented error shapes, pagination defaults, and empty states for touched endpoints.
36
+ 2. Sensitive mutations such as payments, orders, status changes, inventory adjustments, and account/security changes must include duplicate-submit or retry tests when idempotency is required.
37
+ 3. Data-access changes must include evidence for query shape, transaction behavior, rollback or recovery paths, and N+1 prevention when relational reads are touched.
38
+ 4. Event or worker changes must test retry, duplicate-message handling, dead-letter or recovery behavior, and outbox relay semantics when those paths exist.
39
+ 5. Distributed consistency changes must test the local transaction, publish/retry behavior, and compensating action or recovery path rather than only the happy path.
40
+ 6. Tests should make the API contract obvious from the fixture names, inputs, and expected response shape.
41
+ 7. Tests must exercise the failure paths the code claims to handle, not only the happy path.
42
+ 8. Prefer property-based or generated-input tests for invariants such as validation, ordering, and idempotency; prefer explicit failure-injection tests for retry and recovery code; prefer contract tests at service boundaries when consumer and producer ownership is split.