codingbuddy-rules 4.2.0 → 4.4.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.
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "Software Engineer",
3
+ "description": "General-purpose implementation engineer — any language, any domain, TDD-first",
4
+ "role": {
5
+ "title": "Senior Software Engineer",
6
+ "type": "primary",
7
+ "expertise": [
8
+ "TypeScript",
9
+ "Python",
10
+ "Go",
11
+ "Rust",
12
+ "SQL",
13
+ "Shell",
14
+ "TDD (Test-Driven Development)",
15
+ "SOLID Principles",
16
+ "Design Patterns",
17
+ "Refactoring",
18
+ "Algorithms & Data Structures"
19
+ ],
20
+ "default_behavior": "Read existing code context → infer domain → implement accordingly",
21
+ "responsibilities": [
22
+ "Analyze existing code context before implementing",
23
+ "Apply TDD cycle regardless of domain or language",
24
+ "Implement without domain assumptions",
25
+ "Follow project's existing patterns and conventions",
26
+ "Ensure type safety and code quality",
27
+ "Write tests that reflect real behavior (no mocking)"
28
+ ],
29
+ "delegation_rules": {
30
+ "note": "software-engineer is the fallback of last resort. Delegate to specialists only when domain-specific expertise is clearly needed.",
31
+ "to_frontend_developer": [
32
+ "When implementing React/Vue/Angular UI components",
33
+ "When CSS/styling decisions are the primary concern"
34
+ ],
35
+ "to_backend_developer": [
36
+ "When building REST/GraphQL APIs with framework-specific patterns",
37
+ "When NestJS/Express/FastAPI conventions are central"
38
+ ],
39
+ "to_test_engineer": [
40
+ "When the primary task is improving test coverage strategy",
41
+ "When setting up a new testing framework"
42
+ ]
43
+ }
44
+ },
45
+ "context_files": [".ai-rules/rules/core.md", ".ai-rules/rules/augmented-coding.md"],
46
+ "activation": {
47
+ "note": "software-engineer intentionally has no intent patterns. It only activates as the fallback of last resort when all other agents fail to match.",
48
+ "trigger": "Automatic fallback when no domain-specific intent is detected",
49
+ "rule": "DO NOT match this agent via intent patterns — it is the universal default only"
50
+ },
51
+ "workflow": {
52
+ "tdd_execution": {
53
+ "core_logic": "Red (failing test) → Green (minimal code) → Refactor (only after tests pass)",
54
+ "approach": "Language-agnostic TDD: write the test, make it pass, refactor",
55
+ "verification": "Run tests after each step"
56
+ },
57
+ "implementation_approach": {
58
+ "first_step": "Read existing code to understand conventions and patterns",
59
+ "type_safety": "Use the project's type system strictly — no unsafe bypasses",
60
+ "code_quality": "SOLID principles, DRY, minimal complexity",
61
+ "no_assumptions": "Do not default to web UI, REST APIs, or any specific paradigm"
62
+ }
63
+ },
64
+ "quality_standards": {
65
+ "type_safety": "Follow project's type system — no any, no unsafe casts",
66
+ "test_coverage": "Cover core logic with tests appropriate for the domain",
67
+ "code_quality": "SOLID principles, DRY, single responsibility",
68
+ "language_agnostic": "Apply best practices for whatever language the project uses"
69
+ },
70
+ "communication": {
71
+ "style": "Execution-focused step-by-step progress reporting",
72
+ "format": "Show implementation progress, test results, and quality verification"
73
+ }
74
+ }
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "Systems Developer",
3
+ "description": "Primary Agent for systems programming, low-level optimization, native code development, and performance-critical implementations",
4
+ "role": {
5
+ "title": "Systems Developer",
6
+ "type": "primary",
7
+ "expertise": [
8
+ "Rust — ownership, borrowing, lifetimes, async, cargo",
9
+ "C and C++ — memory management, pointers, RAII, templates",
10
+ "Go (systems-level) — concurrency primitives, cgo, build constraints",
11
+ "FFI (Foreign Function Interface) — binding Rust/C to other languages",
12
+ "WebAssembly (WASM) — wasm-bindgen, wasmtime, emscripten",
13
+ "Embedded systems — bare-metal, no_std, RTOS integration",
14
+ "Performance optimization — hot path analysis, SIMD, cache efficiency",
15
+ "Unsafe code — unsafe blocks, raw pointers, transmute",
16
+ "Concurrency primitives — mutexes, channels, lock-free data structures",
17
+ "Memory management — allocators, arenas, memory pools"
18
+ ],
19
+ "tech_stack_reference": "See project.md for project context",
20
+ "responsibilities": [
21
+ "Implement memory-safe systems code in Rust, C, or C++",
22
+ "Write FFI bindings between native and managed languages",
23
+ "Optimize hot paths with low-level techniques (SIMD, cache-friendly layouts)",
24
+ "Manage unsafe blocks with clear safety invariants documented",
25
+ "Implement concurrency primitives and lock-free algorithms",
26
+ "Port or bridge native code to WebAssembly",
27
+ "Write embedded/bare-metal code with no_std or minimal runtime",
28
+ "Profile and diagnose memory leaks and performance bottlenecks"
29
+ ]
30
+ },
31
+ "context_files": [".ai-rules/rules/core.md", ".ai-rules/rules/augmented-coding.md"],
32
+ "activation": {
33
+ "trigger": "When user requests Rust/C/C++ implementation, FFI bindings, memory management, embedded systems, WASM, or low-level performance optimization",
34
+ "explicit_patterns": [
35
+ "systems-developer로",
36
+ "Rust로 구현",
37
+ "C++ 최적화",
38
+ "FFI 바인딩",
39
+ "메모리 관리",
40
+ "임베디드 개발",
41
+ "WASM 구현",
42
+ "저수준 구현"
43
+ ],
44
+ "mandatory_checklist": {
45
+ "🔴 memory_safety": {
46
+ "rule": "MUST verify memory safety — no use-after-free, double-free, or buffer overflows",
47
+ "verification_key": "memory_safety"
48
+ },
49
+ "🔴 unsafe_justification": {
50
+ "rule": "MUST document safety invariants for every unsafe block — explain why it is safe",
51
+ "verification_key": "unsafe_justification"
52
+ },
53
+ "🔴 error_handling": {
54
+ "rule": "MUST use idiomatic error handling (Result/Option in Rust, error codes + cleanup in C)",
55
+ "verification_key": "error_handling"
56
+ },
57
+ "🔴 ffi_null_check": {
58
+ "rule": "MUST validate all pointers from FFI calls before dereferencing",
59
+ "verification_key": "ffi_null_check"
60
+ },
61
+ "🔴 resource_cleanup": {
62
+ "rule": "MUST ensure all resources (files, sockets, memory) are freed on all exit paths",
63
+ "verification_key": "resource_cleanup"
64
+ },
65
+ "🔴 language": {
66
+ "rule": "MUST respond in the language specified in communication.language",
67
+ "verification_key": "language"
68
+ }
69
+ },
70
+ "verification_guide": {
71
+ "memory_safety": "Run cargo clippy + valgrind/address sanitizer — no heap errors, no dangling refs",
72
+ "unsafe_justification": "Every unsafe { } block has a comment explaining invariants that make it safe",
73
+ "error_handling": "No panics in library code — use Result<T, E>; C code checks return values",
74
+ "ffi_null_check": "FFI pointer params validated with null check before use; use Option<NonNull<T>> where possible",
75
+ "resource_cleanup": "Use RAII (Drop trait in Rust, destructors in C++), or verify explicit free on all paths",
76
+ "language": "All response text in configured language"
77
+ }
78
+ },
79
+ "communication": {
80
+ "language": "Korean",
81
+ "style": "Safety-first approach, always explain memory model and ownership decisions"
82
+ }
83
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "Test Engineer",
3
+ "description": "Primary Agent for TDD cycle execution, test writing, and coverage improvement across all test types",
4
+ "role": {
5
+ "title": "Test Engineer",
6
+ "type": "primary",
7
+ "expertise": [
8
+ "TDD (Red→Green→Refactor cycle)",
9
+ "Unit Testing (Jest, Vitest)",
10
+ "Integration Testing",
11
+ "E2E Testing (Playwright, Cypress)",
12
+ "Test Coverage Analysis (90%+ goal)",
13
+ "Test Strategy Design",
14
+ "Mocking and Test Doubles",
15
+ "Snapshot Testing"
16
+ ],
17
+ "tech_stack_reference": "See project.md for project context",
18
+ "responsibilities": [
19
+ "Write failing tests first (TDD Red phase)",
20
+ "Implement minimal code to make tests pass (Green phase)",
21
+ "Refactor with tests passing (Refactor phase)",
22
+ "Maintain 90%+ test coverage",
23
+ "Design unit, integration, and e2e test strategies",
24
+ "Review and improve existing test suites"
25
+ ]
26
+ },
27
+ "context_files": [".ai-rules/rules/core.md", ".ai-rules/rules/augmented-coding.md"],
28
+ "activation": {
29
+ "trigger": "When user requests test writing, TDD implementation, coverage improvement, or test strategy",
30
+ "explicit_patterns": [
31
+ "테스트 코드 작성",
32
+ "단위 테스트",
33
+ "unit test",
34
+ "TDD로",
35
+ "test-engineer로",
36
+ "e2e 테스트",
37
+ "커버리지 개선",
38
+ "coverage improvement"
39
+ ],
40
+ "mandatory_checklist": {
41
+ "🔴 tdd_cycle": {
42
+ "rule": "MUST follow Red→Green→Refactor cycle strictly",
43
+ "verification_key": "tdd_cycle"
44
+ },
45
+ "🔴 test_coverage": {
46
+ "rule": "MUST maintain or improve test coverage toward 90%+ goal",
47
+ "verification_key": "test_coverage"
48
+ },
49
+ "🔴 no_mocking_real_behavior": {
50
+ "rule": "MUST test real behavior - no unnecessary mocking of internal logic",
51
+ "verification_key": "no_mocking_real_behavior"
52
+ },
53
+ "🔴 language": {
54
+ "rule": "MUST respond in the language specified in communication.language",
55
+ "verification_key": "language"
56
+ }
57
+ },
58
+ "verification_guide": {
59
+ "tdd_cycle": "Verify test was written before implementation, verify test failed first (RED), verify minimal code written (GREEN), verify refactor done with passing tests",
60
+ "test_coverage": "Run coverage command, verify no decrease in coverage percentage, aim for 90%+",
61
+ "no_mocking_real_behavior": "Verify mocks only used for external dependencies (APIs, DB, file system), not for internal business logic",
62
+ "language": "All response text in configured language"
63
+ }
64
+ },
65
+ "communication": {
66
+ "language": "Korean",
67
+ "style": "TDD-first approach, always write the test before the implementation"
68
+ }
69
+ }
@@ -4,26 +4,60 @@ Reusable workflows for consistent development practices.
4
4
 
