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,644 @@
1
+ ---
2
+ name: architect
3
+ description: Research the current React/Next.js codebase, decompose a feature or enhancement into logical modules with dependency ordering, and produce a gated architecture plan plus per-module implementation prompts. Use when the user asks to architect, break down, design, or phase a multi-file feature, module, refactor, or enhancement.
4
+ ---
5
+
6
+ # Skill: architect
7
+
8
+ Use this skill when the work is larger than a small single-file change and you need a reusable implementation blueprint before coding.
9
+
10
+ The goal is to:
11
+
12
+ 1. Study the existing this architecture first.
13
+ 2. Break the requested work into small, independently implementable modules.
14
+ 3. Produce one master architecture plan.
15
+ 4. Stop for approval.
16
+ 5. After approval, generate per-module prompt files that can be handed to an AI implementer and that align with this repo's existing feature workflow.
17
+ 6. Maintain persistent implementation memory in `project-memory/core-memory.md` as each module is completed.
18
+
19
+ ## When to trigger
20
+
21
+ - User asks to "architect", "break down", "plan", "design", or "phase" a feature.
22
+ - The work spans multiple areas such as `src/app`, `src/views`, `src/components`, `src/services`, `src/hooks`, `src/utils`, or `src/app/api`.
23
+ - You need to understand existing repo patterns before proposing changes.
24
+ - The user wants a module-by-module implementation plan for a new feature, enhancement, or significant refactor.
25
+
26
+ ## Output locations
27
+
28
+ All outputs go under **`Documentation/features/<feature_name>/`**. Create that folder when generating the first artifact for a feature.
29
+
30
+ | File | Purpose |
31
+ |------|---------|
32
+ | `Documentation/features/<feature_name>/<FEATURE_NAME>_ARCHITECTURE.md` | Master architecture plan with scope, modules, dependencies, implementation order, and file inventory |
33
+ | `Documentation/features/<feature_name>/MODULE_<N>_<MODULE_NAME>.md` | Per-module implementation prompt file, generated only after plan approval |
34
+
35
+ Naming rules:
36
+
37
+ - `<FEATURE_NAME>`: `UPPER_SNAKE_CASE` such as `PDF_EXPORT_QUEUE` or `BRAND_AUDIT_FILTERS`
38
+ - `<feature_name>`: `snake_case` such as `pdf_export_queue` or `brand_audit_filters`
39
+ - `<MODULE_NAME>`: short `UPPER_SNAKE_CASE` label such as `API_ROUTE`, `VIEW_STATE`, `PDF_WIDGET`
40
+
41
+ ## Expected behavior
42
+
43
+ This skill is intentionally two-stage:
44
+
45
+ 1. First run: create only the master architecture plan in `Documentation/features/<feature_name>/<FEATURE_NAME>_ARCHITECTURE.md`
46
+ 2. Wait for explicit approval
47
+ 3. Second run after approval: generate multiple prompt files, one per module, under `Documentation/features/<feature_name>/`
48
+
49
+ If you only see a single architecture document after the first run, that is correct behavior, not a failure.
50
+
51
+ ---
52
+
53
+ ## Phase 0 - Prerequisites (HARD STOP)
54
+
55
+ > Goal: confirm project-memory artifacts exist before doing any work. This skill is grounded in those documents and cannot produce a useful plan without them.
56
+
57
+ Check that **all** of these files exist:
58
+
59
+ - `project-memory/constitution.md`
60
+ - `project-memory/repo-map.md`
61
+ - `project-memory/auth-model.md`
62
+ - `project-memory/quality-playbook.md`
63
+ - `project-memory/core-memory.md`
64
+
65
+ If **any** are missing, STOP immediately. Do not proceed to Phase 1. Do not write a partial plan. Respond to the user exactly with:
66
+
67
+ > ⚠️ `/architect` requires the `project-memory/` artifacts to ground the plan in this project's actual rules, architecture, and history. The following files are missing:
68
+ >
69
+ > - [list each missing file]
70
+ >
71
+ > Please run `/create-blueprint all` first (or `/create-blueprint <artifact>` for individual ones), then re-invoke `/architect <your feature>`.
72
+
73
+ Only continue to Phase 1 once every file above is present.
74
+
75
+ ---
76
+
77
+ ## Phase 1 - Research and discovery
78
+
79
+ > Goal: understand the current codebase structure and constraints before designing modules.
80
+
81
+ ### 1.1 Read foundation docs first
82
+
83
+ Read these in order:
84
+
85
+ 1. `project-memory/constitution.md`
86
+ 2. `project-memory/repo-map.md`
87
+ 3. `project-memory/auth-model.md`
88
+ 4. `project-memory/quality-playbook.md`
89
+ 5. `project-memory/core-memory.md`
90
+ 6. `.agent/workflows/build-feature-react.workflow.md`
91
+ 7. `.agent/skills/feature-workflow/SKILL.md`
92
+ 8. `.agent/templates/FEATURE_PLAN.md`
93
+ 9. `.agent/templates/REVIEW_REPORT.md`
94
+ 10. `.agent/templates/TEST_PLAN.md`
95
+
96
+ These files define the repo's non-negotiable process and where code belongs.
97
+
98
+ If `project-memory/core-memory.md` does not exist yet, create it before finalizing the first architecture plan that will use this skill.
99
+
100
+ ### 1.2 Map the existing architecture
101
+
102
+ Before proposing modules, inspect the actual code paths involved in the feature and note existing patterns.
103
+
104
+ Always identify:
105
+
106
+ - Route entry points in `src/app/**`
107
+ - Feature views in `src/views/**`
108
+ - Shared UI in `src/components/**`
109
+ - Hooks in `src/hooks/**`
110
+ - Service/data logic in `src/services/**`
111
+ - Shared helpers in `src/utils/**`
112
+ - Config and contracts in `src/configs/**` and `src/types/**`
113
+ - Any API/BFF handlers in `src/app/api/**`
114
+ - Auth-sensitive touchpoints in:
115
+ - `src/contexts/authContext.tsx`
116
+ - `src/utils/auth.ts`
117
+ - `src/configs/authConfig.ts`
118
+ - `src/types/auth.ts`
119
+
120
+ Trace the real flow for the feature area. Typical shapes in this repo are:
121
+
122
+ ```text
123
+ page.tsx -> view component -> hooks/selectors -> service -> API route -> external API
124
+ ```
125
+
126
+ or
127
+
128
+ ```text
129
+ page.tsx -> view component -> shared components/dialogs -> service/utils -> local state/auth context
130
+ ```
131
+
132
+ ### 1.3 Reuse hunting via repo-map
133
+
134
+ Before proposing any new file, actively cross-reference `project-memory/repo-map.md` against the feature domain to find reuse candidates. This is the primary reuse check — the repo-map is curated and faster than a broad graph search.
135
+
136
+ Steps:
137
+
138
+ 1. Re-read the relevant sections of `project-memory/repo-map.md` with the feature in mind (components, hooks, services, utils, types).
139
+ 2. List every existing entry that overlaps with what the feature needs.
140
+ 3. For each candidate, use `query_graph` (callers_of / callees_of / imports_of) or `get_impact_radius` to understand what it already does and who uses it — confirm it is safe to extend or reuse.
141
+ 4. For any proposed new file, write an explicit justification: "checked repo-map sections X and Y; nothing covers this because…". If you cannot write that justification, do not propose the new file.
142
+
143
+ The goal is that every module in the plan preferentially extends or reuses existing code. New files are the last resort, not the default.
144
+
145
+ ### 1.4 Capture existing repo patterns
146
+
147
+ Document the patterns that the new design must follow:
148
+
149
+ - Keep `page.tsx` files thin and compositional.
150
+ - Move heavy logic into `src/views/**`, `src/services/**`, `src/hooks/**`, or focused helpers.
151
+ - Prefer shared derivations/selectors over repeated `filter/map/sort` chains.
152
+ - Do not duplicate auth logic or cookie contracts.
153
+ - Respect server/client boundaries between client components, server routes, and secret-bearing code.
154
+ - Tighten service and transform types instead of introducing `any`.
155
+
156
+ ### 1.5 Identify integration points
157
+
158
+ For the requested feature, explicitly note:
159
+
160
+ - Existing files and modules that are closest to the requested behavior
161
+ - Shared services or utilities to reuse
162
+ - Data contracts and types that must be reused or extended
163
+ - API routes or external services that are affected
164
+ - Auth or permission implications
165
+ - Performance-sensitive transforms or rendering paths
166
+ - Whether tests should be unit, integration, manual, or mixed
167
+ - What must be persisted into `project-memory/core-memory.md` after each module lands
168
+
169
+ ### 1.6 Capture scope decisions
170
+
171
+ Before designing modules, write down:
172
+
173
+ - In scope
174
+ - Out of scope
175
+ - Assumptions
176
+ - Open questions
177
+
178
+ If the request is ambiguous, ask clarifying questions before writing the plan.
179
+
180
+ ---
181
+
182
+ ## Phase 2 - Module decomposition
183
+
184
+ > Goal: split the feature into small modules with clear ownership and dependencies.
185
+
186
+ ### 2.1 Decomposition principles
187
+
188
+ Apply these rules:
189
+
190
+ 1. Single responsibility per module.
191
+ 2. Each module should be mergeable with minimal risk.
192
+ 3. Dependencies must be explicit.
193
+ 4. Each module should provide testable value.
194
+ 5. Prefer smaller modules if a module feels too broad.
195
+ 6. Follow existing repo boundaries instead of inventing new layers.
196
+ 7. Keep pages thin; avoid modules that push business logic into route/page files.
197
+ 8. **Reuse over create**: before proposing a new file, confirm via repo-map.md that nothing equivalent exists. Prefer extending an existing hook, service, or component. A new file must be justified explicitly.
198
+ 9. **Deletion safety**: before proposing to delete any file, run `get_impact_radius` on it. List every active caller and dependent. If callers exist, the module must include a migration path for each one before the deletion is permitted. Never propose a deletion without this check.
199
+
200
+ ### 2.2 Valid module shapes in this repo
201
+
202
+ Common module types for this include:
203
+
204
+ - Route composition module
205
+ - Feature view/container module
206
+ - Shared component or dialog module
207
+ - Hook/state orchestration module
208
+ - Service/API integration module
209
+ - Shared transform/helper module
210
+ - Auth/permission adjustment module
211
+ - Testing/verification module
212
+
213
+ Use the smallest combination that fits the actual request.
214
+
215
+ ### 2.3 For each module, define
216
+
217
+ Every module section in the architecture plan must include these fields. Write them precisely — this content is extracted verbatim into the per-module implementation prompts, so prose rationale and justification notes belong in the architecture plan preamble, not inside the module sections.
218
+
219
+ | Section | Content |
220
+ |---------|---------|
221
+ | Goal | One-sentence outcome — what the module produces, not why |
222
+ | Depends on | Prior module numbers or `-` |
223
+ | Estimated effort | Rough time range |
224
+ | Key deliverables | Main outcomes as a short bullet list |
225
+ | New files | Table: `File \| Purpose` — one-line purpose per file; repo-map justification as a footnote in the plan, not in the table cell |
226
+ | Changed files | Table: `File \| Anchor symbol \| Exact change` — anchor is the existing function/type/component to locate; exact change is the specific mutation ("add X param", "extend return type with Y", "insert case Z") |
227
+ | Deleted files | Table: `File \| Active callers (get_impact_radius) \| Pre-condition for deletion` |
228
+ | Architecture | Short ASCII diagram for non-trivial call chains only; omit if the file changes are self-explanatory |
229
+ | Contracts | Actual TypeScript — interfaces, function signatures, prop types, route payload shapes. No prose descriptions. |
230
+ | Implementation notes | Module-specific edge cases or constraints only — nothing that restates constitution.md or quality-playbook.md |
231
+ | Auth / permissions | Specific auth implications for this module, or omit if none |
232
+ | Verification | Exact test commands with flags and paths; specific manual steps |
233
+ | Memory update | Exact sentences for core-memory; exact repo-map edits (table rows, section) if this module adds routes/services/patterns |
234
+
235
+ ### 2.4 Use simple architecture diagrams when helpful
236
+
237
+ Prefer short ASCII diagrams for non-trivial modules.
238
+
239
+ Examples:
240
+
241
+ ```text
242
+ App Route
243
+ -> Feature View
244
+ -> Shared Components
245
+ -> Hook / selector
246
+ -> Service
247
+ -> API route
248
+ -> External API
249
+ ```
250
+
251
+ ```text
252
+ Dialog UI
253
+ -> local form state
254
+ -> submit handler
255
+ -> service transform
256
+ -> API request
257
+ -> response typing
258
+ -> view refresh
259
+ ```
260
+
261
+ ---
262
+
263
+ ## Phase 3 - Dependency ordering and implementation sequence
264
+
265
+ > Goal: produce a safe serial order for implementation.
266
+
267
+ ### 3.1 Build the dependency graph
268
+
269
+ Identify:
270
+
271
+ - standalone modules that can ship first
272
+ - modules that unblock others
273
+ - modules that should remain behind a flag or guarded rollout
274
+ - modules that should be grouped in one merge because of tight contract coupling
275
+
276
+ ### 3.2 Define the implementation order
277
+
278
+ Present the order as a numbered chain, for example:
279
+
280
+ ```text
281
+ 1. Shared contracts/helpers
282
+ |
283
+ 2. Service/API integration
284
+ |
285
+ 3. Feature hook/state orchestration
286
+ |
287
+ 4. View/component wiring
288
+ |
289
+ 5. Tests and final verification
290
+ ```
291
+
292
+ ### 3.3 Note merge guidance
293
+
294
+ Call out:
295
+
296
+ - safe standalone modules
297
+ - coupled modules that should land together
298
+ - risky modules that need extra verification
299
+ - auth-sensitive modules that require `auth-and-permissions`
300
+
301
+ ---
302
+
303
+ ## Phase 4 - Produce the architecture plan and stop for approval
304
+
305
+ > Goal: create one approved master plan before generating prompts or code.
306
+
307
+ ### 4.1 Save location
308
+
309
+ Save the master plan to:
310
+
311
+ `Documentation/features/<feature_name>/<FEATURE_NAME>_ARCHITECTURE.md`
312
+
313
+ ### 4.2 Required document structure
314
+
315
+ Use this structure:
316
+
317
+ ```markdown
318
+ # [Feature Name] Architecture Plan
319
+
320
+ [Brief description of the requested enhancement and intended outcome.]
321
+
322
+ ## Scope decisions
323
+
324
+ ### In scope
325
+ - ...
326
+
327
+ ### Out of scope
328
+ - ...
329
+
330
+ ### Assumptions
331
+ - ...
332
+
333
+ ### Open questions
334
+ - ...
335
+
336
+ ## Memory strategy
337
+
338
+ - Memory document: `project-memory/core-memory.md`
339
+ - What to append after each module:
340
+ - completed status
341
+ - files added/changed
342
+ - key architectural decisions
343
+ - auth implications
344
+ - tests run and gaps
345
+ - notes for the next module
346
+ - Repo map: when the feature adds new API routes, services, hooks, or reusable patterns, update `project-memory/repo-map.md` (tables or placement notes) so the map stays the single source of truth.
347
+
348
+ ## Relevant codebase study
349
+
350
+ - `path/to/file` - why it matters
351
+ - `path/to/file` - why it matters
352
+
353
+ ## Module overview
354
+
355
+ | # | Module | Depends On | Estimated Effort | Key Deliverables |
356
+ |---|--------|------------|------------------|------------------|
357
+ | 1 | ... | - | ... | ... |
358
+
359
+ ## Module 1 - [Name]
360
+
361
+ **Goal**: [one sentence — what this module produces]
362
+
363
+ **Depends on**: [module numbers or `-`]
364
+
365
+ **Estimated effort**: ...
366
+
367
+ **Key deliverables**: ...
368
+
369
+ ### New files
370
+ | File | Purpose |
371
+ |------|---------|
372
+ | ... | [one-line purpose — repo-map justification as a footnote below this table if needed] |
373
+
374
+ ### Changed files
375
+ | File | Anchor symbol | Exact change |
376
+ |------|---------------|--------------|
377
+ | ... | `existingSymbol` | [specific mutation: "add X param", "extend return type with Y", "insert case Z"] |
378
+
379
+ ### Deleted files
380
+ | File | Active callers (from get_impact_radius) | Pre-condition for deletion |
381
+ |------|-----------------------------------------|---------------------------|
382
+ | ... | none | ... |
383
+
384
+ ### Architecture
385
+ [Short ASCII diagram only if the call chain is non-obvious. Omit if the file changes are self-explanatory.]
386
+
387
+ ### Contracts
388
+ [Actual TypeScript — interfaces, function signatures, prop types, route payloads. No prose.]
389
+
390
+ ```typescript
391
+ // replace with real types for this module
392
+ ```
393
+
394
+ ### Implementation notes
395
+ [Module-specific edge cases or constraints only. Omit anything already covered by constitution.md or quality-playbook.md.]
396
+
397
+ ### Auth / permissions
398
+ [Specific auth implications, or omit if none.]
399
+
400
+ ### Verification
401
+ - `[exact test command with flags and paths]`
402
+ - Manual: [specific UI action or API call]
403
+
404
+ ### Memory update
405
+ - **core-memory**: [exact sentences to append]
406
+ - **repo-map**: [exact table rows or section edits, or omit if no new routes/services/patterns]
407
+
408
+ ## Implementation order
409
+
410
+ [dependency chain]
411
+
412
+ ## Merge guidance
413
+
414
+ - ...
415
+
416
+ ## Test strategy
417
+
418
+ - Unit:
419
+ - Integration:
420
+ - Manual:
421
+
422
+ ## Files inventory
423
+
424
+ | File | Action | Module | Notes |
425
+ |------|--------|--------|-------|
426
+ | ... | Create | M1 | repo-map justification |
427
+ | ... | Update | M2 | |
428
+ | ... | Delete | M3 | callers verified zero via get_impact_radius |
429
+ ```
430
+
431
+ ### 4.3 Hard stop
432
+
433
+ After creating `Documentation/features/<feature_name>/<FEATURE_NAME>_ARCHITECTURE.md`:
434
+
435
+ - Present the plan to the user.
436
+ - Stop and wait for explicit approval.
437
+ - Do not generate module prompt files yet.
438
+ - Do not write application code yet.
439
+
440
+ If the user wants changes, update the architecture plan and re-present it.
441
+
442
+ ---
443
+
444
+ ## Phase 5 - Generate per-module implementation prompts
445
+
446
+ > Goal: after approval, generate one prompt file per module that a downstream AI can execute safely.
447
+
448
+ ### 5.1 Trigger
449
+
450
+ Only do this after the user explicitly approves the architecture plan from Phase 4.
451
+
452
+ ### 5.2 Output files
453
+
454
+ For each approved module `N`, create:
455
+
456
+ `Documentation/features/<feature_name>/MODULE_<N>_<MODULE_NAME>.md`
457
+
458
+ Example:
459
+
460
+ ```text
461
+ Documentation/features/pdf_export_queue/MODULE_1_SHARED_TYPES.md
462
+ Documentation/features/pdf_export_queue/MODULE_2_API_ROUTE.md
463
+ Documentation/features/pdf_export_queue/MODULE_3_QUEUE_WIDGET.md
464
+ Documentation/features/pdf_export_queue/MODULE_4_TESTS.md
465
+ ```
466
+
467
+ ### 5.3 Prompt file format
468
+
469
+ Each file should follow this format:
470
+
471
+ ```markdown
472
+ You are implementing a feature module in the this repo (Next.js App Router, React, TypeScript). Follow this process exactly.
473
+
474
+ First, read these files in order:
475
+ 1. `project-memory/constitution.md`
476
+ 2. `project-memory/repo-map.md`
477
+ 3. `project-memory/auth-model.md`
478
+ 4. `project-memory/quality-playbook.md`
479
+ 5. `project-memory/core-memory.md`
480
+ 6. `.agent/workflows/build-feature-react.workflow.md`
481
+ 7. `.agent/skills/feature-workflow/SKILL.md`
482
+ 8. `.agent/templates/FEATURE_PLAN.md`
483
+ 9. `.agent/templates/REVIEW_REPORT.md`
484
+ 10. `.agent/templates/TEST_PLAN.md`
485
+ 11. `Documentation/features/<feature_name>/<FEATURE_NAME>_ARCHITECTURE.md`
486
+
487
+ Artifact paths for this feature (use these; do not use .agent/plans or .agent/docs):
488
+ - Feature plan: `Documentation/features/<feature_name>/FEATURE_PLAN.md`
489
+ - Test plan: `Documentation/features/<feature_name>/TEST_PLAN.md`
490
+ - Review report: `Documentation/reports/REVIEW_REPORT.md`
491
+
492
+ Hard rules:
493
+ - No coding before plan approval.
494
+ - Implement only the approved scope for this module.
495
+ - Keep `page.tsx` files thin.
496
+ - Reuse existing auth surfaces; do not create parallel auth logic.
497
+ - Respect server/client boundaries.
498
+ - Reuse shared derivations/helpers instead of duplicating transforms.
499
+ - Before creating any new file, cross-reference `project-memory/repo-map.md` for existing alternatives; only create if none exists and document why.
500
+ - Before deleting any file, run `get_impact_radius` to confirm zero active callers, or execute the migration path specified in the architecture plan before removing the file.
501
+ - After implementation, run `.agent/skills/react-quality-review/SKILL.md` and fix all findings.
502
+ - If the module touches auth-sensitive code or protected routes, also run `.agent/skills/auth-and-permissions/SKILL.md`.
503
+ - Run tests and verification before finalizing: run the test suite (e.g. `npm run test`) for affected areas; fix all failures before updating memory or moving on.
504
+ - Update `project-memory/core-memory.md` after implementing the module and after tests/review are complete.
505
+ - If this module adds new API routes, services, hooks, or reusable patterns, update `project-memory/repo-map.md` (relevant tables or placement notes).
506
+ - Do not finalize development until required tests and verification commands have been run and recorded.
507
+
508
+ ---
509
+
510
+ ## Module <N> - <Module Name>
511
+
512
+ **Goal**: [one sentence — what this module produces]
513
+
514
+ **Depends on**: [module numbers or `-`]
515
+
516
+ ### Files to create
517
+
518
+ | File | Purpose |
519
+ |------|---------|
520
+ | `path/to/new/file.ts` | [what it exports and why no equivalent exists in repo-map] |
521
+
522
+ ### Files to modify
523
+
524
+ | File | Anchor symbol | Exact change |
525
+ |------|---------------|--------------|
526
+ | `path/to/file.ts` | `existingFunctionOrType` | [add / extend / replace — be specific: "add `newParam: Type` to signature", "extend return type with `NewField`", "insert case for `X` in switch"] |
527
+
528
+ ### Files to delete
529
+
530
+ | File | Pre-condition |
531
+ |------|--------------|
532
+ | `path/to/file.ts` | [only after callers in `other/file.ts` are migrated to `replacementSymbol`] |
533
+
534
+ ### Contracts
535
+
536
+ [Actual TypeScript — interfaces, function signatures, prop types, route payloads. No prose descriptions — write the real types.]
537
+
538
+ ```typescript
539
+ // example — replace with actual contracts for this module
540
+ export interface ExampleType {
541
+ id: string;
542
+ name: string;
543
+ }
544
+
545
+ export function exampleFn(id: string): Promise<ExampleType>
546
+ ```
547
+
548
+ ### Data flow
549
+
550
+ [Short ASCII diagram only if the call chain is non-obvious for this module. Omit if the file changes above make the flow self-evident.]
551
+
552
+ ### Auth / permissions
553
+
554
+ [Only include if this module touches auth-sensitive code or protected routes. Omit otherwise.]
555
+
556
+ ### Verification
557
+
558
+ - `[exact test command]` — [what it covers]
559
+ - Manual: [specific UI action or API call to confirm the module works end-to-end]
560
+
561
+ ### Memory update
562
+
563
+ - **core-memory**: [exact facts to append — completed status, files added/changed, key decisions, test gaps]
564
+ - **repo-map**: [exact table rows or section edits to add — only if this module introduces new routes, services, hooks, or reusable patterns; omit otherwise]
565
+
566
+ ---
567
+
568
+ ## Required planning output
569
+
570
+ Fill `Documentation/features/<feature_name>/FEATURE_PLAN.md` with:
571
+ 1. Requirement clarification
572
+ 2. Codebase study
573
+ 3. Detailed plan
574
+ 4. Implementation order
575
+
576
+ ## Quality and testing output
577
+
578
+ - Fill `Documentation/reports/REVIEW_REPORT.md`
579
+ - Fill `Documentation/features/<feature_name>/TEST_PLAN.md`
580
+ - Add or update the tests required by this module
581
+ - Run the test suite (e.g. `npm run test`) for affected areas; record commands and results in TEST_PLAN; fix failures before finalizing
582
+ - Append a completed module entry to `project-memory/core-memory.md`
583
+ - If the module added new routes, services, or patterns, update `project-memory/repo-map.md` accordingly
584
+ ```
585
+
586
+ ### 5.4 Content rules for module prompt files
587
+
588
+ When generating module prompt files, extract only what the implementing agent needs to act — not to understand the architecture decision. Concretely:
589
+
590
+ 1. **Goal**: one sentence, outcome-focused. Drop all rationale.
591
+ 2. **Files to create**: exact paths only. Drop repo-map justification prose (that was for the architecture review). A one-line purpose is enough.
592
+ 3. **Files to modify**: must include the anchor symbol (the existing function, type, or component to locate) and the exact change — "add X", "extend Y to include Z", "replace W with V". Never just "update this file to support the feature."
593
+ 4. **Files to delete**: keep only pre-conditions for safe deletion. Drop the impact-radius analysis (already done in the architecture plan).
594
+ 5. **Contracts**: write actual TypeScript — interfaces, function signatures, prop types, route payload shapes. Never describe them in prose. These are the authoritative types the agent must implement.
595
+ 6. **Data flow**: include only if the call chain across files is non-obvious. A single-file module rarely needs this. Keep it to the specific path for this module, not the whole feature.
596
+ 7. **Implementation notes**: omit entirely unless there is a module-specific edge case or constraint that is NOT already covered by `constitution.md` or `quality-playbook.md`. Generic reminders ("keep pages thin", "respect server/client boundary") belong in Hard rules, not here.
597
+ 8. **Auth / permissions**: include only if this specific module touches auth-sensitive code. Not a boilerplate flag.
598
+ 9. **Verification**: exact commands with flags, not generic `npm run test`. Specify which paths/suites to run.
599
+ 10. **Memory update**: exact sentences to append to core-memory and exact repo-map edits (table rows, section placement). No vague "document what changed."
600
+
601
+ ### 5.5 Confirmation to user
602
+
603
+ After generating prompt files, report:
604
+
605
+ - all created file paths
606
+ - which module each file covers
607
+ - recommended implementation order
608
+
609
+ ---
610
+
611
+ ## Quality gates
612
+
613
+ Before finalizing the architecture plan, verify:
614
+
615
+ - [ ] The relevant foundation docs were read first.
616
+ - [ ] Scope, assumptions, and open questions are explicit.
617
+ - [ ] Existing repo patterns were studied before proposing changes.
618
+ - [ ] `project-memory/repo-map.md` was cross-referenced against the feature domain to identify reuse candidates before proposing new files.
619
+ - [ ] Every proposed new file includes an explicit repo-map justification confirming no equivalent exists.
620
+ - [ ] Every proposed deletion has had `get_impact_radius` run; active callers are listed and either zeroed out or a migration path is specified.
621
+ - [ ] Each module has explicit dependencies.
622
+ - [ ] Each module includes verification steps.
623
+ - [ ] Server/client boundaries are respected.
624
+ - [ ] Auth-sensitive work is identified.
625
+ - [ ] Page files remain thin in the proposed design.
626
+ - [ ] Shared derivations/helpers are preferred over duplicate transforms.
627
+ - [ ] The files inventory covers every proposed file change (create, update, delete) with notes.
628
+ - [ ] The implementation order matches the dependency graph.
629
+ - [ ] Each module defines what must be written to `project-memory/core-memory.md`.
630
+ - [ ] When the feature adds new routes, services, or patterns, the plan (or Memory update) states that `project-memory/repo-map.md` must be updated.
631
+
632
+ ---
633
+
634
+ ## Chaining with other skills
635
+
636
+ This skill designs the implementation. It does not replace the existing execution workflow.
637
+
638
+ After planning:
639
+
640
+ 1. Use `.agent/skills/feature-workflow/SKILL.md` to implement each approved module.
641
+ 2. Use `.agent/skills/auth-and-permissions/SKILL.md` for auth-sensitive modules.
642
+ 3. Use `.agent/skills/react-quality-review/SKILL.md` after implementation.
643
+
644
+ The generated module prompts should make downstream implementation safer, smaller in scope, and consistent with the repo's required plan -> approval -> implementation -> review -> test sequence, with `project-memory/core-memory.md` updated after every implemented module.
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: auth-and-permissions
3
+ description: Add or modify auth-sensitive routes/pages without breaking the current Keystone/Prism auth model.
4
+ when_to_use:
5
+ - Creating or changing pages under `src/app/[lang]/(dashboard)/(private)/`
6
+ - Adding permission-gated UI behavior
7
+ - Updating auth-sensitive API routes under `src/app/api/**`
8
+ references:
9
+ - project-memory/repo-map.md
10
+ - project-memory/auth-model.md
11
+ - project-memory/constitution.md
12
+ - src/contexts/authContext.tsx
13
+ - src/utils/auth.ts
14
+ - src/configs/authConfig.ts
15
+ - src/types/auth.ts
16
+ ---
17
+
18
+ # Auth and Permissions Skill
19
+
20
+ ## Steps
21
+
22
+ 1. Read `project-memory/repo-map.md` and `project-memory/auth-model.md` before touching auth-sensitive code.
23
+ 2. For private pages, follow the existing route layout under `src/app/[lang]/(dashboard)/(private)/...`.
24
+ 3. For UI permission gating, consume auth state from `useAuth()` in `src/contexts/authContext.tsx`.
25
+ 4. Reuse auth helpers from `src/utils/auth.ts` for cookie/token/header behavior; do not duplicate logic.
26
+ 5. Keep cookie key contracts centralized in `src/configs/authConfig.ts`.
27
+ 6. Extend permission typing in `src/types/auth.ts` when introducing new permission keys.
28
+ 7. Add or update tests for authorized/unauthorized behavior where relevant.
29
+
30
+ ## Non-Negotiable Checklist (must all be true)
31
+
32
+ - [ ] Page/component auth state comes from `useAuth()` in `src/contexts/authContext.tsx`.
33
+ - [ ] Cookie and token handling reuses `src/utils/auth.ts` helpers or approved extensions.
34
+ - [ ] Cookie key usage remains centralized in `src/configs/authConfig.ts`.
35
+ - [ ] No duplicate auth helpers were added outside the canonical auth modules.
36
+ - [ ] Access tests cover both authorized and unauthorized outcomes.
37
+
38
+ ## Deliverable
39
+
40
+ For each auth-sensitive change, include a short note in PR/plan stating:
41
+ - route path changed
42
+ - permission key(s) used from `src/types/auth.ts` / permission checks
43
+ - where `useAuth()` and auth helpers enforce behavior