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,29 +1,48 @@
1
1
  ---
2
2
  name: explore-codebase
3
- description: Navigate and understand codebase structure using the knowledge graph
4
- disable-model-invocation: true
3
+ description: Navigate and understand a React/Next.js codebase efficiently using Serena's symbolic tools. Trigger when the user asks "where is X", "what does Y do", "how is Z wired", "where's the layout for ...", or asks for a tour of a module. Symbol-level navigation, not full-file reads.
5
4
  ---
6
5
 
7
- ## Explore Codebase
6
+ # Skill: explore-codebase (frontend)
8
7
 
9
- Use the code-review-graph MCP tools to explore and understand the codebase.
8
+ Use Serena to understand the codebase's structure and find specific code, without reading whole files.
10
9
 
11
- ### Steps
10
+ ## Steps
12
11
 
13
- 1. Run `list_graph_stats` to see overall codebase metrics.
14
- 2. Run `get_architecture_overview` for high-level community structure.
15
- 3. Use `list_communities` to find major modules, then `get_community` for details.
16
- 4. Use `semantic_search_nodes` to find specific functions or classes.
17
- 5. Use `query_graph` with patterns like `callers_of`, `callees_of`, `imports_of` to trace relationships.
18
- 6. Use `list_flows` and `get_flow` to understand execution paths.
12
+ 1. **Orient with project-memory first**
13
+ - If `project-memory/repo-map.md` exists, read it — it's the curated map of where things live.
14
+ - If `project-memory/architecture.md` exists, skim its module-topology and server/client boundary sections.
15
+ - For app-router projects, `src/app/` is the route tree; `src/app/(public)`, `(dashboard)`, etc. are route groups per `repo-map.md`.
19
16
 
20
- ### Tips
17
+ 2. **List symbols in candidate files**
18
+ - `get_symbols_overview(relative_path="<file or dir>")` — shows top-level symbols (components, hooks, exports) without reading their bodies.
19
+ - For app-router projects, `get_symbols_overview` on `src/app/<route>/page.tsx` and `layout.tsx` is the right starting point.
21
20
 
22
- - Start broad (stats, architecture) then narrow down to specific areas.
23
- - Use `children_of` on a file to see all its functions and classes.
24
- - Use `find_large_functions` to identify complex code.
21
+ 3. **Locate by name**
22
+ - `find_symbol(name_path="<name>", include_body=false)` find a component / hook / type by name. Add `substring_matching=true` for fuzzy.
23
+ - Use `name_path="<Component>/<method>"` for class methods (rare in React) or named exports.
25
24
 
