jdi-cli 0.1.0 → 0.1.2

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.
Files changed (72) hide show
  1. package/core/agents/jdi-architect.md +19 -0
  2. package/core/agents/jdi-bootstrap.md +46 -7
  3. package/core/agents/jdi-researcher.md +2 -1
  4. package/core/skills/clean-architecture/SKILL.md +134 -0
  5. package/core/skills/ddd/SKILL.md +140 -0
  6. package/core/skills/hexagonal/SKILL.md +127 -0
  7. package/core/skills/onion/SKILL.md +133 -0
  8. package/core/skills/the-method/SKILL.md +139 -0
  9. package/core/skills/vertical-slice/SKILL.md +127 -0
  10. package/package.json +1 -1
  11. package/runtimes/antigravity/skills/clean-architecture/SKILL.md +125 -0
  12. package/runtimes/antigravity/skills/clean-code/SKILL.md +1 -1
  13. package/runtimes/antigravity/skills/ddd/SKILL.md +131 -0
  14. package/runtimes/antigravity/skills/dry/SKILL.md +1 -1
  15. package/runtimes/antigravity/skills/frontend-rules/SKILL.md +1 -1
  16. package/runtimes/antigravity/skills/frontend-validator/SKILL.md +1 -1
  17. package/runtimes/antigravity/skills/hexagonal/SKILL.md +118 -0
  18. package/runtimes/antigravity/skills/jdi-adopter/SKILL.md +1 -1
  19. package/runtimes/antigravity/skills/jdi-architect/SKILL.md +20 -1
  20. package/runtimes/antigravity/skills/jdi-asker/SKILL.md +1 -1
  21. package/runtimes/antigravity/skills/jdi-planner/SKILL.md +1 -1
  22. package/runtimes/antigravity/skills/jdi-researcher/SKILL.md +3 -2
  23. package/runtimes/antigravity/skills/kiss/SKILL.md +1 -1
  24. package/runtimes/antigravity/skills/onion/SKILL.md +124 -0
  25. package/runtimes/antigravity/skills/solid/SKILL.md +1 -1
  26. package/runtimes/antigravity/skills/the-method/SKILL.md +130 -0
  27. package/runtimes/antigravity/skills/vertical-slice/SKILL.md +118 -0
  28. package/runtimes/antigravity/skills/yagni/SKILL.md +1 -1
  29. package/runtimes/claude/agents/jdi-adopter.md +1 -1
  30. package/runtimes/claude/agents/jdi-architect.md +20 -1
  31. package/runtimes/claude/agents/jdi-asker.md +1 -1
  32. package/runtimes/claude/agents/jdi-bootstrap.md +47 -8
  33. package/runtimes/claude/agents/jdi-planner.md +1 -1
  34. package/runtimes/claude/agents/jdi-researcher.md +3 -2
  35. package/runtimes/claude/skills/clean-architecture/SKILL.md +120 -0
  36. package/runtimes/claude/skills/clean-code/SKILL.md +1 -1
  37. package/runtimes/claude/skills/ddd/SKILL.md +125 -0
  38. package/runtimes/claude/skills/dry/SKILL.md +1 -1
  39. package/runtimes/claude/skills/frontend-rules/SKILL.md +1 -1
  40. package/runtimes/claude/skills/frontend-validator/SKILL.md +1 -1
  41. package/runtimes/claude/skills/hexagonal/SKILL.md +112 -0
  42. package/runtimes/claude/skills/kiss/SKILL.md +1 -1
  43. package/runtimes/claude/skills/onion/SKILL.md +119 -0
  44. package/runtimes/claude/skills/solid/SKILL.md +1 -1
  45. package/runtimes/claude/skills/the-method/SKILL.md +124 -0
  46. package/runtimes/claude/skills/vertical-slice/SKILL.md +113 -0
  47. package/runtimes/claude/skills/yagni/SKILL.md +1 -1
  48. package/runtimes/copilot/agents/jdi-adopter.agent.md +1 -1
  49. package/runtimes/copilot/agents/jdi-architect.agent.md +20 -1
  50. package/runtimes/copilot/agents/jdi-asker.agent.md +1 -1
  51. package/runtimes/copilot/agents/jdi-bootstrap.agent.md +47 -8
  52. package/runtimes/copilot/agents/jdi-planner.agent.md +1 -1
  53. package/runtimes/copilot/agents/jdi-researcher.agent.md +3 -2
  54. package/runtimes/opencode/agents/jdi-adopter.md +1 -1
  55. package/runtimes/opencode/agents/jdi-architect.md +20 -1
  56. package/runtimes/opencode/agents/jdi-asker.md +1 -1
  57. package/runtimes/opencode/agents/jdi-bootstrap.md +47 -8
  58. package/runtimes/opencode/agents/jdi-planner.md +1 -1
  59. package/runtimes/opencode/agents/jdi-researcher.md +3 -2
  60. package/runtimes/opencode/skills/clean-architecture/SKILL.md +120 -0
  61. package/runtimes/opencode/skills/clean-code/SKILL.md +1 -1
  62. package/runtimes/opencode/skills/ddd/SKILL.md +125 -0
  63. package/runtimes/opencode/skills/dry/SKILL.md +1 -1
  64. package/runtimes/opencode/skills/frontend-rules/SKILL.md +1 -1
  65. package/runtimes/opencode/skills/frontend-validator/SKILL.md +1 -1
  66. package/runtimes/opencode/skills/hexagonal/SKILL.md +112 -0
  67. package/runtimes/opencode/skills/kiss/SKILL.md +1 -1
  68. package/runtimes/opencode/skills/onion/SKILL.md +119 -0
  69. package/runtimes/opencode/skills/solid/SKILL.md +1 -1
  70. package/runtimes/opencode/skills/the-method/SKILL.md +124 -0
  71. package/runtimes/opencode/skills/vertical-slice/SKILL.md +113 -0
  72. package/runtimes/opencode/skills/yagni/SKILL.md +1 -1
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: jdi-planner
3
3
  description: Generates PLAN.md for the phase. Reads CONTEXT.md (from asker) + PROJECT.md, decomposes into tasks, maps files_modified, execution order. No fluff.
