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.
- package/.agent/INSTRUCTIONS.md +31 -1
- package/.agent/frontend/skills/architect/SKILL.md +309 -467
- package/.agent/frontend/skills/auth-and-permissions/SKILL.md +185 -41
- package/.agent/frontend/skills/brainstorm/SKILL.md +127 -0
- package/.agent/frontend/skills/code-reviewer/SKILL.md +307 -0
- package/.agent/frontend/skills/{react-quality-review → code-reviewer}/examples.md +2 -2
- package/.agent/frontend/skills/create-blueprint/SKILL.md +280 -130
- package/.agent/frontend/skills/debug-issue/SKILL.md +76 -18
- package/.agent/frontend/skills/explore-codebase/SKILL.md +38 -19
- package/.agent/frontend/skills/quick-execute/SKILL.md +105 -0
- package/.agent/frontend/skills/refactor-safely/SKILL.md +47 -19
- package/.agent/frontend/skills/security-assessment/SKILL.md +182 -0
- package/.agent/frontend/skills/ux-architect/SKILL.md +198 -0
- package/.agent/frontend/skills/vuexy-component-guide/SKILL.md +51 -0
- package/.agent/frontend/workflows/module-runner.claude.md +233 -0
- package/.agent/frontend/workflows/module-runner.codex.md +159 -0
- package/.agent/frontend/workflows/module-runner.cursor.md +218 -0
- package/.agent/templates/UX_PLAN.md +228 -0
- package/README.md +28 -3
- package/package.json +2 -2
- package/scripts/setup-rules.js +13 -4
- package/.agent/frontend/skills/feature-workflow/SKILL.md +0 -61
- package/.agent/frontend/skills/react-quality-review/SKILL.md +0 -126
- package/.agent/frontend/workflows/build-feature-react.workflow.md +0 -82
- package/.agent/frontend/workflows/feature-module-runner.md +0 -101
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/_sections.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/_template.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/advanced-event-handler-refs.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/advanced-init-once.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/react-rules-calling.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/react-rules-hooks.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/react-rules-purity.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-activity.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-conditional-render.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-content-visibility.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-hoist-jsx.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-usetransition-loading.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-defer-reads.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-dependencies.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-derived-state-no-effect.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-derived-state.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-functional-setstate.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-lazy-state-init.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-memo-with-default-value.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-memo.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-move-effect-to-event.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-no-inline-components.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-simple-expression-in-memo.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-transitions.md +0 -0
- /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-use-ref-transient-values.md +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-blueprint
|
|
3
|
-
description:
|
|
4
|
-
disable-model-invocation:
|
|
3
|
+
description: Bootstrap or refresh `project-memory/` artifacts (constitution, auth-model, repo-map, architecture, design-system, models, quality-playbook, core-memory) from the current React/Next.js codebase. The canonical onboarding skill — run this FIRST when installing nurosys-agents in a new project. Uses Serena for symbolic codebase analysis. Trigger with `/create-blueprint all` to bootstrap everything, or `/create-blueprint <artifact_type>` for a single artifact.
|
|
4
|
+
disable-model-invocation: false
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Skill: create-blueprint
|
|
@@ -14,7 +14,7 @@ Use this skill to generate or refresh project-memory documentation artifacts bas
|
|
|
14
14
|
|
|
15
15
|
- User asks `create-blueprint all` — runs all artifact types in sequence (full project-memory setup).
|
|
16
16
|
- User asks `create-blueprint <artifact_type>` or `update-blueprint <artifact_type>` — creates or refreshes a single artifact.
|
|
17
|
-
- Artifact types: `constitution`, `auth-model`, `repo-map`, `core-memory`, `models`, `architecture`, `quality-playbook`.
|
|
17
|
+
- Artifact types: `constitution`, `auth-model`, `repo-map`, `core-memory`, `models`, `architecture`, `design-system`, `quality-playbook`.
|
|
18
18
|
- When codebase has evolved significantly and project-memory docs are stale or missing.
|
|
19
19
|
- After completing a major feature or architectural refactor to capture new patterns.
|
|
20
20
|
|
|
@@ -22,13 +22,14 @@ Use this skill to generate or refresh project-memory documentation artifacts bas
|
|
|
22
22
|
|
|
23
23
|
When the user passes `all`, run each artifact **in this order** (dependencies first):
|
|
24
24
|
|
|
25
|
-
1. `architecture` — establish
|
|
26
|
-
2. `models` —
|
|
27
|
-
3. `repo-map` — module layout needed by all other docs
|
|
28
|
-
4. `
|
|
29
|
-
5. `
|
|
30
|
-
6. `
|
|
31
|
-
7. `
|
|
25
|
+
1. `architecture` — establish app-router structure, server/client boundary rules, state-management approach
|
|
26
|
+
2. `models` — shared types/interfaces inform repo map and constitution
|
|
27
|
+
3. `repo-map` — module layout (pages/views/hooks/services/components) needed by all other docs
|
|
28
|
+
4. `design-system` — design tokens, custom-wrapper inventory, form patterns (frontend-only artifact)
|
|
29
|
+
5. `constitution` — rules derived from observed patterns in the codebase
|
|
30
|
+
6. `auth-model` — client-side auth: context, useAuth, route gating, permission keys
|
|
31
|
+
7. `quality-playbook` — patterns and anti-patterns (derived from real code)
|
|
32
|
+
8. `core-memory` — last, as it captures decisions made above
|
|
32
33
|
|
|
33
34
|
After each artifact is generated and approved, continue to the next without stopping for further user input unless a blocking question arises (e.g., ambiguous auth pattern). At the end, report a summary table of all artifacts created.
|
|
34
35
|
|
|
@@ -38,13 +39,14 @@ After each artifact is generated and approved, continue to the next without stop
|
|
|
38
39
|
|
|
39
40
|
| Artifact | Purpose | When to create/update |
|
|
40
41
|
|----------|---------|----------------------|
|
|
41
|
-
| `constitution` | Non-negotiable rules (
|
|
42
|
-
| `auth-model` |
|
|
43
|
-
| `repo-map` |
|
|
44
|
-
| `core-memory` | Historical implementation decisions, completed
|
|
45
|
-
| `models` |
|
|
46
|
-
| `architecture` |
|
|
47
|
-
| `
|
|
42
|
+
| `constitution` | Non-negotiable rules (React rules, a11y minimums, no-secret-in-client, performance budgets) | After major framework upgrades or quality decisions |
|
|
43
|
+
| `auth-model` | Client-side auth: context provider, useAuth hook, route gating mechanism, permission keys, cookie helpers, login/logout flows | After auth system changes or new permission patterns |
|
|
44
|
+
| `repo-map` | Pages/views/hooks/services/components layout, naming conventions, reusable components registry | After adding new module categories or changing structure |
|
|
45
|
+
| `core-memory` | Historical implementation decisions, completed features, design lessons, known patterns | End of each completed feature or milestone |
|
|
46
|
+
| `models` | Shared TypeScript types / interfaces / valibot schemas for domain entities | After new entity additions or significant type changes |
|
|
47
|
+
| `architecture` | App-router structure, server/client boundaries, state-management approach, data-fetching patterns, integration points | After architectural refactors |
|
|
48
|
+
| `design-system` | **Frontend-only.** Design tokens (color/spacing/typography), breakpoints, custom-wrapper inventory, Vuexy customization summary, form pattern, theme approach | After design-system changes, new wrappers, new tokens |
|
|
49
|
+
| `quality-playbook` | High-signal React anti-patterns with symptoms, root causes, preferred fixes (rerender, hooks, derivation, effects vs events) | After discovering recurring bugs or anti-patterns |
|
|
48
50
|
|
|
49
51
|
---
|
|
50
52
|
|
|
@@ -68,70 +70,86 @@ If absent: → proceed to Phase 2 with a blank slate.
|
|
|
68
70
|
|
|
69
71
|
---
|
|
70
72
|
|
|
71
|
-
## Phase 2 — Analyze codebase with
|
|
73
|
+
## Phase 2 — Analyze codebase with Serena
|
|
72
74
|
|
|
73
|
-
Use
|
|
75
|
+
Use Serena's symbolic tools to extract structured information **first** — avoid large file reads until you have a focused direction.
|
|
74
76
|
|
|
75
|
-
### 2.1
|
|
77
|
+
### 2.1 Orient yourself
|
|
78
|
+
|
|
79
|
+
Start with the project layout:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
ls -la # see top-level layout
|
|
83
|
+
cat package.json # detect framework (Next.js / Vite / CRA / Remix) and key deps
|
|
84
|
+
ls src/app 2>/dev/null || ls src/pages 2>/dev/null # detect router (app vs pages)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Then check Serena memories from prior sessions (if any):
|
|
76
88
|
|
|
77
89
|
```
|
|
78
|
-
|
|
90
|
+
list_memories
|
|
79
91
|
```
|
|
80
92
|
|
|
81
|
-
|
|
82
|
-
- Graph stats (total nodes, languages, communities, flows).
|
|
83
|
-
- Risk score.
|
|
84
|
-
- Key communities and flows.
|
|
93
|
+
If memories exist with names like `project_overview`, `tech_stack`, `project_structure`, read them — they may already contain bootstrap context.
|
|
85
94
|
|
|
86
|
-
### 2.2 Artifact-specific
|
|
95
|
+
### 2.2 Artifact-specific Serena queries
|
|
87
96
|
|
|
88
|
-
Call the appropriate sequence based on what you're building:
|
|
97
|
+
Call the appropriate sequence based on what you're building. **Target: ≤8 Serena calls per artifact.**
|
|
89
98
|
|
|
90
99
|
#### For `repo-map` (module layout, conventions):
|
|
91
|
-
1. `
|
|
92
|
-
2. `
|
|
93
|
-
3. `
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
#### For `
|
|
118
|
-
1. `
|
|
119
|
-
2. `
|
|
120
|
-
3.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
100
|
+
1. `get_symbols_overview(relative_path="src")` — top-level structure
|
|
101
|
+
2. For app-router: `get_symbols_overview(relative_path="src/app")` — see route tree. For pages-router: `get_symbols_overview(relative_path="src/pages")`.
|
|
102
|
+
3. `get_symbols_overview(relative_path="src/components")` and `src/views/` and `src/hooks/` — drill into each top-level folder
|
|
103
|
+
4. `find_symbol(name_path="...Page", substring_matching=true)` and `...Layout` to enumerate route entry points
|
|
104
|
+
|
|
105
|
+
#### For `architecture` (app-router topology, server/client boundaries, state):
|
|
106
|
+
1. `Read` `src/app/layout.tsx` (or `src/pages/_app.tsx`) to see top-level providers
|
|
107
|
+
2. `find_symbol(name_path="...", substring_matching=true)` on `Provider` to enumerate context providers
|
|
108
|
+
3. `find_symbol(name_path="...", substring_matching=true)` on `useQuery` / `useSWR` / `useMutation` to detect data-fetching approach
|
|
109
|
+
4. `Read` `next.config.js` / `vite.config.ts` for build-time config
|
|
110
|
+
|
|
111
|
+
#### For `auth-model` (client-side auth):
|
|
112
|
+
1. `find_symbol(name_path="useAuth", substring_matching=true)` and `useSession` — locate the auth hook
|
|
113
|
+
2. `find_symbol(include_body=true)` on that hook to read its mechanism
|
|
114
|
+
3. `find_symbol(name_path="AuthProvider", substring_matching=true)` and `AuthContext` to find the context
|
|
115
|
+
4. `find_referencing_symbols` on `useAuth` to enumerate consumers (route guards, gated UI)
|
|
116
|
+
5. `Read` cookie / token helper files directly (typically `src/utils/auth.ts`, `src/configs/authConfig.ts` — per project conventions)
|
|
117
|
+
6. Identify private-route convention by listing `src/app/` route-group directories (e.g. `(dashboard)`, `(private)`)
|
|
118
|
+
|
|
119
|
+
#### For `design-system` (NEW — tokens, wrappers, patterns):
|
|
120
|
+
1. `Read` `src/@core/theme/` or `src/themes/` to extract design tokens (colors, spacing, typography, breakpoints)
|
|
121
|
+
2. `find_symbol(name_path="Custom", substring_matching=true)` — enumerate custom MUI wrappers (CustomTextField, CustomDialog, etc.)
|
|
122
|
+
3. For each wrapper, `find_symbol(include_body=true)` to read its API surface
|
|
123
|
+
4. `Read` an example form file to extract the project's form pattern (react-hook-form + valibot/zod, formik, etc.)
|
|
124
|
+
5. Check the package.json for the UI library version and any Vuexy/template lineage
|
|
125
|
+
|
|
126
|
+
#### For `models` (shared types, schemas):
|
|
127
|
+
1. `get_symbols_overview(relative_path="src/types")` (or `src/models/` per convention)
|
|
128
|
+
2. `find_symbol(name_path="...", substring_matching=true)` on `type ` patterns or specific entity names
|
|
129
|
+
3. Sample 3-5 representative types/interfaces — don't enumerate all
|
|
130
|
+
|
|
131
|
+
#### For `quality-playbook` (React anti-patterns):
|
|
132
|
+
1. `git log --grep="fix:" --oneline | head -20` to spot recurring bug types
|
|
133
|
+
2. `git log --grep="perf:" --oneline | head -20` for rerender/performance fixes
|
|
134
|
+
3. Sample 1-2 representative component files to extract baseline patterns
|
|
135
|
+
4. Reference `.agent/frontend/skills/code-reviewer/rules/` — the 23 rule files already encode known React anti-patterns; this artifact captures any project-specific patterns layered on top
|
|
136
|
+
|
|
137
|
+
#### For `constitution` (React rules, a11y, performance, no-secrets):
|
|
138
|
+
1. `find_symbol(name_path="...", substring_matching=true)` on patterns: `'use client'`, `Provider`, `Layout`
|
|
139
|
+
2. Read 1-2 example client components to extract conventions (state, hooks, fetching)
|
|
140
|
+
3. Read root layout for provider hierarchy
|
|
141
|
+
4. Read `next.config.js` for CSP / headers / strict-mode settings
|
|
142
|
+
|
|
143
|
+
#### For `core-memory` (history):
|
|
144
|
+
1. Read existing `project-memory/core-memory.md` if present (this is a manual record, not auto-derived)
|
|
145
|
+
2. `git log --oneline | head -30` to see recent work
|
|
146
|
+
3. Cross-reference with existing core-memory to identify what's new or changed
|
|
147
|
+
|
|
148
|
+
### 2.3 Efficiency
|
|
149
|
+
|
|
150
|
+
- Always prefer `get_symbols_overview` + targeted `find_symbol` over raw `Read`
|
|
151
|
+
- Target ≤8 Serena calls total for Phase 2
|
|
152
|
+
- For files that aren't code (configs, migrations, json), use `Read` with `offset`/`limit` to read only relevant sections
|
|
135
153
|
|
|
136
154
|
---
|
|
137
155
|
|
|
@@ -143,13 +161,14 @@ Based on the graph results, perform targeted reads **only** for files the graph
|
|
|
143
161
|
|
|
144
162
|
| Artifact | What to extract | How | Sources |
|
|
145
163
|
|----------|-----------------|-----|---------|
|
|
146
|
-
| `repo-map` |
|
|
147
|
-
| `architecture` |
|
|
148
|
-
| `auth-model` |
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
164
|
+
| `repo-map` | Folder layout (pages/views/hooks/services/components), naming conventions, reusable components, entry points | Read 1–3 representative pages/views/hooks; extract patterns | Serena `get_symbols_overview` results; Read: example pages, layout files |
|
|
165
|
+
| `architecture` | Server vs client boundary rules, state management approach, data fetching patterns, provider hierarchy, integration points | Read root layout/`_app.tsx`, top-level providers, example pages | Serena results for `Provider`, data-fetching hooks; Read: root layout, next.config |
|
|
166
|
+
| `auth-model` | Context provider, useAuth hook signature, route gating mechanism, permission keys, cookie helpers, login/logout flow | Read auth context, hook, cookie helpers, and a representative private page | Serena results for `useAuth`, `AuthContext`; Read: cookie helpers, route-group directories |
|
|
167
|
+
| `design-system` | Theme tokens (color/spacing/typography/breakpoints), custom-wrapper inventory, form pattern, Vuexy/template lineage | Read theme files + each Custom* wrapper body + 1 example form | Serena results for `Custom*` symbols; Read: theme, example form file |
|
|
168
|
+
| `models` | TypeScript types/interfaces/schemas, shared shapes | Read 3–5 representative type/schema files | Serena `find_symbol` results; Read: types from different domains |
|
|
169
|
+
| `constitution` | React rules in use, a11y conventions, performance guards, no-secrets rules, server/client boundary rules | Read representative client/server components, root layout, next.config | Serena results for `'use client'`, providers; Read: examples |
|
|
170
|
+
| `quality-playbook` | Recurring React anti-patterns, preferred fixes (project-specific, layered on top of the 23 rule files) | Analyze git fix-commit history; read 1–2 example components | Bash: `git log --grep="fix:" --oneline`; Read: examples |
|
|
171
|
+
| `core-memory` | Completed features, design decisions, patterns to reuse/avoid | Existing file + git enumeration | Existing core-memory.md; Bash: `git log --oneline` |
|
|
153
172
|
|
|
154
173
|
### 3.2 Read targeted files
|
|
155
174
|
|
|
@@ -220,42 +239,65 @@ Non-negotiable rules for this codebase.
|
|
|
220
239
|
- [Rule about framework usage, anti-patterns]
|
|
221
240
|
```
|
|
222
241
|
|
|
223
|
-
#### auth-model.md
|
|
242
|
+
#### auth-model.md (frontend / client-side)
|
|
224
243
|
|
|
225
244
|
```markdown
|
|
226
|
-
# Auth Model
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
##
|
|
231
|
-
-
|
|
232
|
-
-
|
|
233
|
-
-
|
|
234
|
-
|
|
235
|
-
##
|
|
236
|
-
-
|
|
237
|
-
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
- [
|
|
247
|
-
- [
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
-
|
|
252
|
-
-
|
|
253
|
-
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
-
|
|
258
|
-
- [
|
|
245
|
+
# Auth Model (Frontend / Client-Side)
|
|
246
|
+
|
|
247
|
+
Client-side auth: context provider, useAuth hook, route gating, permission keys, cookie/session handling, login/logout flows. The backend is the security boundary; this document describes what the **UI** does to reflect the auth state and gate visible UI.
|
|
248
|
+
|
|
249
|
+
## Context provider
|
|
250
|
+
- **Name and file**: [e.g. `<AuthProvider>` in `src/contexts/authContext.tsx`]
|
|
251
|
+
- **Scope**: where it wraps in the app tree (root layout, dashboard-only, etc.)
|
|
252
|
+
- **State it exposes**: user, isLoading, isAuthenticated, permissions, login(), logout(), refresh()
|
|
253
|
+
|
|
254
|
+
## useAuth (or equivalent) hook
|
|
255
|
+
- **Name and file**: [e.g. `useAuth()` in `src/contexts/authContext.tsx`]
|
|
256
|
+
- **Return shape** (TypeScript):
|
|
257
|
+
```ts
|
|
258
|
+
{ user: User | null; isLoading: boolean; permissions: Permission[]; login(...): Promise<void>; logout(): Promise<void>; hasPermission(key: PermissionKey): boolean }
|
|
259
|
+
```
|
|
260
|
+
- **Where to use**: in client components only (not server components — for server components, document the server-side data-fetching pattern)
|
|
261
|
+
|
|
262
|
+
## Private vs public route convention
|
|
263
|
+
- **How a route is marked private**: [e.g. file convention `src/app/[lang]/(private)/...`, HOC, middleware, server-side check]
|
|
264
|
+
- **How a route is marked public**: [e.g. `(public)` route group, explicit allowlist]
|
|
265
|
+
- **Gate enforcement point**: [middleware? layout-level? per-page server-side check? client-side redirect?]
|
|
266
|
+
- **Behavior on unauthorized**: [redirect to /login with returnTo, render 403 page, etc.]
|
|
267
|
+
|
|
268
|
+
## Permission keys
|
|
269
|
+
- **Enum / type location**: [e.g. `src/types/permissions.ts`]
|
|
270
|
+
- **Key naming convention**: [e.g. `<resource>:<action>` — `users:read`, `users:update`]
|
|
271
|
+
- **Where keys are checked**:
|
|
272
|
+
- Page-level access (in the documented gate)
|
|
273
|
+
- UI element gating (button disable/hide via `useAuth().hasPermission(...)`)
|
|
274
|
+
|
|
275
|
+
## Cookie / token / storage handling
|
|
276
|
+
- **Helper file**: [e.g. `src/utils/auth.ts`]
|
|
277
|
+
- **Token storage**: [httpOnly cookies (server-set, recommended), localStorage (only if documented), etc.]
|
|
278
|
+
- **Cookie attributes (when client controls them)**: Secure, SameSite, httpOnly
|
|
279
|
+
- **Token refresh strategy**: [silent refresh, refresh on 401, etc.]
|
|
280
|
+
|
|
281
|
+
## Login flow
|
|
282
|
+
1. User visits `/login`
|
|
283
|
+
2. Form submits to [endpoint]
|
|
284
|
+
3. On success: [cookie set / token stored / context updated]
|
|
285
|
+
4. Redirect to `returnTo` or default landing
|
|
286
|
+
|
|
287
|
+
## Logout flow
|
|
288
|
+
1. User clicks logout
|
|
289
|
+
2. [API call to invalidate session / clear cookies]
|
|
290
|
+
3. Context cleared, sensitive cached data invalidated (SWR / React Query / store)
|
|
291
|
+
4. Redirect to `/login` (or public landing)
|
|
292
|
+
|
|
293
|
+
## Server-side counterpart
|
|
294
|
+
- **What the backend enforces** (so UI checks are not the security boundary): [e.g. every authenticated route on the backend validates the session cookie + checks permission server-side]
|
|
295
|
+
- **Source of truth for permissions**: [server endpoint that returns user + permissions, called on session start]
|
|
296
|
+
|
|
297
|
+
## Patterns
|
|
298
|
+
- **Identity propagation to API calls**: [how the fetcher injects the session — cookies sent automatically, Authorization header, etc.]
|
|
299
|
+
- **Loading state**: components must guard against `user === null` while `isLoading` is true
|
|
300
|
+
- **Logout side effects**: enumerate caches / stores cleared on logout
|
|
259
301
|
```
|
|
260
302
|
|
|
261
303
|
#### repo-map.md
|
|
@@ -427,6 +469,101 @@ Example:
|
|
|
427
469
|
- **Monolithic API backend**: Simple to deploy and reason about. Tradeoff: harder to scale individual features independently (mitigated with feature flags and service extraction when needed).
|
|
428
470
|
```
|
|
429
471
|
|
|
472
|
+
#### design-system.md (frontend-only)
|
|
473
|
+
|
|
474
|
+
```markdown
|
|
475
|
+
# Design System
|
|
476
|
+
|
|
477
|
+
Design tokens, custom-wrapper inventory, form patterns, theming approach. The single source of truth for "what does the UI look like and what building blocks compose it."
|
|
478
|
+
|
|
479
|
+
## Template lineage
|
|
480
|
+
- **Base**: [e.g. Vuexy Admin Template v9.x, ShadCN, custom]
|
|
481
|
+
- **UI library**: [e.g. MUI v7, Tailwind, Chakra]
|
|
482
|
+
- **Version**: [exact version in package.json]
|
|
483
|
+
|
|
484
|
+
## Theme tokens
|
|
485
|
+
|
|
486
|
+
### Colors
|
|
487
|
+
- **Primary palette**: [token names, hex values]
|
|
488
|
+
- **Semantic colors**: error, warning, info, success
|
|
489
|
+
- **Skin variants**: [filled / light / light-static, per Vuexy convention]
|
|
490
|
+
|
|
491
|
+
### Typography
|
|
492
|
+
- **Font families**: [primary, mono]
|
|
493
|
+
- **Type scale**: [body, heading levels]
|
|
494
|
+
|
|
495
|
+
### Spacing
|
|
496
|
+
- **Scale**: [0, 1, 2, 4, 8, 16, 24, 32 — in units matching theme]
|
|
497
|
+
- **Layout grid**: [breakpoints, container widths]
|
|
498
|
+
|
|
499
|
+
### Breakpoints
|
|
500
|
+
- xs / sm / md / lg / xl with their pixel values
|
|
501
|
+
|
|
502
|
+
### Other tokens
|
|
503
|
+
- Border radius, shadows, transitions
|
|
504
|
+
|
|
505
|
+
## Custom wrapper inventory
|
|
506
|
+
|
|
507
|
+
| Wrapper | Wraps | When to use | Key props |
|
|
508
|
+
|---------|-------|-------------|-----------|
|
|
509
|
+
| `CustomTextField` | `TextField` | Every text input | size, variant, error, helperText |
|
|
510
|
+
| `CustomDialog` | `Dialog` | Modal dialogs (forms, confirmations) | maxWidth, scroll, fullWidth |
|
|
511
|
+
| `CustomAvatar` | `Avatar` | User avatars, icon avatars | skin, color, src |
|
|
512
|
+
| `CustomChip` | `Chip` | Tags, status indicators | skin, color, variant |
|
|
513
|
+
| `CustomBadge` | `Badge` | Counts, dots | skin, color, max |
|
|
514
|
+
| `CustomTabList` | `TabList` | Tabs | indicator color |
|
|
515
|
+
| `CustomIconButton` | `IconButton` | Icon-only buttons | requires aria-label |
|
|
516
|
+
| `CustomAutocomplete` | `Autocomplete` | Combobox inputs | options, getOptionLabel |
|
|
517
|
+
|
|
518
|
+
For each wrapper: file path, common props, what NOT to use it for.
|
|
519
|
+
|
|
520
|
+
## Form pattern
|
|
521
|
+
|
|
522
|
+
- **Library**: [react-hook-form + valibot / formik + yup / etc.]
|
|
523
|
+
- **Standard template**:
|
|
524
|
+
```tsx
|
|
525
|
+
// (pseudo-code — actual project uses real types)
|
|
526
|
+
const form = useForm({ resolver: valibotResolver(schema), defaultValues })
|
|
527
|
+
// Field via Controller<...> + CustomTextField
|
|
528
|
+
// Submit with form.handleSubmit(onSubmit)
|
|
529
|
+
```
|
|
530
|
+
- **Validation conventions**: where schemas live, how server errors map to field errors
|
|
531
|
+
|
|
532
|
+
## Layout / page-shell
|
|
533
|
+
|
|
534
|
+
- **App-shell composition**: nav + sidebar + main + footer (per template)
|
|
535
|
+
- **Page-content max-width**: [per breakpoint]
|
|
536
|
+
- **Container component**: [e.g. `<PageContent>`]
|
|
537
|
+
|
|
538
|
+
## Patterns
|
|
539
|
+
|
|
540
|
+
### Dialog pattern
|
|
541
|
+
- Standard composition: header (title + close) → body (scrollable) → footer (cancel + primary action)
|
|
542
|
+
- Reference: `examples.md#form-dialogs`
|
|
543
|
+
|
|
544
|
+
### Drawer pattern
|
|
545
|
+
- When to use vs dialog: drawer for navigation/long content, dialog for focused actions
|
|
546
|
+
- Reference: ...
|
|
547
|
+
|
|
548
|
+
### Data grid
|
|
549
|
+
- Wrapper: [project's DataGrid wrapper if any]
|
|
550
|
+
- Pagination strategy: client-side / server-side
|
|
551
|
+
|
|
552
|
+
### Empty / loading / error states
|
|
553
|
+
- Standard components: `<EmptyState>`, `<LoadingState>`, `<ErrorState>` — files and props
|
|
554
|
+
|
|
555
|
+
## Accessibility defaults
|
|
556
|
+
- Theme color contrast meets WCAG AA (per Vuexy)
|
|
557
|
+
- All Custom* wrappers are keyboard-accessible by default
|
|
558
|
+
- `CustomIconButton` REQUIRES `aria-label` — enforced by linter
|
|
559
|
+
- Focus management: dialogs trap focus and return it on close
|
|
560
|
+
|
|
561
|
+
## When to extend the design system
|
|
562
|
+
- **Yes**: a new pattern reused 3+ times, a new token needed across multiple features
|
|
563
|
+
- **No (use existing instead)**: one-off styling, slight variants of an existing wrapper
|
|
564
|
+
- **Process**: file an addition under `src/@core/components/` (or template's equivalent) + update this artifact via `/create-blueprint design-system`
|
|
565
|
+
```
|
|
566
|
+
|
|
430
567
|
#### quality-playbook.md
|
|
431
568
|
|
|
432
569
|
```markdown
|
|
@@ -578,35 +715,48 @@ ls -la .claude/docs/<artifact-type>.md .cursor/docs/<artifact-type>.md
|
|
|
578
715
|
|
|
579
716
|
If either symlink already exists, skip (do not overwrite).
|
|
580
717
|
|
|
581
|
-
#### 7.3.2
|
|
718
|
+
#### 7.3.2 Module execution
|
|
719
|
+
|
|
720
|
+
Feature execution is now handled entirely by the `/module-runner` skill (no shell script needed). `/module-runner` is wired during `npm exec nurosys-agent-setup` for the user's chosen IDE. No additional setup required here.
|
|
582
721
|
|
|
583
|
-
|
|
722
|
+
### 7.4 Wire artifact as a Cursor rule
|
|
723
|
+
|
|
724
|
+
After writing the artifact, run the cursor rules setup script to create (or refresh) the `.cursor/rules/<artifact-type>.mdc` symlink pointing to the new file:
|
|
584
725
|
|
|
585
726
|
```bash
|
|
586
|
-
|
|
587
|
-
if [ ! -L scripts/run-feature-modules.sh ]; then
|
|
588
|
-
# Remove the file if it exists as a regular file
|
|
589
|
-
rm -f scripts/run-feature-modules.sh
|
|
590
|
-
# Create the symlink
|
|
591
|
-
ln -sf ../.agent/scripts/run-feature-modules.sh scripts/run-feature-modules.sh
|
|
592
|
-
echo "✅ Created symlink: scripts/run-feature-modules.sh"
|
|
593
|
-
else
|
|
594
|
-
echo "✅ Symlink already exists: scripts/run-feature-modules.sh"
|
|
595
|
-
fi
|
|
727
|
+
node scripts/setup-cursor-rules.js
|
|
596
728
|
```
|
|
597
729
|
|
|
598
|
-
|
|
730
|
+
Or if installed as a package bin:
|
|
599
731
|
```bash
|
|
600
|
-
|
|
732
|
+
npm exec nurosys-setup-rules
|
|
601
733
|
```
|
|
602
734
|
|
|
603
|
-
This
|
|
735
|
+
This script:
|
|
736
|
+
- Creates `.cursor/rules/` if it does not exist
|
|
737
|
+
- Adds a `.mdc` symlink for every `project-memory/*.md` that exists
|
|
738
|
+
- Skips files that already have a symlink
|
|
739
|
+
- Reports which files were linked, skipped, or missing
|
|
740
|
+
|
|
741
|
+
The `.cursor/rules/<artifact>.mdc` files are written by `nurosys-setup-rules` with the correct MDC frontmatter automatically — you do not need to embed frontmatter in the `project-memory/` source files. For reference, the frontmatter applied per artifact is:
|
|
742
|
+
|
|
743
|
+
| Artifact | `description` | `globs` | `alwaysApply` |
|
|
744
|
+
|----------|--------------|---------|---------------|
|
|
745
|
+
| `constitution.md` | "Non-negotiable project rules and coding standards" | — | `true` |
|
|
746
|
+
| `architecture.md` | "System architecture, module topology, and data flow" | — | `true` |
|
|
747
|
+
| `repo-map.md` | "Repository module layout, naming conventions, and reusable components" | — | `true` |
|
|
748
|
+
| `auth-model.md` | "Auth model, JWT flow, guard chain, RBAC, and tenant scoping" | `["src/auth/**", "src/core/auth/**"]` | `false` |
|
|
749
|
+
| `models.md` | "Domain model inventory and entity definitions" | `["src/**/*.model.ts", "src/**/*.entity.ts"]` | `false` |
|
|
750
|
+
| `quality-playbook.md` | "Code quality patterns, anti-patterns, and preferred fixes for this project" | — | `false` |
|
|
751
|
+
| `core-memory.md` | "Project history, design decisions, and completed modules" | — | `false` |
|
|
752
|
+
|
|
753
|
+
When `create-blueprint all` runs, call the script once at the end after all artifacts are written.
|
|
604
754
|
|
|
605
|
-
### 7.
|
|
755
|
+
### 7.5 Confirm with user
|
|
606
756
|
|
|
607
757
|
Report:
|
|
608
758
|
- The artifact file path: `project-memory/<artifact-type>.md`
|
|
609
|
-
-
|
|
759
|
+
- Whether `.cursor/rules/<artifact-type>.mdc` symlink was created or already existed
|
|
610
760
|
- Whether this was a creation or update
|
|
611
761
|
- Number of sections/changes
|
|
612
762
|
|
|
@@ -630,6 +780,6 @@ Before finalizing the artifact:
|
|
|
630
780
|
- **Single source of truth**: project-memory artifacts are the authoritative reference stored in `project-memory/<artifact-type>.md`. If they conflict with code, the code is wrong — update the code, not the artifact.
|
|
631
781
|
- **Symlink architecture**: Artifacts in `project-memory/` are symlinked from `.claude/docs/` and `.cursor/docs/` to avoid duplication. Symlinks are created automatically when a new artifact is generated. **Always edit the artifact in `project-memory/`, never in the symlink copies.**
|
|
632
782
|
- **Regular refresh cadence**: After each completed feature module (or every 2–3 weeks), run `create-blueprint` on `core-memory` and `repo-map` to keep them current.
|
|
633
|
-
- **
|
|
783
|
+
- **Serena-first approach**: Always use Serena's symbolic tools (`get_symbols_overview`, `find_symbol`, `find_referencing_symbols`) before reading whole files. Symbolic navigation is faster and uses far fewer tokens.
|
|
634
784
|
- **Curation, not exhaustion**: Artifact sections describe the most important patterns and decisions, not every detail. If a pattern is used once, it probably doesn't need to be in the playbook.
|
|
635
785
|
- **Portable artifacts**: These skill generates artifacts that are project-specific in content but portable in structure. You can copy the `project-memory/` folder to another project and run the skill again to regenerate them with that project's codebase.
|
|
@@ -1,28 +1,86 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: debug-issue
|
|
3
|
-
description: Systematically
|
|
4
|
-
disable-model-invocation: true
|
|
3
|
+
description: Systematically trace and diagnose React/Next.js issues using Serena's symbolic tools. Trigger on "debug", "why is X failing", "trace this error", or any user-reported bug — runtime errors, rerender loops, stale data, hook warnings, hydration mismatches, prod-only bugs. Symbol-level, not full-file reads.
|
|
5
4
|
---
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
# Skill: debug-issue (frontend)
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
Trace bugs through the codebase using symbolic navigation. The rule: **follow the symptom, don't grep the world**.
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
## Steps
|
|
12
11
|
|
|
13
|
-
1.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
1. **Capture the symptom precisely**
|
|
13
|
+
- Error message, stack trace, console warnings, reproduction steps, expected vs actual.
|
|
14
|
+
- For hydration errors: server-rendered HTML mismatch and the offending component path from the warning.
|
|
15
|
+
- For rerender loops: which component or hook the React DevTools profiler identifies.
|
|
16
|
+
- If the user gave a stack trace, the top app-code frame is your starting symbol.
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
2. **Locate the suspected entry point**
|
|
19
|
+
- `find_symbol(name_path="<name from stack/trace>", include_body=true)` — read the function/component/hook where the symptom surfaces.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
21
|
+
3. **Check Recent changes**
|
|
22
|
+
- `git log -p --follow <suspect-file>` — what changed recently?
|
|
23
|
+
- If the bug landed since the last release, the suspect file's recent commits are the most likely cause.
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
25
|
+
4. **For each bug class, apply the right lens:**
|
|
26
|
+
|
|
27
|
+
### Rerender loops / infinite updates
|
|
28
|
+
- Read the suspect's body. Look for:
|
|
29
|
+
- State updates in render
|
|
30
|
+
- Effects with state in deps that update that same state without a stable trigger
|
|
31
|
+
- Inline object/array/function in dependency arrays
|
|
32
|
+
- Inline component definitions inside the parent
|
|
33
|
+
- Reference rule files: `rules/rerender-derived-state-no-effect.md`, `rules/rerender-dependencies.md`, `rules/rerender-no-inline-components.md`, `rules/rerender-functional-setstate.md`
|
|
34
|
+
|
|
35
|
+
### Stale data / closure bugs
|
|
36
|
+
- Reference: `rules/rerender-defer-reads.md`, `rules/rerender-use-ref-transient-values.md`, `rules/advanced-event-handler-refs.md`
|
|
37
|
+
- Check: stale closure over state inside a callback registered once (event listener, timer, websocket handler)
|
|
38
|
+
|
|
39
|
+
### Hook dependency warnings (`react-hooks/exhaustive-deps`)
|
|
40
|
+
- Reference: `rules/react-rules-hooks.md`
|
|
41
|
+
- Don't silence with eslint-disable. The warning is usually right.
|
|
42
|
+
|
|
43
|
+
### Hydration mismatch
|
|
44
|
+
- Look for: `Date.now()`, `Math.random()`, browser-only APIs (`window`, `document`) in components rendered on the server
|
|
45
|
+
- Check: client-only state initialized differently on server vs client
|
|
46
|
+
- Reference: `rules/rerender-lazy-state-init.md` for safe deferred init
|
|
47
|
+
|
|
48
|
+
### "Works in dev, breaks in production"
|
|
49
|
+
- Check: `process.env.NODE_ENV` branches
|
|
50
|
+
- Check: missing keys in lists (silent in dev, surfaces in prod)
|
|
51
|
+
- Check: `console.*` statements stripped in prod that hid an actual error
|
|
52
|
+
- Check: source-map mismatch (use the unminified stack via DevTools)
|
|
53
|
+
|
|
54
|
+
### Data not appearing / fetch failing
|
|
55
|
+
- Trace upstream: who calls this hook/component? `find_referencing_symbols`
|
|
56
|
+
- Trace downstream: what API does the hook hit? Check the fetch URL.
|
|
57
|
+
- Empty/loading/error states present per `architecture.md`?
|
|
58
|
+
|
|
59
|
+
5. **Read targeted memories**
|
|
60
|
+
- `list_memories` then `read_memory` if any look relevant (e.g. prior bug in the same area).
|
|
61
|
+
|
|
62
|
+
6. **Form a hypothesis and confirm**
|
|
63
|
+
- State the suspected cause concisely.
|
|
64
|
+
- Confirm by running the repro, adding a temporary log, or reading one more symbol.
|
|
65
|
+
- Don't write a fix until you can explain the root cause in one sentence.
|
|
66
|
+
|
|
67
|
+
## Tips
|
|
68
|
+
|
|
69
|
+
- **Stack trace is the map.** Walk app-code frames from top down, reading symbol bodies along the way. Don't try to understand the whole module first.
|
|
70
|
+
- **Recent changes are the most common cause** of a newly-reported bug. Check `git log` early.
|
|
71
|
+
- **Consumers AND callees.** A hook can fail because of bad props (consumer's fault) or bad logic (its own fault) — check both.
|
|
72
|
+
- **React DevTools profiler** for rerender bugs — note the path from the user's screenshot/description; that path is your starting symbol.
|
|
73
|
+
- **Hydration errors include the component path** in the warning — use it as your entry point.
|
|
74
|
+
- **Avoid speculative grepping.** If you find yourself searching for "this might be related", you've lost the trail — go back to the symptom.
|
|
75
|
+
|
|
76
|
+
## Token Efficiency
|
|
77
|
+
|
|
78
|
+
- Target ≤6 Serena calls: locate entry (1) + read body (1) + consumers (1) + key callees (1-2) + verify (1).
|
|
79
|
+
- If you need more, you're either solving the wrong problem or the bug is genuinely cross-cutting — pause and tell the user what you've found.
|
|
80
|
+
|
|
81
|
+
## Do not
|
|
82
|
+
|
|
83
|
+
- Fix the bug in this skill. This skill diagnoses; fixes go through `/quick-execute` (small) or `/architect` → `/module-runner` (large).
|
|
84
|
+
- Read whole files when a symbol body suffices.
|
|
85
|
+
- Silence lint warnings to make the symptom go away. Investigate first.
|
|
86
|
+
- Add temporary `console.log` to production code paths without flagging it to the user.
|