26
- ## Token Efficiency Rules
27
- - ALWAYS start with `get_minimal_context(task="<your task>")` before any other graph tool.
28
- - Use `detail_level="minimal"` on all calls. Only escalate to "standard" when minimal is insufficient.
29
- - Target: complete any review/debug/refactor task in ≤5 tool calls and ≤800 total output tokens.
25
+ 4. **Read targeted symbol bodies**
26
+ - `find_symbol(name_path="...", include_body=true)` read only the symbol you need.
27
+
28
+ 5. **Trace relationships**
29
+ - `find_referencing_symbols(name_path="...", relative_path="...")` — find every consumer of a hook / component / type.
30
+ - This answers "what re-renders when this changes?" and "is this component still used?"
31
+
32
+ 6. **Check Serena memories**
33
+ - `list_memories` — prior session notes (project_overview, tech_stack, design-system, etc.)
34
+ - `read_memory(memory_name="...")` if relevant.
35
+
36
+ ## Tips
37
+
38
+ - **Project-memory before any tool call.** If `repo-map.md` answers the question, don't query Serena.
39
+ - **Symbols before files.** Default to `get_symbols_overview` over `Read`; default to `find_symbol(include_body=true)` over `Read` on a known file.
40
+ - **App router routing**: page files live in `src/app/<route>/page.tsx`. The route's UI is composed by `layout.tsx` (server) + page.tsx + any client components.
41
+ - **Hooks**: project hooks usually live in `src/hooks/` per `repo-map.md` — `find_symbol(name_path="useX")` is the fastest path.
42
+ - **Components**: shared components in `src/components/` or `src/@core/components/`; feature-specific views in `src/views/<feature>/`.
43
+
44
+ ## Token Efficiency
45
+
46
+ - Target ≤5 Serena calls for any exploration task.
47
+ - If you can't pinpoint what you need in 5 calls, the question is too broad — ask the user to narrow it.
48
+ - Never read a file's whole content just to find one symbol. Use Serena.
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: quick-execute
3
+ description: Fast execution for small frontend tasks (component bug fixes, prop tightening, a11y label additions, copy tweaks, single-component refactors). No planning gate, no approval cycle. Use when the user asks for a short, well-scoped UI change and there is no need for UX or architectural design. Trigger with `/quick-execute <task>` or natural-language descriptions of a small change.
4
+ disable-model-invocation: false
5
+ ---
6
+
7
+ # Skill: quick-execute
8
+
9
+ A no-friction execution skill. Skip planning, skip approval gates, ship the change.
10
+
11
+ **Use it for:** typo / copy fixes, a11y label additions, prop type tightening, conditional rendering fixes, single-component bug fixes (incorrect state, missing dep), simple style tweaks confined to one component, key prop fixes in lists.
12
+
13
+ **Do NOT use it for:** anything touching UX layout, auth context/route gating, design-system primitives, new pages/routes, or more than ~3 files. Those go through `/ux-architect` or `/architect`.
14
+
15
+ ---
16
+
17
+ ## Phase 1 — Understand the task
18
+
19
+ Read the user's request. If anything is genuinely ambiguous (not a stylistic preference — a load-bearing decision), ask **exactly one** clarifying question. Otherwise proceed.
20
+
21
+ If the task description references a file or component the user already has open, treat that as the starting point — don't re-search for it.
22
+
23
+ ---
24
+
25
+ ## Phase 2 — Locate (Serena-first, ≤3 calls)
26
+
27
+ Use Serena to pinpoint the code that needs to change.
28
+
29
+ | Need | Tool |
30
+ |---|---|
31
+ | Find a component / hook by name | `find_symbol(name_path="...", include_body=false)` |
32
+ | Inspect a file's structure | `get_symbols_overview(relative_path="...")` |
33
+ | Find callers before changing a hook/component | `find_referencing_symbols(...)` |
34
+ | Read a specific symbol's body | `find_symbol(name_path="...", include_body=true)` |
35
+
36
+ **Hard cap: 3 Serena calls.** If you can't pinpoint the change in 3 calls, the task is too vague for `/quick-execute` — STOP and recommend `/explore-codebase`, `/ux-architect`, or `/architect`.
37
+
38
+ Project-memory: do **not** read project-memory docs in this skill. If the change is small enough for `/quick-execute`, it's small enough that constitution-level rules apply only if obviously violated.
39
+
40
+ ---
41
+
42
+ ## Phase 3 — Execute
43
+
44
+ Make the change. Use Serena's symbolic edit tools where the change is symbol-shaped:
45
+
46
+ - Replacing a whole component / hook → `replace_symbol_body`
47
+ - Inserting a new component near an existing one → `insert_after_symbol` / `insert_before_symbol`
48
+ - Small in-line edits inside a larger symbol → `replace_content` (regex/string)
49
+
50
+ For trivial JSX tweaks (single-line conditional, ARIA attribute, key prop), prefer `replace_content` over reading the whole component.
51
+
52
+ No approval gate. No "here's what I'm about to do" preamble. Just do it.
53
+
54
+ ---
55
+
56
+ ## Phase 4 — Verify
57
+
58
+ Run the smallest verification that covers the change:
59
+
60
+ 1. **If a test file exists for the affected component** (e.g. `Component.test.tsx`, `Component.spec.tsx`) — run `npm test -- <scoped pattern>`. If it passes, done.
61
+ 2. **If no test exists, run the lint check** — `npm run lint` (or equivalent from `package.json` scripts). For TypeScript projects, also `npx tsc --noEmit` is acceptable as a quick gate.
62
+ 3. **If neither applies, run build** — `npm run build` (catches type/import errors).
63
+ 4. **If none of the above is feasible** — state explicitly: "No automated verification available. Manual check: [one concrete thing — render the page, click X, verify Y]."
64
+
65
+ Do not write a new test just to verify a `/quick-execute` change. If the change needs new tests, it's outside this skill's scope.
66
+
67
+ ---
68
+
69
+ ## Phase 5 — Summarize
70
+
71
+ One paragraph. State:
72
+
73
+ - What changed (1 sentence, file + component/hook)
74
+ - Why (1 sentence, the user's intent restated)
75
+ - How it was verified (1 sentence)
76
+
77
+ No bulleted lists, no headings, no "what's next" section. Just the paragraph.
78
+
79
+ ---
80
+
81
+ ## Hard Guardrails (STOP and recommend `/ux-architect` or `/architect`)
82
+
83
+ If during execution you discover any of the following, **stop immediately** and tell the user the task needs `/ux-architect` (for UX/visual decisions) or `/architect` (for technical decomposition):
84
+
85
+ - The change requires editing more than 3 files
86
+ - The change touches `project-memory/auth-model.md` concerns (auth context, route gating, useAuth, permission keys)
87
+ - The change introduces a new page or route under `src/app/` (or the project's pages directory)
88
+ - The change touches the design-system layer — custom wrappers (`CustomTextField`, `CustomDialog`, etc.), theme tokens, breakpoints
89
+ - The change modifies any context provider, app-shell layout, or top-level provider tree
90
+ - The change requires installing or upgrading a third-party dependency
91
+ - The change crosses the server/client boundary (adding `'use client'`, converting a server component to client, etc.)
92
+ - You realize there are callers/consumers (other components, hooks, pages) that need coordinated updates
93
+
94
+ Tell the user: "This is bigger than `/quick-execute` is designed for. Recommend `/ux-architect <task>` (if UX/visual changes) or `/architect <task>` (if technical only) to plan it properly." Do not partially execute and leave the system in an inconsistent state.
95
+
96
+ ---
97
+
98
+ ## Do not
99
+
100
+ - Plan. There is no plan phase in this skill.
101
+ - Ask for approval. The user invoked `/quick-execute` precisely to skip that.
102
+ - Make unrelated improvements ("while I'm here, I also cleaned up the styles..."). Stay in scope.
103
+ - Update `project-memory/core-memory.md`. Small changes don't earn a history entry.
104
+ - Commit or push. Leave that to the user.
105
+ - Introduce new dependencies, change rendering strategy (SSR↔CSR), or restructure hooks/components beyond the original scope.
@@ -1,29 +1,57 @@
1
1
  ---
2
2
  name: refactor-safely
3
- description: Plan and execute safe refactoring using dependency analysis
4
- disable-model-invocation: true
3
+ description: Plan and execute React/Next.js refactors with confidence. Uses Serena's symbolic tools for impact analysis (consumers, references) and symbolic edits (rename, replace_symbol_body, safe_delete_symbol) plus React-specific guardrails for hooks, components, and the server/client boundary. Trigger on "rename", "refactor", "extract", "split", "consolidate", "move" requests.
5
4
  ---
6
5
 
7
- ## Refactor Safely
6
+ # Skill: refactor-safely (frontend)
8
7
 
9
- Use the knowledge graph to plan and execute refactoring with confidence.
8
+ Symbol-level refactors with bounded blast radius. The rule: **map impact first, then edit**.
10
9
 
11
- ### Steps
10
+ ## Steps
12
11
 
13
- 1. Use `refactor_tool` with mode="suggest" for community-driven refactoring suggestions.
14
- 2. Use `refactor_tool` with mode="dead_code" to find unreferenced code.
15
- 3. For renames, use `refactor_tool` with mode="rename" to preview all affected locations.
16
- 4. Use `apply_refactor_tool` with the refactor_id to apply renames.
17
- 5. After changes, run `detect_changes` to verify the refactoring impact.
12
+ 1. **Locate the target symbol**
13
+ - `find_symbol(name_path="<name>", include_body=true)` read the current definition.
18
14
 
19
- ### Safety Checks
15
+ 2. **Map blast radius**
16
+ - `find_referencing_symbols(name_path="<name>", relative_path="<file>")` — every consumer.
17
+ - Count and review the result. If >20 consumers and the user asked for a quick rename, surface impact first: "This affects N consumer sites — confirm before I proceed."
20
18
 
21
- - Always preview before applying (rename mode gives you an edit list).
22
- - Check `get_impact_radius` before major refactors.
23
- - Use `get_affected_flows` to ensure no critical paths are broken.
24
- - Run `find_large_functions` to identify decomposition targets.
19
+ 3. **Preview the plan**
20
+ - List files and line ranges that will change.
21
+ - For renames: old new name and how many sites update.
22
+ - For signature changes: list each consumer and how it needs to adapt.
23
+ - For prop changes: list every component using the prop.
24
+ - Get user confirmation if the refactor touches more than a single file.
25
25
 
26
- ## Token Efficiency Rules
27
- - ALWAYS start with `get_minimal_context(task="<your task>")` before any other graph tool.
28
- - Use `detail_level="minimal"` on all calls. Only escalate to "standard" when minimal is insufficient.
29
- - Target: complete any review/debug/refactor task in ≤5 tool calls and ≤800 total output tokens.
26
+ 4. **Apply the edit symbolically**
27
+ - **Rename**: `rename_symbol(name_path="...", relative_path="...", new_name="...")` updates definition + all references in one call.
28
+ - **Replace a component/hook body**: `replace_symbol_body(name_path="...", relative_path="...", body="<new body>")`.
29
+ - **Insert near a symbol**: `insert_after_symbol` / `insert_before_symbol`.
30
+ - **Delete safely**: `safe_delete_symbol(name_path="...", relative_path="...")` — verifies no remaining references first.
31
+ - **Small in-line edits**: `replace_content(relative_path="...", pattern="...", replacement="...")`.
32
+
33
+ 5. **Verify**
34
+ - `find_referencing_symbols` again after rename — confirm everything was updated.
35
+ - Run `npm run build && npm run lint` (and tests if scoped) to catch type and lint failures.
36
+
37
+ ## React-specific safety rules
38
+
39
+ - **Renaming a hook**: confirm every caller is inside another hook or component function. If any caller is at module top level, the rename is unsafe (top-level hooks violate Rules of React) — abort and recommend `/architect` for a deeper refactor.
40
+ - **Changing a hook's parameter or return shape**: flag every consumer that destructures the return value — confirm each one updates correctly. Don't apply a partial change.
41
+ - **Changing a hook's dependency array shape (effects/memos/callbacks)**: flag as needing review — the meaning may change. Do not auto-apply.
42
+ - **Splitting a component**: preserve `displayName` if used in dev tools, tests, or analytics.
43
+ - **Renaming a component used by an app-shell layout** (root layout, providers, error boundaries): surface as a high-impact change before proceeding.
44
+ - **Crossing the server/client boundary**: moving code between `'use client'` and server components is **not** a `/refactor-safely` operation — recommend `/architect`.
45
+ - **Moving a class component → functional component**: out of scope; recommend `/architect`.
46
+ - **Changing a component's props in a way that breaks API**: if `project-memory/design-system.md` documents the component as public, surface the breaking-change risk before proceeding.
47
+
48
+ ## Safety rules (general)
49
+
50
+ - **Never delete a symbol without `find_referencing_symbols` first.** Use `safe_delete_symbol` which does this check for you.
51
+ - **For cross-module renames** (the symbol is exported and used by other modules), confirm with the user before running `rename_symbol`.
52
+ - **If `project-memory/architecture.md` documents the refactored area as stable/public**, surface that to the user before proceeding.
53
+
54
+ ## Token Efficiency
55
+
56
+ - Target ≤6 Serena calls per refactor: locate (1) + impact (1) + edit (1) + verify (1-3).
57
+ - Don't re-read files after symbolic edits — Serena's edit tools are reliable; if they returned without error, the change is applied.
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: security-assessment
3
+ description: Run a standalone security audit on the frontend codebase, a diff, or a specific path. Covers XSS, client-side auth bypass, secret leakage (NEXT_PUBLIC_), CSP & headers, third-party scripts, dependency audit, data exposure, cookies & storage. Outputs a structured SECURITY_ASSESSMENT report with CRITICAL/HIGH/MEDIUM/LOW findings. Trigger with `/security-assessment [scope]` where scope is `diff`, `path:<path>`, or `full`. Also invoked as a sub-agent by `/module-runner` and `/architect`.
4
+ disable-model-invocation: false
5
+ ---
6
+
7
+ # Skill: security-assessment (frontend)
8
+
9
+ A focused security audit for React / Next.js codebases. Distinct from `/code-reviewer` — that skill checks React quality + correctness; this one goes deep on security only and produces a security-specific report.
10
+
11
+ **Two invocation modes:**
12
+
13
+ 1. **Standalone (default)** — Triggered by user. Writes `documentation/reports/SECURITY_ASSESSMENT_<YYYY-MM-DD>.md` and presents a summary in chat.
14
+ 2. **Sub-agent mode** — Invoked by `/module-runner` (per-module audit) or `/architect` (pre-design review). Returns JSON. Detect via parent prompt saying "sub-agent mode" or "mode=subagent".
15
+
16
+ ---
17
+
18
+ ## Phase 1 — Determine scope
19
+
20
+ | Invocation | Scope |
21
+ |---|---|
22
+ | `/security-assessment` (no args) | `diff` — audit changed files only (current branch vs main/master) |
23
+ | `/security-assessment diff` | Same as above, explicit |
24
+ | `/security-assessment path:src/app/(public)` | Audit a specific path |
25
+ | `/security-assessment full` | Audit the entire codebase (slow — confirm before proceeding) |
26
+
27
+ For `full`, ask: "Full-codebase audit may take significant time and tokens. Proceed?" Wait for confirmation. Skip this prompt in sub-agent mode.
28
+
29
+ For `diff`: `git diff --name-only origin/main...HEAD` (fall back to `main` → `master` → `develop`).
30
+
31
+ ---
32
+
33
+ ## Phase 2 — Load auth model + design-system
34
+
35
+ Required:
36
+ - `project-memory/auth-model.md` — client-side auth: route gating mechanism, useAuth, permission keys, public-vs-private route convention, what client must enforce vs what backend enforces
37
+
38
+ If missing, **STOP**. Tell the user: "Cannot run security-assessment without `project-memory/auth-model.md`. Run `/create-blueprint auth-model` first."
39
+
40
+ Optional (skip silently if absent):
41
+ - `project-memory/constitution.md` — for rules on logging, secret handling, no-PII rules
42
+ - `project-memory/design-system.md` — to identify which custom wrappers handle escaping vs raw rendering
43
+
44
+ ---
45
+
46
+ ## Phase 3 — Map the audit surface with Serena (≤8 calls)
47
+
48
+ | Need | Tool |
49
+ |---|---|
50
+ | All page / layout files in scope | `find_symbol(name_path="...", substring_matching=true)` on `Page` / `Layout` |
51
+ | Components rendering arbitrary HTML | grep / search for `dangerouslySetInnerHTML` (raw `Bash grep` if Serena doesn't surface it) |
52
+ | `next.config.js` headers / CSP | direct `Read` |
53
+ | Public env-var usage | grep for `NEXT_PUBLIC_` and `process.env.NEXT_PUBLIC_` |
54
+ | Third-party `<script>` tags / `next/script` | grep |
55
+ | `localStorage` / `sessionStorage` writes | grep |
56
+ | Cookie handlers | `find_symbol` on documented cookie helpers from `auth-model.md` |
57
+
58
+ Build the audit-target list first; read symbol bodies in Phase 4 only as needed.
59
+
60
+ ---
61
+
62
+ ## Phase 4 — Run the audit checks
63
+
64
+ ### 4.1 XSS
65
+
66
+ For every component or page in scope:
67
+ - `dangerouslySetInnerHTML` usage — is the source trusted? Is it sanitized (DOMPurify, isomorphic-dompurify, sanitize-html)? Flag any uses sourcing from API responses or URL params without sanitization.
68
+ - Raw HTML from markdown libraries — confirm the markdown lib is configured safely (no raw HTML pass-through unless explicitly trusted).
69
+ - URL params reflected directly into the DOM (e.g. `<div>{searchParams.q}</div>` is fine; `dangerouslySetInnerHTML={{ __html: searchParams.q }}` is a finding).
70
+ - Anchor `href` with user-controlled URL — must use `rel="noreferrer noopener"` for `target="_blank"`, and `javascript:` URLs must be filtered.
71
+ - Inline event handlers built from strings.
72
+
73
+ ### 4.2 Client-side auth bypass
74
+
75
+ - Per `auth-model.md`, every private route must use the documented gate (HOC, middleware, server-side check).
76
+ - Any `if (user.role === ...)` check that controls *access* (not just UI rendering) must have a server-side counterpart — UI checks alone are not security.
77
+ - Flag any direct API calls (in client components) that fetch sensitive data without an auth check on the server side.
78
+ - Verify that login / logout flows match `auth-model.md` (no ad-hoc token reads from URL, no localStorage tokens unless documented).
79
+
80
+ ### 4.3 Secret leakage
81
+
82
+ - Every `NEXT_PUBLIC_*` env var: examine its value/role. If it looks like a secret (`*_SECRET`, `*_KEY`, `*_TOKEN`, server-only API tokens), it leaks into the client bundle — **CRITICAL**.
83
+ - Hardcoded API keys, JWT secrets, Stripe live keys, etc. in any client-side file — `git grep -nE "(sk_live|pk_live|api[_-]?key|jwt[_-]?secret)"` patterns.
84
+ - Server-only code accidentally imported into a client component (signaled by `'use client'` at top + import of server-only utility).
85
+ - Source maps shipped in production builds (`next.config.js` — `productionBrowserSourceMaps`).
86
+
87
+ ### 4.4 CSP & security headers
88
+
89
+ Inspect `next.config.js` (or `next.config.mjs`):
90
+ - `Content-Security-Policy` defined? Avoids `'unsafe-inline'` and `'unsafe-eval'`?
91
+ - `frame-ancestors` set (clickjacking protection)?
92
+ - `Strict-Transport-Security`, `X-Content-Type-Options: nosniff`, `Referrer-Policy`, `Permissions-Policy` configured?
93
+ - For other frameworks: `vite.config.ts` plugin equivalents, `_headers` (Netlify), `vercel.json` headers.
94
+
95
+ ### 4.5 Third-party scripts
96
+
97
+ - All `<script src="https://...">` (and `next/script`) entries: verify the source is intentional and reputable.
98
+ - `crossOrigin` and `integrity` (SRI) attributes for any external script you control loading-order of.
99
+ - Loading-strategy review for `next/script`: `beforeInteractive` for auth-sensitive scripts is suspicious; default `afterInteractive` is safer.
100
+ - Any `eval`-equivalent constructs introduced by third-party libs (e.g. analytics with inline scripts).
101
+
102
+ ### 4.6 Dependency audit
103
+
104
+ - Run `npm audit --omit=dev` (best-effort; capture summary). Flag CRITICAL/HIGH advisories.
105
+ - Pay special attention to: parsers (markdown, XML, YAML), sanitizers, JWT libs, crypto libs, anything handling user input.
106
+ - Recent diff added a new dep? Justified, reputable, maintained?
107
+
108
+ ### 4.7 Data exposure
109
+
110
+ - Any component rendering raw token / password / secret fields directly (`<div>{user.apiToken}</div>`).
111
+ - `console.log` / `console.error` calls in client code that include auth tokens, full user objects with PII, API keys.
112
+ - Production-build leaks: ensure `console.*` statements are stripped in production (or that production logger guards them).
113
+ - API responses over-fetching: client components receiving full user objects from server when only a subset is needed (reduce attack surface).
114
+ - Error boundaries / fallback UIs that print stack traces in production.
115
+
116
+ ### 4.8 Cookies & storage
117
+
118
+ - `localStorage` / `sessionStorage` writes carrying anything sensitive: auth tokens, session IDs, PII. These should be in `httpOnly` cookies instead.
119
+ - Cookie helpers (per `auth-model.md`) — confirm `Secure`, `SameSite=Lax` or `Strict`, `httpOnly` (server-set) where applicable.
120
+ - IndexedDB usage with sensitive data — same rule: not for tokens.
121
+
122
+ ---
123
+
124
+ ## Phase 5 — Synthesize findings
125
+
126
+ Severity (see `templates/SECURITY_REPORT.md`):
127
+
128
+ - **CRITICAL** — `NEXT_PUBLIC_*` secret leak, client-only auth gate on sensitive data, hardcoded production credentials, XSS with attacker-controlled HTML reaching the DOM
129
+ - **HIGH** — Missing CSP / `'unsafe-inline'` in CSP, sensitive data in localStorage, missing SRI on third-party scripts loading auth-adjacent code, missing server-side enforcement counterpart
130
+ - **MEDIUM** — Missing security headers, third-party script without integrity hash, PII in client logs, sourcemaps in prod
131
+ - **LOW** — Hygiene: minor unused `NEXT_PUBLIC_` vars, inline event handlers from constants, etc.
132
+
133
+ Discard speculative findings. Every finding must cite a `file:line`.
134
+
135
+ ---
136
+
137
+ ## Phase 6 — Output
138
+
139
+ ### 6.1 Standalone mode
140
+
141
+ Write report to `documentation/reports/SECURITY_ASSESSMENT_<YYYY-MM-DD>.md` using `.agent/templates/SECURITY_REPORT.md`. Fill every section. If a section has no findings, write "No findings." — do not delete the section.
142
+
143
+ Then in chat:
144
+ - Counts: "0 CRITICAL, 2 HIGH, 3 MEDIUM, 1 LOW"
145
+ - The HIGH/CRITICAL findings, one line each
146
+ - The report path
147
+
148
+ Do not paste the full report into chat.
149
+
150
+ ### 6.2 Sub-agent mode
151
+
152
+ Do **not** write a file. Return:
153
+
154
+ ```json
155
+ {
156
+ "verdict": "clean" | "fix_required" | "block",
157
+ "counts": { "critical": 0, "high": 0, "medium": 0, "low": 0 },
158
+ "findings": [
159
+ {
160
+ "severity": "CRITICAL" | "HIGH" | "MEDIUM" | "LOW",
161
+ "category": "xss" | "auth_bypass" | "secret_leak" | "csp" | "third_party" | "deps" | "data_exposure" | "storage" | "other",
162
+ "title": "<short>",
163
+ "files": ["<path:line>"],
164
+ "fix": "<one sentence>"
165
+ }
166
+ ]
167
+ }
168
+ ```
169
+
170
+ `verdict = block` if any CRITICAL. `verdict = fix_required` if any HIGH. `verdict = clean` otherwise.
171
+
172
+ The parent (`/module-runner`'s security-fixer phase) consumes this JSON and applies fixes for CRITICAL/HIGH automatically.
173
+
174
+ ---
175
+
176
+ ## Do not
177
+
178
+ - Write code fixes in this skill. Fixes happen in `/module-runner`'s security-fixer phase or surface to the user.
179
+ - Update `project-memory/`. Findings don't change the source of truth.
180
+ - Speculate. Every finding must be backed by `file:line`.
181
+ - Run `full` without explicit confirmation (in standalone mode).
182
+ - Confuse UI-level permission display with security. Hiding a button doesn't enforce auth — the server must.
@@ -0,0 +1,198 @@
1
+ ---
2
+ name: ux-architect
3
+ description: Plan the UX, layout, and component composition for a frontend feature BEFORE technical decomposition. Reads project-memory (design-system, repo-map, architecture, auth-model), invokes `/vuexy-component-guide` as a read-only sub-agent to maximize reuse, surveys existing pages/views/components via Serena, and produces `<feature>_UX_PLAN.md`. NEVER writes code. Hands off to `/architect` for technical module decomposition. Trigger with `/ux-architect <feature description>`.
4
+ disable-model-invocation: false
5
+ ---
6
+
7
+ # Skill: ux-architect
8
+
9
+ The UX/layout planner for frontend features. You design **what the user will see and how it composes from existing components** before the technical decomposition happens.
10
+
11
+ ## Hard guarantee — ux-architect NEVER writes code
12
+
13
+ This skill produces a single document: `documentation/features/<feature_name>/<feature>_UX_PLAN.md`.
14
+
15
+ **What ux-architect MUST NOT touch:**
16
+ - Anything under `src/` (pages, components, hooks, services, styles)
17
+ - `next.config.js`, theme files, design-token modules
18
+ - Tests
19
+ - Git
20
+ - Dependencies (`package.json`)
21
+ - `project-memory/` (except optional notes to `core-memory.md` deferred to `/module-runner`)
22
+
23
+ If you feel the urge to "just sketch the JSX" or "show the component code", stop. The UX plan describes composition; `/module-runner` writes the code later, guided by `/architect`'s technical module plan, which itself consumes this UX plan.
24
+
25
+ ---
26
+
27
+ ## When to trigger
28
+
29
+ - User asks to "design", "plan UX for", "wireframe", "lay out", or "spec the screen for" a feature
30
+ - A `/brainstorm` session picked an approach that includes new UI
31
+ - The user is about to call `/architect` but the visual/composition decisions haven't been made yet
32
+
33
+ ---
34
+
35
+ ## Output
36
+
37
+ `documentation/features/<feature_name>/<feature>_UX_PLAN.md` — written using the template at `.agent/templates/UX_PLAN.md`.
38
+
39
+ Naming:
40
+ - `<feature_name>` is `snake_case` (e.g. `user_profile_drawer`, `bulk_actions_toolbar`)
41
+
42
+ ---
43
+
44
+ ## Phase 0 — Prerequisites (HARD STOP)
45
+
46
+ Required project-memory files:
47
+
48
+ - `project-memory/design-system.md`
49
+ - `project-memory/repo-map.md`
50
+ - `project-memory/architecture.md`
51
+ - `project-memory/auth-model.md`
52
+
53
+ If any are missing, **STOP** and respond:
54
+
55
+ > ⚠️ `/ux-architect` requires the following project-memory files to ground UX decisions in this project's actual conventions. Missing:
56
+ > - [list each missing file]
57
+ >
58
+ > Run `/create-blueprint all` (or `/create-blueprint <artifact>` for individual ones), then re-invoke `/ux-architect <feature>`.
59
+
60
+ Do not proceed to Phase 1 until every required file exists.
61
+
62
+ ---
63
+
64
+ ## Phase 1 — Understand intent
65
+
66
+ Capture, in your own words (one short paragraph):
67
+
68
+ - **Who is the user?** Role, permission level, context of use.
69
+ - **What do they see?** The screens/dialogs/drawers in play.
70
+ - **What does success look like?** A single sentence describing the user's end state.
71
+ - **Accessibility** — any specific a11y requirements stated or implied (keyboard-only flow, screen-reader-critical, etc.)
72
+ - **Responsive scope** — which breakpoints matter (mobile-first? desktop-only admin?)
73
+
74
+ If anything load-bearing is ambiguous (not stylistic — actually changes the plan), ask **exactly one** clarifying question and stop. Otherwise proceed.
75
+
76
+ ---
77
+
78
+ ## Phase 2 — Read foundational docs
79
+
80
+ Read in order:
81
+
82
+ | File | What you extract |
83
+ |------|------------------|
84
+ | `project-memory/design-system.md` | Design tokens, breakpoints, color/spacing scale, custom-wrapper inventory, theming approach |
85
+ | `project-memory/architecture.md` | App-router structure, server/client boundary rules, state-management approach, data-fetching patterns |
86
+ | `project-memory/repo-map.md` | Where pages/views/hooks/components live, naming conventions, existing reusable components registry |
87
+ | `project-memory/auth-model.md` | Private-vs-public route convention, useAuth pattern, permission keys, route gating mechanism |
88
+ | `project-memory/core-memory.md` (if present) | Prior decisions about similar features — avoid re-litigating |
89
+
90
+ ---
91
+
92
+ ## Phase 3 — Sub-agent consult: `/vuexy-component-guide` (REQUIRED)
93
+
94
+ This is the **reuse-first** step. Always run it. Run it **before** sketching any layouts — what's available shapes what you propose.
95
+
96
+ Spawn `/vuexy-component-guide` as a sub-agent (Claude Code Task tool / Cursor subagent / foreground for Codex). The parent prompt includes:
97
+
98
+ > Sub-agent mode. Proposed UI surface for feature `<feature_name>`:
99
+ > - Pages / routes: [list]
100
+ > - Dialogs / drawers / modals: [list with what each contains]
101
+ > - Forms: [list with field counts and validation needs]
102
+ > - Lists / tables / cards: [list with item shape]
103
+ > - States: empty / loading / error for each fetch surface
104
+ >
105
+ > Return reuse_candidates and gaps per your SKILL.md sub-agent contract.
106
+
107
+ Capture the returned JSON. Every UI element you proposed should map to either a `reuse_candidate` or a `gap`. If something is unaccounted for in the response, ask the sub-agent to re-run (or surface it as a finding to the user).
108
+
109
+ ---
110
+
111
+ ## Phase 4 — Sub-agent consult: existing-pages reuse (Serena, ≤6 calls)
112
+
113
+ Identify any existing pages, views, or components this feature should **extend** rather than duplicate.
114
+
115
+ | Need | Tool |
116
+ |---|---|
117
+ | Find similar pages | `find_symbol(name_path="...Page", substring_matching=true)` |
118
+ | Find similar dialogs/drawers | `find_symbol(name_path="...Dialog", substring_matching=true)` and `...Drawer` |
119
+ | Inspect a candidate page's structure | `get_symbols_overview(relative_path="src/.../page.tsx")` |
120
+ | Read a candidate component body | `find_symbol(name_path="...", include_body=true)` |
121
+
122
+ Output of this phase: a short list — "Existing components/pages this feature should extend or compose with, with file paths". Surface these in the UX plan's "Reuse from existing app" section.
123
+
124
+ ---
125
+
126
+ ## Phase 5 — Compose the UX plan
127
+
128
+ Use `.agent/templates/UX_PLAN.md` as the template. Fill every section:
129
+
130
+ 1. **Feature summary** — one paragraph: who, what they see, what success looks like
131
+ 2. **Scope decisions** — in scope, out of scope, assumptions (explicit and confirmable)
132
+ 3. **Reuse from existing app** — from Phase 4 (pages/components/hooks to extend or compose with)
133
+ 4. **Component reuse from design system** — from Phase 3 (`reuse_candidates` from `/vuexy-component-guide`)
134
+ 5. **Gaps & new patterns** — from Phase 3 (`gaps` from `/vuexy-component-guide`) — each gap needs a stated plan (build new, propose addition to design system, or close as out-of-scope)
135
+ 6. **Pages & routes** — every new or modified route; note `'use client'` decisions
136
+ 7. **Page-by-page layout** — for each page, an ASCII wireframe + which components compose each region
137
+ 8. **Dialogs / drawers / modals** — trigger, content composition, dismissal behavior
138
+ 9. **Forms** — fields, validation rules, submit behavior, error rendering; reference the form pattern from the design system
139
+ 10. **State surface** — for every stateful piece: where it lives (local / hook / context / server) and the data shape
140
+ 11. **Empty / loading / error states** — required for every list, fetch, and form surface — no exceptions
141
+ 12. **A11y** — keyboard nav order, ARIA roles, focus management on dialog open/close, color/contrast considerations
142
+ 13. **Responsive** — breakpoint behavior for each layout; mobile-vs-desktop differences spelled out
143
+ 14. **Auth gating** — which routes are private, which UI is permission-gated, what `useAuth()` (or documented equivalent) drives each gate
144
+ 15. **Design-system fit** — confirm: any new tokens? any new wrappers? Default expectation is no. If yes, surface as a finding requiring design-system extension before implementation.
145
+ 16. **Open questions** — any UX decisions deferred because the user needs to weigh in
146
+
147
+ Each section is text + ASCII + references. No JSX, no CSS, no code.
148
+
149
+ ---
150
+
151
+ ## Phase 6 — Approval gate (HARD STOP)
152
+
153
+ After writing `_UX_PLAN.md`, **STOP**. Present to the user:
154
+
155
+ - Path to the UX plan file
156
+ - One-paragraph summary of the visual outcome
157
+ - Any `gaps` from the design-system consult that need a decision
158
+ - Any `Open questions` from Phase 5
159
+
160
+ Wait for explicit approval. If the user requests changes, update the plan and re-present.
161
+
162
+ ---
163
+
164
+ ## Phase 7 — Hand off to `/architect`
165
+
166
+ After approval, present the next-step instruction:
167
+
168
+ > ✅ UX plan approved. The technical module decomposition is the next step.
169
+ >
170
+ > Run: `/architect documentation/features/<feature_name>/`
171
+ >
172
+ > `/architect` will read your UX plan and produce a `MODULE_WISE_PLAN.md` that translates this UX into ordered technical modules (page-layer, view-layer, hooks, services). It will then write per-module prompts that `/module-runner` consumes to build each module autonomously.
173
+
174
+ `/ux-architect` is done after this hand-off. Do not do `/architect`'s job from here.
175
+
176
+ ---
177
+
178
+ ## Quality gates
179
+
180
+ Before finalizing the UX plan, verify:
181
+
182
+ - [ ] Every UI element in scope maps to either a design-system `reuse_candidate` or an explicit `gap` (no UI silently invented)
183
+ - [ ] Every fetch surface has empty / loading / error states defined
184
+ - [ ] Every form has validation rules and a submit-error UX
185
+ - [ ] Every private route has its auth gate named per `auth-model.md`
186
+ - [ ] No new design tokens or wrappers without an explicit "Design-system fit" finding
187
+ - [ ] Open questions are real questions for the user, not deferred decisions you should have made
188
+
189
+ ---
190
+
191
+ ## Do not
192
+
193
+ - Write code (no JSX, no CSS, no TypeScript types beyond field shape descriptions)
194
+ - Speculate about API shapes — those belong in `/architect`'s technical module plan
195
+ - Skip the `/vuexy-component-guide` consult — reuse-first is the whole point of this skill
196
+ - Propose new custom wrappers without surfacing them as a design-system gap
197
+ - Update `project-memory/`. If the design system itself needs an addition, suggest `/create-blueprint design-system` after this UX plan is approved
198
+ - Create the `documentation/features/<feature_name>/` directory until Phase 5 (avoid empty directories on early-exit)