create-claude-workspace 1.0.0 → 1.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/README.md +53 -31
- package/dist/template/.claude/agents/backend-ts-architect.md +5 -5
- package/dist/template/.claude/agents/orchestrator.md +12 -1
- package/dist/template/.claude/agents/project-initializer.md +25 -3
- package/dist/template/.claude/agents/senior-code-reviewer.md +23 -22
- package/dist/template/.claude/agents/technical-planner.md +3 -2
- package/dist/template/.claude/agents/test-engineer.md +15 -28
- package/dist/template/.claude/agents/ui-engineer.md +64 -51
- package/dist/template/.claude/profiles/angular.md +233 -0
- package/dist/template/.claude/profiles/react.md +249 -0
- package/dist/template/.claude/profiles/svelte.md +263 -0
- package/dist/template/.claude/profiles/vue.md +292 -0
- package/dist/template/.claude/scripts/autonomous.mjs +52 -8
- package/dist/template/.claude/scripts/docker-run.mjs +6 -1
- package/dist/template/.claude/templates/claude-md.md +38 -173
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,29 +1,50 @@
|
|
|
1
1
|
# Claude Starter Kit
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Autonomous AI-driven development agents for Claude Code.
|
|
4
|
+
One command to scaffold, then let Claude build your TypeScript project.
|
|
5
5
|
|
|
6
|
-
> **
|
|
6
|
+
> **Framework-agnostic**: Supports Angular, React, Vue, Svelte via frontend profiles. Optimized for Nx monorepo but works with standalone projects too.
|
|
7
7
|
|
|
8
|
-
## Quick Start
|
|
8
|
+
## Quick Start
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
```bash
|
|
11
|
+
npx create-claude-workspace
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This scaffolds the `.claude/` folder (agents, scripts, templates) plus Docker files into your project.
|
|
15
|
+
|
|
16
|
+
Then initialize your project:
|
|
11
17
|
|
|
12
18
|
```bash
|
|
13
|
-
|
|
19
|
+
claude --agent project-initializer
|
|
14
20
|
```
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
Answer the discovery questions (non-technical). Claude generates the full pipeline:
|
|
23
|
+
- `CLAUDE.md` — architecture & conventions
|
|
24
|
+
- `PRODUCT.md` — product strategy & monetization (via `product-owner` agent)
|
|
25
|
+
- `TODO.md` — phased development plan (via `technical-planner` agent)
|
|
26
|
+
- `MEMORY.md` — progress tracking
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
### Start Autonomous Development
|
|
29
|
+
|
|
30
|
+
Pick one:
|
|
31
|
+
|
|
32
|
+
- **Unattended** (recommended): `node .claude/scripts/autonomous.mjs --skip-permissions` — clean context per task, survives rate limits
|
|
33
|
+
- **Docker** (fully isolated): `node .claude/scripts/docker-run.mjs` — container sandbox, safe `--skip-permissions`
|
|
34
|
+
- **Interactive**: `claude --agent orchestrator`, then `/ralph-loop:ralph-loop Continue autonomous development according to CLAUDE.md`
|
|
35
|
+
|
|
36
|
+
### npx Options
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx create-claude-workspace [directory] # scaffold into a specific directory
|
|
40
|
+
npx create-claude-workspace --update # overwrite agents with latest version
|
|
41
|
+
npx create-claude-workspace --run # scaffold + start autonomous loop
|
|
42
|
+
npx create-claude-workspace --docker # scaffold + run in Docker
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Docker Options
|
|
24
46
|
|
|
25
47
|
```bash
|
|
26
|
-
# Options (same on all platforms)
|
|
27
48
|
node .claude/scripts/docker-run.mjs --max-iterations 20 # limit iterations
|
|
28
49
|
node .claude/scripts/docker-run.mjs --shell # interactive shell
|
|
29
50
|
node .claude/scripts/docker-run.mjs --rebuild # force rebuild image
|
|
@@ -31,20 +52,8 @@ node .claude/scripts/docker-run.mjs --login # run 'claude auth lo
|
|
|
31
52
|
ANTHROPIC_API_KEY=sk-... node .claude/scripts/docker-run.mjs # API key
|
|
32
53
|
```
|
|
33
54
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
1. Copy `.claude/` folder into your project root (includes `CLAUDE.md` with agent routing instructions)
|
|
37
|
-
2. Run Claude Code in your project
|
|
38
|
-
3. Say: **"Initialize this project"** (Claude reads `.claude/CLAUDE.md` and delegates to `project-initializer` agent)
|
|
39
|
-
4. Answer the discovery questions (non-technical)
|
|
40
|
-
5. Claude generates the full pipeline:
|
|
41
|
-
- `CLAUDE.md` — architecture & conventions
|
|
42
|
-
- `PRODUCT.md` — product strategy & monetization (via `product-owner` agent)
|
|
43
|
-
- `TODO.md` — phased development plan (via `technical-planner` agent)
|
|
44
|
-
- `MEMORY.md` — progress tracking
|
|
45
|
-
6. Start autonomous development (pick one):
|
|
46
|
-
- **Unattended** (recommended): `node .claude/scripts/autonomous.mjs --skip-permissions` — runs in clean context per task, survives rate limits
|
|
47
|
-
- **Interactive**: Start Claude with `claude --agent orchestrator`, then use `/ralph-loop:ralph-loop Continue autonomous development according to CLAUDE.md`
|
|
55
|
+
**Authentication:** The Docker container uses your host machine's Claude auth automatically.
|
|
56
|
+
Authenticate on your host first (`claude auth login`), or pass an API key.
|
|
48
57
|
|
|
49
58
|
## Agents
|
|
50
59
|
|
|
@@ -56,7 +65,7 @@ ANTHROPIC_API_KEY=sk-... node .claude/scripts/docker-run.mjs # API key
|
|
|
56
65
|
| `devops-integrator` | GitLab/GitHub: milestones, issues, branches, MRs/PRs, post-merge cleanup |
|
|
57
66
|
| `deployment-engineer` | CI/CD pipelines, deploys, rollbacks, smoke tests, DB migrations |
|
|
58
67
|
| `orchestrator` | Development cycle: 12-step workflow with error recovery |
|
|
59
|
-
| `ui-engineer` | Frontend:
|
|
68
|
+
| `ui-engineer` | Frontend: components, styling, state, a11y (any framework) |
|
|
60
69
|
| `backend-ts-architect` | Backend: API, DB, business logic, DI, services |
|
|
61
70
|
| `senior-code-reviewer` | Code review: security, performance, architecture, duplication |
|
|
62
71
|
| `test-engineer` | Write and run tests: Vitest/Jest auto-detect + Playwright E2E |
|
|
@@ -142,9 +151,22 @@ claude plugin add commit-commands # git workflow shortcuts
|
|
|
142
151
|
# Figma MCP — configure in Claude Code MCP settings with API token
|
|
143
152
|
```
|
|
144
153
|
|
|
154
|
+
## Frontend Profiles
|
|
155
|
+
|
|
156
|
+
Framework-specific best practices are stored in `.claude/profiles/`. During project initialization, the correct profile is detected and copied to `.claude/profiles/frontend.md` in the target project.
|
|
157
|
+
|
|
158
|
+
**Shipped profiles:**
|
|
159
|
+
- `angular.md` — Angular (signals, standalone, zoneless, SSR, TestBed, theme system)
|
|
160
|
+
|
|
161
|
+
**Planned:**
|
|
162
|
+
- `react.md` — React (hooks, server components, Testing Library)
|
|
163
|
+
- `vue.md` — Vue (Composition API, Pinia, Vue Test Utils)
|
|
164
|
+
- `svelte.md` — Svelte (runes, $state, SvelteKit)
|
|
165
|
+
|
|
166
|
+
Only `ui-engineer`, `senior-code-reviewer`, and `test-engineer` read the frontend profile. Backend and infrastructure agents are unaffected — they don't receive framework-specific context.
|
|
167
|
+
|
|
145
168
|
## Limitations
|
|
146
169
|
|
|
147
|
-
- Designed for **Angular + Nx monorepo** projects only — will not work with React, Vue, or plain Angular CLI
|
|
148
170
|
- Requires **Claude Code** with Agent tool support (`subagent_type` parameter)
|
|
149
171
|
- `ralph-loop` and other plugins are Claude Code community plugins — install via `claude plugin add <name>`
|
|
150
172
|
- Git integration requires `gh` (GitHub) or `glab` (GitLab) CLI to be installed and authenticated
|
|
@@ -155,7 +177,7 @@ claude plugin add commit-commands # git workflow shortcuts
|
|
|
155
177
|
|
|
156
178
|
| File | Content |
|
|
157
179
|
|------|---------|
|
|
158
|
-
| `CLAUDE.md` | Architecture,
|
|
180
|
+
| `CLAUDE.md` | Architecture, coding standards, DI, workflow mode (solo/team), autonomous workflow |
|
|
159
181
|
| `PRODUCT.md` | Vision, target users, features (MVP/v1.1/future), monetization, metrics |
|
|
160
182
|
| `TODO.md` | Phased tasks with type/dependencies/complexity/acceptance criteria, checkboxes (`[ ]` / `[x]` / `[~]`) |
|
|
161
183
|
| `MEMORY.md` | Session state: current task/step, iterations, complexity tracking, done, next, decisions, blockers |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: backend-ts-architect
|
|
3
|
-
description: "Use this agent for backend TypeScript tasks: API design, database operations, business logic, authentication, service architecture, or backend code reviews. Works with Hono, Cloudflare Workers, Node.js, Bun, and custom DI
|
|
3
|
+
description: "Use this agent for backend TypeScript tasks: API design, database operations, business logic, authentication, service architecture, or backend code reviews. Works with Hono, Cloudflare Workers, Node.js, Bun, and custom DI.\n\nExamples:\n\n<example>\nuser: \"Create an API endpoint for processing transactions\"\nassistant: \"This involves backend API design with transaction handling. Let me use the backend-ts-architect agent.\"\n</example>\n\n<example>\nuser: \"Design the payout calculation service\"\nassistant: \"I'll use the backend-ts-architect agent to architect this service properly.\"\n</example>\n\n<example>\nuser: \"The database queries are slow\"\nassistant: \"Let me engage the backend-ts-architect agent to analyze and optimize these queries.\"\n</example>"
|
|
4
4
|
model: opus
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ You are a Senior Backend TypeScript Architect with deep expertise in server-side
|
|
|
11
11
|
- Advanced TypeScript patterns (generics, conditional types, mapped types, branded types)
|
|
12
12
|
- Hono framework (routes, middleware, validation)
|
|
13
13
|
- Platform-agnostic backend: runs on both Cloudflare Workers (production) and Node.js (local dev)
|
|
14
|
-
- Custom
|
|
14
|
+
- Custom DI framework (Injector, InjectionToken, inject(), Provider)
|
|
15
15
|
- RESTful API design with OpenAPI documentation
|
|
16
16
|
- Database design, query optimization, migrations
|
|
17
17
|
- Authentication, authorization, security best practices
|
|
@@ -41,10 +41,10 @@ You are a Senior Backend TypeScript Architect with deep expertise in server-side
|
|
|
41
41
|
|
|
42
42
|
**Custom DI:**
|
|
43
43
|
- `InjectionToken<T>` for typed tokens
|
|
44
|
-
- `inject()` for dependency resolution
|
|
44
|
+
- `inject()` for dependency resolution
|
|
45
45
|
- `Injector.create({ providers, parent? })` for container setup
|
|
46
46
|
- `runInInjectionContext()` for scoped execution
|
|
47
|
-
-
|
|
47
|
+
- Consistent DI pattern across frontend and backend
|
|
48
48
|
|
|
49
49
|
**UnitOfWork:**
|
|
50
50
|
- Atomic multi-table writes without transactions (D1 `batch()` / SQLite transaction)
|
|
@@ -75,7 +75,7 @@ You are a Senior Backend TypeScript Architect with deep expertise in server-side
|
|
|
75
75
|
|
|
76
76
|
## Code Standards
|
|
77
77
|
|
|
78
|
-
- Strict TypeScript — no `any`, proper type imports
|
|
78
|
+
- Strict TypeScript — no `any`, no `eslint-disable`, proper type imports
|
|
79
79
|
- `moduleResolution: "bundler"` — NEVER add `.js` extensions to imports (write `'./foo'`, not `'./foo.js'`)
|
|
80
80
|
- `readonly` on all fields that don't need reassignment
|
|
81
81
|
- Custom error classes for domain-specific errors
|
|
@@ -33,7 +33,7 @@ At the beginning of EVERY session (including every Ralph Loop iteration):
|
|
|
33
33
|
### 2. Resolve app names
|
|
34
34
|
- Read CLAUDE.md — find app name(s) from the Architecture/Tech Stack section
|
|
35
35
|
- Store app names for use in build/test/lint commands:
|
|
36
|
-
- `FRONTEND_APP` = the
|
|
36
|
+
- `FRONTEND_APP` = the frontend app name (e.g., `my-app`)
|
|
37
37
|
- `BACKEND_APP` = the API app name (e.g., `api`) — may not exist
|
|
38
38
|
- Also note: workflow mode from CLAUDE.md — `Workflow: solo` or `Workflow: team` (default: solo)
|
|
39
39
|
- Store these in MEMORY.md under a `## Session Config` section if not already present
|
|
@@ -71,6 +71,11 @@ If currently on main/master AND remote exists (`git remote -v | grep origin`):
|
|
|
71
71
|
```bash
|
|
72
72
|
git pull --rebase origin HEAD
|
|
73
73
|
```
|
|
74
|
+
If on a **detached HEAD** (worktree mode after previous merge) AND remote exists:
|
|
75
|
+
```bash
|
|
76
|
+
git fetch origin main:main 2>/dev/null || git fetch origin master:master
|
|
77
|
+
```
|
|
78
|
+
This updates the local main ref without checkout — needed when main is checked out in another worktree.
|
|
74
79
|
If no remote or on a feature branch (continuing work), skip this step.
|
|
75
80
|
|
|
76
81
|
### 7. Check git log and structure
|
|
@@ -326,6 +331,12 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
326
331
|
|
|
327
332
|
**STEP 12: POST-MERGE & NEXT ITEM**
|
|
328
333
|
- Working tree is now **clean** (everything committed in STEP 11, including `Current Step: 12 — POST-MERGE (pending)` in MEMORY.md).
|
|
334
|
+
- **Worktree handling**: If any `git checkout main` below fails with "already checked out at" error (you're in a git worktree while main is checked out elsewhere):
|
|
335
|
+
1. Merge without checkout: `git fetch . feat/{branch-name}:main` (fast-forwards local main). If not a fast-forward (main diverged), rebase first: `git rebase main && git fetch . HEAD:main`.
|
|
336
|
+
2. Detach HEAD: `git checkout --detach`
|
|
337
|
+
3. Delete feature branch: `git branch -d feat/{branch-name}`
|
|
338
|
+
4. Skip `git pull --rebase origin HEAD` here — health check syncs at next iteration start.
|
|
339
|
+
5. Continue to next task from the detached state (STEP 1 will create a new feature branch).
|
|
329
340
|
- **Solo workflow** (CLAUDE.md `Workflow: solo` or default):
|
|
330
341
|
- **If git integration active** (MR/PR was created in STEP 11):
|
|
331
342
|
- Ensure latest commit is pushed:
|
|
@@ -37,8 +37,16 @@ After the conversation, scan what already exists. Do NOT create or scaffold anyt
|
|
|
37
37
|
- Check if this is a git repo (`git rev-parse --git-dir`). If not, `git init`.
|
|
38
38
|
- `git remote -v` — note if remote origin exists
|
|
39
39
|
- Read `package.json`, `nx.json`, `tsconfig.base.json` if they exist
|
|
40
|
+
- **Detect frontend framework** from `package.json` dependencies:
|
|
41
|
+
- `@angular/core` → Angular
|
|
42
|
+
- `react` or `next` → React
|
|
43
|
+
- `vue` or `nuxt` → Vue
|
|
44
|
+
- `svelte` or `@sveltejs/kit` → Svelte
|
|
45
|
+
- None of the above → no frontend / backend-only / TS library
|
|
46
|
+
- Store the detected framework for Step 4 (profile selection)
|
|
40
47
|
- List `apps/` and `libs/` structure if they exist
|
|
41
48
|
- Check for existing plan/design/UX files (TODO.md, PLAN.md, PRODUCT.md, UX.md)
|
|
49
|
+
- Check for existing `.claude/profiles/frontend.md` (may already exist if user set it up manually)
|
|
42
50
|
- Check if Figma MCP server is available
|
|
43
51
|
- `git log --oneline -10` — recent history
|
|
44
52
|
|
|
@@ -129,7 +137,9 @@ If `git remote -v` shows no origin:
|
|
|
129
137
|
|
|
130
138
|
If remote is already configured, skip this step.
|
|
131
139
|
|
|
132
|
-
### Step 4: Generate CLAUDE.md
|
|
140
|
+
### Step 4: Generate CLAUDE.md and Frontend Profile
|
|
141
|
+
|
|
142
|
+
**4a. Generate CLAUDE.md:**
|
|
133
143
|
|
|
134
144
|
Read the template from `.claude/templates/claude-md.md`.
|
|
135
145
|
Create a **minimal** CLAUDE.md in the project root by filling what is KNOWN from the conversation and codebase:
|
|
@@ -138,12 +148,24 @@ Create a **minimal** CLAUDE.md in the project root by filling what is KNOWN from
|
|
|
138
148
|
- If user answered "yes" to npm publishing (question 6), add `- **Distribution**: npm ([registry], [public/restricted])` to Tech Stack section (details collected in Step 2b)
|
|
139
149
|
- Fill in Tech Stack ONLY for what is already detected in the codebase (existing package.json, nx.json, etc.)
|
|
140
150
|
- For NEW projects (empty codebase): leave Tech Stack minimal — just project type and package manager if known. Architecture decisions will be made by architect agents in TODO.md Phase 0.
|
|
141
|
-
- **Remove all Angular-specific sections** if the project is not Angular (detected from codebase or conversation)
|
|
142
151
|
- **Remove all backend sections** if no backend is mentioned
|
|
143
152
|
- Remove placeholder comments and unresolved `[PLACEHOLDER]` values
|
|
144
|
-
- Keep: CLI-First Principle,
|
|
153
|
+
- Keep: CLI-First Principle, Code Quality & Linting, and general coding conventions — these apply to all project types
|
|
145
154
|
- The result should be a working CLAUDE.md that will be EXPANDED by architect agents as they make technical decisions
|
|
146
155
|
|
|
156
|
+
**4b. Copy frontend profile:**
|
|
157
|
+
|
|
158
|
+
If a frontend framework was detected (or is expected for a new project):
|
|
159
|
+
1. Check `.claude/profiles/` for the matching profile file:
|
|
160
|
+
- Angular → `.claude/profiles/angular.md`
|
|
161
|
+
- React → `.claude/profiles/react.md`
|
|
162
|
+
- Vue → `.claude/profiles/vue.md`
|
|
163
|
+
- Svelte → `.claude/profiles/svelte.md`
|
|
164
|
+
2. Copy the profile to `.claude/profiles/frontend.md` in the project
|
|
165
|
+
3. If the profile file doesn't exist in the kit (not yet created), warn: "No profile found for [framework]. The ui-engineer, test-engineer, and senior-code-reviewer agents will rely on their native knowledge of [framework]. Consider creating `.claude/profiles/frontend.md` with project-specific conventions."
|
|
166
|
+
|
|
167
|
+
If no frontend framework is detected (backend-only / TS library), skip this step.
|
|
168
|
+
|
|
147
169
|
### Step 5: Product Planning — DELEGATE to `product-owner` agent
|
|
148
170
|
|
|
149
171
|
**If commercial (from question 4):**
|
|
@@ -4,7 +4,7 @@ description: "Use this agent for comprehensive code review of recently written c
|
|
|
4
4
|
model: opus
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
You are a Senior Fullstack Code Reviewer with 15+ years of experience across frontend
|
|
7
|
+
You are a Senior Fullstack Code Reviewer with 15+ years of experience across frontend, backend (Node.js, Hono, Cloudflare Workers), and database domains. You conduct thorough, production-quality code reviews.
|
|
8
8
|
|
|
9
9
|
## Core Responsibilities
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ You are a Senior Fullstack Code Reviewer with 15+ years of experience across fro
|
|
|
12
12
|
- Evaluate architectural decisions against onion architecture and project conventions
|
|
13
13
|
- Ensure adherence to project-specific standards from CLAUDE.md
|
|
14
14
|
- Identify bugs, edge cases, error handling gaps
|
|
15
|
-
- Check
|
|
15
|
+
- Check frontend patterns from `.claude/profiles/frontend.md` (framework-specific review checklist)
|
|
16
16
|
|
|
17
17
|
## Review Process
|
|
18
18
|
|
|
@@ -20,6 +20,7 @@ You are a Senior Fullstack Code Reviewer with 15+ years of experience across fro
|
|
|
20
20
|
|
|
21
21
|
Before reviewing, you MUST:
|
|
22
22
|
- Read CLAUDE.md for project-specific coding standards and patterns
|
|
23
|
+
- Read `.claude/profiles/frontend.md` for framework-specific review checklist (if frontend code is involved)
|
|
23
24
|
- Read UX.md if it exists (design system compliance)
|
|
24
25
|
- Understand the business domain and requirements
|
|
25
26
|
- For Nx workspaces, understand project boundaries and dependencies
|
|
@@ -32,17 +33,16 @@ Before reviewing, you MUST:
|
|
|
32
33
|
- Logic errors, incorrect assumptions, off-by-one, null/undefined handling
|
|
33
34
|
- All requirements addressed, edge cases covered
|
|
34
35
|
|
|
35
|
-
**
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
- @defer for heavy components below the fold
|
|
36
|
+
**Frontend Patterns (from profile)**
|
|
37
|
+
Read `.claude/profiles/frontend.md` for the framework-specific review checklist. Apply ALL items listed there. Common cross-framework checks:
|
|
38
|
+
- Smart/dumb component separation — no service injection in presentational components
|
|
39
|
+
- No method calls or complex expressions in templates/JSX — use computed/derived values
|
|
40
|
+
- Correct state management patterns for the framework
|
|
41
|
+
- Lazy loading and code splitting applied correctly
|
|
42
|
+
- No hardcoded colors, sizes, or magic numbers — use theme system tokens
|
|
43
43
|
|
|
44
44
|
**SCSS & Theme**
|
|
45
|
-
- Theme compliance:
|
|
45
|
+
- Theme compliance: use theme functions/tokens from the frontend profile
|
|
46
46
|
- No hardcoded colors, sizes, or magic numbers
|
|
47
47
|
- Uses design tokens from theme system
|
|
48
48
|
|
|
@@ -50,6 +50,7 @@ Before reviewing, you MUST:
|
|
|
50
50
|
- Strict mode, no `any` — use `unknown` + narrowing
|
|
51
51
|
- No non-null assertions (`!`) — flag WARN. Handle nullability with type narrowing, `??`, or early returns
|
|
52
52
|
- No `as unknown as T` double-casting — flag WARN. Fix the types or use type guards instead
|
|
53
|
+
- No `eslint-disable` comments — flag CRITICAL. Never suppress linter rules — fix the underlying code instead
|
|
53
54
|
- `readonly` where appropriate
|
|
54
55
|
- Proper `type` imports for type-only imports
|
|
55
56
|
- Explicit access modifiers (public/protected/private)
|
|
@@ -63,9 +64,9 @@ Before reviewing, you MUST:
|
|
|
63
64
|
- **Co-located tests**: test files MUST be next to source files (`foo.spec.ts` beside `foo.ts`). Flag WARN if tests are placed in `__tests__/` directories or if multiple source files' tests are bundled into one `.spec.ts`.
|
|
64
65
|
|
|
65
66
|
**Memory & Resources**
|
|
66
|
-
- Subscription cleanup (
|
|
67
|
+
- Subscription/listener cleanup (framework-specific patterns from frontend profile)
|
|
67
68
|
- Resource disposal (ImageBitmap.close(), stream.stop(), BroadcastChannel.close())
|
|
68
|
-
- No memory leaks in effects or event listeners
|
|
69
|
+
- No memory leaks in effects, subscriptions, or event listeners
|
|
69
70
|
|
|
70
71
|
**Security**
|
|
71
72
|
- No innerHTML/XSS, no injection vulnerabilities
|
|
@@ -82,15 +83,15 @@ Before reviewing, you MUST:
|
|
|
82
83
|
- File upload: validate type, size, and sanitize filename (if applicable)
|
|
83
84
|
|
|
84
85
|
**SSR Safety**
|
|
85
|
-
- No direct window/document/navigator access
|
|
86
|
-
- Correct
|
|
87
|
-
- **SSR/Client separation**: Flag WARN if a service mixes server and browser logic
|
|
86
|
+
- No direct window/document/navigator access in server-rendered code
|
|
87
|
+
- Correct render mode per route (if framework supports it)
|
|
88
|
+
- **SSR/Client separation**: Flag WARN if a service mixes server and browser logic. These should be split into separate server/browser implementations — see frontend profile for framework-specific patterns
|
|
88
89
|
|
|
89
90
|
**Performance**
|
|
90
|
-
- Lazy loading
|
|
91
|
+
- Lazy loading / code splitting applied correctly
|
|
91
92
|
- No eager page imports
|
|
92
|
-
- No
|
|
93
|
-
-
|
|
93
|
+
- No computations in templates/JSX — use derived/computed values
|
|
94
|
+
- Deferred/lazy rendering for heavy below-fold content
|
|
94
95
|
|
|
95
96
|
**Architecture**
|
|
96
97
|
- Separation of concerns, correct lib boundaries
|
|
@@ -134,7 +135,7 @@ Before reviewing, you MUST:
|
|
|
134
135
|
- **Declarative over imperative**: prefer expressions that describe WHAT over statements that describe HOW. Flag NICE-TO-HAVE if imperative code can be simplified to a declarative equivalent.
|
|
135
136
|
|
|
136
137
|
**Code Style & Linting**
|
|
137
|
-
- Naming:
|
|
138
|
+
- Naming: follow conventions from frontend profile and CLAUDE.md
|
|
138
139
|
- Import ordering enforced by `simple-import-sort` — flag WARN if manual ordering is wrong
|
|
139
140
|
- No comments (self-explanatory code)
|
|
140
141
|
- DRY: 3+ repeats = extract to shared
|
|
@@ -144,8 +145,8 @@ Before reviewing, you MUST:
|
|
|
144
145
|
- `@nx/enforce-module-boundaries` — verify lib tags (`type:`, `scope:`) are set in `project.json` for new libraries, imports respect boundary constraints (e.g., `type:ui` cannot import `type:feature`, `type:domain` cannot import `type:infrastructure`)
|
|
145
146
|
- No cross-boundary imports via deep paths — only entry points via `@[PREFIX]/<lib>`
|
|
146
147
|
- Prettier formatting — no obvious violations (the pipeline catches this, but flag egregious manual formatting)
|
|
147
|
-
- Stylelint — no hardcoded colors or sizes in SCSS (must use theme tokens
|
|
148
|
-
- New libraries MUST be created via `nx generate
|
|
148
|
+
- Stylelint — no hardcoded colors or sizes in SCSS (must use theme tokens from frontend profile)
|
|
149
|
+
- New libraries MUST be created via generators (`nx generate` or framework CLI), not manually — flag if config files contain hand-written targets for standard operations (build, test, lint)
|
|
149
150
|
|
|
150
151
|
## Output Format
|
|
151
152
|
|
|
@@ -31,11 +31,12 @@ Read these files (all mandatory if they exist):
|
|
|
31
31
|
### 2. Determine Tech Stack (for new/empty projects)
|
|
32
32
|
|
|
33
33
|
If the codebase has no `nx.json` or `package.json` (brand new project), YOU must decide the tech stack based on PRODUCT.md features:
|
|
34
|
-
- **Does it need a UI?** →
|
|
34
|
+
- **Does it need a UI?** → Choose frontend framework based on project needs. Check if `.claude/profiles/` has a matching profile. If the user mentioned a preference in the discovery conversation, use that.
|
|
35
35
|
- **Does it need a backend?** → Default: Hono on Cloudflare Workers (production) + Node.js (local dev). Backend code must be platform-agnostic — no Node-specific or CF-specific APIs in business/domain layers.
|
|
36
36
|
- **Does it need a database?** → Default: D1 (Cloudflare production) + SQLite/better-sqlite3 (local dev). Both behind repository interfaces.
|
|
37
37
|
- **Package manager** → Default to `npm` unless PRODUCT.md or user context suggests otherwise.
|
|
38
|
-
- **
|
|
38
|
+
- **Monorepo** → Use Nx for multi-app/fullstack projects. For simple single-app projects, framework CLI may suffice (decide based on complexity).
|
|
39
|
+
- **Nx preset** → `angular-monorepo` (Angular), `react-monorepo` (React), `ts` (TS library), `node-monorepo` (Node backend). For Vue/Svelte with Nx, use `ts` preset + framework plugin.
|
|
39
40
|
|
|
40
41
|
Document these decisions in the `## Architecture Decisions` section of TODO.md AND include them in the Phase 0 scaffolding task description so the architect knows exactly what to scaffold.
|
|
41
42
|
|
|
@@ -9,12 +9,16 @@ You are a Senior Test Engineer specializing in TypeScript testing with Vitest an
|
|
|
9
9
|
## Core Competencies
|
|
10
10
|
|
|
11
11
|
- **Unit testing**: Vitest or Jest (auto-detected from project), assertions, mocking, spies, fakes
|
|
12
|
-
- **
|
|
12
|
+
- **Component testing**: Framework-specific component tests (see `.claude/profiles/frontend.md` for patterns)
|
|
13
13
|
- **Service testing**: DI mocking, HTTP interceptor testing, IndexedDB mocking
|
|
14
14
|
- **Business logic testing**: Pure function tests, edge cases, boundary conditions
|
|
15
15
|
- **Domain model testing**: Validation, invariants, value object equality
|
|
16
16
|
- **E2E testing**: Playwright browser automation, user flow testing, visual verification
|
|
17
17
|
|
|
18
|
+
## Frontend Profile
|
|
19
|
+
|
|
20
|
+
When writing component tests, read `.claude/profiles/frontend.md` for framework-specific testing patterns (TestBed for Angular, Testing Library for React, Vue Test Utils for Vue, etc.). If the file does not exist, detect the framework from `package.json` and apply standard testing patterns.
|
|
21
|
+
|
|
18
22
|
## Test Framework Detection (MANDATORY first step)
|
|
19
23
|
|
|
20
24
|
Before writing ANY test, detect which test framework the project uses:
|
|
@@ -147,33 +151,15 @@ describe('PriceCalculator', () => {
|
|
|
147
151
|
});
|
|
148
152
|
```
|
|
149
153
|
|
|
150
|
-
##
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
import { describe, it, expect } from 'vitest';
|
|
154
|
-
import { TestBed } from '@angular/core/testing';
|
|
155
|
-
import { CardBadge } from './card-badge';
|
|
156
|
-
|
|
157
|
-
describe('CardBadge', () => {
|
|
158
|
-
it('should display card name from input', async () => {
|
|
159
|
-
const fixture = TestBed.createComponent(CardBadge);
|
|
160
|
-
fixture.componentRef.setInput('name', 'Pikachu');
|
|
161
|
-
fixture.detectChanges();
|
|
162
|
-
|
|
163
|
-
const el = fixture.nativeElement as HTMLElement;
|
|
164
|
-
expect(el.textContent).toContain('Pikachu');
|
|
165
|
-
});
|
|
154
|
+
## Component Test Template
|
|
166
155
|
|
|
167
|
-
|
|
168
|
-
const fixture = TestBed.createComponent(CardBadge);
|
|
169
|
-
const spy = vi.fn();
|
|
170
|
-
fixture.componentInstance.selected.subscribe(spy);
|
|
156
|
+
For framework-specific component testing patterns (TestBed, Testing Library, Vue Test Utils, etc.), read `.claude/profiles/frontend.md` — it contains the canonical component test template for this project's framework.
|
|
171
157
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
158
|
+
**General principles for component tests:**
|
|
159
|
+
- Test user-visible behavior, not implementation details
|
|
160
|
+
- Set inputs/props, trigger actions, assert on rendered output
|
|
161
|
+
- Mock services/dependencies at the boundary
|
|
162
|
+
- Test accessibility: ARIA attributes, keyboard navigation
|
|
177
163
|
|
|
178
164
|
## E2E Testing (Playwright)
|
|
179
165
|
|
|
@@ -184,7 +170,7 @@ When called for **E2E test writing**, create tests for user flows:
|
|
|
184
170
|
Before writing E2E tests, detect existing config:
|
|
185
171
|
1. Check for `playwright.config.ts` in project root or `apps/[APP]-e2e/`
|
|
186
172
|
2. Check for existing E2E project in `nx.json` (look for `*-e2e` project)
|
|
187
|
-
3. If no E2E project exists, use Nx generator to scaffold it:
|
|
173
|
+
3. If no E2E project exists and Nx is available, use Nx generator to scaffold it:
|
|
188
174
|
```bash
|
|
189
175
|
nx g @nx/playwright:configuration --directory=apps/[APP]-e2e --no-interactive
|
|
190
176
|
```
|
|
@@ -192,9 +178,10 @@ Before writing E2E tests, detect existing config:
|
|
|
192
178
|
```bash
|
|
193
179
|
nx add @nx/playwright
|
|
194
180
|
```
|
|
181
|
+
If not using Nx, install Playwright directly: `npm init playwright@latest`
|
|
195
182
|
NEVER manually create `project.json` for E2E projects — the generator configures targets, config files, and directory structure correctly.
|
|
196
183
|
|
|
197
|
-
4. E2E tests live in `apps/[APP]-e2e/src/` — NOT next to unit tests
|
|
184
|
+
4. E2E tests live in `apps/[APP]-e2e/src/` (Nx) or `e2e/` (standalone) — NOT next to unit tests
|
|
198
185
|
|
|
199
186
|
### When to write E2E tests
|
|
200
187
|
- Multi-step user flows (checkout, onboarding, form submission)
|