4
4
  model: gpt-5
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: jdi-researcher
3
3
  description: Upfront pre-roadmap research. Reads user idea, asks key questions, researches stack/domain, generates initial PROJECT.md + ROADMAP.md. Single agent instead of multiple parallel researchers to save tokens.
4
4
  model: gpt-5
@@ -56,10 +56,11 @@ Options:
56
56
  - Vertical Slice
57
57
  - Clean Architecture
58
58
  - Hexagonal (Ports & Adapters)
59
+ - Onion Architecture
59
60
  - The Method (Juval Löwy)
60
61
  - "Don't know, suggest" (-> recommend based on type + stack)
61
62
 
62
- Locked for the life of the project (global rule).
63
+ Locked for the life of the project (global rule). Mutually exclusive — the project uses exactly ONE code design. The choice is enforced by a JDI skill loaded into doer + reviewer (one of: `ddd`, `vertical-slice`, `clean-architecture`, `hexagonal`, `onion`, `the-method`).
63
64
 
64
65
  **Q4 — MVP scope**
65
66
  "Which minimum features for the MVP? (comma-separated)"
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  description: Adopt mode for brownfield projects. Scans existing repo (manifests, layout, git, docs), infers stack/code-design, confirms with user, generates PROJECT.md + ROADMAP.md with adopted=true flag. Replaces /jdi-new for projects with code already written.
3
3
  mode: subagent
4
4
  model: anthropic/claude-sonnet-4-20250514
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  description: Creates new JDI agents and skills. Create mode = generic agent/skill in core. Specialist mode = per-project doer/reviewer in .jdi/agents/.
3
3
  ---
4
4
 
@@ -378,13 +378,29 @@ Write to `.jdi/agents/jdi-reviewer-{slug}.md`.
378
378
 
379
379
  After writing doer/reviewer, inject `<skills_to_load>` block after `</role>` via Edit.
380
380
 
381
+ **Code-design skill (mandatory) — resolve from `PROJECT.md.Code Design` (LOCKED value) using this mapping:**
382
+
383
+ | Code Design (PROJECT.md) | Skill to load |
384
+ |---|---|
385
+ | The Method | `the-method` |
386
+ | DDD | `ddd` |
387
+ | Clean Architecture | `clean-architecture` |
388
+ | Hexagonal | `hexagonal` |
389
+ | Onion | `onion` |
390
+ | Vertical Slice | `vertical-slice` |
391
+
392
+ The resolved code-design skill is loaded by **both doer and reviewer**. Exactly one code-design skill is loaded. Never load two code-design skills simultaneously — the project uses exactly one design. If the mapping cannot resolve, abort with an error and ask the user to fix `PROJECT.md.Code Design`.
393
+
381
394
  **Doer — always:**
382
395
  ```markdown
383
396
  <skills_to_load>
384
397
  - solid — before creating classes/modules/interfaces. Detects god class, large switches, deep inheritance, dep on concretes.
398
+ - {CODE_DESIGN_SKILL} — INVIOLABLE structural rules for the project's locked code design. Apply on every file created.
385
399
  </skills_to_load>
386
400
  ```
387
401
 
402
+ Replace `{CODE_DESIGN_SKILL}` with the resolved entry from the mapping above (e.g. `the-method`, `ddd`, `clean-architecture`, `hexagonal`, `onion`, `vertical-slice`).
403
+
388
404
  If `has_frontend=true`, append:
389
405
  ```markdown
390
406
  - frontend-rules — when task touches .tsx/.vue/.svelte/.razor/.cshtml/.html/.twig/.erb/.blade.php. WCAG 2.2 AA + UX.
@@ -397,9 +413,12 @@ If `has_frontend=true`, append:
397
413
  - kiss — gate 5: over-engineering — interface with 1 impl, factory for new(), pass-through, deep inheritance.
398
414
  - yagni — gate 5: speculative code — optional params never passed, TODO without ticket, generic with 1 type.
399
415
  - clean-code — bad names, long functions, magic numbers, silent catch, boolean params, redundant comments.
416
+ - {CODE_DESIGN_SKILL} — gate 5: enforce INVIOLABLE structural rules for the project's locked code design. BLOCKED on violations defined by the skill.
400
417
  </skills_to_load>
401
418
  ```
402
419
 
420
+ Replace `{CODE_DESIGN_SKILL}` with the same resolved entry — both doer and reviewer load the SAME code-design skill.
421
+
403
422
  If `has_frontend=true`, append:
404
423
  ```markdown
405
424
  - frontend-rules — gate 5 frontend: <input> without label, button without aria-label, localStorage with token, outline removed.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  description: Adaptive question loop to capture locked decisions before the plan. Writes CONTEXT.md.
3
3
  mode: subagent
4
4
  model: anthropic/claude-sonnet-4-20250514
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  description: Fires jdi-architect in specialist mode to generate doer + reviewer per-project. Reads PROJECT.md, drives architect, validates outputs, updates routing.
3
3
  mode: subagent
4
4
  model: anthropic/claude-sonnet-4-20250514
@@ -80,20 +80,59 @@ Pass `adopted=$ADOPTED` and `boundary_commit=$BOUNDARY` to the architect in Step
80
80
 
81
81
  ### Step 2.7: Multi-stack? (multi-specialist support)
82
82
 
83
- AskUserQuestion:
83
+ **MANDATORY step. Never skip — even if PROJECT.md only mentions 1 language, ASK the user.**
84
+
85
+ #### Step 2.7a: Auto-detect fullstack from PROJECT.md
86
+
87
+ Before asking, parse `.jdi/PROJECT.md` Stack/Frameworks/Vision sections. Detect dual-stack patterns:
88
+
89
+ **Backend keywords (case-insensitive):**
90
+ `C#|.NET|dotnet|ASP\.NET|Java|Spring|Kotlin|Go|Rust|Python|Django|Flask|FastAPI|Node|Express|NestJS|Ruby|Rails|PHP|Laravel|Elixir|Phoenix`
91
+
92
+ **Frontend keywords (case-insensitive):**
93
+ `React|Vue|Svelte|Angular|Next\.?js|Nuxt|Remix|SvelteKit|Astro|Solid|Qwik|Preact|Blazor`
94
+
95
+ **Mobile keywords:**
96
+ `iOS|Swift|Android|Kotlin Mobile|React Native|Flutter|Dart|Xamarin|MAUI`
97
+
98
+ **Infra keywords:**
99
+ `Terraform|Pulumi|CloudFormation|Kubernetes|Helm|Ansible`
100
+
101
+ If ≥2 categories match (e.g. backend + frontend), set `SUGGESTED_COUNT=2` and `SUGGESTED_PAIRS` accordingly.
102
+
103
+ Examples of detection result from `Stack: "C# 10 + React 19"`:
104
+ - Match: `C#` (backend) + `React` (frontend) → SUGGESTED_COUNT=2
105
+ - Suggested pairs:
106
+ - `{stack_label: "Backend C#", file_glob: "**/*.{cs,csproj,sln}"}`
107
+ - `{stack_label: "Frontend React", file_glob: "**/*.{ts,tsx,jsx,css,scss}"}`
108
+
109
+ #### Step 2.7b: AskUserQuestion (always run)
110
+
111
+ If `SUGGESTED_COUNT >= 2`, the FIRST option (default-selected by AskUserQuestion) MUST be the suggested multi-stack option. Format:
112
+
113
+ > "Detected fullstack project: **{detected_categories}** (e.g. {match_keywords}).
114
+ > Stack count?"
115
+ >
116
+ > Options (when SUGGESTED_COUNT=2):
117
+ > - [Multi (2 pairs — backend + frontend) **(Recommended)**]
118
+ > - [Single (1 specialist pair)]
119
+ > - [Multi (3 pairs)]
120
+ > - [Multi (custom count)]
121
+
122
+ If `SUGGESTED_COUNT=1` (single language detected, e.g. just Python or just Go):
84
123
 
85
124
  > "Project stack count?
86
125
  > - **Single-stack:** 1 doer + 1 reviewer (90% of projects)
87
- > - **Multi-stack:** multiple doer/reviewer pairs, each owning a file glob (fullstack: backend + frontend, mobile: iOS + Android, etc.)"
126
+ > - **Multi-stack:** multiple pairs (fullstack, mobile iOS+Android, infra+app, etc.)"
88
127
  >
89
128
  > Options:
90
- > - [Single (1 specialist pair)]
91
- > - [Multi (2 pairs — e.g. backend + frontend)]
92
- > - [Multi (3 pairs — e.g. backend + frontend + infra)]
129
+ > - [Single (1 specialist pair) **(Recommended)**]
130
+ > - [Multi (2 pairs)]
131
+ > - [Multi (3 pairs)]
93
132
  > - [Multi (custom count)]
94
133
 
95
134
  If single: `SPECIALIST_COUNT=1`. Standard flow.
96
- If multi: `SPECIALIST_COUNT=N`. Architect loops S1-S8 N times.
135
+ If multi: `SPECIALIST_COUNT=N`. Architect loops S1-S8 N times. Pre-fill `stack_label` + `file_glob` from `SUGGESTED_PAIRS` when available (user can edit each).
97
136
 
98
137
  For multi-stack, ask glob+label per specialist BEFORE architect S1:
99
138
 
@@ -196,7 +235,7 @@ Bootstrap ok. Next: /jdi-discuss 1
196
235
  - Never create specialist without PROJECT.md present
197
236
  - Never skip architect — bootstrap is wrapper, not generator
198
237
  - Never commit if architect returned cancelled/failed
199
- - 1 doer + 1 reviewer per project (default). Multi-stack = future feature
238
+ - Single-stack (1 doer + 1 reviewer) is the default. Multi-stack (N pairs with file-glob routing) is opt-in via S2.7 — ALWAYS execute S2.7 (do not skip the question)
200
239
  </rules>
201
240
 
202
241
  <fallbacks>
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  description: Generates PLAN.md for the phase. Reads CONTEXT.md (from asker) + PROJECT.md, decomposes into tasks, maps files_modified, execution order. No fluff.
3
3
  mode: subagent
4
4
  model: anthropic/claude-sonnet-4-20250514
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  description: Upfront pre-roadmap research. Reads user idea, asks key questions, researches stack/domain, generates initial PROJECT.md + ROADMAP.md. Single agent instead of multiple parallel researchers to save tokens.
3
3
  mode: subagent
4
4
  model: anthropic/claude-sonnet-4-20250514
@@ -60,10 +60,11 @@ Options:
60
60
  - Vertical Slice
61
61
  - Clean Architecture
62
62
  - Hexagonal (Ports & Adapters)
63
+ - Onion Architecture
63
64
  - The Method (Juval Löwy)
64
65
  - "Don't know, suggest" (-> recommend based on type + stack)
65
66
 
66
- Locked for the life of the project (global rule).
67
+ Locked for the life of the project (global rule). Mutually exclusive — the project uses exactly ONE code design. The choice is enforced by a JDI skill loaded into doer + reviewer (one of: `ddd`, `vertical-slice`, `clean-architecture`, `hexagonal`, `onion`, `the-method`).
67
68
 