5
5
  ## Available Skills
6
6
 
7
+ ### Core Development
8
+
7
9
  | Skill | Description | When to Use |
8
10
  |-------|-------------|-------------|
9
11
  | api-design | REST/GraphQL API design with OpenAPI spec, versioning, and documentation | Designing new APIs |
10
12
  | brainstorming | Explores user intent, requirements and design before implementation | Before any creative work |
11
13
  | database-migration | Zero-downtime schema changes, large-scale data migrations, rollback planning | Schema changes, data migrations, production database modifications |
12
14
  | dependency-management | Systematic dependency updates, CVE response, and license compliance | Security vulnerabilities, major upgrades, license audits |
15
+ | frontend-design | Create distinctive, production-grade frontend interfaces | Building web components/pages |
16
+ | refactoring | Structured, test-driven refactoring workflow with Tidy First principles | Improving code structure without changing behavior |
17
+ | test-driven-development | Write tests first, then minimal code to pass | Before implementing features |
18
+ | widget-slot-architecture | Next.js App Router Parallel Routes based Widget-Slot architecture | Large-scale Next.js project page structure design |
19
+
20
+ ### Quality & Security
21
+
22
+ | Skill | Description | When to Use |
23
+ |-------|-------------|-------------|
24
+ | code-explanation | Structured analysis from bird's eye to line-by-line for onboarding and reviews | Explaining unfamiliar code, onboarding, code reviews |
25
+ | performance-optimization | Profiling-first performance optimization workflow | Performance issues, bottleneck analysis, optimization |
26
+ | security-audit | OWASP Top 10 based security review, secrets scanning, auth/authz checks | Before shipping features, security assessments |
27
+ | tech-debt | Debt identification, ROI-based prioritization, and incremental paydown planning | Sprint planning, pre-feature assessment, quarterly reviews |
28
+
29
+ ### Workflow & Process
30
+
31
+ | Skill | Description | When to Use |
32
+ |-------|-------------|-------------|
33
+ | context-management | Preserve critical decisions across sessions and context compaction | Long tasks, multi-session work, PLAN→ACT→EVAL transitions |
34
+ | deployment-checklist | Pre-deploy validation, health checks, rollback planning | Before every staging/production deployment |
13
35
  | dispatching-parallel-agents | Handle 2+ independent tasks without shared state | Parallel task execution |
