nurosys-agents 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.agent/INSTRUCTIONS.md +31 -1
  2. package/.agent/frontend/skills/architect/SKILL.md +309 -467
  3. package/.agent/frontend/skills/auth-and-permissions/SKILL.md +185 -41
  4. package/.agent/frontend/skills/brainstorm/SKILL.md +127 -0
  5. package/.agent/frontend/skills/code-reviewer/SKILL.md +307 -0
  6. package/.agent/frontend/skills/{react-quality-review → code-reviewer}/examples.md +2 -2
  7. package/.agent/frontend/skills/create-blueprint/SKILL.md +280 -130
  8. package/.agent/frontend/skills/debug-issue/SKILL.md +76 -18
  9. package/.agent/frontend/skills/explore-codebase/SKILL.md +38 -19
  10. package/.agent/frontend/skills/quick-execute/SKILL.md +105 -0
  11. package/.agent/frontend/skills/refactor-safely/SKILL.md +47 -19
  12. package/.agent/frontend/skills/security-assessment/SKILL.md +182 -0
  13. package/.agent/frontend/skills/ux-architect/SKILL.md +198 -0
  14. package/.agent/frontend/skills/vuexy-component-guide/SKILL.md +51 -0
  15. package/.agent/frontend/workflows/module-runner.claude.md +233 -0
  16. package/.agent/frontend/workflows/module-runner.codex.md +159 -0
  17. package/.agent/frontend/workflows/module-runner.cursor.md +218 -0
  18. package/.agent/templates/UX_PLAN.md +228 -0
  19. package/README.md +28 -3
  20. package/package.json +2 -2
  21. package/scripts/setup-rules.js +13 -4
  22. package/.agent/frontend/skills/feature-workflow/SKILL.md +0 -61
  23. package/.agent/frontend/skills/react-quality-review/SKILL.md +0 -126
  24. package/.agent/frontend/workflows/build-feature-react.workflow.md +0 -82
  25. package/.agent/frontend/workflows/feature-module-runner.md +0 -101
  26. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/_sections.md +0 -0
  27. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/_template.md +0 -0
  28. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/advanced-event-handler-refs.md +0 -0
  29. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/advanced-init-once.md +0 -0
  30. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/react-rules-calling.md +0 -0
  31. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/react-rules-hooks.md +0 -0
  32. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/react-rules-purity.md +0 -0
  33. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-activity.md +0 -0
  34. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-conditional-render.md +0 -0
  35. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-content-visibility.md +0 -0
  36. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-hoist-jsx.md +0 -0
  37. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-usetransition-loading.md +0 -0
  38. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-defer-reads.md +0 -0
  39. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-dependencies.md +0 -0
  40. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-derived-state-no-effect.md +0 -0
  41. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-derived-state.md +0 -0
  42. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-functional-setstate.md +0 -0
  43. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-lazy-state-init.md +0 -0
  44. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-memo-with-default-value.md +0 -0
  45. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-memo.md +0 -0
  46. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-move-effect-to-event.md +0 -0
  47. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-no-inline-components.md +0 -0
  48. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-simple-expression-in-memo.md +0 -0
  49. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-transitions.md +0 -0
  50. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-use-ref-transient-values.md +0 -0
@@ -1,43 +1,187 @@
1
1
  ---