68
69
  **Q4 — MVP scope**
69
70
  "Which minimum features for the MVP? (comma-separated)"
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: clean-architecture
3
+ description: Clean Architecture (Robert C. Martin). 4 concentric layers - Entities, Use Cases, Interface Adapters, Frameworks & Drivers. The Dependency Rule points strictly inward. Language-agnostic rigid rules. Mutually exclusive with The Method, DDD, Hexagonal, Onion, Vertical Slice.
4
+ ---
5
+
6
+ # Skill: Clean Architecture
7
+
8
+ Rigid, inviolable rules from Robert C. Martin's *Clean Architecture*. The system is organized as **concentric layers**, and source-code dependencies point only **inward**.
9
+
10
+ Clean Architecture is the ONLY allowed design when PROJECT.md `Code Design: LOCKED: Clean Architecture`. Do not mix with The Method, DDD aggregates as a primary structure, Hexagonal terminology as the primary structure, Onion shells, or Vertical Slice feature folders as the primary structure.
11
+
12
+ ## The 4 layers (mandatory)
13
+
14
+ From innermost to outermost:
15
+
16
+ 1. **Entities (Enterprise Business Rules)** — the most general and high-level rules. Reusable across applications in the enterprise. Pure data + behavior. No knowledge of any other layer.
17
+ 2. **Use Cases (Application Business Rules)** — application-specific business rules. Orchestrate the dance of Entities to satisfy a use case. No knowledge of UI, DB, frameworks, devices, or external systems.
18
+ 3. **Interface Adapters** — convert data between the form most convenient for use cases/entities and the form most convenient for external agents. Controllers, Presenters, Gateways, ViewModels live here. No knowledge of frameworks beyond what is necessary to expose adapter contracts.
19
+ 4. **Frameworks & Drivers** — the outermost layer. Web framework, database, UI framework, file system, devices, external APIs. Glue code only — minimal logic.
20
+
21
+ Every code unit belongs to exactly one of these 4 layers. A unit that does not fit must be redesigned.
22
+
23
+ ## The Dependency Rule (inviolable)
24
+
25
+ **Source-code dependencies point only inward. Nothing in an inner circle may know anything at all about something in an outer circle.**
26
+
27
+ 1. Entities depend on nothing outside the Entities layer.
28
+ 2. Use Cases depend on Entities only. Use Cases do not import, reference, or know the names of anything in Interface Adapters or Frameworks & Drivers.
29
+ 3. Interface Adapters depend on Use Cases and Entities only. They do not depend on Frameworks & Drivers code directly — they depend on framework abstractions only where unavoidable, and never let framework types cross into the inner circles.
30
+ 4. Frameworks & Drivers depend on whatever is convenient (Adapters, libraries, vendor SDKs).
31
+ 5. Names defined in outer circles (e.g., entity names from a DB schema, DTOs from a controller, framework annotations) must not appear in inner-circle code.
32
+
33
+ ## Boundary Crossing rules (inviolable)
34
+
35
+ 1. **Cross boundaries via interfaces owned by the inner side.** Inputs into Use Cases are defined by interfaces in the Use Cases layer; implementations live in Interface Adapters.
36
+ 2. **Cross boundaries via Data Transfer Objects (DTOs) that are simple structures.** No framework objects, no ORM entities, no HTTP request objects cross a boundary.
37
+ 3. **Use Cases never receive framework-specific types** (HTTP request, ORM entity, file handle, socket). The Adapter translates these into the Use Case's input DTOs.
38
+ 4. **Use Cases return DTOs / output ports.** They never return entities directly to outer layers.
39
+ 5. **The Use Case interactor invokes an output port (interface) to deliver results.** The Presenter implements the output port. Use Cases never call presenters or controllers directly.
40
+
41
+ ## Layer purity rules (inviolable)
42
+
43
+ ### Entities
44
+
45
+ 1. Entities are pure. No imports from any other layer.
46
+ 2. Entities encapsulate enterprise-wide business rules; if a rule is application-specific, it does not belong here.
47
+ 3. Entities are not Database records, ORM models, JSON shapes, or API DTOs. If a class plays one of those roles, it is not an Entity.
48
+ 4. Entities have no annotations from persistence, serialization, or web frameworks.
49
+ 5. Entities are not anemic. Behavior lives with data.
50
+
51
+ ### Use Cases
52
+
53
+ 6. Each Use Case has a single, application-specific purpose stated by its name (verb-noun: e.g., `RegisterCustomer`, `RenewSubscription`).
54
+ 7. A Use Case owns its input port (input boundary) and output port (output boundary) as interfaces in the Use Cases layer.
55
+ 8. A Use Case does not import any framework, ORM, HTTP, file-system, or external-API type.
56
+ 9. A Use Case is testable without any infrastructure. If it cannot be tested without spinning up DB / HTTP / queue, the design is wrong.
57
+ 10. A Use Case orchestrates Entities. It does not duplicate enterprise rules that already live in Entities.
58
+
59
+ ### Interface Adapters
60
+
61
+ 11. Controllers translate external input (HTTP request, CLI args, message payload) into Use Case input DTOs and invoke the Use Case.
62
+ 12. Presenters convert Use Case output DTOs into a form suitable for delivery (ViewModel, response body).
63
+ 13. Gateways implement the persistence interfaces declared by the Use Cases.
64
+ 14. Adapters never contain business rules.
65
+ 15. Adapters depend inward on Use Cases / Entities, never outward on Frameworks.
66
+
67
+ ### Frameworks & Drivers
68
+
69
+ 16. Framework code is glue only. It wires Adapters to the framework runtime.
70
+ 17. Web framework controllers in the Frameworks layer call Adapters, not Use Cases directly.
71
+ 18. ORM-mapped models, framework annotations, configuration code, dependency injection wiring live here.
72
+
73
+ ## Composition rules
74
+
75
+ 1. **Composition Root is in the outermost layer.** The main / startup / DI container assembles all components.
76
+ 2. **Inner layers never construct outer layer types.** Dependencies are injected through interfaces defined by the inner layer.
77
+ 3. **Plug-in architecture.** A change in framework, DB, or UI must require changes only in the outer layers. Inner layers stay untouched.
78
+
79
+ ## Forbidden patterns (inviolable)
80
+
81
+ - **Use Cases referencing framework types** (HTTP request, ORM entity, file handle, vendor SDK type).
82
+ - **Entities referencing persistence frameworks** (ORM annotations, database column attributes that encode behavior).
83
+ - **Anemic Entities.** Behavior must accompany data.
84
+ - **Skipping a layer for convenience** (Controller calling a repository directly, Presenter calling the database).
85
+ - **Returning framework / ORM types from a Use Case.**
86
+ - **Use Case knowing the concrete Adapter** (e.g., calling a specific HTTP client class). Use Cases declare interfaces; Adapters implement.
87
+ - **Shared "Util" / "Helper" classes spanning layers** with hidden business rules.
88
+ - **Database-driven design** where the schema dictates Entity shape.
89
+ - **Cross-layer reach-around** (Framework code calling Use Cases bypassing Adapters, Adapters calling Frameworks bypassing the Composition Root).
90
+ - **Concentric layers reorganized as feature folders** that hide which layer a unit belongs to.
91
+
92
+ ## Reviewer enforcement (gate 5)
93
+
94
+ Reviewer rejects (BLOCKED) when:
95
+ - An Entity or Use Case imports a framework, ORM, HTTP, or vendor SDK type.
96
+ - A Use Case returns a framework / ORM / DTO defined in an outer layer.
97
+ - A Controller invokes persistence directly instead of going through a Use Case.
98
+ - An Adapter contains a business rule.
99
+ - An inner-layer file imports an outer-layer file (direct dependency violation).
100
+ - Boundary crossings carry framework-specific types instead of plain DTOs.
101
+ - Use Cases or Entities are not testable without infrastructure.
102
+
103
+ Reviewer warns (APPROVED_WITH_WARNINGS) when:
104
+ - A Use Case is named after a CRUD verb without application semantics.
105
+ - An Entity has only getters/setters (anemic).
106
+ - An Adapter file leaks framework annotations into its public interface.
107
+ - The Composition Root is split across layers instead of living in the outermost layer.
108
+
109
+ ## Anti-patterns
110
+
111
+ - "Service" layer mixing Use Cases with Adapter responsibilities
112
+ - DTOs leaking into Entities
113
+ - ORM entities serving as both Entity and persistence model
114
+ - Controller-with-business-logic
115
+ - Use Case classes that depend on framework annotations
116
+ - Hexagonal-style port terminology used to disguise a violation (the rule is the Dependency Rule, not the port naming)
117
+
118
+ ## Outputs
119
+
120
+ Does NOT produce own files. Modifies parent agent's structural decisions during code authoring and review.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: clean-code
3
3
  description: Clean Code. Human-readable code, optimized for reading (read 10x more than written). Names reveal intent, small functions, no redundant comments, explicit error handling, no magic numbers. Applies in any language.