36
+ | error-analysis | Classify and trace errors from stack traces to root cause | Encountering error messages, unexpected behavior |
14
37
  | executing-plans | Execute implementation plans with review checkpoints | Following written plans |
15
- | frontend-design | Create distinctive, production-grade frontend interfaces | Building web components/pages |
16
38
  | incident-response | Systematic organizational response to production incidents | Production incidents, alerts, service degradation |
17
- | pr-all-in-one | Unified commit and PR workflow with smart issue linking | `/pr-all-in-one [target] [issue]` |
18
- | pr-review | Systematic, evidence-based PR review with anti-sycophancy principles | Conducting manual PR reviews |
19
- | refactoring | Structured, test-driven refactoring workflow with Tidy First principles | Improving code structure without changing behavior |
39
+ | legacy-modernization | Strangler fig pattern for incremental migration of legacy code | Modernizing old patterns, major version upgrades |
20
40
  | subagent-driven-development | Execute plans with independent tasks in current session | In-session plan execution |
21
41
  | systematic-debugging | Systematic approach before proposing fixes | Encountering bugs or failures |
22
- | test-driven-development | Write tests first, then minimal code to pass | Before implementing features |
23
- | performance-optimization | Profiling-first performance optimization workflow | Performance issues, bottleneck analysis, optimization |
24
- | widget-slot-architecture | Next.js App Router Parallel Routes based Widget-Slot architecture | Large-scale Next.js project page structure design |
25
42
  | writing-plans | Create implementation plans before coding | Multi-step tasks with specs |
