|
1 | 1 | # Custom Instructions for Claude Code |
2 | 2 |
|
3 | | -## Project Rules |
4 | | - |
5 | | -Follow the common rules defined in `packages/rules/.ai-rules/` for consistency across all AI coding assistants. |
6 | | - |
7 | | -### 📚 Core Workflow |
8 | | - |
9 | | -**Source**: `packages/rules/.ai-rules/rules/core.md` |
10 | | - |
11 | | -**Work Modes**: |
12 | | -- **PLAN mode**: Create implementation plans with TDD approach |
13 | | -- **ACT mode**: Execute changes following quality standards |
14 | | -- **EVAL mode**: Evaluate code quality and suggest improvements |
15 | | -- **AUTO mode**: Autonomous PLAN → ACT → EVAL cycle until quality achieved |
16 | | - |
17 | | -**Mode Flow**: PLAN (default) → ACT (user types "ACT") → PLAN (automatic) → EVAL (user types "EVAL") | AUTO (autonomous cycle) |
18 | | - |
19 | | -**Mode Indicators**: Display `activation_message.formatted` from the `parse_mode` response (e.g., `🤖 agent-name [Primary Agent]`), then print `# Mode: PLAN|ACT|EVAL|AUTO` and `## Agent : [Agent Name]` at the start of responses |
20 | | - |
21 | | -### 🏗️ Project Context |
22 | | - |
23 | | -**Source**: `packages/rules/.ai-rules/rules/project.md` |
24 | | - |
25 | | -**Tech Stack**: See project's `package.json` |
26 | | - |
27 | | -**Architecture**: |
28 | | -- Layered structure: app → widgets → features → entities → shared |
29 | | -- Pure/impure function separation required |
30 | | -- Server Components as default |
31 | | - |
32 | | -### 🎯 Code Quality |
33 | | - |
34 | | -**Source**: `packages/rules/.ai-rules/rules/augmented-coding.md` |
35 | | - |
36 | | -**TDD Cycle**: Red (failing test) → Green (minimal code) → Refactor |
37 | | - |
38 | | -**Principles**: |
39 | | -- TDD for core logic (entities, shared/utils, hooks) |
40 | | -- Test-after for UI (features, widgets) |
41 | | -- SOLID principles, DRY, 90%+ test coverage |
42 | | -- No mocking - test real behavior |
43 | | -- TypeScript strict mode (no `any`) |
44 | | - |
45 | | -### 🤖 Specialist Agents |
46 | | - |
47 | | -**Source**: `packages/rules/.ai-rules/agents/` |
48 | | - |
49 | | -**Available Agents**: |
50 | | - |
51 | | -| Agent | Description | Expertise | |
52 | | -|-------|-------------|-----------| |
53 | | -| Accessibility Specialist | Accessibility expert for Planning, Implementation, and Evaluation modes - unified specialist for WCAG 2.1 AA compliance, ARIA attributes, and keyboard navigation | | |
54 | | -| Act Mode Agent | ACT mode agent - specialized for actual implementation execution | | |
55 | | -| Agent Architect | Primary Agent for creating, validating, and managing AI agent configurations | | |
56 | | -| AI/ML Engineer | AI/ML expert for Planning, Implementation, and Evaluation modes - unified specialist for LLM integration, prompt engineering, RAG architecture, AI safety, and testing non-deterministic systems | | |
57 | | -| Architecture Specialist | Architecture expert for Planning, Implementation, and Evaluation modes - unified specialist for layer placement, dependency direction, and type safety | | |
58 | | -| Auto Mode Agent | AUTO mode agent - autonomous PLAN → ACT → EVAL cycle until quality targets met | | |
59 | | -| Backend Developer | Language-agnostic backend specialist with Clean Architecture, TDD, and security focus. Supports Node.js, Python, Go, Java, and other backend stacks. | | |
60 | | -| Code Quality Specialist | Code quality expert for Planning, Implementation, and Evaluation modes - unified specialist for SOLID principles, DRY, complexity analysis, and design patterns | | |
61 | | -| Code Reviewer | Senior software engineer specializing in comprehensive code quality evaluation and improvement recommendations | | |
62 | | -| Data Engineer | Data specialist focused on database design, schema optimization, migrations, and analytics query optimization. Handles data modeling, ETL patterns, and reporting data structures. | | |
63 | | -| Data Scientist | Data science specialist for exploratory data analysis, statistical modeling, ML model development, and data visualization. Handles EDA, feature engineering, model training, and Jupyter notebook development. | | |
64 | | -| DevOps Engineer | Docker, Datadog monitoring, and Next.js deployment specialist | | |
65 | | -| Documentation Specialist | Documentation expert for Planning, Implementation, and Evaluation modes - unified specialist for documentation planning, code comments, type definitions, and documentation quality assessment | | |
66 | | -| Eval Mode Agent | EVAL mode agent - specialized for code quality evaluation and improvement suggestions | | |
67 | | -| Event Architecture Specialist | Event-driven architecture specialist for Planning, Implementation, and Evaluation modes - unified specialist for message queues, event sourcing, CQRS, real-time communication, distributed transactions, and event schema management | | |
68 | | -| Frontend Developer | Modern React/Next.js specialist with Server Components/Actions, TDD, and accessibility focus | | |
69 | | -| i18n Specialist | Internationalization expert for Planning, Implementation, and Evaluation modes - unified specialist for i18n library setup, translation key structure, formatting, and RTL support | | |
70 | | -| Integration Specialist | External service integration specialist for Planning, Implementation, and Evaluation modes - unified specialist for API integrations, webhooks, OAuth flows, and failure isolation patterns | | |
71 | | -| Migration Specialist | Cross-cutting migration coordinator for legacy system modernization, framework upgrades, database migrations, and API versioning - unified specialist for Strangler Fig, Branch by Abstraction, and zero-downtime migration patterns | | |
72 | | -| Mobile Developer | Cross-platform and native mobile specialist supporting React Native, Flutter, iOS (Swift/SwiftUI), and Android (Kotlin/Compose). Focuses on mobile-specific patterns, performance, and platform guidelines. | | |
73 | | -| Observability Specialist | Observability expert for Planning, Implementation, and Evaluation modes - unified specialist for vendor-neutral monitoring, distributed tracing, structured logging, SLI/SLO frameworks, and alerting patterns | | |
74 | | -| Parallel Orchestrator | Orchestrates parallel execution of multiple GitHub issues using taskMaestro with file-overlap validation, Wave grouping, and AUTO mode workers | | |
75 | | -| Performance Specialist | Performance expert for Planning, Implementation, and Evaluation modes - unified specialist for bundle size optimization, rendering optimization, and Core Web Vitals | | |
76 | | -| Plan Mode Agent | PLAN mode agent - specialized for work planning and design | | |
77 | | -| Plan Reviewer | Reviews implementation plans for quality, completeness, and feasibility before execution | | |
78 | | -| Platform Engineer | Cloud-native infrastructure expert for Planning, Implementation, and Evaluation modes - unified specialist for Infrastructure as Code, Kubernetes orchestration, multi-cloud strategy, GitOps workflows, cost optimization, and disaster recovery | | |
79 | | -| Security Engineer | Primary Agent for implementing security features, fixing vulnerabilities, and applying security best practices in code | | |
80 | | -| Security Specialist | Security expert for Planning, Implementation, and Evaluation modes - unified specialist for authentication, authorization, and security vulnerability prevention | | |
81 | | -| SEO Specialist | SEO expert for Planning, Implementation, and Evaluation modes - unified specialist for metadata, structured data, and search engine optimization | | |
82 | | -| Software Engineer | General-purpose implementation engineer — any language, any domain, TDD-first | | |
83 | | -| Solution Architect | High-level system design and architecture planning specialist | | |
84 | | -| Systems Developer | Primary Agent for systems programming, low-level optimization, native code development, and performance-critical implementations | | |
85 | | -| Technical Planner | Low-level implementation planning with TDD and bite-sized tasks | | |
86 | | -| Test Engineer | Primary Agent for TDD cycle execution, test writing, and coverage improvement across all test types | | |
87 | | -| Test Strategy Specialist | Test strategy expert for Planning, Implementation, and Evaluation modes - unified specialist for TDD vs Test-After decisions, test coverage planning, and test quality assessment | | |
88 | | -| Tooling Engineer | Project configuration, build tools, and development environment specialist | | |
89 | | -| UI/UX Designer | UI/UX design specialist based on universal design principles and UX best practices - focuses on aesthetics, usability, and user experience rather than specific design system implementations | | |
90 | | - |
91 | | -See [packages/rules/.ai-rules/agents/README.md](../../packages/rules/.ai-rules/agents/README.md) for details. |
| 3 | +Follow the common rules in `packages/rules/.ai-rules/` for consistency across AI assistants. |
92 | 4 |
|
93 | | -## 🔴 MANDATORY: TDD Execution Continuity |
| 5 | +## 📚 Core Workflow — Modes |
94 | 6 |
|
95 | | -<TDD_CONTINUITY_RULE> |
| 7 | +- **PLAN**: Create implementation plans with TDD approach |
| 8 | +- **ACT**: Execute changes following quality standards |
| 9 | +- **EVAL**: Evaluate code quality and suggest improvements |
| 10 | +- **AUTO**: Autonomous PLAN → ACT → EVAL cycle |
| 11 | + |
| 12 | +**Mode indicators**: Display `activation_message.formatted` from `parse_mode`, then `# Mode: PLAN|ACT|EVAL|AUTO` at start of response. |
| 13 | + |
| 14 | +## 🎯 Code Quality |
96 | 15 |
|
97 | | -**TDD RED phase test failures are expected results and are NOT a reason to halt implementation.** |
| 16 | +- **TDD cycle**: Red → Green → Refactor (atomic operation) |
| 17 | +- TDD for core logic; test-after for UI |
| 18 | +- SOLID, DRY, 90%+ coverage |
| 19 | +- TypeScript strict (no `any`) |
| 20 | +- No mocking — test real behavior |
98 | 21 |
|
99 | | -### Test Failure Classification |
| 22 | +## 🤖 Specialist Agents |
100 | 23 |
|
101 | | -| Type | Description | Action | |
102 | | -|------|-------------|--------| |
103 | | -| **Expected RED** | Intentional test failure in TDD RED phase | Proceed to GREEN phase immediately | |
104 | | -| **Unexpected Failure** | Test that should pass but doesn't | Stop and analyze root cause | |
| 24 | +Agent list is **not duplicated here** — fetch on demand: |
| 25 | +- `mcp__codingbuddy__get_agent_details(agentName)` — profile, expertise, system prompt |
| 26 | +- `mcp__codingbuddy__list_agent_stacks` — all available agents |
| 27 | +- Full list: [packages/rules/.ai-rules/agents/README.md](../../packages/rules/.ai-rules/agents/README.md) |
105 | 28 |
|
106 | | -### RED-GREEN-REFACTOR is an Atomic Operation |
| 29 | +## 🔴 MANDATORY: TDD Execution Continuity |
| 30 | + |
| 31 | +<TDD_CONTINUITY_RULE> |
107 | 32 |
|
108 | | -1. **RED**: Write failing test -> Run to confirm failure -> **DO NOT STOP** |
109 | | -2. **GREEN**: Write minimal implementation -> Run to confirm pass |
110 | | -3. **REFACTOR**: Refactor -> Confirm tests still pass |
| 33 | +TDD RED phase test failures are **expected results** and are NOT a reason to halt implementation. |
111 | 34 |
|
112 | | -**Do not wait for user input until all three phases are complete.** |
| 35 | +| Type | Action | |
| 36 | +|------|--------| |
| 37 | +| **Expected RED** (intentional failure) | Proceed to GREEN immediately | |
| 38 | +| **Unexpected failure** | Stop and analyze root cause | |
113 | 39 |
|
114 | | -### TDD Step Handling During Plan Execution |
| 40 | +**RED → GREEN → REFACTOR is atomic** — do not wait for user input until all three phases are complete. |
115 | 41 |
|
116 | | -Even if plan separates TDD into individual steps (e.g., Step 1: Write test, Step 2: Verify fails, Step 3: Implement): |
117 | | -- When a step containing **"Expected: FAIL" or "verify it fails"** results in test failure -> Proceed to next step immediately |
118 | | -- This **takes precedence** over the executing-plans skill's "STOP on test fail" rule |
| 42 | +When a plan step contains "Expected: FAIL" or "verify it fails", a test failure means **proceed to next step**. This takes precedence over executing-plans "STOP on test fail" rule. |
119 | 43 |
|
120 | 44 | </TDD_CONTINUITY_RULE> |
121 | 45 |
|
122 | 46 | ## 🔴 MANDATORY: Keyword Mode Detection |
123 | 47 |
|
124 | 48 | <CODINGBUDDY_CRITICAL_RULE> |
125 | 49 |
|
126 | | -**When user message starts with PLAN, ACT, EVAL, or AUTO keyword (or localized equivalents):** |
| 50 | +When user message starts with PLAN, ACT, EVAL, or AUTO (or localized equivalents): |
127 | 51 |
|
128 | | -1. Call `activate` MCP tool with the user's prompt (preferred in Claude Code) |
129 | | -2. **Fallback**: Call `parse_mode` if `activate` is unavailable |
130 | | -3. Follow the returned `rules` as context |
131 | | -4. Use returned `specialists` to run a council via Claude native Teams |
| 52 | +1. Call `activate` MCP tool (preferred in Claude Code) |
| 53 | +2. Fallback: `parse_mode` if `activate` unavailable |
| 54 | +3. Follow returned `rules` as context |
| 55 | +4. Use returned `specialists` for council via Claude native Teams |
132 | 56 |
|
133 | 57 | </CODINGBUDDY_CRITICAL_RULE> |
134 | 58 |
|
135 | | -## 🔴 MANDATORY: Specialist Council Execution |
| 59 | +## 🔴 MANDATORY: Specialist Council |
136 | 60 |
|
137 | 61 | <SPECIALIST_COUNCIL_RULE> |
138 | 62 |
|
139 | | -**When `activate` returns specialists, run them as a council via Claude native Teams.** |
| 63 | +When `activate` returns specialists, run as council via Claude native Teams: |
140 | 64 |
|
141 | | -### Workflow |
142 | | - |
143 | | -1. Call `activate({ prompt })` → get rules, primaryAgent, specialists |
144 | | -2. Create a Claude native Team with the returned specialists as teammates |
145 | | -3. Each specialist independently analyzes the task |
146 | | -4. Specialists cross-review each other's findings |
| 65 | +1. `activate({ prompt })` → rules, primaryAgent, specialists |
| 66 | +2. Create Claude native Team with specialists as teammates |
| 67 | +3. Each specialist independently analyzes |
| 68 | +4. Cross-review findings |
147 | 69 | 5. Collect consensus: approve | concern | reject |
148 | | -6. Summarize all findings to user |
149 | | - |
150 | | -### Fallback (non-Teams environments) |
| 70 | +6. Summarize to user |
151 | 71 |
|
152 | | -If Teams is not available, dispatch specialists as parallel subagents: |
153 | | -- Use `Agent` tool with `run_in_background: true` for each specialist |
154 | | -- Collect results and synthesize |
| 72 | +**Fallback** (non-Teams): dispatch specialists as parallel subagents via Agent tool with `run_in_background: true`. |
155 | 73 |
|
156 | 74 | </SPECIALIST_COUNCIL_RULE> |
157 | 75 |
|
158 | 76 | ## Claude Code Native Feature Mapping |
159 | 77 |
|
160 | | -Use Claude Code native features instead of codingbuddy equivalents: |
| 78 | +Prefer native features over codingbuddy equivalents: |
161 | 79 |
|
162 | | -| Need | Native Feature | Instead of | |
163 | | -|------|----------------|------------| |
| 80 | +| Need | Native | Instead of | |
| 81 | +|------|--------|------------| |
164 | 82 | | Cross-session context | **Claude Code Memory** | `update_context` / `create_briefing` / `resume_session` | |
165 | | -| Specialist debate | **Claude native Teams** | `dispatch_agents` subagent strategy | |
| 83 | +| Specialist debate | **Claude native Teams** | `dispatch_agents` | |
166 | 84 | | Task exploration | **/dream** | `analyze_task` | |
167 | 85 | | Planning with approval | **EnterPlanMode** | `parse_mode` planning stage | |
168 | 86 | | Repeated execution | **/loop** | AUTO mode repetition | |
169 | 87 | | Clarification | **AskUserQuestion** | clarification gate | |
170 | 88 |
|
171 | | -## Claude Code Specific |
172 | | - |
173 | | -- Follow project's configured language setting |
174 | | -- Use structured markdown formatting |
175 | | -- Provide clear, actionable feedback |
176 | | -- Reference project context from `packages/rules/.ai-rules/rules/project.md` |
177 | | -- Follow PLAN → ACT → EVAL workflow when appropriate |
178 | | - |
179 | 89 | ## Full Documentation |
180 | 90 |
|
181 | | -For comprehensive guides: |
182 | | -- **augmented-coding**: [packages/rules/.ai-rules/rules/augmented-coding.md](../../packages/rules/.ai-rules/rules/augmented-coding.md) |
183 | | -- **clarification-guide**: [packages/rules/.ai-rules/rules/clarification-guide.md](../../packages/rules/.ai-rules/rules/clarification-guide.md) |
184 | | -- **core**: [packages/rules/.ai-rules/rules/core.md](../../packages/rules/.ai-rules/rules/core.md) |
185 | | -- **parallel-execution**: [packages/rules/.ai-rules/rules/parallel-execution.md](../../packages/rules/.ai-rules/rules/parallel-execution.md) |
186 | | -- **project**: [packages/rules/.ai-rules/rules/project.md](../../packages/rules/.ai-rules/rules/project.md) |
187 | | -- **structured-reasoning-guide**: [packages/rules/.ai-rules/rules/structured-reasoning-guide.md](../../packages/rules/.ai-rules/rules/structured-reasoning-guide.md) |
188 | | -- **Agents System**: [packages/rules/.ai-rules/agents/README.md](../../packages/rules/.ai-rules/agents/README.md) |
189 | | -- **Claude Integration**: [packages/rules/.ai-rules/adapters/claude-code.md](../../packages/rules/.ai-rules/adapters/claude-code.md) |
190 | | - |
191 | | ---- |
192 | | - |
193 | | -**Note**: These instructions reference common AI rules from `packages/rules/.ai-rules/` directory shared across all AI assistants (Cursor, Claude Code, Antigravity, Codex, Q, Kiro) for consistency. |
| 91 | +Rules: [packages/rules/.ai-rules/rules/](../../packages/rules/.ai-rules/rules/) |
| 92 | +Agents: [packages/rules/.ai-rules/agents/README.md](../../packages/rules/.ai-rules/agents/README.md) |
| 93 | +Claude adapter: [packages/rules/.ai-rules/adapters/claude-code.md](../../packages/rules/.ai-rules/adapters/claude-code.md) |
0 commit comments