2
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
3
+ description: Frontend auth & permission guardrails. Audits private routes, useAuth usage, permission-gated UI, and cookie/session handling against the project's documented client-side auth model. Generic across Next.js App Router, Pages Router, Vite/CRA — driven entirely by `project-memory/auth-model.md`. Trigger on changes touching auth, login, logout, session, route guards, useAuth, useSession, permission, role. Also invoked as a sub-agent by `/architect` and `/module-runner`.
4
+ disable-model-invocation: false
5
+ ---
6
+
7
+ # Skill: auth-and-permissions (frontend)
8
+
9
+ Audits a frontend change for auth correctness. This skill is **fully generic** — it owns the *checks*, but the project's specific context provider, useAuth hook, route-gating mechanism, cookie helpers, and permission keys all come from `project-memory/auth-model.md`.
10
+
11
+ **Important reminder:** Client-side auth is **never** the security boundary. The server must enforce. This skill audits whether the **UI correctly reflects** the auth model — not whether the auth model itself is sound (that's `/security-assessment`'s job).
12
+
13
+ **Three invocation modes:**
14
+
15
+ 1. **Manual / standalone** — Triggered by user or `/code-reviewer` for PR-level auth review. Produces a structured checklist note in chat.
16
+ 2. **Sub-agent mode (planning_input)** — Invoked by `/architect` during planning. Returns JSON drafting the auth approach for a planned module before implementation.
17
+ 3. **Sub-agent mode (findings)** — Invoked by `/module-runner` per-module review. Returns JSON with findings.
18
+
19
+ Detect sub-agent modes from the parent prompt: "mode=subagent" or "sub-agent mode" + role (architect / module-runner).
20
+
21
+ ---
22
+
23
+ ## Phase 1 Load the auth model
24
+
25
+ Read `project-memory/auth-model.md`. Extract:
26
+
27
+ | Concept (generic) | What you learn from auth-model.md (project-specific) |
28
+ |---|---|
29
+ | **Context provider** | The component/file that provides auth state app-wide (e.g. `<AuthProvider>`) |
30
+ | **useAuth hook** | The hook (or helper) that exposes the authenticated user, permissions, login/logout |
31
+ | **Private-route convention** | How a route is marked private — file convention (`(private)` segment), HOC, middleware, server-side check, etc. |
32
+ | **Public-route convention** | How a route is explicitly marked public |
33
+ | **Permission keys** | The enumeration of permission strings the UI uses |
34
+ | **Cookie / token helpers** | Names of cookie read/write helpers and what storage layer they use |
35
+ | **Login / logout flows** | The documented endpoints + UI flows |
36
+ | **Server-side counterpart** | What the backend enforces (so the audit can flag client-only "checks") |
37
+
38
+ If `auth-model.md` does not exist, **STOP**. Tell the user: "Cannot audit auth without `project-memory/auth-model.md`. Run `/create-blueprint auth-model` first."
39
+
40
+ Also read (skip silently if absent):
41
+ - `project-memory/constitution.md` non-negotiable rules
42
+ - `project-memory/repo-map.md` file locations for auth implementation
43
+
44
+ ---
45
+
46
+ ## Phase 2 — Determine scope
47
+
48
+ | Invocation | Scope |
49
+ |---|---|
50
+ | User-triggered, no args | Changed files on current branch (`git diff --name-only origin/main...HEAD`) |
51
+ | `/auth-and-permissions path:<path>` | Specific path |
52
+ | `/auth-and-permissions route:<route>` | Single route (resolve to its file path via `repo-map.md`) |
53
+ | Sub-agent from `/architect` | The proposed module's planned UI surface (described in parent prompt) |
54
+ | Sub-agent from `/module-runner` | Current module's diff |
55
+
56
+ ---
57
+
58
+ ## Phase 3 — Identify the audit surface (Serena, ≤6 calls)
59
+
60
+ - `get_symbols_overview` on each changed file to see what's there
61
+ - `find_symbol` on the context provider name from `auth-model.md` — verify it wraps the right scope
62
+ - `find_symbol` on the useAuth hook name — list its callers via `find_referencing_symbols`
63
+ - Identify changed pages under the documented private-route convention
64
+ - Identify components using documented cookie/token helpers
65
+
66
+ ---
67
+
68
+ ## Phase 4 — Run the checks (generic, driven by auth-model)
69
+
70
+ ### 4.1 Private-route gating
71
+
72
+ - [ ] Every page under the documented private-route convention is wrapped by the documented gate (server-side check, HOC, layout, or middleware — per `auth-model.md`).
73
+ - [ ] No private page renders sensitive UI before auth has resolved (no flicker of authenticated content for unauthenticated users).
74
+ - [ ] No private page directly reads cookies/tokens; everything goes through the documented helpers.
75
+
76
+ ### 4.2 useAuth as the single source of truth
77
+
78
+ - [ ] Components that need user identity or permissions use `useAuth()` (or the documented equivalent) — not ad-hoc context, not direct cookie reads, not props drilled from a random ancestor.
79
+ - [ ] No duplicate context providers for the same data.
80
+ - [ ] No login state derived from the URL or local component state in places where it should come from the auth model.
81
+
82
+ ### 4.3 Permission-gated UI
83
+
84
+ - [ ] Permission checks use keys from the documented permission enumeration in `auth-model.md` — no ad-hoc strings (e.g. `'user.edit'` typo'd as `'user-edit'`).
85
+ - [ ] Permission checks gate UI elements appropriately (buttons disabled or hidden, menu items omitted, etc.) but DO NOT replace server-side enforcement.
86
+ - [ ] Negative-case UI is intentional: disabled with tooltip / hidden / "Not authorized" message — not silent failure on click.
87
+
88
+ ### 4.4 No client-only security checks
89
+
90
+ - [ ] Any UI logic that *protects sensitive data* must have a server-side counterpart. Hiding a "Delete user" button is fine; making `DELETE /api/users/:id` succeed only if the UI was visible is not.
91
+ - [ ] No client-only feature flags that gate access to data — the server must enforce.
92
+
93
+ ### 4.5 Cookie / storage hygiene
94
+
95
+ - [ ] Sensitive tokens are not stored in `localStorage` / `sessionStorage` unless explicitly documented in `auth-model.md` (default: must be `httpOnly` cookies).
96
+ - [ ] Cookie writes/reads go through the documented helpers — no `document.cookie` raw access in feature code.
97
+ - [ ] Login/logout flows follow `auth-model.md` exactly — no shortcut bypasses.
98
+
99
+ ### 4.6 Loading and error states for auth
100
+
101
+ - [ ] Components don't assume `user` is truthy when auth is still loading.
102
+ - [ ] Logout / session-expired states clear sensitive cached data (SWR / React Query / Zustand stores per `auth-model.md`).
103
+ - [ ] Permission-denied responses from the server trigger a clear UX (not a silent stale-data display).
104
+
105
+ ---
106
+
107
+ ## Phase 5 — Output
108
+
109
+ ### 5.1 Manual / standalone mode
110
+
111
+ Chat response in this structure:
112
+
113
+ ```
114
+ ## Auth & Permissions Audit (frontend) — <feature or scope>
115
+
116
+ **Scope**: <files / routes reviewed>
117
+ **Auth-model reference**: project-memory/auth-model.md (<one-line summary of relevant section>)
118
+
119
+ ### Route inventory
120
+ | Route | Type | Gate | Permission(s) gating UI | Verdict |
121
+ |-------|------|------|--------------------------|---------|
122
+ | /dashboard/users | private | <HOC/middleware name> | users:read (page), users:update (edit button) | ✅ |
123
+
124
+ ### Findings
125
+ | Severity | Issue | File:line | Fix |
126
+ |---|---|---|---|
127
+ | BLOCKER / HIGH / MED / LOW | ... | ... | ... |
128
+
129
+ ### Verdict
130
+ - **Decision**: ✅ Clear / ⚠️ Fix required / 🛑 Block
131
+ - **Required fixes before merge**: <list, or "none">
132
+ ```
133
+
134
+ Severity guide:
135
+ - `BLOCKER` — missing gate on a private route, sensitive data exposed before auth resolves, raw token in `localStorage`, hardcoded auth secrets in client code
136
+ - `HIGH` — permission-key typos that silently miss the gate, missing server-side counterpart for client-only check
137
+ - `MED` — cookie attribute misses (when client controls them), duplicate context providers
138
+ - `LOW` — stylistic / minor refactor recommendations
139
+
140
+ ### 5.2 Sub-agent mode — when called by `/architect` (planning input)
141
+
142
+ Return JSON describing the **recommended auth approach** for the planned module. No file written.
143
+
144
+ ```json
145
+ {
146
+ "mode": "planning_input",
147
+ "routes": [
148
+ {
149
+ "route": "/dashboard/users",
150
+ "type": "private",
151
+ "gate": "<gate mechanism from auth-model: HOC/layout/middleware/server-check>",
152
+ "page_permission": "<permission key gating page access, or null>",
153
+ "ui_gates": [
154
+ { "ui_element": "Edit button", "permission": "users:update", "negative_ux": "disabled with tooltip" }
155
+ ],
156
+ "use_auth_consumers": ["<list of view/component names that need useAuth>"],
157
+ "data_dependencies": "<what the page fetches; which fetches require auth context>"
158
+ }
159
+ ],
160
+ "notes": "<one short paragraph of non-obvious considerations>"
161
+ }
162
+ ```
163
+
164
+ ### 5.3 Sub-agent mode — when called by `/module-runner` (review)
165
+
166
+ Return JSON with audit findings (same shape as `/security-assessment`):
167
+
168
+ ```json
169
+ {
170
+ "verdict": "clean" | "fix_required" | "block",
171
+ "findings": [
172
+ { "severity": "BLOCKER|HIGH|MED|LOW", "issue": "...", "file": "<path:line>", "fix": "..." }
173
+ ]
174
+ }
175
+ ```
176
+
177
+ `verdict = block` for any BLOCKER. `verdict = fix_required` for any HIGH. `verdict = clean` otherwise.
178
+
179
+ ---
180
+
181
+ ## Do not
182
+
183
+ - Hardcode framework-specific names (context names, hook names, file paths). If you find yourself writing a literal class/hook name in this skill, stop — the right name lives in `project-memory/auth-model.md`.
184
+ - Recommend installing an alternate auth library. The documented system is the system.
185
+ - Fix code in this skill. Surface findings; fixes happen in `/module-runner` or by the user.
186
+ - Update `project-memory/auth-model.md`. If the model itself is wrong, the user runs `/create-blueprint auth-model` to refresh it.
187
+ - Confuse UI permission display with security. This skill audits **UI correctness**, not server enforcement. Server enforcement is the backend's job and out of scope here.
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: brainstorm
3
+ description: Explore 3-5 distinct approaches to a frontend problem, feature, or design decision. Outputs structured options with tradeoffs and a recommendation. No code, no implementation, no planning artifacts — pure ideation. Use BEFORE `/ux-architect` (UI work) or `/architect` (technical refactor) 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 /ux-architect <chosen approach>" (UI/layout work) | "Run /architect <chosen approach>" (technical-only refactor, no UX change) | "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,307 @@
1
+ ---
2
+ name: code-reviewer
3
+ description: Full-stack React code review for frontend changes on the current branch. Reads all project-memory docs, audits changed files against constitution, design-system, auth-model, plus the 23 React-specific rules (Rules of React, rerender optimization, rendering performance, advanced patterns), and writes a structured REVIEW_REPORT. Trigger on any "review my changes", "review this branch", "do a code review", or "review <feature>" request. Also invoked as a sub-agent by `/module-runner`.
4
+ ---
5
+
6
+ # Skill: code-reviewer (frontend)
7
+
8
+ Perform a thorough React-aware code review of all uncommitted or branch-level changes. Output is a structured review report written to `documentation/reports/` (or the active feature folder), or a JSON findings object in sub-agent mode.
9
+
10
+ **Two invocation modes:**
11
+
12
+ 1. **Standalone (default)** — Triggered by user. Writes a REVIEW_REPORT file and presents a summary in chat.
13
+ 2. **Sub-agent mode** — Invoked by `/module-runner`. Returns JSON findings; no file written.
14
+
15
+ ---
16
+
17
+ ## When to trigger
18
+
19
+ - User says "review my changes", "do a code review", "review this branch", or similar.
20
+ - User asks for a review of a specific feature/module before merging.
21
+ - Used automatically at the end of each module by `/module-runner`.
22
+
23
+ ---
24
+
25
+ ## Phase 1 — Understand the change surface
26
+
27
+ ### 1.1 Identify changed files
28
+
29
+ ```bash
30
+ git status
31
+ git diff --name-only HEAD
32
+ git diff --name-only --cached
33
+ git diff --name-only main...HEAD # or origin/main / master / develop per project
34
+ ```
35
+
36
+ Collect modified / added / deleted files, the branch name (to infer feature/milestone), and whether changes are staged/unstaged/committed.
37
+
38
+ ### 1.2 Infer feature and milestone
39
+
40
+ From branch name or dominant changed-folder under `src/`:
41
+ - **Feature name**: slug after `feature/`, `feat/`, or derived from changed folder (e.g. `user-profile-drawer`).
42
+ - **Milestone**: highest module number under `documentation/features/<feature>/`, otherwise `M0` or omit.
43
+
44
+ ### 1.3 Use Serena symbolic tools first
45
+
46
+ Before reading any file end-to-end, use Serena.
47
+
48
+ | Need | Serena tool |
49
+ |---|---|
50
+ | List symbols in a changed file | `get_symbols_overview(relative_path="...")` |
51
+ | Read a specific component / hook body | `find_symbol(name_path="...", include_body=true)` |
52
+ | Find all callers of a hook/component | `find_referencing_symbols(name_path="...", relative_path="...")` |
53
+ | Locate a class/hook/component by name | `find_symbol(name_path="...", substring_matching=true)` |
54
+ | Prior session notes | `list_memories` then `read_memory` if names look relevant |
55
+
56
+ For each changed file:
57
+ 1. `get_symbols_overview` first
58
+ 2. For changed symbols, `find_symbol(include_body=true)` to read just that symbol
59
+ 3. For risky changes (shared hooks, context providers, app-shell layouts), `find_referencing_symbols` to see consumers
60
+
61
+ Fall back to raw `Read` only when symbol navigation can't surface the relevant code (configs, plain markdown).
62
+
63
+ **Token efficiency**: target ≤8 Serena calls for the structural analysis phase.
64
+
65
+ ---
66
+
67
+ ## Phase 2 — Load project-memory
68
+
69
+ Read all of these (skip silently if absent, note the omission):
70
+
71
+ | File | Purpose |
72
+ |------|---------|
73
+ | `project-memory/constitution.md` | Non-negotiable rules: React idioms, a11y minimums, performance budgets, no-secret-in-client |
74
+ | `project-memory/quality-playbook.md` | High-signal anti-patterns with symptoms and preferred fixes |
75
+ | `project-memory/auth-model.md` | Client-side auth: context, useAuth, route gating, permission keys |
76
+ | `project-memory/architecture.md` | App-router structure, server/client boundaries, state management approach |
77
+ | `project-memory/design-system.md` | Design tokens, custom wrappers, form patterns |
78
+ | `project-memory/models.md` (if present) | Domain types/interfaces |
79
+ | `project-memory/repo-map.md` | Module layout, reusable components registry |
80
+ | `project-memory/core-memory.md` | Historical decisions, completed modules |
81
+
82
+ ---
83
+
84
+ ## Phase 3 — Review the changed code
85
+
86
+ For each changed file, tag findings by severity. The React-specific rule set (in `rules/`) drives most of these checks.
87
+
88
+ ### 3.1 Rules of React (CRITICAL — `react-rules-*`)
89
+
90
+ - [ ] `react-rules-purity` — Components and hooks are pure; no side effects during render
91
+ - [ ] `react-rules-hooks` — Hooks called only at top level, only from React functions
92
+ - [ ] `react-rules-calling` — No components called as functions, no hooks passed as values
93
+
94
+ ### 3.2 Re-render optimization (MEDIUM — `rerender-*`)
95
+
96
+ 13 rules covering: no inline-component definitions, derive state during render (not in effects), memoization boundaries, lazy state init, transitions, ref-transient values, effect-vs-event boundaries, functional setState for stable callbacks, etc. Drill into the specific `rules/rerender-*.md` file for any finding.
97
+
98
+ ### 3.3 Rendering performance (MEDIUM — `rendering-*`)
99
+
100
+ 5 rules: hoist static JSX, ternary over `&&` for conditional rendering, useTransition over manual loading state, CSS `content-visibility: auto` for long lists, Activity for preserving hidden UI state.
101
+
102
+ ### 3.4 Advanced patterns (LOW — `advanced-*`)
103
+
104
+ 2 rules: event-handler refs for stable callbacks, init-once for app-level singletons.
105
+
106
+ ### 3.5 Server / client boundary (per `architecture.md`)
107
+
108
+ - [ ] `'use client'` directives only where needed (interactivity, hooks, browser APIs)
109
+ - [ ] No server-only utilities imported into client components
110
+ - [ ] Page components stay thin per `architecture.md`; data fetching at the right layer
111
+ - [ ] No NEXT_PUBLIC_* secrets leaked (cross-check with `/security-assessment` for full audit)
112
+
113
+ ### 3.6 Auth correctness (per `auth-model.md`)
114
+
115
+ - [ ] Private routes use the documented gate
116
+ - [ ] `useAuth()` (or documented equivalent) is the single source of truth for user/permissions
117
+ - [ ] Permission checks use documented keys, not ad-hoc strings
118
+ - [ ] No client-only security checks gating sensitive data
119
+
120
+ ### 3.7 Design-system fidelity (per `design-system.md`)
121
+
122
+ - [ ] New UI uses documented custom wrappers / Vuexy components — not raw MUI components when a wrapper exists
123
+ - [ ] No new design tokens / colors / spacing introduced inline (must live in the theme)
124
+ - [ ] Forms use the documented pattern (react-hook-form + valibot, per design-system)
125
+
126
+ ### 3.8 Accessibility minimums
127
+
128
+ - [ ] Interactive elements have semantic HTML or appropriate `role`
129
+ - [ ] Icon-only buttons have `aria-label`
130
+ - [ ] Keyboard nav works (Tab order, Escape on dialogs, focus management)
131
+ - [ ] Color is not the sole carrier of meaning (text/icon paired)
132
+ - [ ] Form fields have visible labels (not placeholder-only)
133
+
134
+ ### 3.9 State management and data fetching
135
+
136
+ - [ ] State lives at the right scope (local / hook / context / server) per `architecture.md`
137
+ - [ ] No prop drilling >2 levels for data that should be a hook or context
138
+ - [ ] Empty / loading / error states present for every fetch surface
139
+ - [ ] No race conditions in effects (proper cleanup, cancellation)
140
+
141
+ ### 3.10 Architecture alignment
142
+
143
+ - [ ] Changes respect module topology in `architecture.md`
144
+ - [ ] No new unexpected coupling between layers (page → service is normal; service → page is not)
145
+ - [ ] Pages stay thin — composition lives in views/components
146
+
147
+ ---
148
+
149
+ ## Phase 4 — Determine the output location
150
+
151
+ | Condition | Output path |
152
+ |-----------|-------------|
153
+ | Active feature with folder under `documentation/features/<feature>/` | `documentation/features/<feature>/REVIEW_REPORT_<feature>_<milestone>.md` |
154
+ | General / no clearly scoped feature folder | `documentation/reports/REVIEW_REPORT_<feature>_<milestone>.md` |
155
+ | No feature identifiable | `documentation/reports/REVIEW_REPORT_<branch-slug>.md` |
156
+
157
+ ---
158
+
159
+ ## Phase 5 — Write the review report
160
+
161
+ Save to the path from Phase 4. Use this template:
162
+
163
+ ```markdown
164
+ # Frontend Code Review Report
165
+
166
+ ## Feature
167
+ `<feature-name>` — <short description>
168
+
169
+ ## Branch
170
+ `<branch-name>`
171
+
172
+ ## Scope Reviewed
173
+ <Bullet list of changed files/folders and what each covers>
174
+
175
+ ---
176
+
177
+ ## Findings
178
+
179
+ ### BLOCKER
180
+ - **File**: `path/to/Component.tsx:42`
181
+ - **Issue**: <what is wrong>
182
+ - **Rule**: <constitution rule / quality-playbook anchor / `rules/<rule-id>.md`>
183
+ - **Fix**: <minimum change to resolve>
184
+
185
+ *(none)* if no blockers.
186
+
187
+ ### HIGH
188
+ <Same format. HIGH = must fix before merge.>
189
+
190
+ *(none)* if none.
191
+
192
+ ### MEDIUM
193
+ <Same format. MEDIUM = should fix in this PR; defer with documented rationale.>
194
+
195
+ *(none)* if none.
196
+
197
+ ### LOW / SUGGESTION
198
+ <Same format. LOW = nice-to-have improvements.>
199
+
200
+ *(none)* if none.
201
+
202
+ ---
203
+
204
+ ## React Rules Coverage Summary
205
+
206
+ | Category | Checked | Findings |
207
+ |----------|---------|----------|
208
+ | Rules of React (CRITICAL) | yes | 0 |
209
+ | Re-render optimization | yes | <count> |
210
+ | Rendering performance | yes | <count> |
211
+ | Advanced patterns | yes | <count> |
212
+
213
+ ## Architecture Alignment
214
+ <1–3 bullets on alignment with project-memory/architecture.md and repo-map.md. Note deviations.>
215
+
216
+ ## Auth and Security Summary
217
+ <1–2 sentences on auth coverage. Reference `/auth-and-permissions` and/or `/security-assessment` for deeper passes.>
218
+
219
+ ## Design-System Fidelity
220
+ <1–2 sentences on whether changes used documented wrappers/patterns or introduced new ones.>
221
+
222
+ ## Quality Gate Status
223
+
224
+ | Gate | Status | Notes |
225
+ |------|--------|-------|
226
+ | TypeScript compile (`npx tsc --noEmit`) | pass / fail / not run | |
227
+ | Lint (`npm run lint`) | pass / fail / not run | |
228
+ | Unit tests | pass / fail / not run | |
229
+ | E2E tests (if configured) | pass / fail / not run | |
230
+ | Build (`npm run build`) | pass / fail / not run | |
231
+
232
+ Run the gates feasible in your environment. Report blocked gates and whether they're pre-existing failures unrelated to these changes.
233
+
234
+ ## Recommendation
235
+
236
+ **APPROVE** / **APPROVE WITH CONDITIONS** / **REQUEST CHANGES**
237
+
238
+ <1–2 sentences explaining the decision and any required follow-up.>
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Phase 6 — Output
244
+
245
+ ### 6.1 Standalone mode
246
+
247
+ After writing the report, output to the user:
248
+ 1. Full path of the written report
249
+ 2. Concise inline summary:
250
+ - Count of blockers / high / medium / low findings
251
+ - Overall recommendation
252
+ - Any CRITICAL finding that must be addressed before merge
253
+
254
+ ### 6.2 Sub-agent mode (invoked by `/module-runner`)
255
+
256
+ Detect from parent prompt: "mode=subagent" or "sub-agent mode".
257
+
258
+ In sub-agent mode:
259
+ - **Do NOT write a REVIEW_REPORT file.** All findings go in the JSON return value.
260
+ - Auto-approve internal decisions; no clarifying questions.
261
+ - Skip the "Quality Gate Status" section (runner handles build/test separately).
262
+ - Return:
263
+
264
+ ```json
265
+ {
266
+ "verdict": "clean" | "fix_required" | "block",
267
+ "counts": { "blocker": 0, "high": 0, "medium": 0, "low": 0 },
268
+ "findings": [
269
+ {
270
+ "id": "F1",
271
+ "severity": "BLOCKER" | "HIGH" | "MEDIUM" | "LOW",
272
+ "category": "react-rules" | "rerender" | "rendering" | "advanced" | "server-client" | "auth" | "design-system" | "a11y" | "state" | "architecture",
273
+ "rule_id": "<e.g. rerender-no-inline-components — if a rule file matches>",
274
+ "file": "<path:line>",
275
+ "issue": "<one sentence>",
276
+ "fix": "<one sentence>",
277
+ "required": true | false
278
+ }
279
+ ]
280
+ }
281
+ ```
282
+
283
+ `verdict = block` if any BLOCKER. `verdict = fix_required` if any HIGH or MEDIUM with `required=true`. `verdict = clean` otherwise.
284
+
285
+ The parent (`/module-runner`'s code-fixer step) applies fixes for `required=true` findings only.
286
+
287
+ ---
288
+
289
+ ## Quality gates for the review itself
290
+
291
+ Before finalizing:
292
+
293
+ - [ ] Every finding cites a `rules/<rule-id>.md` file, a constitution section, or an `auth-model.md` / `design-system.md` section.
294
+ - [ ] Every finding names the exact `file:line`.
295
+ - [ ] The report describes what's wrong and what the fix is — not what the code does.
296
+ - [ ] Auth and a11y coverage is explicitly confirmed or flagged, not assumed.
297
+ - [ ] No stylistic-preference findings without a rule citation.
298
+ - [ ] Gate status reflects actual command output, not assumptions.
299
+
300
+ ---
301
+
302
+ ## Notes
303
+
304
+ - This skill reads project-memory but does NOT modify it. `core-memory.md` is updated by `/module-runner`'s Step 7, not here.
305
+ - For dedicated security audit (XSS, CSP, secret leakage, deps), use `/security-assessment`.
306
+ - For dedicated auth audit, use `/auth-and-permissions`.
307
+ - The 23 React-specific rule files live under `.agent/.../code-reviewer/rules/` (one file per rule with explanation, bad/good examples, references).
@@ -1,6 +1,6 @@
1
- # React Quality Review Examples
1
+ # Code Reviewer Examples (React)
2
2
 
3
- Use these examples with `.agent/skills/react-quality-review/SKILL.md` and `project-memory/quality-playbook.md`.
3
+ Use these examples with `.agent/frontend/skills/code-reviewer/SKILL.md`, `project-memory/quality-playbook.md`, and the 23 rule files under `rules/`.
4
4
 
5
5
  ## Example 1: Thin page composition (good)
6
6