nurosys-agents 2.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 (106) hide show
  1. package/.agent/INSTRUCTIONS.md +82 -0
  2. package/.agent/README.md +483 -0
  3. package/.agent/backend/skills/architect/SKILL.md +436 -0
  4. package/.agent/backend/skills/auth-and-permissions/SKILL.md +168 -0
  5. package/.agent/backend/skills/brainstorm/SKILL.md +127 -0
  6. package/.agent/backend/skills/code-reviewer/SKILL.md +324 -0
  7. package/.agent/backend/skills/create-blueprint/SKILL.md +650 -0
  8. package/.agent/backend/skills/debug-issue/SKILL.md +53 -0
  9. package/.agent/backend/skills/explore-codebase/SKILL.md +45 -0
  10. package/.agent/backend/skills/quick-execute/SKILL.md +99 -0
  11. package/.agent/backend/skills/refactor-safely/SKILL.md +46 -0
  12. package/.agent/backend/skills/security-assessment/SKILL.md +174 -0
  13. package/.agent/backend/workflows/module-runner.claude.md +226 -0
  14. package/.agent/backend/workflows/module-runner.codex.md +155 -0
  15. package/.agent/backend/workflows/module-runner.cursor.md +212 -0
  16. package/.agent/frontend/skills/architect/SKILL.md +644 -0
  17. package/.agent/frontend/skills/auth-and-permissions/SKILL.md +43 -0
  18. package/.agent/frontend/skills/create-blueprint/SKILL.md +635 -0
  19. package/.agent/frontend/skills/debug-issue/SKILL.md +28 -0
  20. package/.agent/frontend/skills/explore-codebase/SKILL.md +29 -0
  21. package/.agent/frontend/skills/feature-workflow/SKILL.md +61 -0
  22. package/.agent/frontend/skills/react-quality-review/SKILL.md +126 -0
  23. package/.agent/frontend/skills/react-quality-review/examples.md +24 -0
  24. package/.agent/frontend/skills/react-quality-review/rules/_sections.md +26 -0
  25. package/.agent/frontend/skills/react-quality-review/rules/_template.md +28 -0
  26. package/.agent/frontend/skills/react-quality-review/rules/advanced-event-handler-refs.md +55 -0
  27. package/.agent/frontend/skills/react-quality-review/rules/advanced-init-once.md +42 -0
  28. package/.agent/frontend/skills/react-quality-review/rules/react-rules-calling.md +66 -0
  29. package/.agent/frontend/skills/react-quality-review/rules/react-rules-hooks.md +91 -0
  30. package/.agent/frontend/skills/react-quality-review/rules/react-rules-purity.md +121 -0
  31. package/.agent/frontend/skills/react-quality-review/rules/rendering-activity.md +26 -0
  32. package/.agent/frontend/skills/react-quality-review/rules/rendering-conditional-render.md +40 -0
  33. package/.agent/frontend/skills/react-quality-review/rules/rendering-content-visibility.md +38 -0
  34. package/.agent/frontend/skills/react-quality-review/rules/rendering-hoist-jsx.md +46 -0
  35. package/.agent/frontend/skills/react-quality-review/rules/rendering-usetransition-loading.md +75 -0
  36. package/.agent/frontend/skills/react-quality-review/rules/rerender-defer-reads.md +39 -0
  37. package/.agent/frontend/skills/react-quality-review/rules/rerender-dependencies.md +45 -0
  38. package/.agent/frontend/skills/react-quality-review/rules/rerender-derived-state-no-effect.md +40 -0
  39. package/.agent/frontend/skills/react-quality-review/rules/rerender-derived-state.md +29 -0
  40. package/.agent/frontend/skills/react-quality-review/rules/rerender-functional-setstate.md +74 -0
  41. package/.agent/frontend/skills/react-quality-review/rules/rerender-lazy-state-init.md +58 -0
  42. package/.agent/frontend/skills/react-quality-review/rules/rerender-memo-with-default-value.md +38 -0
  43. package/.agent/frontend/skills/react-quality-review/rules/rerender-memo.md +44 -0
  44. package/.agent/frontend/skills/react-quality-review/rules/rerender-move-effect-to-event.md +45 -0
  45. package/.agent/frontend/skills/react-quality-review/rules/rerender-no-inline-components.md +82 -0
  46. package/.agent/frontend/skills/react-quality-review/rules/rerender-simple-expression-in-memo.md +35 -0
  47. package/.agent/frontend/skills/react-quality-review/rules/rerender-transitions.md +40 -0
  48. package/.agent/frontend/skills/react-quality-review/rules/rerender-use-ref-transient-values.md +73 -0
  49. package/.agent/frontend/skills/refactor-safely/SKILL.md +29 -0
  50. package/.agent/frontend/skills/vuexy-component-guide/SKILL.md +369 -0
  51. package/.agent/frontend/skills/vuexy-component-guide/examples.md +662 -0
  52. package/.agent/frontend/skills/vuexy-component-guide/reference.md +1036 -0
  53. package/.agent/frontend/workflows/build-feature-react.workflow.md +82 -0
  54. package/.agent/frontend/workflows/feature-module-runner.md +101 -0
  55. package/.agent/monolith/skills/architect/SKILL.md +648 -0
  56. package/.agent/monolith/skills/auth-and-permissions/SKILL.md +43 -0
  57. package/.agent/monolith/skills/code-reviewer/SKILL.md +281 -0
  58. package/.agent/monolith/skills/create-blueprint/SKILL.md +635 -0
  59. package/.agent/monolith/skills/debug-issue/SKILL.md +28 -0
  60. package/.agent/monolith/skills/explore-codebase/SKILL.md +29 -0
  61. package/.agent/monolith/skills/feature-workflow/SKILL.md +61 -0
  62. package/.agent/monolith/skills/react-quality-review/SKILL.md +126 -0
  63. package/.agent/monolith/skills/react-quality-review/examples.md +24 -0
  64. package/.agent/monolith/skills/react-quality-review/rules/_sections.md +26 -0
  65. package/.agent/monolith/skills/react-quality-review/rules/_template.md +28 -0
  66. package/.agent/monolith/skills/react-quality-review/rules/advanced-event-handler-refs.md +55 -0
  67. package/.agent/monolith/skills/react-quality-review/rules/advanced-init-once.md +42 -0
  68. package/.agent/monolith/skills/react-quality-review/rules/react-rules-calling.md +66 -0
  69. package/.agent/monolith/skills/react-quality-review/rules/react-rules-hooks.md +91 -0
  70. package/.agent/monolith/skills/react-quality-review/rules/react-rules-purity.md +121 -0
  71. package/.agent/monolith/skills/react-quality-review/rules/rendering-activity.md +26 -0
  72. package/.agent/monolith/skills/react-quality-review/rules/rendering-conditional-render.md +40 -0
  73. package/.agent/monolith/skills/react-quality-review/rules/rendering-content-visibility.md +38 -0
  74. package/.agent/monolith/skills/react-quality-review/rules/rendering-hoist-jsx.md +46 -0
  75. package/.agent/monolith/skills/react-quality-review/rules/rendering-usetransition-loading.md +75 -0
  76. package/.agent/monolith/skills/react-quality-review/rules/rerender-defer-reads.md +39 -0
  77. package/.agent/monolith/skills/react-quality-review/rules/rerender-dependencies.md +45 -0
  78. package/.agent/monolith/skills/react-quality-review/rules/rerender-derived-state-no-effect.md +40 -0
  79. package/.agent/monolith/skills/react-quality-review/rules/rerender-derived-state.md +29 -0
  80. package/.agent/monolith/skills/react-quality-review/rules/rerender-functional-setstate.md +74 -0
  81. package/.agent/monolith/skills/react-quality-review/rules/rerender-lazy-state-init.md +58 -0
  82. package/.agent/monolith/skills/react-quality-review/rules/rerender-memo-with-default-value.md +38 -0
  83. package/.agent/monolith/skills/react-quality-review/rules/rerender-memo.md +44 -0
  84. package/.agent/monolith/skills/react-quality-review/rules/rerender-move-effect-to-event.md +45 -0
  85. package/.agent/monolith/skills/react-quality-review/rules/rerender-no-inline-components.md +82 -0
  86. package/.agent/monolith/skills/react-quality-review/rules/rerender-simple-expression-in-memo.md +35 -0
  87. package/.agent/monolith/skills/react-quality-review/rules/rerender-transitions.md +40 -0
  88. package/.agent/monolith/skills/react-quality-review/rules/rerender-use-ref-transient-values.md +73 -0
  89. package/.agent/monolith/skills/refactor-safely/SKILL.md +29 -0
  90. package/.agent/monolith/skills/vuexy-component-guide/SKILL.md +369 -0
  91. package/.agent/monolith/skills/vuexy-component-guide/examples.md +662 -0
  92. package/.agent/monolith/skills/vuexy-component-guide/reference.md +1036 -0
  93. package/.agent/monolith/workflows/add-new-api-feature-module.md +63 -0
  94. package/.agent/monolith/workflows/backend-quality-review.md +27 -0
  95. package/.agent/monolith/workflows/build-feature-backend.workflow.md +91 -0
  96. package/.agent/monolith/workflows/build-feature-react.workflow.md +82 -0
  97. package/.agent/monolith/workflows/feature-module-runner.md +97 -0
  98. package/.agent/templates/FEATURE_PLAN.md +42 -0
  99. package/.agent/templates/MODULE.md +45 -0
  100. package/.agent/templates/REVIEW_REPORT.md +44 -0
  101. package/.agent/templates/SECURITY_REPORT.md +70 -0
  102. package/.agent/templates/TEST_PLAN.md +49 -0
  103. package/README.md +131 -0
  104. package/package.json +42 -0
  105. package/scripts/setup-rules.js +224 -0
  106. package/scripts/setup.js +518 -0
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: brainstorm
3
+ description: Explore 3-5 distinct approaches to a problem, feature, or architectural decision. Outputs structured options with tradeoffs and a recommendation. No code, no implementation, no planning artifacts — pure ideation. Use BEFORE `/architect` when the right approach is not yet obvious. Trigger with `/brainstorm <problem statement>`.
4
+ disable-model-invocation: false
5
+ ---
6
+
7
+ # Skill: brainstorm
8
+
9
+ The thinking-out-loud skill. You produce **3-5 distinct approaches** to a problem, evaluate each honestly, and recommend one with the key tradeoff named.
10
+
11
+ This skill **never writes code**, **never writes planning artifacts**, **never updates project-memory**. Its only output is a single structured response in the chat.
12
+
13
+ Use it before `/architect` when the user hasn't yet decided _how_ to solve something. Use `/architect` after the user picks an approach.
14
+
15
+ ---
16
+
17
+ ## Phase 1 — Frame the problem
18
+
19
+ Restate the problem in **one paragraph**. Capture:
20
+ - What the user wants to achieve (the goal, not the solution)
21
+ - The constraints they've stated explicitly
22
+ - The implicit constraints you can infer from project-memory (only if relevant — read `constitution.md` only if the user's problem touches a constitutional concern)
23
+
24
+ If the problem statement is too vague to generate distinct approaches, ask **exactly one** clarifying question and stop. Do not generate options on a misframed problem.
25
+
26
+ ---
27
+
28
+ ## Phase 2 — Light context gathering (optional, ≤3 Serena calls)
29
+
30
+ Only if the problem requires knowing what currently exists in the codebase. Examples:
31
+ - "Should we add rate limiting?" → check if any rate-limiting exists today (`find_symbol` for likely names)
32
+ - "How should we structure feature X?" → look at how similar features are structured (`get_symbols_overview` on 1-2 sibling feature dirs)
33
+
34
+ If the problem is purely conceptual ("JWT vs session cookies for our use case"), skip this phase entirely.
35
+
36
+ **Hard cap: 3 Serena calls.** Brainstorming is cheap reasoning, not deep research.
37
+
38
+ ---
39
+
40
+ ## Phase 3 — Generate 3-5 distinct approaches
41
+
42
+ Each approach must be **genuinely different in mechanism**, not just a parameter tweak of the same idea.
43
+
44
+ Examples of distinct approaches:
45
+ - For rate limiting: (a) Redis-backed token bucket middleware, (b) Postgres-row-based counter with cron eviction, (c) external service (Cloudflare/upstash), (d) per-handler decorator-based throttle.
46
+
47
+ Examples of NOT distinct (these are variants of one approach):
48
+ - (a) Redis with 60s window, (b) Redis with 5min window, (c) Redis with sliding window.
49
+
50
+ If you can only come up with 2 distinct approaches, output 2. Don't pad to hit 3.
51
+
52
+ ---
53
+
54
+ ## Phase 4 — Evaluate each approach
55
+
56
+ For each option, produce a compact block. **Use this exact structure** so the user can scan them in parallel:
57
+
58
+ ```
59
+ ### Option N: <short name>
60
+
61
+ **Mechanism**: <one sentence — how it actually works>
62
+ **Pros**: <2-4 bullets, concrete>
63
+ **Cons**: <2-4 bullets, concrete>
64
+ **Complexity**: <Low | Medium | High> — <one phrase justifying>
65
+ **Reversibility**: <Easy | Moderate | Hard> — <one phrase justifying>
66
+ **New dependencies**: <list, or "none">
67
+ ```
68
+
69
+ Be honest about cons. If an option has a serious flaw, name it. The user can't make a good decision from sanitized comparisons.
70
+
71
+ ---
72
+
73
+ ## Phase 5 — Recommend
74
+
75
+ End with a single **Recommendation** block:
76
+
77
+ ```
78
+ ### Recommendation: Option N
79
+
80
+ **Why**: <one paragraph, the core reason this fits the user's constraints best>
81
+ **Key tradeoff to accept**: <one sentence — the specific downside the user is signing up for>
82
+ **Next step**: <one of: "Run /architect <chosen approach>" | "Run /quick-execute <task>" if trivial | "Run /create-blueprint <artifact>" if project-memory needs updating first>
83
+ ```
84
+
85
+ If you genuinely cannot pick between two options because they trade off along axes only the user can weigh (e.g. "performance vs ops burden"), say so explicitly and present the choice to the user. Do not fake confidence.
86
+
87
+ ---
88
+
89
+ ## Do not
90
+
91
+ - Write code (not even snippets — descriptions only)
92
+ - Create files anywhere (`documentation/`, `project-memory/`, `src/`)
93
+ - Use any tool other than read-only Serena/Read (≤3 calls)
94
+ - Pad to N options when only K are genuinely distinct
95
+ - Recommend "it depends" without naming the axes
96
+ - Re-run brainstorm after the user picks — hand off to `/architect` or `/quick-execute`
97
+
98
+ ---
99
+
100
+ ## Example invocation flow
101
+
102
+ ```
103
+ User: /brainstorm we need to add audit logging to all admin actions
104
+
105
+ You: [Phase 1] Frame: User wants every admin-permission action recorded with actor, target, action type, timestamp. Constraint (from constitution): no PII in logs.
106
+
107
+ [Phase 2] Skip — purely architectural.
108
+
109
+ [Phase 3-4] Three options:
110
+
111
+ ### Option 1: Decorator-based audit hook
112
+ **Mechanism**: A @Audit() decorator on controller methods writes to an audit_log table after success.
113
+ **Pros**: ...
114
+ **Cons**: ...
115
+ ...
116
+
117
+ ### Option 2: Middleware/interceptor capturing all authed requests
118
+ ...
119
+
120
+ ### Option 3: DB-trigger-based row-change capture
121
+ ...
122
+
123
+ ### Recommendation: Option 1
124
+ **Why**: ...
125
+ **Key tradeoff to accept**: Devs must remember to add @Audit() — no enforcement at compile time.
126
+ **Next step**: Run /architect "audit logging via @Audit() decorator"
127
+ ```
@@ -0,0 +1,324 @@
1
+ ---
2
+ name: code-reviewer
3
+ description: Full-stack code review for backend changes on the current branch. Reads all project-memory docs, audits changed files against the constitution/quality-playbook/auth-model/architecture/models, and writes a structured REVIEW_REPORT to documentation/reports/ (or the active feature folder). Trigger on any "review my changes", "review this branch", "do a code review", or "review <feature>" request.
4
+ ---
5
+
6
+ # Skill: code-reviewer
7
+
8
+ Use this skill to perform a thorough, standards-aligned code review of all uncommitted or branch-level changes. The output is a structured review report written to the project's `documentation/reports/` directory (or the active feature folder when one is clearly identified).
9
+
10
+ ---
11
+
12
+ ## When to trigger
13
+
14
+ - User says "review my changes", "do a code review", "review this branch", or similar.
15
+ - User asks for a review of a specific feature or module before merging.
16
+ - Used automatically at the end of a feature-module implementation workflow.
17
+
18
+ ---
19
+
20
+ ## Phase 1 — Understand the change surface
21
+
22
+ ### 1.1 Identify changed files
23
+
24
+ Run the following to understand what is in scope:
25
+
26
+ ```bash
27
+ git status
28
+ git diff --name-only HEAD
29
+ git diff --name-only --cached
30
+ ```
31
+
32
+ For a branch comparison against main:
33
+
34
+ ```bash
35
+ git diff --name-only main...HEAD
36
+ ```
37
+
38
+ Collect:
39
+ - All modified, added, and deleted files.
40
+ - The active branch name (to infer feature name and milestone if present).
41
+ - Whether changes are staged, unstaged, or committed ahead of main.
42
+
43
+ ### 1.2 Infer feature and milestone
44
+
45
+ Extract from the branch name or the changed file paths:
46
+ - **Feature name**: the slug after `feature/`, `feat/`, or derived from the dominant changed folder under `src/apis/` (e.g. `influencer-discovery`).
47
+ - **Milestone**: if module files exist under `documentation/features/<feature>/`, identify the highest module number being reviewed (e.g. `M3`). Otherwise use `M0` or omit.
48
+
49
+ ### 1.3 Use Serena symbolic tools first
50
+
51
+ Before reading any file end-to-end, use Serena's symbolic tools for efficient structural analysis. **Always prefer symbol-level navigation over full-file reads.**
52
+
53
+ | Need | Serena tool |
54
+ |---|---|
55
+ | List symbols (classes, functions, methods) in a changed file | `get_symbols_overview(relative_path="...")` |
56
+ | Read a specific symbol's body | `find_symbol(name_path="ClassName/methodName", include_body=true)` |
57
+ | Find all callers of a changed function (blast radius) | `find_referencing_symbols(name_path="...", relative_path="...")` |
58
+ | Locate a class/service by name | `find_symbol(name_path="...", substring_matching=true)` |
59
+ | Read prior session notes for this project | `list_memories` then `read_memory` (only if names look relevant) |
60
+
61
+ For each changed file:
62
+ 1. `get_symbols_overview` first — see what symbols exist
63
+ 2. For changed symbols, `find_symbol` with `include_body=true` to read just that symbol
64
+ 3. For risky changes (mutations, query helpers, auth surfaces), `find_referencing_symbols` to see callers
65
+ 4. To verify test coverage, search for a test file alongside the source: `find_symbol(name_path="<TestedSymbol>", substring_matching=true)` and filter by paths matching the project's test glob (e.g. `*.spec.ts`, `*.test.ts` — check `project-memory/repo-map.md` for the project's convention)
66
+
67
+ Fall back to raw `Read` only when Serena can't locate what you need (e.g. config files, migrations, non-code assets).
68
+
69
+ **Token efficiency**: target ≤8 Serena calls for the full structural analysis phase. If you find yourself making more, you're probably reviewing too broadly — narrow scope or escalate to a targeted `Read` of one file.
70
+
71
+ ---
72
+
73
+ ## Phase 2 — Load project-memory context
74
+
75
+ Read all of the following files in full before reviewing any code. These define the non-negotiable constraints for this codebase.
76
+
77
+ | File | Purpose |
78
+ |------|---------|
79
+ | `project-memory/constitution.md` | Non-negotiable rules: structure, security, validation, auth, DI, SQL, error handling |
80
+ | `project-memory/quality-playbook.md` | High-signal check patterns with symptoms, root causes, and preferred fixes |
81
+ | `project-memory/auth-model.md` | JWT flow, guard chain, RBAC entities, tenant/resource scoping |
82
+ | `project-memory/architecture.md` | System-level architecture decisions and module topology |
83
+ | `project-memory/models.md` | Domain model inventory: Sequelize entities, associations, field contracts |
84
+ | `project-memory/repo-map.md` | Module layout, naming conventions, reusable component registry |
85
+ | `project-memory/core-memory.md` | Historical implementation decisions and completed module record |
86
+ | `project-memory/README.md` | Index of all project-memory docs |
87
+
88
+ If a file does not exist, skip it and note the omission in the review.
89
+
90
+ ---
91
+
92
+ ## Phase 3 — Review the changed code
93
+
94
+ For each changed file, perform the following checks. Record every finding, tagged by severity.
95
+
96
+ ### 3.1 Structural alignment (Constitution §Project structure, repo-map.md §Module layout)
97
+
98
+ - [ ] New feature modules follow the directory structure and naming convention defined in `project-memory/repo-map.md`.
99
+ - [ ] All required files for this project type are present (see repo-map for the checklist: e.g., DB-backed features might need `.model.ts`, `.service.ts`, `.dto.ts`, etc.).
100
+ - [ ] New models/entities are registered per `project-memory/repo-map.md` (e.g., in a models registry file).
101
+ - [ ] Feature module is wired into the module tree per repo-map (e.g., imported in a root APIs module or feature module).
102
+ - [ ] No new file duplicates functionality already documented in `project-memory/repo-map.md`.
103
+
104
+ ### 3.2 Security and auth (Constitution, quality-playbook)
105
+
106
+ - [ ] Every endpoint has an explicit auth decision: protected (requires auth/permission) or intentionally public.
107
+ - [ ] Protected endpoints use your project's auth guard/middleware (see `project-memory/auth-model.md`).
108
+ - [ ] Permission/authorization checks happen both at endpoint level and service level where applicable.
109
+ - [ ] Service/query layer enforces ownership/tenant scoping using authenticated context, never client-supplied IDs.
110
+ - [ ] Identity and tenant context come from authenticated request context, never from request body/query.
111
+ - [ ] No secrets or config values hardcoded in code; use your project's config service/mechanism.
112
+
113
+ ### 3.3 Input validation (Constitution, quality-playbook)
114
+
115
+ - [ ] All endpoints validate inputs (body, query, path params) using your project's validation mechanism (e.g., DTOs, validation pipes, decorators).
116
+ - [ ] No raw request data passed to services/repositories/queries; always validate at the boundary.
117
+ - [ ] Unknown/extra fields are rejected for auth-sensitive and data-sensitive endpoints (explicit allowlist or default deny).
118
+
119
+ ### 3.4 Dependency injection and module wiring (Constitution, quality-playbook)
120
+
121
+ - [ ] DI tokens/identifiers are defined consistently and reused across the module.
122
+ - [ ] No new circular dependencies; if DI needs bidirectional wiring, it's explicitly documented.
123
+ - [ ] Module/package imports and exports are correctly wired for all dependencies.
124
+ - [ ] Controllers/handlers are thin; business logic lives in services, not at the boundary.
125
+
126
+ ### 3.5 Error handling (Constitution)
127
+
128
+ - [ ] Client errors (validation, auth, resource not found) use appropriate status codes (4xx), not 500.
129
+ - [ ] Errors are not silently swallowed; all error paths are logged or explicitly documented.
130
+ - [ ] Error responses follow your project's consistent envelope shape (see `project-memory/constitution.md`).
131
+
132
+ ### 3.6 SQL and query safety (Constitution §9–11)
133
+
134
+ - [ ] All user-influenced values are parameterized (use your ORM/query builder's parameterization mechanism, never string interpolation).
135
+ - [ ] No string concatenation of request input into SQL templates.
136
+ - [ ] Raw queries (if used) employ parameterization consistently with your project's query library (see `project-memory/repo-map.md` for patterns).
137
+ - [ ] Row-level security applied via server-side tenant/ownership predicates, never from client-supplied IDs.
138
+
139
+ ### 3.7 Logging and PII (Constitution)
140
+
141
+ - [ ] No secrets, tokens, passwords, credentials, or sensitive user data logged.
142
+ - [ ] No full request/response bodies logged for auth-sensitive or PII-containing endpoints.
143
+ - [ ] Logged context is actionable: route identifier, request/trace ID, function/service, error type/message.
144
+
145
+ ### 3.8 Dependencies (Constitution)
146
+
147
+ - [ ] No new external dependency added without explicit justification (why not use existing libs?).
148
+ - [ ] Prefer reusing your project's existing libraries and frameworks over adding new ones.
149
+
150
+ ### 3.9 Caching (Constitution)
151
+
152
+ - [ ] Cache keys derived from canonicalized inputs using your project's cache key strategy.
153
+ - [ ] Cache bypass/refresh happens only where freshness is explicitly required.
154
+ - [ ] No accidental changes to cache key derivation or TTL semantics that would break stale invalidations.
155
+
156
+ ### 3.10 Model and domain alignment (project-memory/models.md)
157
+
158
+ - [ ] New data models follow your project's ORM conventions and naming rules (see repo-map and models doc).
159
+ - [ ] Table/entity metadata is explicit (table names, timestamps, field-to-column mappings).
160
+ - [ ] Associations (foreign keys, relationships) are correctly defined; no orphaned or unmapped foreign keys.
161
+ - [ ] Field naming is consistent with project conventions (e.g., snake_case in DB, camelCase in code).
162
+
163
+ ### 3.11 Architecture alignment (project-memory/architecture.md)
164
+
165
+ - [ ] Changes respect the module topology and layers described in your architecture doc.
166
+ - [ ] No new unexpected coupling between modules without documented rationale (see repo-map).
167
+ - [ ] External-service integration (APIs, queues, caches, etc.) follows your project's established patterns.
168
+
169
+ ---
170
+
171
+ ## Phase 4 — Determine the output location
172
+
173
+ Choose the report location based on context:
174
+
175
+ | Condition | Output path |
176
+ |-----------|-------------|
177
+ | Active feature with a folder under `documentation/features/<feature>/` | `documentation/features/<feature>/REVIEW_REPORT_<feature>_<milestone>.md` |
178
+ | General / no clearly scoped feature folder | `documentation/reports/REVIEW_REPORT_<feature>_<milestone>.md` |
179
+ | No feature identifiable | `documentation/reports/REVIEW_REPORT_<branch-slug>.md` |
180
+
181
+ Name the file using:
182
+ - `<feature>` = feature slug in your project's naming convention (e.g., kebab-case).
183
+ - `<milestone>` = module/phase label if applicable (e.g., `M3`), otherwise omit.
184
+
185
+ ---
186
+
187
+ ## Phase 5 — Write the review report
188
+
189
+ Save the review report to the path determined in Phase 4. Use this template:
190
+
191
+ ```markdown
192
+ # Backend Code Review Report
193
+
194
+ ## Feature
195
+ `<feature-name>` — <short description of the change being reviewed>
196
+
197
+ ## Branch
198
+ `<branch-name>`
199
+
200
+ ## Scope Reviewed
201
+ <Bullet list of changed files/folders reviewed and what each covers>
202
+
203
+ ---
204
+
205
+ ## Findings
206
+
207
+ ### BLOCKER
208
+ <List each blocker finding with:>
209
+ - **File**: `path/to/file.ts` (line N if known)
210
+ - **Issue**: What is wrong.
211
+ - **Rule**: Which constitution / quality-playbook rule is violated.
212
+ - **Fix**: Minimum change needed to resolve.
213
+
214
+ *(none)* if no blockers.
215
+
216
+ ### HIGH
217
+ <Same format. HIGH = must fix before merge, not necessarily a blocker today.>
218
+
219
+ *(none)* if none.
220
+
221
+ ### MEDIUM
222
+ <Same format. MEDIUM = should fix in this PR; acceptable to defer with documented rationale.>
223
+
224
+ *(none)* if none.
225
+
226
+ ### LOW / SUGGESTION
227
+ <Same format. LOW = nice-to-have improvements or style alignment.>
228
+
229
+ *(none)* if none.
230
+
231
+ ---
232
+
233
+ ## Architecture Alignment
234
+ <1–3 bullet points on how well the changes align with project-memory/architecture.md and repo-map.md. Note any deviations.>
235
+
236
+ ## Auth and Security Summary
237
+ <1–2 sentences confirming auth coverage or identifying remaining gaps.>
238
+
239
+ ## Quality Gate Status
240
+
241
+ | Gate | Status | Notes |
242
+ |------|--------|-------|
243
+ | TypeScript compile (`npx tsc --noEmit`) | pass / fail / not run | |
244
+ | Lint (`npm run lint`) | pass / fail / not run | |
245
+ | Unit tests | pass / fail / not run | |
246
+ | E2E tests | pass / fail / not run | |
247
+
248
+ Run the gates that are feasible given the current environment. Report blocked gates and whether they are pre-existing failures unrelated to these changes.
249
+
250
+ ## Recommendation
251
+
252
+ **APPROVE** / **APPROVE WITH CONDITIONS** / **REQUEST CHANGES**
253
+
254
+ <1–2 sentences explaining the recommendation and any required follow-up.>
255
+ ```
256
+
257
+ ---
258
+
259
+ ## Phase 6 — Output
260
+
261
+ ### 6.1 Standalone mode (default — user-invoked)
262
+
263
+ After writing the report file, output to the user:
264
+
265
+ 1. The full path of the written report.
266
+ 2. A concise inline summary:
267
+ - Number of blockers, high, medium, low findings.
268
+ - Overall recommendation (APPROVE / APPROVE WITH CONDITIONS / REQUEST CHANGES).
269
+ - Any critical finding that must be addressed before merge.
270
+
271
+ ### 6.2 Sub-agent mode (invoked by `/module-runner`)
272
+
273
+ Detect sub-agent mode from the parent agent's prompt — it will say "mode=subagent" or "sub-agent mode".
274
+
275
+ In sub-agent mode:
276
+ - **Do NOT write a REVIEW_REPORT file.** All findings go in the JSON return value.
277
+ - Auto-approve internal decisions (no clarifying questions, no waiting for user input).
278
+ - Skip the "Quality Gate Status" section (the runner handles build/test separately).
279
+ - Return a JSON object to the parent:
280
+
281
+ ```json
282
+ {
283
+ "verdict": "clean" | "fix_required" | "block",
284
+ "counts": { "blocker": 0, "high": 0, "medium": 0, "low": 0 },
285
+ "findings": [
286
+ {
287
+ "id": "F1",
288
+ "severity": "BLOCKER" | "HIGH" | "MEDIUM" | "LOW",
289
+ "category": "structure" | "security" | "validation" | "di" | "errors" | "sql" | "logging" | "deps" | "caching" | "models" | "architecture",
290
+ "file": "<path:line>",
291
+ "issue": "<one sentence>",
292
+ "rule": "<which constitution / quality-playbook rule, or auth-model section>",
293
+ "fix": "<one sentence>",
294
+ "required": true | false
295
+ }
296
+ ]
297
+ }
298
+ ```
299
+
300
+ `verdict = block` if any BLOCKER. `verdict = fix_required` if any HIGH or MEDIUM with `required=true`. `verdict = clean` otherwise.
301
+
302
+ The parent (`/module-runner`'s code-fixer step) consumes this JSON and applies fixes for `required=true` findings only.
303
+
304
+ ---
305
+
306
+ ## Quality gates for the review itself
307
+
308
+ Before finalizing the report, verify:
309
+
310
+ - [ ] Every finding links to a specific constitution/quality-playbook rule or project-memory doc section.
311
+ - [ ] Every finding names the exact file (and line where possible).
312
+ - [ ] The report does not describe what code does — it states what is wrong and what the fix is.
313
+ - [ ] Auth and validation coverage has been explicitly confirmed or flagged, not assumed.
314
+ - [ ] No findings are added for purely stylistic preferences without a rule citation.
315
+ - [ ] The gate status table reflects actual command output, not assumptions.
316
+
317
+ ---
318
+
319
+ ## Notes
320
+
321
+ - This skill reads project-memory docs but does NOT modify them. After implementation modules, `core-memory.md` is updated by `/module-runner` (in its Step 7), not this skill.
322
+ - If this review is triggered mid-module (not post-implementation), findings should feed back into the implementation, not the merge decision.
323
+ - For auth-heavy changes, complement this review with `/auth-and-permissions` — either run it manually after, or rely on `/module-runner` which invokes both `/code-reviewer` and `/security-assessment` as part of its per-module pipeline.
324
+ - This skill does NOT do security audits beyond the basics in §3.2. For a dedicated, structured security review, use `/security-assessment`.