|
2 | 2 | applyTo: "**" |
3 | 3 | --- |
4 | 4 |
|
5 | | -## Golden Rules |
| 5 | +# Project |
6 | 6 |
|
7 | | -- When unsure about implementation details, requirements, or business logic, ALWAYS consult the developer rather than making assumptions. |
8 | | -- We optimize for maintainability over cleverness. When in doubt, choose the boring solution. |
9 | | -- When reporting information, options, pros/cons, or summarizing changes, be extremely concise—sacrifice grammar if needed. |
10 | | -- Keep plans and documentation concise yet detailed—prioritize information density over formatting. |
| 7 | +React SPA built with Vite using feature slice architecture with clean architecture principles. |
11 | 8 |
|
12 | | -| # | AI _may_ do | AI _must NOT_ do | |
13 | | -| --- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | |
14 | | -| G-0 | Ask for clarification when unsure about project-specific details | Write changes without context for a feature/decision | |
15 | | -| G-1 | Generate code in `src/features/`, `src/lib/api/`, `src/pages/`, or explicitly pointed files | Touch files beyond `src` and `e2e` without request; modify existing tests | |
16 | | -| G-2 | Add/update `AIDEV-NOTE:` anchor comments near non-trivial code (exception to "no comments" rule) | Delete or mangle existing `AIDEV-` comments | |
17 | | -| G-3 | Follow lint/style configs (`.prettierrc`, `.eslint.config.mjs`) | Re-format code to any other style | |
18 | | -| G-4 | For changes >300 LOC or >3 files, ask for confirmation | Refactor large modules without human guidance | |
19 | | -| G-5 | Stay within current task context; inform dev if fresh start needed | Continue work from prior prompt after "new task" | |
20 | | -| G-6 | Modify API contracts only with explicit approval and documentation | Change API contracts without approval | |
21 | | -| G-7 | Use git commands only when explicitly requested | Stage, commit, or push without explicit request | |
| 9 | +## Stack |
22 | 10 |
|
23 | | -> **Note:** Rules G-3, G-4, and G-7 primarily apply to Agent mode when Copilot makes autonomous changes. |
| 11 | +TypeScript SPA. React 19, Vite 7, React Router 7, TanStack Query, Zustand, XState, Chakra UI, i18next. Testing: Vitest, Storybook, Playwright, MSW. |
24 | 12 |
|
25 | | -## Workflow Guidelines |
| 13 | +## Commands |
26 | 14 |
|
27 | | -### When working on complex tasks |
| 15 | +- `pnpm dev` — start dev server (port 5173) |
| 16 | +- `pnpm lint --fix` — lint and auto-fix |
| 17 | +- `pnpm test` — all tests (unit + storybook) |
| 18 | +- `pnpm test:e2e` — Playwright E2E (headless) |
| 19 | +- `pnpm storybook` — component dev (port 6006) |
28 | 20 |
|
29 | | -- Break down work into clear, incremental steps |
30 | | -- In Plan mode, Copilot will propose an implementation plan for review |
31 | | -- In Agent mode, follow the task incrementally with clear checkpoints |
32 | | -- Update relevant `AIDEV-*` anchor comments as you work |
| 21 | +Package manager: PNPM only. Path alias: `@/*` → `src/`. |
33 | 22 |
|
34 | | -### Context Usage |
| 23 | +## Core Principles |
35 | 24 |
|
36 | | -- **Locate Anchors First**: Before editing code, check for existing `AIDEV-*` anchors in relevant files/subdirectories using grep. [Important] |
37 | | -- **Handle Insufficient Information**: If context is unclear, ask: "Please provide '[specific file/detail]' or clarify expected behavior." |
| 25 | +- **Simplicity first** — make every change as simple as possible, minimize code impact, choose the boring solution |
| 26 | +- When unsure about requirements or business logic, ask the developer — never assume |
| 27 | +- For changes >300 LOC or >3 files, ask for confirmation before proceeding |
| 28 | +- Modify API contracts only with explicit approval |
| 29 | +- Use git commands only when explicitly requested |
| 30 | +- Stay within current task context — inform dev if a fresh start is needed |
| 31 | +- Keep reports, options, and summaries extremely concise — prioritize information density |
38 | 32 |
|
39 | | -## Commands |
| 33 | +## Workflow |
| 34 | + |
| 35 | +**1. Plan Mode Default** |
| 36 | + |
| 37 | +- Enter plan mode for any non-trivial task (3+ steps or architectural decisions) |
| 38 | +- If something goes wrong, STOP and re-plan immediately — do not keep pushing |
| 39 | +- For complex features, write or request a spec before implementation |
| 40 | +- Use plan mode for verification steps, not just building |
| 41 | + |
| 42 | +**2. Self-Improvement Loop** |
| 43 | + |
| 44 | +- After any correction, capture the pattern in `tasks/lessons.md` and write a rule to prevent recurrence |
| 45 | +- Review `tasks/lessons.md` at the start of each session |
| 46 | +- Ruthlessly iterate on lessons until the mistake rate drops |
| 47 | + |
| 48 | +**3. Verification Before Done** |
| 49 | + |
| 50 | +- Never mark a task complete without proving it works |
| 51 | +- Run tests, check logs, and demonstrate correctness |
| 52 | +- Ask: "Would a staff engineer approve this?" |
| 53 | + |
| 54 | +**4. Demand Elegance (Balanced)** |
| 55 | + |
| 56 | +- For non-trivial changes, ask: "Is there a more elegant solution?" |
| 57 | +- If a fix feels hacky: "Knowing everything I know now, implement the elegant solution" |
| 58 | +- Skip this for simple fixes — do not over-engineer |
| 59 | + |
| 60 | +**5. Autonomous Bug Fixing** |
| 61 | + |
| 62 | +- When given a bug report: just fix it |
| 63 | +- Use logs, errors, and failing tests to diagnose — require zero context switching from the developer |
| 64 | + |
| 65 | +## Conventions |
| 66 | + |
| 67 | +- Use `AIDEV-NOTE:`, `AIDEV-TODO:`, `AIDEV-QUESTION:` anchors near non-trivial code (exception to no-comments rule) |
| 68 | + |
| 69 | +## Reference Docs |
40 | 70 |
|
41 | | -**Package Manager:** PNPM only (`pnpm`, not `npm` or `yarn`) |
42 | | - |
43 | | -### Essential Commands |
44 | | - |
45 | | -| Command | Description | |
46 | | -| ---------------------- | -------------------------------- | |
47 | | -| `pnpm dev` | Start dev server (port 5173) | |
48 | | -| `pnpm lint` | Run ESLint | |
49 | | -| `pnpm lint --fix` | Fix lint errors | |
50 | | -| `pnpm test` | Run all tests (unit + storybook) | |
51 | | -| `pnpm test:unit` | Unit tests only | |
52 | | -| `pnpm test:storybook` | Storybook tests only | |
53 | | -| `pnpm test:e2e` | E2E tests (Playwright, headless) | |
54 | | -| `pnpm test:e2e:ui` | E2E interactive web UI mode | |
55 | | -| `pnpm test:e2e:headed` | E2E with visible browser | |
56 | | -| `pnpm test:e2e:debug` | E2E debug mode | |
57 | | -| `pnpm test:e2e:report` | Open E2E HTML report | |
58 | | -| `pnpm test:coverage` | Tests with coverage report | |
59 | | -| `pnpm storybook` | Storybook (port 6006) | |
60 | | - |
61 | | -### CI Commands |
62 | | - |
63 | | -| Command | Description | |
64 | | -| ------------------------ | -------------------------------- | |
65 | | -| `pnpm test:unit:ci` | Unit tests with coverage/reports | |
66 | | -| `pnpm test:storybook:ci` | Storybook tests with reports | |
67 | | -| `pnpm test:e2e:ci` | E2E tests with reports | |
| 71 | +- Read `docs/architecture.md` when adding features, modifying project structure, or making architectural decisions |
0 commit comments