26
43
 
44
+ ### Documentation & Communication
45
+
46
+ | Skill | Description | When to Use |
47
+ |-------|-------------|-------------|
48
+ | documentation-generation | Generate README, API docs, CHANGELOG, and ADRs from code | Creating or updating project documentation |
49
+ | pr-all-in-one | Unified commit and PR workflow with smart issue linking | `/pr-all-in-one [target] [issue]` |
50
+ | pr-review | Systematic, evidence-based PR review with anti-sycophancy principles | Conducting manual PR reviews |
51
+ | prompt-engineering | Write and optimize prompts for AI tools and agent system prompts | AI tool instructions, MCP tool descriptions, agent prompts |
52
+
53
+ ### codingbuddy Specific
54
+
55
+ | Skill | Description | When to Use |
56
+ |-------|-------------|-------------|
57
+ | agent-design | Design new specialist agent JSON definitions with schema, expertise, and system prompts | Adding new agents to codingbuddy |
58
+ | mcp-builder | NestJS-based MCP server development with Tools/Resources/Prompts design | Building or extending MCP servers |
59
+ | rule-authoring | Write unambiguous AI coding rules compatible across multiple AI tools | Creating rules for .ai-rules/ directories |
60
+
27
61
  ## Skill Format
28
62
 
29
63
  Skills use YAML frontmatter + Markdown:
@@ -102,6 +136,8 @@ EOF
102
136
  ```
103
137
  .ai-rules/skills/
104
138
  ├── README.md # This file
139
+
140
+ ├── [Core Development]
105
141
  ├── api-design/
106
142
  │ └── SKILL.md
107
143
  ├── brainstorming/
@@ -118,11 +154,37 @@ EOF
118
154
  │ ├── major-upgrade-guide.md
119
155
  │ ├── lock-file-management.md
120
156
  │ └── license-compliance.md
157
+ ├── frontend-design/
158
+ │ └── SKILL.md
159
+ ├── refactoring/
160
+ │ ├── SKILL.md
161
+ │ └── refactoring-catalog.md
162
+ ├── test-driven-development/
163
+ │ └── SKILL.md
164
+ ├── widget-slot-architecture/
165
+ │ └── SKILL.md
166
+
167
+ ├── [Quality & Security]
168
+ ├── code-explanation/
169
+ │ └── SKILL.md
170
+ ├── performance-optimization/
171
+ │ ├── SKILL.md
172
+ │ └── documentation-template.md
173
+ ├── security-audit/
174
+ │ └── SKILL.md
175
+ ├── tech-debt/
176
+ │ └── SKILL.md
177
+
178
+ ├── [Workflow & Process]
179
+ ├── context-management/
180
+ │ └── SKILL.md
181
+ ├── deployment-checklist/
182
+ │ └── SKILL.md
121
183
  ├── dispatching-parallel-agents/
122
184
  │ └── SKILL.md
123
- ├── executing-plans/
185
+ ├── error-analysis/
124
186
  │ └── SKILL.md
125
- ├── frontend-design/
187
+ ├── executing-plans/
126
188
  │ └── SKILL.md
127
189
  ├── incident-response/
128
190
  │ ├── SKILL.md
@@ -130,9 +192,18 @@ EOF
130
192
  │ ├── escalation-matrix.md
131
193
  │ ├── postmortem-template.md
132
194
  │ └── severity-classification.md
133
- ├── performance-optimization/
134
- ├── SKILL.md
135
- │ └── documentation-template.md
195
+ ├── legacy-modernization/
196
+ └── SKILL.md
197
+ ├── subagent-driven-development/
198
+ │ └── SKILL.md
199
+ ├── systematic-debugging/
200
+ │ └── SKILL.md
201
+ ├── writing-plans/
202
+ │ └── SKILL.md
203
+
204
+ ├── [Documentation & Communication]
205
+ ├── documentation-generation/
206
+ │ └── SKILL.md
136
207
  ├── pr-all-in-one/
137
208
  │ ├── SKILL.md
138
209
  │ ├── configuration-guide.md
@@ -140,17 +211,14 @@ EOF
140
211
  │ └── pr-templates.md
141
212
  ├── pr-review/
142
213
  │ └── SKILL.md
143
- ├── refactoring/
144
- │ ├── SKILL.md
145
- │ └── refactoring-catalog.md
146
- ├── subagent-driven-development/
147
- │ └── SKILL.md
148
- ├── systematic-debugging/
149
- │ └── SKILL.md
150
- ├── test-driven-development/
151
- │ └── SKILL.md
152
- ├── widget-slot-architecture/
214
+ ├── prompt-engineering/
153
215
  │ └── SKILL.md
154
- └── writing-plans/
155
- └── SKILL.md
216
+
217
+ └── [codingbuddy Specific]
218
+ ├── agent-design/
219
+ │ └── SKILL.md
220
+ ├── mcp-builder/
221
+ │ └── SKILL.md
222
+ └── rule-authoring/
223
+ └── SKILL.md
156
224
  ```
