specialist-agent 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +346 -0
- package/agents/cloud-lite.md +44 -0
- package/agents/cloud.md +122 -0
- package/agents/data-lite.md +44 -0
- package/agents/data.md +136 -0
- package/agents/designer-lite.md +44 -0
- package/agents/designer.md +126 -0
- package/agents/devops-lite.md +44 -0
- package/agents/devops.md +131 -0
- package/agents/finance-lite.md +43 -0
- package/agents/finance.md +108 -0
- package/agents/security-lite.md +43 -0
- package/agents/security.md +123 -0
- package/agents/starter-lite.md +49 -0
- package/agents/starter.md +200 -0
- package/agents/tester-lite.md +48 -0
- package/agents/tester.md +142 -0
- package/cli/index.mjs +232 -0
- package/package.json +45 -0
- package/packs/nextjs/ARCHITECTURE.md +1033 -0
- package/packs/nextjs/CLAUDE.md +70 -0
- package/packs/nextjs/agents/builder.md +145 -0
- package/packs/nextjs/agents/doctor.md +152 -0
- package/packs/nextjs/agents/migrator.md +203 -0
- package/packs/nextjs/agents/reviewer.md +141 -0
- package/packs/nextjs/agents-lite/builder.md +51 -0
- package/packs/nextjs/agents-lite/doctor.md +51 -0
- package/packs/nextjs/agents-lite/migrator.md +52 -0
- package/packs/nextjs/agents-lite/reviewer.md +51 -0
- package/packs/nextjs/skills/dev-create-component/SKILL.md +82 -0
- package/packs/nextjs/skills/dev-create-hook/SKILL.md +90 -0
- package/packs/nextjs/skills/dev-create-module/SKILL.md +63 -0
- package/packs/nextjs/skills/dev-create-service/SKILL.md +35 -0
- package/packs/nextjs/skills/dev-create-test/SKILL.md +106 -0
- package/packs/nextjs/skills/dev-generate-types/SKILL.md +37 -0
- package/packs/nextjs/skills/docs-onboard/SKILL.md +55 -0
- package/packs/nextjs/skills/migration-migrate-component/SKILL.md +58 -0
- package/packs/nextjs/skills/migration-migrate-module/SKILL.md +25 -0
- package/packs/nextjs/skills/review-check-architecture/SKILL.md +101 -0
- package/packs/nextjs/skills/review-fix-violations/SKILL.md +48 -0
- package/packs/nextjs/skills/review-review/SKILL.md +46 -0
- package/packs/react/ARCHITECTURE.md +991 -0
- package/packs/react/CLAUDE.md +66 -0
- package/packs/react/agents/builder.md +74 -0
- package/packs/react/agents/doctor.md +100 -0
- package/packs/react/agents/migrator.md +114 -0
- package/packs/react/agents/reviewer.md +116 -0
- package/packs/react/agents-lite/builder.md +42 -0
- package/packs/react/agents-lite/doctor.md +41 -0
- package/packs/react/agents-lite/migrator.md +51 -0
- package/packs/react/agents-lite/reviewer.md +47 -0
- package/packs/react/skills/dev-create-component/SKILL.md +53 -0
- package/packs/react/skills/dev-create-hook/SKILL.md +78 -0
- package/packs/react/skills/dev-create-module/SKILL.md +51 -0
- package/packs/react/skills/dev-create-service/SKILL.md +34 -0
- package/packs/react/skills/dev-create-test/SKILL.md +92 -0
- package/packs/react/skills/dev-generate-types/SKILL.md +37 -0
- package/packs/react/skills/docs-onboard/SKILL.md +42 -0
- package/packs/react/skills/migration-migrate-component/SKILL.md +44 -0
- package/packs/react/skills/migration-migrate-module/SKILL.md +25 -0
- package/packs/react/skills/review-check-architecture/SKILL.md +73 -0
- package/packs/react/skills/review-fix-violations/SKILL.md +45 -0
- package/packs/react/skills/review-review/SKILL.md +43 -0
- package/packs/svelte/ARCHITECTURE.md +975 -0
- package/packs/svelte/CLAUDE.md +66 -0
- package/packs/svelte/agents/builder.md +80 -0
- package/packs/svelte/agents/doctor.md +100 -0
- package/packs/svelte/agents/migrator.md +128 -0
- package/packs/svelte/agents/reviewer.md +104 -0
- package/packs/svelte/agents-lite/builder.md +43 -0
- package/packs/svelte/agents-lite/doctor.md +44 -0
- package/packs/svelte/agents-lite/migrator.md +59 -0
- package/packs/svelte/agents-lite/reviewer.md +48 -0
- package/packs/svelte/skills/dev-create-component/SKILL.md +77 -0
- package/packs/svelte/skills/dev-create-module/SKILL.md +59 -0
- package/packs/svelte/skills/dev-create-service/SKILL.md +35 -0
- package/packs/svelte/skills/dev-create-store/SKILL.md +94 -0
- package/packs/svelte/skills/dev-create-test/SKILL.md +98 -0
- package/packs/svelte/skills/dev-generate-types/SKILL.md +37 -0
- package/packs/svelte/skills/docs-onboard/SKILL.md +47 -0
- package/packs/svelte/skills/migration-migrate-component/SKILL.md +51 -0
- package/packs/svelte/skills/migration-migrate-module/SKILL.md +25 -0
- package/packs/svelte/skills/review-check-architecture/SKILL.md +79 -0
- package/packs/svelte/skills/review-fix-violations/SKILL.md +47 -0
- package/packs/svelte/skills/review-review/SKILL.md +44 -0
- package/packs/vue/ARCHITECTURE.md +798 -0
- package/packs/vue/CLAUDE.md +66 -0
- package/packs/vue/agents/builder.md +73 -0
- package/packs/vue/agents/doctor.md +82 -0
- package/packs/vue/agents/migrator.md +101 -0
- package/packs/vue/agents/reviewer.md +92 -0
- package/packs/vue/agents-lite/builder.md +42 -0
- package/packs/vue/agents-lite/doctor.md +40 -0
- package/packs/vue/agents-lite/migrator.md +50 -0
- package/packs/vue/agents-lite/reviewer.md +46 -0
- package/packs/vue/skills/dev-create-component/SKILL.md +58 -0
- package/packs/vue/skills/dev-create-composable/SKILL.md +31 -0
- package/packs/vue/skills/dev-create-module/SKILL.md +50 -0
- package/packs/vue/skills/dev-create-service/SKILL.md +34 -0
- package/packs/vue/skills/dev-create-test/SKILL.md +62 -0
- package/packs/vue/skills/dev-generate-types/SKILL.md +37 -0
- package/packs/vue/skills/docs-onboard/SKILL.md +42 -0
- package/packs/vue/skills/migration-migrate-component/SKILL.md +41 -0
- package/packs/vue/skills/migration-migrate-module/SKILL.md +25 -0
- package/packs/vue/skills/review-check-architecture/SKILL.md +73 -0
- package/packs/vue/skills/review-fix-violations/SKILL.md +42 -0
- package/packs/vue/skills/review-review/SKILL.md +42 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dev-create-test
|
|
3
|
+
description: "Create tests for adapters, hooks, or components using Vitest + React Testing Library"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[file-path]"
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Create tests for the specified file or module.
|
|
10
|
+
|
|
11
|
+
Target: $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. Analyze the file to understand what to test.
|
|
16
|
+
|
|
17
|
+
2. Determine the test type:
|
|
18
|
+
|
|
19
|
+
### Adapter (high priority -- pure functions, easy to test)
|
|
20
|
+
```typescript
|
|
21
|
+
import { describe, it, expect } from 'vitest'
|
|
22
|
+
import { xxxAdapter } from '../adapters/xxx-adapter'
|
|
23
|
+
|
|
24
|
+
describe('xxxAdapter', () => {
|
|
25
|
+
describe('toXxx', () => {
|
|
26
|
+
it('should convert API response to app contract', () => {
|
|
27
|
+
const response = { uuid: '123', field_name: 'test', created_at: '2024-01-01T00:00:00Z' }
|
|
28
|
+
const result = xxxAdapter.toXxx(response)
|
|
29
|
+
expect(result.id).toBe('123')
|
|
30
|
+
expect(result.fieldName).toBe('test')
|
|
31
|
+
expect(result.createdAt).toBeInstanceOf(Date)
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Hook (medium priority -- mock service)
|
|
38
|
+
```typescript
|
|
39
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
40
|
+
import { renderHook, waitFor } from '@testing-library/react'
|
|
41
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
42
|
+
import { useXxxList } from '../hooks/useXxxList'
|
|
43
|
+
|
|
44
|
+
vi.mock('../services/xxx-service')
|
|
45
|
+
|
|
46
|
+
function createWrapper() {
|
|
47
|
+
const queryClient = new QueryClient({
|
|
48
|
+
defaultOptions: { queries: { retry: false } },
|
|
49
|
+
})
|
|
50
|
+
return ({ children }: { children: React.ReactNode }) => (
|
|
51
|
+
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe('useXxxList', () => {
|
|
56
|
+
it('should fetch and transform data', async () => {
|
|
57
|
+
const { result } = renderHook(() => useXxxList({ page: 1 }), {
|
|
58
|
+
wrapper: createWrapper(),
|
|
59
|
+
})
|
|
60
|
+
await waitFor(() => expect(result.current.isLoading).toBe(false))
|
|
61
|
+
expect(result.current.items).toBeDefined()
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Component (medium-low priority -- React Testing Library)
|
|
67
|
+
```typescript
|
|
68
|
+
import { describe, it, expect } from 'vitest'
|
|
69
|
+
import { render, screen } from '@testing-library/react'
|
|
70
|
+
import userEvent from '@testing-library/user-event'
|
|
71
|
+
import { XxxComponent } from '../components/XxxComponent'
|
|
72
|
+
|
|
73
|
+
describe('XxxComponent', () => {
|
|
74
|
+
it('should render items', () => {
|
|
75
|
+
render(<XxxComponent items={mockItems} />)
|
|
76
|
+
expect(screen.getByText('Item 1')).toBeInTheDocument()
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
it('should call onSelect when item is clicked', async () => {
|
|
80
|
+
const onSelect = vi.fn()
|
|
81
|
+
render(<XxxComponent items={mockItems} onSelect={onSelect} />)
|
|
82
|
+
await userEvent.click(screen.getByText('Item 1'))
|
|
83
|
+
expect(onSelect).toHaveBeenCalledWith(mockItems[0])
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Server Action (low priority)
|
|
89
|
+
```typescript
|
|
90
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
91
|
+
import { createXxx } from '../actions/xxx-actions'
|
|
92
|
+
|
|
93
|
+
vi.mock('../services/xxx-service')
|
|
94
|
+
vi.mock('next/cache', () => ({ revalidatePath: vi.fn() }))
|
|
95
|
+
|
|
96
|
+
describe('createXxx', () => {
|
|
97
|
+
it('should create item and return success', async () => {
|
|
98
|
+
const result = await createXxx({ name: 'Test' })
|
|
99
|
+
expect(result.success).toBe(true)
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
3. Create the test in `__tests__/OriginalName.spec.ts(x)`.
|
|
105
|
+
|
|
106
|
+
4. Run: `npx vitest run --reporter=verbose`
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dev-generate-types
|
|
3
|
+
description: "Generate types, contracts and adapter from an API endpoint or JSON example"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[endpoint-or-json]"
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Generate types, contracts and adapter for an API endpoint following `docs/ARCHITECTURE.md` sections 4.2-4.3.
|
|
10
|
+
|
|
11
|
+
Endpoint or example JSON: $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. Read `docs/ARCHITECTURE.md` sections 4.2 and 4.3.
|
|
16
|
+
|
|
17
|
+
2. If the user provided an example JSON, use it. If they provided an endpoint:
|
|
18
|
+
- Search existing code for calls to that endpoint
|
|
19
|
+
- Ask the user for an example response JSON
|
|
20
|
+
|
|
21
|
+
3. From the JSON, create:
|
|
22
|
+
|
|
23
|
+
a. **`[resource].types.ts`** -- types that mirror the API exactly:
|
|
24
|
+
- snake_case, string dates, IDs as string
|
|
25
|
+
- Include request payloads and list response (with pagination)
|
|
26
|
+
|
|
27
|
+
b. **`[resource].contracts.ts`** -- clean app contracts:
|
|
28
|
+
- camelCase, Date objects, derived booleans
|
|
29
|
+
- No internal API fields (tokens, metadata)
|
|
30
|
+
|
|
31
|
+
c. **`[resource]-adapter.ts`** -- pure functions:
|
|
32
|
+
- `toXxx(response)` -- inbound (API -> App)
|
|
33
|
+
- `toXxxList(response)` -- inbound for list
|
|
34
|
+
- `toCreatePayload(input)` -- outbound (App -> API)
|
|
35
|
+
- Conversions: snake->camel, string->Date, cents->decimal
|
|
36
|
+
|
|
37
|
+
4. Validate: `npx tsc --noEmit`
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docs-onboard
|
|
3
|
+
description: "Create a quick module summary for onboarding new developers"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[module-name]"
|
|
6
|
+
allowed-tools: Read, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Create a quick summary of a module for onboarding.
|
|
10
|
+
|
|
11
|
+
Module: $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. Map the structure:
|
|
16
|
+
```bash
|
|
17
|
+
find src/modules/$ARGUMENTS -type f | head -40
|
|
18
|
+
find app/$ARGUMENTS -type f | head -10
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Summarize in quick format:
|
|
22
|
+
|
|
23
|
+
### Endpoints
|
|
24
|
+
List the consumed endpoints (grep in services).
|
|
25
|
+
|
|
26
|
+
### Pages & Routes
|
|
27
|
+
List the app/ routes and their types (Server/Client).
|
|
28
|
+
|
|
29
|
+
### Main Components
|
|
30
|
+
List components and their responsibilities (1 line each). Note Server vs Client.
|
|
31
|
+
|
|
32
|
+
### State
|
|
33
|
+
- What is in Zustand? (client state)
|
|
34
|
+
- What is in React Query? (server state via hooks)
|
|
35
|
+
- What is in Server Actions? (mutations)
|
|
36
|
+
|
|
37
|
+
### Data Flow
|
|
38
|
+
```
|
|
39
|
+
Page (Server Component, fetch data)
|
|
40
|
+
--> Client Component (interactivity)
|
|
41
|
+
--> Hook (React Query + service + adapter)
|
|
42
|
+
--> Service (HTTP) --> Adapter (parse)
|
|
43
|
+
|
|
44
|
+
Mutations:
|
|
45
|
+
Client Component --> Server Action --> Service --> Adapter --> revalidatePath
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Points of Attention
|
|
49
|
+
- Anything outside the ARCHITECTURE.md pattern?
|
|
50
|
+
- Components > 200 lines?
|
|
51
|
+
- Missing loading.tsx or error.tsx?
|
|
52
|
+
- Pages Router remnants?
|
|
53
|
+
- Missing `'use client'` or `'use server'` directives?
|
|
54
|
+
|
|
55
|
+
3. Output: concise summary that a new developer can understand the module in 2 minutes.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: migration-migrate-component
|
|
3
|
+
description: "Migrate a Pages Router component/page to App Router following ARCHITECTURE.md"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[component-file]"
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Migrate a Pages Router component/page to App Router following `docs/ARCHITECTURE.md` sections 5 and 6.
|
|
10
|
+
|
|
11
|
+
Component: $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. Read `docs/ARCHITECTURE.md` sections 5 and 6.
|
|
16
|
+
|
|
17
|
+
2. Analyze the component/page:
|
|
18
|
+
- Count lines (JSX, logic)
|
|
19
|
+
- List: props, state, effects, data fetching methods
|
|
20
|
+
- Check for `getServerSideProps`, `getStaticProps`, `getStaticPaths`
|
|
21
|
+
- Check for `useRouter` from `next/router`
|
|
22
|
+
- Check for `Head` component usage
|
|
23
|
+
- Map who imports this component
|
|
24
|
+
|
|
25
|
+
3. Convert routing:
|
|
26
|
+
- `pages/xxx.tsx` -> `app/xxx/page.tsx`
|
|
27
|
+
- `pages/xxx/[id].tsx` -> `app/xxx/[id]/page.tsx`
|
|
28
|
+
- `pages/api/xxx.ts` -> `app/api/xxx/route.ts` (or Server Action)
|
|
29
|
+
|
|
30
|
+
4. Convert data fetching:
|
|
31
|
+
- `getServerSideProps` -> async Server Component (service + adapter)
|
|
32
|
+
- `getStaticProps` -> async Server Component + revalidate
|
|
33
|
+
- `getStaticPaths` -> `generateStaticParams()`
|
|
34
|
+
- Client-side `useEffect` + fetch -> React Query hook
|
|
35
|
+
|
|
36
|
+
5. Determine Server vs Client:
|
|
37
|
+
- Data fetching only? -> Server Component
|
|
38
|
+
- Has hooks, events, browser APIs? -> Client Component
|
|
39
|
+
- Mixed? -> Split into Server page + Client component
|
|
40
|
+
|
|
41
|
+
6. Convert imports:
|
|
42
|
+
- `useRouter` from `next/router` -> `useRouter` + `usePathname` + `useSearchParams` from `next/navigation`
|
|
43
|
+
- `Head` -> `metadata` export or `generateMetadata()`
|
|
44
|
+
|
|
45
|
+
7. Create siblings:
|
|
46
|
+
- `loading.tsx` -- skeleton matching page structure
|
|
47
|
+
- `error.tsx` -- error boundary (`'use client'` required)
|
|
48
|
+
|
|
49
|
+
8. Type all props.
|
|
50
|
+
|
|
51
|
+
9. Decompose if > 200 lines.
|
|
52
|
+
|
|
53
|
+
10. Validate:
|
|
54
|
+
```bash
|
|
55
|
+
npx tsc --noEmit
|
|
56
|
+
npx next build
|
|
57
|
+
npx vitest run --passWithNoTests
|
|
58
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: migration-migrate-module
|
|
3
|
+
description: "Migrate an entire module from Pages Router to App Router architecture in 6 phases"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[module-path]"
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Migrate an entire module to the target architecture from `docs/ARCHITECTURE.md`.
|
|
10
|
+
|
|
11
|
+
Module/Path: $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
Use `@migrator` to coordinate the full migration in phases:
|
|
16
|
+
|
|
17
|
+
1. **Phase 0 -- Analysis**: Map the module (files, patterns, dependencies, Pages Router usage)
|
|
18
|
+
2. **Phase 1 -- Structure**: Create `src/modules/[name]/` (components/, hooks/, services/, adapters/, stores/, actions/, types/, __tests__/) + `app/[name]/` (page, layout, loading, error)
|
|
19
|
+
3. **Phase 2 -- Types**: Create `.types.ts` + `.contracts.ts` + adapter
|
|
20
|
+
4. **Phase 3 -- Services**: Migrate to pure service (no try/catch)
|
|
21
|
+
5. **Phase 4 -- State & Data**: getServerSideProps -> async Server Component, client fetch -> React Query hooks, state -> Zustand, mutations -> Server Actions
|
|
22
|
+
6. **Phase 5 -- Components & Pages**: Convert pages/ to app/, determine Server vs Client, type all props, create loading + error
|
|
23
|
+
7. **Phase 6 -- Review**: Validate conformance, check for Pages Router remnants
|
|
24
|
+
|
|
25
|
+
Validate build/tsc/tests after each phase. Ask for approval before each phase.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-check-architecture
|
|
3
|
+
description: "Validate project conformance against ARCHITECTURE.md with automated checks (Next.js-specific)"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[module]"
|
|
6
|
+
allowed-tools: Read, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Validate the entire project (or a specific module) against `docs/ARCHITECTURE.md`.
|
|
10
|
+
|
|
11
|
+
Scope: $ARGUMENTS (if empty, validate all src/modules/)
|
|
12
|
+
|
|
13
|
+
## Automated Checks
|
|
14
|
+
|
|
15
|
+
Run all checks and report a summary:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
echo "=== 1. Services with try/catch ==="
|
|
19
|
+
grep -rn "try {" src/modules/*/services/ --include="*.ts" 2>/dev/null || echo "OK: None"
|
|
20
|
+
|
|
21
|
+
echo "=== 2. Services with transformation ==="
|
|
22
|
+
grep -rn "\.map(\|\.filter(\|new Date\|\.reduce(" src/modules/*/services/ --include="*.ts" 2>/dev/null || echo "OK: None"
|
|
23
|
+
|
|
24
|
+
echo "=== 3. Hooks in Server Components (pages without 'use client') ==="
|
|
25
|
+
for f in $(find app/ -name "page.tsx" -o -name "layout.tsx" 2>/dev/null); do
|
|
26
|
+
if ! grep -q "'use client'" "$f" 2>/dev/null; then
|
|
27
|
+
grep -l "useState\|useEffect\|useRef\|useQuery\|useStore" "$f" 2>/dev/null
|
|
28
|
+
fi
|
|
29
|
+
done || echo "OK: None"
|
|
30
|
+
|
|
31
|
+
echo "=== 4. Missing 'use client' in components with hooks ==="
|
|
32
|
+
grep -rn "useState\|useEffect\|useRef\|useCallback\|useMemo\|useQuery\|useMutation" src/modules/*/components/ --include="*.tsx" -l 2>/dev/null | while read f; do
|
|
33
|
+
grep -L "'use client'" "$f" 2>/dev/null
|
|
34
|
+
done || echo "OK: None"
|
|
35
|
+
|
|
36
|
+
echo "=== 5. Missing 'use server' in actions ==="
|
|
37
|
+
grep -rL "'use server'" src/modules/*/actions/ --include="*.ts" 2>/dev/null || echo "OK: All have directive"
|
|
38
|
+
|
|
39
|
+
echo "=== 6. error.tsx without 'use client' ==="
|
|
40
|
+
find app/ -name "error.tsx" 2>/dev/null | while read f; do
|
|
41
|
+
grep -L "'use client'" "$f" 2>/dev/null
|
|
42
|
+
done || echo "OK: All have directive"
|
|
43
|
+
|
|
44
|
+
echo "=== 7. Missing loading.tsx for pages ==="
|
|
45
|
+
for dir in $(find app/ -name "page.tsx" -exec dirname {} \; 2>/dev/null); do
|
|
46
|
+
[ ! -f "$dir/loading.tsx" ] && echo "Missing: $dir/loading.tsx"
|
|
47
|
+
done || echo "OK: All present"
|
|
48
|
+
|
|
49
|
+
echo "=== 8. Missing error.tsx for pages ==="
|
|
50
|
+
for dir in $(find app/ -name "page.tsx" -exec dirname {} \; 2>/dev/null); do
|
|
51
|
+
[ ! -f "$dir/error.tsx" ] && echo "Missing: $dir/error.tsx"
|
|
52
|
+
done || echo "OK: All present"
|
|
53
|
+
|
|
54
|
+
echo "=== 9. Server state in Zustand ==="
|
|
55
|
+
grep -rn "async\|fetch\|axios\|api\.\|\.get(\|\.post(" src/modules/*/stores/ --include="*.ts" 2>/dev/null || echo "OK: None"
|
|
56
|
+
|
|
57
|
+
echo "=== 10. any types ==="
|
|
58
|
+
grep -rn ": any\| any;\|as any\|<any>" src/modules/ --include="*.ts" --include="*.tsx" 2>/dev/null | wc -l
|
|
59
|
+
|
|
60
|
+
echo "=== 11. Cross-module imports ==="
|
|
61
|
+
for module in src/modules/*/; do
|
|
62
|
+
name=$(basename "$module")
|
|
63
|
+
grep -rn "from.*modules/" "$module" --include="*.ts" --include="*.tsx" 2>/dev/null | grep -v "modules/${name}" || true
|
|
64
|
+
done
|
|
65
|
+
|
|
66
|
+
echo "=== 12. dangerouslySetInnerHTML ==="
|
|
67
|
+
grep -rn "dangerouslySetInnerHTML" src/ app/ --include="*.tsx" 2>/dev/null || echo "OK: None"
|
|
68
|
+
|
|
69
|
+
echo "=== 13. Debug artifacts ==="
|
|
70
|
+
grep -rn "console\.\|debugger" src/modules/ --include="*.ts" --include="*.tsx" 2>/dev/null | wc -l
|
|
71
|
+
|
|
72
|
+
echo "=== 14. Queries without staleTime ==="
|
|
73
|
+
grep -rn "useQuery" src/ --include="*.ts" --include="*.tsx" -l 2>/dev/null | while read f; do
|
|
74
|
+
grep -L "staleTime" "$f" 2>/dev/null
|
|
75
|
+
done
|
|
76
|
+
|
|
77
|
+
echo "=== 15. Components > 200 lines ==="
|
|
78
|
+
find src/modules -name "*.tsx" -exec sh -c 'lines=$(wc -l < "$1"); [ "$lines" -gt 200 ] && echo "$1: $lines lines"' _ {} \;
|
|
79
|
+
|
|
80
|
+
echo "=== 16. Pages Router remnants ==="
|
|
81
|
+
ls pages/ 2>/dev/null && echo "WARN: pages/ directory still exists"
|
|
82
|
+
grep -rn "getServerSideProps\|getStaticProps\|getStaticPaths" src/ app/ --include="*.ts" --include="*.tsx" 2>/dev/null || echo "OK: None"
|
|
83
|
+
grep -rn "from.*next/router" src/ app/ --include="*.ts" --include="*.tsx" 2>/dev/null || echo "OK: None"
|
|
84
|
+
|
|
85
|
+
echo "=== 17. <img> instead of next/image ==="
|
|
86
|
+
grep -rn "<img " src/ app/ --include="*.tsx" 2>/dev/null || echo "OK: None"
|
|
87
|
+
|
|
88
|
+
echo "=== 18. Missing metadata in pages ==="
|
|
89
|
+
for f in $(find app/ -name "page.tsx" 2>/dev/null); do
|
|
90
|
+
grep -L "metadata\|generateMetadata" "$f" 2>/dev/null
|
|
91
|
+
done || echo "OK: All have metadata"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Produce a summary table:
|
|
95
|
+
|
|
96
|
+
| Check | Status | Occurrences |
|
|
97
|
+
|-------|--------|-------------|
|
|
98
|
+
| Services without try/catch | OK/FAIL | X |
|
|
99
|
+
| ... | ... | ... |
|
|
100
|
+
|
|
101
|
+
Overall score: X/18 checks passing.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-fix-violations
|
|
3
|
+
description: "Find and auto-fix ARCHITECTURE.md violations in a module"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[module]"
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Identify and fix `docs/ARCHITECTURE.md` violations in the specified module.
|
|
10
|
+
|
|
11
|
+
Module: $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. Run `/review-check-architecture` to find violations.
|
|
16
|
+
|
|
17
|
+
2. For each violation found, fix in priority order:
|
|
18
|
+
|
|
19
|
+
**Critical (fix first):**
|
|
20
|
+
- try/catch in services -> remove, move error handling to hook or Server Action
|
|
21
|
+
- Transformation in services -> move to adapter
|
|
22
|
+
- Hooks in Server Components -> add `'use client'` or move hooks to Client Component
|
|
23
|
+
- Missing `'use client'` in components with hooks -> add directive
|
|
24
|
+
- Missing `'use server'` in actions -> add directive
|
|
25
|
+
- error.tsx without `'use client'` -> add directive
|
|
26
|
+
- dangerouslySetInnerHTML without sanitization -> remove or sanitize
|
|
27
|
+
- Hardcoded secrets -> move to env vars
|
|
28
|
+
|
|
29
|
+
**Important:**
|
|
30
|
+
- Server state in Zustand -> migrate to React Query hooks
|
|
31
|
+
- any types -> type correctly
|
|
32
|
+
- Missing staleTime in queries -> add
|
|
33
|
+
- Missing loading.tsx / error.tsx -> create
|
|
34
|
+
- Pages Router remnants -> convert to App Router
|
|
35
|
+
- `<img>` tags -> convert to `next/image`
|
|
36
|
+
- Missing metadata in pages -> add metadata export
|
|
37
|
+
|
|
38
|
+
**Improvements:**
|
|
39
|
+
- Components > 200 lines -> decompose
|
|
40
|
+
- Console.log -> remove
|
|
41
|
+
- TODO/FIXME -> resolve or create issue
|
|
42
|
+
|
|
43
|
+
3. Validate after each fix:
|
|
44
|
+
```bash
|
|
45
|
+
npx tsc --noEmit && npx next build && npx vitest run --passWithNoTests
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
4. Report what was fixed and what remains.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-review
|
|
3
|
+
description: "Perform a full code review validating against ARCHITECTURE.md (RSC + Client checks)"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[scope]"
|
|
6
|
+
allowed-tools: Read, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Perform a full code review of changed files, validating against `docs/ARCHITECTURE.md`.
|
|
10
|
+
|
|
11
|
+
Scope: $ARGUMENTS (if empty, review files changed in git)
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. Identify changed files:
|
|
16
|
+
```bash
|
|
17
|
+
git diff --name-only HEAD~1 2>/dev/null || git diff --name-only --cached 2>/dev/null || echo "Please specify the files"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
2. Run automated checks:
|
|
21
|
+
```bash
|
|
22
|
+
npx tsc --noEmit
|
|
23
|
+
npx eslint --ext .ts,.tsx src/ app/ --max-warnings 0
|
|
24
|
+
npx vitest run --passWithNoTests
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
3. Check ARCHITECTURE.md patterns:
|
|
28
|
+
- Services: no try/catch, no transformation
|
|
29
|
+
- Adapters: pure functions
|
|
30
|
+
- Hooks: use service+adapter, staleTime defined, `'use client'`
|
|
31
|
+
- Stores: client state only (Zustand), selectors in consumers
|
|
32
|
+
- Server Components: no hooks, no event handlers, no browser APIs
|
|
33
|
+
- Client Components: `'use client'` directive, proper hook usage
|
|
34
|
+
- Server Actions: `'use server'`, revalidatePath after mutations
|
|
35
|
+
- Pages: metadata exported, loading.tsx + error.tsx siblings
|
|
36
|
+
- error.tsx: must have `'use client'`
|
|
37
|
+
- Naming: correct conventions
|
|
38
|
+
- Boundaries: no cross-module imports
|
|
39
|
+
|
|
40
|
+
4. Classify:
|
|
41
|
+
- VIOLATION -- ARCHITECTURE.md violation
|
|
42
|
+
- ATTENTION -- Recommended improvement
|
|
43
|
+
- COMPLIANT -- Correct
|
|
44
|
+
- HIGHLIGHT -- Positive highlight
|
|
45
|
+
|
|
46
|
+
5. Produce report with verdict: Approved | With caveats | Requires changes
|