4
4
  ---
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: ddd
3
+ description: Domain-Driven Design (Eric Evans). Strategic patterns (Bounded Context, Ubiquitous Language, Context Map) plus tactical patterns (Aggregates, Entities, Value Objects, Domain Services, Repositories, Domain Events). Language-agnostic rigid rules. Mutually exclusive with The Method, Clean Architecture, Hexagonal, Onion, Vertical Slice.
4
+ ---
5
+
6
+ # Skill: Domain-Driven Design (DDD)
7
+
8
+ Rigid, inviolable rules from Eric Evans's *Domain-Driven Design* and Vaughn Vernon's *Implementing DDD*. The domain is the center of the system. Persistence, UI, frameworks, and external integrations are peripheral details.
9
+
10
+ DDD is the ONLY allowed design when PROJECT.md `Code Design: LOCKED: DDD`. Do not introduce The Method's Managers/Engines/ResourceAccess, Clean Architecture's concentric layers as a structural primary, Hexagonal port terminology as the primary structure, Onion shells, or Vertical Slice handlers as the primary structure.
11
+
12
+ ## Strategic rules (inviolable)
13
+
14
+ 1. **Bounded Context (BC) is the unit of model isolation.** Every BC owns its own model, its own ubiquitous language, its own database schema, and its own deployment unit (where feasible). A model is meaningful only inside its BC.
15
+ 2. **Each BC must be named.** Anonymous BCs do not exist. The name appears in the codebase (folder, namespace, module, package).
16
+ 3. **Ubiquitous Language (UL) is contractual within a BC.** The same word means exactly one thing inside the BC. Synonyms are forbidden. Code, tests, docs, conversations, and database column names share the UL terminology.
17
+ 4. **No shared model across BCs.** When two BCs reference the same real-world concept, each has its own model class for it. Cross-BC reuse of classes is forbidden.
18
+ 5. **Cross-BC interaction follows a Context Map relationship.** Every integration between BCs is explicitly typed as exactly one of: Shared Kernel, Customer/Supplier, Conformist, Anticorruption Layer (ACL), Open Host Service (OHS), Published Language (PL), Partnership, Separate Ways. Undeclared integration is forbidden.
19
+ 6. **Anticorruption Layer (ACL) is required when integrating with a legacy or external model.** Foreign models do not leak into a BC.
20
+ 7. **Core Domain is identified explicitly.** Other BCs are classified as Supporting Subdomain or Generic Subdomain. The Core Domain receives the highest engineering investment and is never outsourced or replaced by a generic library.
21
+ 8. **Domain knowledge does not leak into Generic Subdomains.** Generic Subdomain code (Identity, Logging, Notification) must be reusable across projects without domain assumptions.
22
+
23
+ ## Tactical rules (inviolable)
24
+
25
+ ### Aggregate
26
+
27
+ 1. **An Aggregate has exactly one Root.** All external access goes through the Root. References to inner entities from outside the Aggregate are forbidden.
28
+ 2. **The Aggregate Root enforces all invariants of the Aggregate.** No partial state may be observed by other Aggregates or by Application Services.
29
+ 3. **One transaction modifies at most one Aggregate instance.** Multi-aggregate consistency is achieved by Domain Events, not by enclosing transactions.
30
+ 4. **Aggregates reference other Aggregates only by identifier (ID), never by direct object reference.** Cross-aggregate navigation through references is forbidden.
31
+ 5. **Aggregate boundaries are designed around invariants and transactional consistency, never around UI screens or convenience.**
32
+ 6. **Aggregates must be small.** If an Aggregate contains a collection that grows unbounded, the design is wrong and must be split.
33
+
34
+ ### Entity vs Value Object
35
+
36
+ 7. **An Entity has identity that persists across state changes.** Equality is by identity, never by attributes.
37
+ 8. **A Value Object is immutable and identity-less.** Equality is by attributes. Mutating a Value Object is forbidden — replace, do not modify.
38
+ 9. **Prefer Value Objects.** When a concept has no identity, model it as a Value Object. Default to Value Object; promote to Entity only when identity is required.
39
+ 10. **Value Objects must be self-validating.** Construction of a Value Object with invalid state must fail at construction time.
40
+
41
+ ### Domain Service
42
+
43
+ 11. **A Domain Service exists only when an operation does not belong to any Entity or Value Object.** If the operation can fit on an Entity/VO, it must live there.
44
+ 12. **Domain Services are stateless and named with a Ubiquitous Language verb-noun expressing a domain operation, not a technical action.**
45
+ 13. **Domain Services contain domain logic only.** Persistence, transactions, messaging, and orchestration of use cases live in Application Services.
46
+
47
+ ### Repository
48
+
49
+ 14. **One Repository per Aggregate Root.** No repository per Entity that is not a Root. No "generic" repository shared across Aggregates.
50
+ 15. **Repository interface lives with the domain model, not with persistence.** Persistence implementation lives outside the domain layer.
51
+ 16. **Repositories return whole Aggregates, never partial state.** A method returning a piece of an Aggregate (single inner entity, partial fields) is forbidden.
52
+ 17. **Queries that span multiple Aggregates or return projections do not use Repositories.** Use a dedicated Query/ReadModel pattern (CQRS-style). Reads and writes may diverge structurally.
53
+
54
+ ### Domain Event
55
+
56
+ 18. **Domain Events are immutable, past-tense facts.** Names are past tense (e.g., "OrderPlaced", "PaymentRefused"). Mutating a Domain Event is forbidden.
57
+ 19. **Domain Events are emitted by Aggregates.** Application Services do not invent domain events.
58
+ 20. **Domain Events carry only the data needed to react to the fact.** Do not embed entire Aggregate state.
59
+ 21. **Cross-Aggregate consistency uses Domain Events, not synchronous calls between Aggregates.**
60
+
61
+ ### Application Service
62
+
63
+ 22. **Application Services orchestrate use cases.** They load Aggregates via Repositories, invoke domain methods, persist changes, and emit Domain Events. They contain no business rules.
64
+ 23. **Application Services are thin.** A method longer than orchestration of 5-8 domain calls is a smell; extract domain logic back to the domain.
65
+ 24. **Application Services do not return domain entities directly to UI.** Return DTOs or projections.
66
+
67
+ ### Domain layer purity
68
+
69
+ 25. **The Domain Layer depends on nothing external.** No framework, ORM, HTTP, file system, or messaging library is referenced from domain code.
70
+ 26. **Persistence-ignorant domain.** Entities/Aggregates do not inherit from ORM base classes, do not have persistence annotations leaking semantic meaning, and do not know about transactions.
71
+ 27. **No anemic models.** Entities and Value Objects own their behavior. A class with only getters/setters and no business methods is forbidden in the domain layer.
72
+ 28. **No "Manager", "Helper", "Util", "Processor" classes in the domain layer.** These names betray missing domain concepts.
73
+
74
+ ## Modeling rules (inviolable)
75
+
76
+ 1. The model in code must match the model in conversation with domain experts. If they diverge, the code is wrong.
77
+ 2. Names come from the Ubiquitous Language. Technical names ("Data", "Info", "Object", "Item", "Entry") are forbidden in the domain layer.
78
+ 3. New domain concepts are added to the Ubiquitous Language before they are added to the code.
79
+ 4. Domain experts must recognize the names, intents, and invariants encoded in the domain layer.
80
+
81
+ ## Forbidden patterns (inviolable)
82
+
83
+ - **Generic Repository** spanning multiple Aggregates (`Repository<T>`) is forbidden.
84
+ - **Lazy-loaded navigation across Aggregates** is forbidden.
85
+ - **Transactions spanning multiple Aggregates** are forbidden.
86
+ - **Returning Entities from a query that crosses Aggregates** is forbidden — use a read model.
87
+ - **CRUD-only Application Services** ("CreateUser", "UpdateUser") with no domain semantics are a smell; reframe as domain operations ("RegisterCustomer", "DeactivateAccount") when meaning exists.
88
+ - **Anti-corruption layer absence** when consuming an external/legacy model is a violation.
89
+ - **Sharing entities across Bounded Contexts** is forbidden.
90
+ - **DTO leaking into the domain layer** is forbidden.
91
+
92
+ ## Reviewer enforcement (gate 5)
93
+
94
+ Reviewer rejects (BLOCKED) when:
95
+ - Domain code references a framework / ORM / HTTP / messaging library.
96
+ - An Aggregate is mutated from outside its Root.
97
+ - A single transaction modifies more than one Aggregate instance.
98
+ - A Repository serves multiple Aggregate Roots, or returns partial state.
99
+ - Cross-Aggregate references are by object instead of by ID.
100
+ - A Domain Service performs persistence, transactions, or messaging.
101
+ - An Application Service contains business rules.
102
+ - An Entity / VO has only getters/setters (anemic).
103
+ - Two Bounded Contexts share the same model class.
104
+ - An integration with an external system has no Anticorruption Layer.
105
+
106
+ Reviewer warns (APPROVED_WITH_WARNINGS) when:
107
+ - A class is named "Manager" / "Helper" / "Util" / "Processor" in the domain layer.
108
+ - A Value Object is mutable.
109
+ - An Aggregate exposes its internal collections directly.
110
+ - A Domain Event is named in present/future tense.
111
+ - The Ubiquitous Language used in code disagrees with the language in PROJECT.md or CONTEXT.md.
112
+
113
+ ## Anti-patterns
114
+
115
+ - Anemic Domain Model
116
+ - Generic Repository pattern
117
+ - God Aggregate (entire schema under one Root)
118
+ - Smart UI bypassing domain
119
+ - Domain services that orchestrate use cases (those are Application Services)
120
+ - "Service layer" without distinguishing Domain Service vs Application Service
121
+ - Database-first design driving Aggregate shape
122
+
123
+ ## Outputs
124
+
125
+ Does NOT produce own files. Modifies parent agent's structural decisions during code authoring and review.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: dry
3
3
  description: DRY (Don't Repeat Yourself). 1 source of truth per piece of knowledge. Detects real duplication (same decision in 2+ places) and separates from apparent duplication (same code, different reasons). Applies in any language.
4
4
  ---
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: frontend-rules
3
3
  description: Universal UI/UX and accessibility rules for any web interface. Framework-agnostic - works for React, Vue, Svelte, Solid, Angular, Blazor, Razor, Twig, Jinja, ERB, Blade, and any template engine. Based on WCAG 2.2 AA, Nielsen heuristics, Material/Apple HIG.
4
4
  ---
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: frontend-validator
3
3
  description: Validates live UI via Playwright + axe-core. Detects Playwright; installs if missing (with user consent). Spawns dev server, navigates critical routes on mobile+desktop, captures console errors, network failures, a11y violations, screenshots, layout shifts. Structured JSON output for the reviewer to parse.
4
4
  ---
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: hexagonal
3
+ description: Hexagonal Architecture / Ports and Adapters (Alistair Cockburn). Application core in the center, surrounded by Ports (interfaces owned by the core) and Adapters (implementations). Driving (primary) vs Driven (secondary) sides. Language-agnostic rigid rules. Mutually exclusive with The Method, DDD, Clean Architecture, Onion, Vertical Slice.
4
+ ---
5
+
6
+ # Skill: Hexagonal Architecture (Ports and Adapters)
7
+
8
+ Rigid, inviolable rules from Alistair Cockburn's Ports and Adapters. The application is a **core** isolated from the outside world by **ports** (interfaces) and **adapters** (implementations).
9
+
10
+ Hexagonal is the ONLY allowed design when PROJECT.md `Code Design: LOCKED: Hexagonal`. Do not use The Method, DDD as primary structure, Clean Architecture's 4-layer terminology as primary structure, Onion shells, or Vertical Slice feature folders as primary structure.
11
+
12
+ ## Mandatory structure
13
+
14
+ The system consists of exactly three structural elements:
15
+
16
+ 1. **Application Core (the hexagon)** — domain model + application logic. Knows nothing about technology, protocols, or external systems. The core is the only place where business rules exist.
17
+ 2. **Ports** — interfaces **owned by the core** that declare what the core needs from the outside (driven ports) or what the outside can ask the core to do (driving ports). A port is an abstract contract; it has no implementation in the core.
18
+ 3. **Adapters** — implementations of ports living outside the core. Adapters translate between the technology-specific outside world (HTTP, DB, queue, file, UI) and the technology-free core.
19
+
20
+ Every code unit belongs to exactly one of: Core, Port (still inside the core's package), or Adapter. A unit that does not fit must be redesigned.
21
+
22
+ ## Driving vs Driven (mandatory)
23
+
24
+ 1. **Driving (primary) side** — the side that initiates interaction with the core. UI, HTTP controllers, CLI handlers, scheduled job triggers, integration tests. Driving adapters invoke driving ports.
25
+ 2. **Driven (secondary) side** — the side the core delegates to. Persistence, message bus, external APIs, file system, email, cache. The core invokes driven ports, which are implemented by driven adapters.
26
+ 3. **Driving port** is an interface that exposes the core's capabilities to the outside. **Driven port** is an interface declared by the core that the outside must satisfy.
27
+ 4. **Direction of dependency: adapters depend on ports; ports live in the core; the core depends on nothing infrastructural.**
28
+
29
+ ## Inviolable rules
30
+
31
+ ### Core purity
32
+
33
+ 1. The core has zero imports from any framework, ORM, HTTP library, vendor SDK, file system API, or transport library.
34
+ 2. The core defines its own types for inputs and outputs to ports. Adapter types (HTTP request, ORM model, queue message) do not appear in core code.
35
+ 3. The core does not know the identity of any adapter. It interacts only with ports.
36
+ 4. The core does not perform I/O. All I/O happens through driven ports.
37
+ 5. The core is fully testable without any adapter. If a unit test of the core requires spinning up DB / HTTP / queue, the design is wrong.
38
+
39
+ ### Ports
40
+
41
+ 6. A port is an interface. It has no logic.
42
+ 7. Ports live in the core's package / module. They are not in an "infrastructure" or "adapters" package.
43
+ 8. The core defines a port; the adapter implements it. A port defined outside the core, or implemented in the core, is forbidden.
44
+ 9. Driving ports name capabilities of the core in domain language (e.g., `PlaceOrder`, `RenewSubscription`). Driven ports name dependencies in domain language (e.g., `OrderRepository`, `NotificationSender`).
45
+ 10. Port methods receive and return only types defined inside the core. They do not receive HTTP requests, ORM entities, or framework-specific types.
46
+
47
+ ### Adapters
48
+
49
+ 11. An adapter implements exactly one port (driving or driven). An adapter that mixes driving and driven roles is forbidden.
50
+ 12. A driving adapter translates an external trigger (HTTP request, CLI command, message, schedule) into a core-defined input and invokes a driving port.
51
+ 13. A driven adapter translates a core-defined call into a technology-specific action (SQL query, HTTP call, file write, queue publish) and translates the result back into core-defined output.
52
+ 14. Adapters contain only translation and I/O. Business rules in an adapter are forbidden — they must move into the core.
53
+ 15. Adapters never call other adapters directly. Coordination between adapters happens through the core via a driving adapter → core → driven adapter sequence.
54
+ 16. Adapters never call the core's internal classes directly. They go through ports.
55
+
56
+ ### Composition
57
+
58
+ 17. The Composition Root assembles adapters and injects them into the core at startup. The core does not construct its own adapters.
59
+ 18. Replacing an adapter (e.g., swapping PostgreSQL for MongoDB, REST for gRPC) must not require changes inside the core. If it does, the port is leaking.
60
+ 19. Multiple adapters may implement the same port. The core does not know how many.
61
+ 20. Test adapters (fakes, in-memory implementations) are first-class adapters and must use the same ports as production adapters. The core cannot have a "test-only" code path.
62
+
63
+ ## Forbidden patterns (inviolable)
64
+
65
+ - **Framework types crossing into the core.** No HTTP request type, no ORM entity, no vendor SDK type referenced in core code.
66
+ - **Business rules in adapters.** A driven adapter computing a price, a driving adapter validating a domain rule — both forbidden.
67
+ - **Adapters calling adapters.** Adapter coordination outside the core is forbidden.
68
+ - **Core code instantiating an adapter.** Construction happens in the Composition Root.
69
+ - **Ports defined outside the core.** A port placed in an "infrastructure" module is a violation.
70
+ - **Anemic core.** A core without behavior is a violation — adapters become a leak path for rules.
71
+ - **A driving port returning a framework-specific type** (a port returning `HttpResponse` is wrong).
72
+ - **Driven ports leaking persistence concepts** (a port named `SqlUserRepository` is wrong; it must be domain-named).
73
+ - **Mixed-role adapter** (one adapter both responding to HTTP and writing to DB).
74
+ - **Bypassing ports** by injecting an adapter directly where a port should appear.
75
+ - **Concentric layer terminology** ("Entities layer", "Use Cases layer", "Application Services layer") imposed as the primary structure — Hexagonal organizes by core/ports/adapters, not by concentric layers.
76
+
77
+ ## Naming conventions
78
+
79
+ - Driving ports: domain capability verbs (`PlaceOrder`, `RegisterCustomer`).
80
+ - Driven ports: dependency names in domain language (`OrderRepository`, `EmailSender`, `PaymentGateway`).
81
+ - Adapters: technology-qualified (`HttpPlaceOrderAdapter`, `PostgresOrderRepositoryAdapter`, `SmtpEmailSenderAdapter`).
82
+ - The core never references a name containing a technology word.
83
+
84
+ ## Reviewer enforcement (gate 5)
85
+
86
+ Reviewer rejects (BLOCKED) when:
87
+ - Core code imports a framework / ORM / HTTP / vendor SDK / file-system type.
88
+ - A port is defined outside the core or implemented inside the core.
89
+ - A port method's signature mentions a framework-specific type.
90
+ - An adapter contains business logic.
91
+ - An adapter calls another adapter directly.
92
+ - The core instantiates an adapter.
93
+ - A driven port name leaks a persistence technology.
94
+ - A driving adapter returns the result of a port call without translating from a core type to an external type.
95
+
96
+ Reviewer warns (APPROVED_WITH_WARNINGS) when:
97
+ - An adapter file is doing more translation than necessary (smell: complex mapping suggesting hidden rules).
98
+ - A port is implemented by a single adapter and is unlikely ever to vary (still allowed — keep the port).
99
+ - A core class has no behavior (anemic).
100
+ - Composition wiring is scattered instead of centralized in a Composition Root.
101
+
102
+ ## Anti-patterns
103
+
104
+ - "Service" layer between core and adapters (no such thing in Hexagonal)
105
+ - Repository implemented inside the core (must be a port)
106
+ - Use Case classes shaped after Clean Architecture's Use Case layer (the structure is core/ports/adapters)
107
+ - Ports tied to a transport (e.g., `RestOrderPort`) — ports are domain-shaped, adapters are transport-shaped
108
+ - "Domain Services" terminology imported wholesale from DDD as the primary structure (acceptable internal to the core when meaningful, but does not replace the hexagonal primary structure)
109
+
110
+ ## Outputs
111
+
112
+ Does NOT produce own files. Modifies parent agent's structural decisions during code authoring and review.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: kiss
3
3
  description: KISS (Keep It Simple, Stupid). The simplest solution that solves the problem wins. Complexity only justified by real measured pain. Each layer/abstraction must pay its own cost. Applies in any language.
4
4
  ---