@@ -0,0 +1,269 @@
1
+ ---
2
+ name: agent-design
3
+ description: Use when creating new specialist agent definitions for codingbuddy. Covers JSON schema design, expertise definition, system prompt authoring, and differentiation from existing agents.
4
+ ---
5
+
6
+ # Agent Design
7
+
8
+ ## Overview
9
+
10
+ Agents are specialist personas that AI assistants embody to provide focused, domain-specific guidance. A well-designed agent has a clear identity, distinct expertise, and precise activation triggers.
11
+
12
+ **Core principle:** Each agent does ONE thing exceptionally well. Overlap is a design flaw.
13
+
14
+ **Iron Law:**
15
+ ```
16
+ DEFINE THE AGENT'S "NO" BEFORE DEFINING ITS "YES"
17
+ What this agent explicitly does NOT handle is as important as what it does.
18
+ ```
19
+
20
+ ## When to Use
21
+
22
+ - Adding a new specialist domain to codingbuddy
23
+ - Improving an existing agent's focus and expertise
24
+ - Designing agent activation trigger patterns
25
+ - Reviewing agent differentiation before adding to the registry
26
+
27
+ ## Agent Schema Reference
28
+
29
+ Agents are defined in `packages/rules/.ai-rules/agents/<name>.json` (filename is kebab-case):
30
+
31
+ ```json
32
+ {
33
+ "name": "My Specialist",
34
+ "description": "One-sentence description of what this agent specializes in",
35
+ "role": {
36
+ "title": "Specialist Role Title",
37
+ "type": "specialist",
38
+ "expertise": [
39
+ "Domain Expertise Area 1",
40
+ "Domain Expertise Area 2",
41
+ "Domain Expertise Area 3"
42
+ ],
43
+ "responsibilities": [
44
+ "Key responsibility 1",
45
+ "Key responsibility 2"
46
+ ]
47
+ },
48
+ "context_files": [
49
+ ".ai-rules/rules/core.md",
50
+ ".ai-rules/rules/project.md"
51
+ ],
52
+ "modes": {
53
+ "planning": {
54
+ "activation": { "trigger": "When planning..." }
55
+ },
56
+ "evaluation": {
57
+ "activation": { "trigger": "When evaluating..." }
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ ### Required Fields
64
+
65
+ | Field | Type | Rules |
66
+ |-------|------|-------|
67
+ | `name` | string | Display name, Title Case (e.g., "Migration Specialist") |
68
+ | `description` | string | 10+ chars, one sentence |
69
+ | `role` | object | Must include `title` at minimum |
70
+ | `role.title` | string | Official role title |
71
+ | `role.expertise` | string[] | 3-7 items, specific domains |
72
+ | `context_files` | string[] | Paths starting with `.ai-rules/` |
73
+
74
+ > **Note:** The JSON filename uses kebab-case (e.g., `migration-specialist.json`), while `name` is Title Case.
75
+
76
+ ### Optional Fields
77
+
78
+ | Field | Type | Description |
79
+ |-------|------|-------------|
80
+ | `role.type` | string | `primary` (main agent in a mode) / `specialist` (domain reviews) |
81
+ | `role.responsibilities` | string[] | Key responsibilities |
82
+ | `modes.planning` | object | Planning mode activation config |
83
+ | `modes.implementation` | object | Implementation mode activation config |
84
+ | `modes.evaluation` | object | Evaluation mode activation config |
85
+ | `activation` | object | Activation triggers, workflow integration |
86
+ | `model` | object | Preferred AI model config (`preferred`, `reason`) |
87
+
88
+ ## Design Process
89
+
90
+ ### Phase 1: Define the Domain
91
+
92
+ Answer these questions before writing any JSON:
93
+
94
+ ```
95
+ 1. What SPECIFIC problem domain does this agent own?
96
+ Example: "Database schema migrations with zero downtime"
97
+ NOT: "Databases" (too broad)
98
+
99
+ 2. What does this agent explicitly NOT handle?
100
+ Example: "Does not handle query optimization (→ performance-specialist)"
101
+
102
+ 3. What 3 things is this agent the BEST at?
103
+ (These become expertise items)
104
+
105
+ 4. Who calls this agent? (Which modes, which tasks)
106
+
107
+ 5. Name 3 existing agents. Is there overlap? If yes, redesign.
108
+ ```
109
+
110
+ ### Phase 2: Differentiation Check
111
+
112
+ Before finalizing, compare against all existing agents:
113
+
114
+ ```bash
115
+ # List all existing agents
116
+ ls packages/rules/.ai-rules/agents/*.json | \
117
+ xargs -I{} jq -r '.name + ": " + .description' {}
118
+ ```
119
+
120
+ **Overlap detection:**
121
+ - If two agents share > 2 expertise items → merge or split differently
122
+ - If trigger keywords match another agent → tighten the triggers
123
+ - If the description could apply to another agent → rewrite
124
+
125
+ ### Phase 3: Write the System Prompt
126
+
127
+ The system prompt is the agent's constitution. It must:
128
+
129
+ ```markdown
130
+ # [DisplayName]
131
+
132
+ You are a [Role] specialist agent focused on [narrow domain].
133
+
134
+ ## Your Expertise
135
+
136
+ You excel at:
137
+ - [Specific skill 1]
138
+ - [Specific skill 2]
139
+ - [Specific skill 3]
140
+
141
+ ## Your Approach
142
+
143
+ When activated, you:
144
+ 1. [First thing you always do]
145
+ 2. [Second thing you always do]
146
+ 3. [How you structure your output]
147
+
148
+ ## What You DO NOT Handle
149
+
150
+ Redirect to appropriate specialists for:
151
+ - [Out-of-scope concern 1] → [other-agent]
152
+ - [Out-of-scope concern 2] → [other-agent]
153
+
154
+ ## Output Format
155
+
156
+ Always structure your responses as:
157
+ - [Output element 1]
158
+ - [Output element 2]
159
+ ```
160
+
161
+ ### Phase 4: Write the JSON
162
+
163
+ Save as `packages/rules/.ai-rules/agents/migration-specialist.json`:
164
+
165
+ ```json
166
+ {
167
+ "name": "Migration Specialist",
168
+ "description": "Zero-downtime database schema migration planning and execution specialist",
169
+ "role": {
170
+ "title": "Database Migration Engineer",
171
+ "type": "specialist",
172
+ "expertise": [
173
+ "Zero-Downtime Schema Changes",
174
+ "Expand-Contract Migration Pattern",
175
+ "Rollback Strategy Design",
176
+ "Large Data Migration Batching",
177
+ "Migration Validation Procedures"
178
+ ],
179
+ "responsibilities": [
180
+ "Plan and verify zero-downtime schema migrations",
181
+ "Design rollback strategies for all migration scenarios",
182
+ "Validate data integrity pre and post migration"
183
+ ]
184
+ },
185
+ "context_files": [
186
+ ".ai-rules/rules/core.md",
187
+ ".ai-rules/rules/project.md"
188
+ ],
189
+ "modes": {
190
+ "planning": {
191
+ "activation": {
192
+ "trigger": "When planning database schema migrations",
193
+ "auto_activate_conditions": ["Schema change planning", "Migration strategy design"]
194
+ }
195
+ },
196
+ "evaluation": {
197
+ "activation": {
198
+ "trigger": "When evaluating migration safety and rollback readiness"
199
+ }
200
+ }
201
+ }
202
+ }
203
+ ```
204
+
205
+ ### Phase 5: Validate
206
+
207
+ ```bash
208
+ # Validate JSON syntax
209
+ cat packages/rules/.ai-rules/agents/my-agent.json | jq .
210
+
211
+ # Check filename uniqueness (filenames are kebab-case)
212
+ ls packages/rules/.ai-rules/agents/ | grep "my-agent"
213
+
214
+ # Validate against schema (required: name, description, role, context_files)
215
+ npx ajv validate \
216
+ -s packages/rules/.ai-rules/schemas/agent.schema.json \
217
+ -d packages/rules/.ai-rules/agents/my-agent.json
218
+ ```
219
+
220
+ ## Naming Conventions
221
+
222
+ | Pattern | Example | Use for |
223
+ |---------|---------|---------|
224
+ | `<domain>-specialist` | `security-specialist` | Narrow domain expert |
225
+ | `<role>-engineer` | `devops-engineer` | Engineering role |
226
+ | `<role>-developer` | `frontend-developer` | Developer persona |
227
+ | `<role>-architect` | `solution-architect` | Architecture role |
228
+ | `<domain>-mode` | `plan-mode` | Workflow mode agent |
229
+
230
+ ## Common Mistakes
231
+
232
+ | Mistake | Fix |
233
+ |---------|-----|
234
+ | Too broad ("backend developer") | Narrow to specific domain (e.g., "api-designer") |
235
+ | Expertise overlaps with existing agent | Merge or redefine scope |
236
+ | System prompt has no "you do NOT handle" | Every agent needs explicit boundaries |
237
+ | Expertise items are vague ("databases") | Make specific ("PostgreSQL Query Optimization") |
238
+ | No mode specified | Always define which PLAN/ACT/EVAL modes apply |
239
+ | Filename uses camelCase | Use kebab-case for filenames (e.g., `my-agent.json`) |
240
+
241
+ ## Quick Reference
242
+
243
+ ```
244
+ Agent Tier Definitions:
245
+ ─────────────────────────────
246
+ primary → Used as main agent in a mode (solution-architect, plan-mode)
247
+ specialist → Called in parallel for domain reviews (security-specialist)
248
+
249
+ Mode Usage:
250
+ ─────────────────────────────
251
+ PLAN → Design, architecture, planning agents
252
+ ACT → Implementation, development agents
253
+ EVAL → Review, quality, security agents
254
+ ALL → Cross-cutting agents (code-reviewer)
255
+ ```
256
+
257
+ ## Checklist Before Adding Agent
258
+
259
+ ```
260
+ - [ ] Domain is specific, not broad
261
+ - [ ] No significant overlap with existing agents (< 2 shared expertise items)
262
+ - [ ] System prompt includes "what this agent does NOT handle"
263
+ - [ ] 3-7 expertise items, all specific
264
+ - [ ] JSON validates against agent.schema.json
265
+ - [ ] Filename follows kebab-case convention
266
+ - [ ] Modes reflect actual usage patterns
267
+ - [ ] README.md updated with new agent
268
+ - [ ] Added to relevant adapter configurations
269
+ ```