@jarrodmedrano/claude-skills 1.0.2 → 1.0.4

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 (54) hide show
  1. package/.claude/skills/bevy/SKILL.md +406 -0
  2. package/.claude/skills/bevy/references/bevy_specific_tips.md +385 -0
  3. package/.claude/skills/bevy/references/common_pitfalls.md +217 -0
  4. package/.claude/skills/bevy/references/ecs_patterns.md +277 -0
  5. package/.claude/skills/bevy/references/project_structure.md +116 -0
  6. package/.claude/skills/bevy/references/ui_development.md +147 -0
  7. package/.claude/skills/domain-driven-design/SKILL.md +459 -0
  8. package/.claude/skills/domain-driven-design/references/ddd_foundations_and_patterns.md +664 -0
  9. package/.claude/skills/domain-driven-design/references/rich_hickey_principles.md +406 -0
  10. package/.claude/skills/domain-driven-design/references/visualization_examples.md +790 -0
  11. package/.claude/skills/domain-driven-design/references/wlaschin_patterns.md +639 -0
  12. package/.claude/skills/game-design-theory/SKILL.md +102 -0
  13. package/.claude/skills/game-design-theory/design-principles.md +308 -0
  14. package/.claude/skills/game-design-theory/gameplay-elements.md +213 -0
  15. package/.claude/skills/game-design-theory/player-psychology.md +175 -0
  16. package/.claude/skills/game-design-theory/playtesting.md +321 -0
  17. package/.claude/skills/game-design-theory/storytelling.md +219 -0
  18. package/.claude/skills/game-feel/SKILL.md +305 -0
  19. package/.claude/skills/game-feel/references/adsr-tuning.md +271 -0
  20. package/.claude/skills/game-feel/references/classic-profiles.md +279 -0
  21. package/.claude/skills/game-feel/references/perception-thresholds.md +160 -0
  22. package/.claude/skills/game-feel/references/polish-effects.md +246 -0
  23. package/.claude/skills/game-feel/references/simulation-recipes.md +306 -0
  24. package/.claude/skills/game-feel/references/six-metrics.md +239 -0
  25. package/.claude/skills/godot/SKILL.md +728 -0
  26. package/.claude/skills/godot/assets/templates/attribute_template.gd +109 -0
  27. package/.claude/skills/godot/assets/templates/component_template.gd +76 -0
  28. package/.claude/skills/godot/assets/templates/interaction_template.gd +108 -0
  29. package/.claude/skills/godot/assets/templates/item_resource.tres +11 -0
  30. package/.claude/skills/godot/assets/templates/spell_resource.tres +20 -0
  31. package/.claude/skills/godot/references/architecture-patterns.md +608 -0
  32. package/.claude/skills/godot/references/common-pitfalls.md +518 -0
  33. package/.claude/skills/godot/references/file-formats.md +491 -0
  34. package/.claude/skills/godot/references/godot4-physics-api.md +302 -0
  35. package/.claude/skills/godot/scripts/validate_tres.py +145 -0
  36. package/.claude/skills/godot/scripts/validate_tscn.py +170 -0
  37. package/.claude/skills/level-design/SKILL.md +249 -0
  38. package/.claude/skills/level-design/anticipatory-play.md +223 -0
  39. package/.claude/skills/level-design/hiding-linearity.md +181 -0
  40. package/.claude/skills/level-design/indie-practices.md +286 -0
  41. package/.claude/skills/level-design/open-world-planning.md +294 -0
  42. package/.claude/skills/level-design/play-personas.md +240 -0
  43. package/.claude/skills/level-design/procedural-handmade.md +271 -0
  44. package/.claude/skills/level-design/themed-environments.md +264 -0
  45. package/.claude/skills/react-three-fiber/SKILL.md +2055 -0
  46. package/.claude/skills/react-three-fiber/scripts/build-scene.ts +171 -0
  47. package/package.json +3 -1
  48. package/scripts/install.js +16 -1
  49. package/templates/github-actions/README.md +36 -0
  50. /package/.claude/{commands/design-review → agents}/design-review-agent.md +0 -0
  51. /package/.claude/{commands/code-review → agents}/pragmatic-code-review-subagent.md +0 -0
  52. /package/{.claude/commands/code-review → templates/github-actions}/claude-code-review-custom.yml +0 -0
  53. /package/{.claude/commands/code-review → templates/github-actions}/claude-code-review.yml +0 -0
  54. /package/{.claude/commands/security-review → templates/github-actions}/security.yml +0 -0
@@ -0,0 +1,459 @@
1
+ ---
2
+ name: domain-driven-design
3
+ description: This skill should be used whenever domain modeling is taking place. It provides specialized guidance for type-driven and data-driven design based on Rich Hickey and Scott Wlaschin's principles. The skill helps contextualize current modeling within the existing domain model, identifies inconsistencies, builds ubiquitous language, and creates visualizations (Mermaid, Graphviz/DOT, ASCII diagrams) to communicate domain concepts clearly. Use this skill when designing types, modeling business domains, refactoring domain logic, or ensuring domain consistency across a codebase.
4
+ ---
5
+
6
+ # Domain-Driven Design
7
+
8
+ ## Overview
9
+
10
+ This skill provides guidance for domain modeling based on Rich Hickey's data-oriented design principles and Scott Wlaschin's type-driven design approach. Focus on building systems that make illegal states unrepresentable, prioritize data and transformations over objects and methods, and establish a ubiquitous language that bridges technical implementation and business domain.
11
+
12
+ ## Core Principles
13
+
14
+ ### Rich Hickey's Data-Oriented Design
15
+
16
+ **Simplicity over Ease**
17
+ - Favor simple constructs that can be understood independently
18
+ - Avoid complecting (intertwining) unrelated concerns
19
+ - Separate policy from mechanism, data from behavior
20
+
21
+ **Data is King**
22
+ - Model the domain using pure data structures, not objects with behavior
23
+ - Prefer generic data structures (maps, sets, vectors) over custom classes when appropriate
24
+ - Data should be self-describing and inspectable
25
+ - Functions transform data; data does not execute behavior
26
+
27
+ **Value of Values**
28
+ - Use immutable values to represent facts
29
+ - Values enable local reasoning and simple equality
30
+ - Values can be freely shared without coordination
31
+ - Consider: what are the immutable facts in this domain?
32
+
33
+ **Decomplecting**
34
+ - Identify what is truly essential to the domain vs. incidental complexity
35
+ - Separate when-it-happens from what-happens
36
+ - Separate mechanism from policy
37
+ - Question: are these concerns actually separate, or have we tangled them?
38
+
39
+ ### Scott Wlaschin's Type-Driven Design
40
+
41
+ **Make Illegal States Unrepresentable**
42
+ - Use the type system to eliminate invalid states at compile time
43
+ - Model optional values explicitly (Option/Maybe types)
44
+ - Use sum types (discriminated unions) for states that are mutually exclusive
45
+ - Avoid primitive obsession; create domain-specific types
46
+
47
+ **Domain Modeling Made Functional**
48
+ - Model workflows as data transformations: Input → Process → Output
49
+ - Explicitly model business rules as functions
50
+ - Separate validation from business logic
51
+ - Think in terms of: What can happen? What are the valid transitions?
52
+
53
+ **Railway-Oriented Programming**
54
+ - Model success and failure paths explicitly (Result types)
55
+ - Chain operations that can fail using bind/flatMap
56
+ - Keep the happy path clear and linear
57
+ - Handle errors at appropriate boundaries
58
+
59
+ **Types as Documentation**
60
+ - Type signatures should communicate intent
61
+ - Use newtype wrappers for semantic clarity (UserId, EmailAddress, Timestamp)
62
+ - Constrain inputs to valid ranges using types
63
+ - Let the type system guide API design
64
+
65
+ ## DDD Building Blocks
66
+
67
+ ### Entities vs Value Objects
68
+
69
+ **Entities** are defined by identity, not attributes:
70
+ - Have a unique identifier (ID, account number, etc.)
71
+ - Can change over time while maintaining identity
72
+ - Two entities with same attributes but different IDs are distinct
73
+ - Used when domain experts refer to things by name/ID
74
+
75
+ **Value Objects** are defined entirely by attributes:
76
+ - No unique identifier
77
+ - Immutable
78
+ - Two value objects with same attributes are interchangeable
79
+ - Used when only the value matters, not identity
80
+
81
+ **Decision Guide:**
82
+ - Ask: Do domain experts refer to this by ID/name? → Entity
83
+ - Ask: Can I replace it with an equivalent copy? → If yes: Value Object
84
+
85
+ ### Aggregates and Aggregate Roots
86
+
87
+ **Aggregate**: A cluster of entities and value objects treated as a single unit for data changes.
88
+
89
+ **Aggregate Root**: The single entity through which all external access to the aggregate must pass.
90
+
91
+ **Purpose:**
92
+ - Define transactional consistency boundaries
93
+ - Enforce invariants that span multiple objects
94
+ - Simplify the model by grouping related concepts
95
+
96
+ **Rules:**
97
+ - External references go only to the aggregate root (use ID references)
98
+ - Root enforces all invariants for the entire aggregate
99
+ - Transactions don't cross aggregate boundaries (use eventual consistency)
100
+ - Keep aggregates small for better performance and scalability
101
+
102
+ **When NOT to create an aggregate:**
103
+ - Objects can be modified independently
104
+ - No shared invariants requiring transactional consistency
105
+ - Different objects have different lifecycles
106
+
107
+ ### Bounded Contexts
108
+
109
+ **Definition**: An explicit boundary within which a domain model applies.
110
+
111
+ **Purpose:**
112
+ - Divide large domains into manageable pieces
113
+ - Allow same term to have different meanings in different contexts
114
+ - Prevent model corruption from mixing incompatible concepts
115
+
116
+ **Key Insight**: Ubiquitous language is only ubiquitous within a context. "Customer" in Sales context may be different from "Customer" in Shipping context.
117
+
118
+ **When modeling:**
119
+ - Identify which bounded context you're in
120
+ - Make context boundaries explicit in code structure (separate modules/namespaces)
121
+ - Use anti-corruption layers when integrating across contexts
122
+ - Document relationships between contexts (context map)
123
+
124
+ ### Domain Events
125
+
126
+ **Definition**: Something important that happened in the domain.
127
+
128
+ **Characteristics:**
129
+ - Named in past tense (OrderPlaced, PaymentProcessed, UserRegistered)
130
+ - Immutable facts
131
+ - Domain experts care about them
132
+ - Can trigger reactions within or across bounded contexts
133
+
134
+ **Uses:**
135
+ - Decouple domain logic
136
+ - Enable eventual consistency between aggregates
137
+ - Integration between bounded contexts
138
+ - Event sourcing (store events as source of truth)
139
+
140
+ ### Repositories
141
+
142
+ **Purpose**: Provide illusion of an in-memory collection of aggregates, abstracting persistence.
143
+
144
+ **Characteristics:**
145
+ - Operate at aggregate boundaries (load/save whole aggregates)
146
+ - Provide lookup by ID
147
+ - Hide database implementation details
148
+ - Return domain entities, not database rows
149
+
150
+ **Pattern**: Application layer uses repository to get/save aggregates; domain layer remains pure.
151
+
152
+ ## Domain Modeling Workflow
153
+
154
+ ### 1. Discover the Ubiquitous Language
155
+
156
+ Start by identifying the domain concepts, using terminology from domain experts:
157
+
158
+ **Action Items:**
159
+ - List nouns (entities, value objects) and verbs (operations, events) from the domain
160
+ - Document domain terms with precise definitions
161
+ - Identify synonyms and resolve ambiguity
162
+ - Ask: What does the business call this? What are the boundaries of this concept?
163
+
164
+ **Output Format:**
165
+ Create a glossary section documenting each term:
166
+ ```markdown
167
+ **Term** (Type: Entity/ValueObject/Event/Command)
168
+ - Definition: [Clear, domain-expert-approved definition]
169
+ - Examples: [Concrete examples]
170
+ - Invariants: [Rules that must always hold]
171
+ ```
172
+
173
+ ### 2. Analyze the Existing Domain Model
174
+
175
+ Before making changes, understand the current state:
176
+
177
+ **Exploration Steps:**
178
+ - Identify where domain concepts are currently modeled (types, schemas, tables)
179
+ - Map out relationships between domain entities
180
+ - Find where business logic lives (services, functions, stored procedures)
181
+ - Document implicit rules and constraints
182
+ - Note inconsistencies in naming or modeling
183
+
184
+ **Questions to Answer:**
185
+ - What types/classes represent domain concepts?
186
+ - What are the invariants? Where are they enforced?
187
+ - Which concepts are tangled together that should be separate?
188
+ - Are there phantom types or states that shouldn't exist?
189
+
190
+ ### 3. Identify Inconsistencies and Smells
191
+
192
+ Common problems to surface:
193
+
194
+ **Naming Inconsistencies**
195
+ - Same concept with different names (User vs Account vs Customer)
196
+ - Different concepts with same name (Order as entity vs Order as command)
197
+ - Technical names bleeding into domain language (DTO, DAO suffixes)
198
+
199
+ **Structural Problems**
200
+ - Illegal states being representable (e.g., `status: "approved" | "rejected"` with separate `approved_at` and `rejected_at` fields that can both be set)
201
+ - Primitive obsession (strings for email, numbers for money)
202
+ - Optional fields that are actually required in certain states
203
+ - Null/undefined used to represent multiple distinct states
204
+
205
+ **Complected Concerns**
206
+ - Domain logic mixed with infrastructure (DB access in business logic)
207
+ - Multiple responsibilities in one type/module
208
+ - Temporal coupling (must call A before B or system breaks)
209
+
210
+ **Missing Concepts**
211
+ - Domain concepts that exist in conversations but not in code
212
+ - Implicit states that should be explicit
213
+ - Business rules enforced through comments or conventions rather than types
214
+
215
+ ### 4. Design the Domain Model
216
+
217
+ Apply type-driven and data-driven principles:
218
+
219
+ **Data Modeling:**
220
+ - Start with the data shape; what are the facts?
221
+ - Use immutable values for facts that don't change
222
+ - Model state transitions explicitly
223
+ - Separate identity from attributes
224
+ - Consider: what varies together? What varies independently?
225
+
226
+ **Type Design:**
227
+ - Create sum types for mutually exclusive states:
228
+ ```
229
+ type PaymentStatus =
230
+ | Pending
231
+ | Approved { approvedAt: Timestamp, approvedBy: UserId }
232
+ | Rejected { rejectedAt: Timestamp, reason: string }
233
+ ```
234
+ - Use product types to ensure all required data is present
235
+ - Create semantic wrappers for primitives:
236
+ ```
237
+ type EmailAddress = EmailAddress of string // with validation
238
+ type Money = { amount: Decimal, currency: Currency }
239
+ ```
240
+ - Make impossible states unrepresentable
241
+
242
+ **Workflow Modeling:**
243
+ - Model each business workflow as a clear pipeline:
244
+ ```
245
+ ValidateInput → ExecuteBusinessLogic → HandleResult → Persist → Notify
246
+ ```
247
+ - Identify decision points and model them explicitly
248
+ - Separate pure business logic from effects (IO, time, randomness)
249
+ - Use clear function signatures that document intent
250
+
251
+ ### 5. Build and Maintain Ubiquitous Language
252
+
253
+ **Consistency Rules:**
254
+ - Use identical terminology in code, documentation, conversations, and UI
255
+ - When domain language changes, update all representations
256
+ - Avoid technical jargon in domain code (no "factory", "manager", "handler" unless domain terms)
257
+ - Resist the temptation to rename domain concepts for technical convenience
258
+
259
+ **Code Conventions:**
260
+ - Domain types should mirror domain language exactly
261
+ - Function names should use domain verbs
262
+ - Module boundaries should follow domain boundaries
263
+ - Comments should explain domain rules, not implementation details
264
+
265
+ **Documentation:**
266
+ - Keep the glossary up to date
267
+ - Document why decisions were made (especially constraints and invariants)
268
+ - Link code to domain documentation
269
+ - Make implicit domain rules explicit
270
+
271
+ ### 6. Visualize the Domain Model
272
+
273
+ Use diagrams to communicate domain structure and relationships:
274
+
275
+ **Mermaid for Relationships:**
276
+ ```mermaid
277
+ classDiagram
278
+ Order --> Customer
279
+ Order --> OrderLine
280
+ OrderLine --> Product
281
+ Order --> PaymentStatus
282
+
283
+ class Order {
284
+ +OrderId id
285
+ +CustomerId customerId
286
+ +List~OrderLine~ lines
287
+ +PaymentStatus status
288
+ }
289
+
290
+ class PaymentStatus {
291
+ <<enumeration>>
292
+ Pending
293
+ Approved
294
+ Rejected
295
+ }
296
+ ```
297
+
298
+ **Mermaid for Workflows:**
299
+ ```mermaid
300
+ graph LR
301
+ A[Receive Order] --> B{Valid?}
302
+ B -->|Yes| C[Calculate Total]
303
+ B -->|No| D[Return Validation Error]
304
+ C --> E[Process Payment]
305
+ E --> F{Payment Success?}
306
+ F -->|Yes| G[Fulfill Order]
307
+ F -->|No| H[Cancel Order]
308
+ ```
309
+
310
+ **Mermaid for State Transitions:**
311
+ ```mermaid
312
+ stateDiagram-v2
313
+ [*] --> Draft
314
+ Draft --> Submitted: submit()
315
+ Submitted --> Approved: approve()
316
+ Submitted --> Rejected: reject()
317
+ Approved --> Fulfilled: fulfill()
318
+ Fulfilled --> [*]
319
+ Rejected --> [*]
320
+ ```
321
+
322
+ **Graphviz/DOT for Complex Relationships:**
323
+ ```dot
324
+ digraph domain {
325
+ rankdir=LR;
326
+ node [shape=box];
327
+
328
+ Customer -> Order [label="places"];
329
+ Order -> OrderLine [label="contains"];
330
+ OrderLine -> Product [label="references"];
331
+ Order -> Payment [label="requires"];
332
+ Payment -> PaymentMethod [label="uses"];
333
+ }
334
+ ```
335
+
336
+ **ASCII for Quick Sketches:**
337
+ ```
338
+ Customer
339
+ └─> Order (1:N)
340
+ ├─> OrderLine (1:N)
341
+ │ └─> Product
342
+ └─> Payment (1:1)
343
+ └─> PaymentMethod
344
+ ```
345
+
346
+ **When to Use Each:**
347
+ - **Mermaid classDiagram**: Entity relationships and type structures
348
+ - **Mermaid graph/flowchart**: Business workflows and decision trees
349
+ - **Mermaid stateDiagram**: State transitions and lifecycle
350
+ - **Graphviz/DOT**: Complex dependency graphs, module boundaries
351
+ - **ASCII**: Quick sketches during discussion, simple hierarchies
352
+
353
+ ## Domain Modeling Anti-Patterns
354
+
355
+ **Anemic Domain Model**
356
+ - Symptom: Data structures with getters/setters, all logic in separate services
357
+ - Problem: Violates data-orientation by adding ceremony without encapsulation benefits
358
+ - Solution: Keep data as data; put related transformations in same module but separate from data definition
359
+
360
+ **Entity Services Anti-Pattern**
361
+ - Symptom: Classes like `UserService`, `OrderManager`, `ProductFactory`
362
+ - Problem: Hides actual operations; lacks ubiquitous language
363
+ - Solution: Name functions after domain operations: `approveOrder`, `cancelSubscription`, `calculateDiscount`
364
+
365
+ **Primitive Obsession**
366
+ - Symptom: String for email, number for money, boolean flags for states
367
+ - Problem: No type safety; invalid values representable
368
+ - Solution: Create semantic types with validation
369
+
370
+ **Accidental Complexity**
371
+ - Symptom: Complex abstractions, design patterns without clear domain benefit
372
+ - Problem: Adds layers that obscure domain meaning
373
+ - Solution: Simplify; prefer composition over inheritance; avoid premature abstraction
374
+
375
+ **Hidden Temporal Coupling**
376
+ - Symptom: Must call methods in specific order or system breaks
377
+ - Problem: Complects workflow with state management
378
+ - Solution: Make workflow explicit; use types to enforce valid transitions
379
+
380
+ **Boolean Blindness**
381
+ - Symptom: Boolean flags to represent states (isApproved, isActive, isDeleted)
382
+ - Problem: Multiple booleans can represent impossible states
383
+ - Solution: Use sum types for mutually exclusive states
384
+
385
+ ## Contextualizing Within Existing Models
386
+
387
+ When adding to or changing an existing domain model:
388
+
389
+ 1. **Map Current State**: Document existing types, relationships, and patterns
390
+ 2. **Identify Affected Concepts**: Which existing concepts does this change touch?
391
+ 3. **Check Consistency**: Does new design follow existing patterns? If not, why?
392
+ 4. **Assess Impact**: What breaks if we make this change?
393
+ 5. **Migration Path**: How do we evolve from current to desired state?
394
+ 6. **Update Ubiquitous Language**: Ensure all usage points are updated
395
+ 7. **Visualize Before/After**: Create diagrams showing current and proposed models
396
+
397
+ **Key Questions:**
398
+ - Does this change align with existing domain boundaries?
399
+ - Are we using consistent terminology?
400
+ - Does this introduce new concepts or reuse existing ones?
401
+ - Are we fixing an inconsistency or introducing a new one?
402
+ - Can we make this change incrementally?
403
+
404
+ ## Checklist for Domain Modeling
405
+
406
+ Before completing domain modeling work:
407
+
408
+ **Language & Communication:**
409
+ - [ ] All domain concepts are named using ubiquitous language
410
+ - [ ] Domain glossary is updated with new/changed terms
411
+ - [ ] All code, docs, and conversations use identical terminology
412
+ - [ ] Bounded context is clearly identified and documented
413
+
414
+ **Type Design:**
415
+ - [ ] Types make illegal states unrepresentable
416
+ - [ ] No primitive obsession; semantic types are used appropriately
417
+ - [ ] Entities have clear identity; value objects are immutable
418
+ - [ ] Sum types used for mutually exclusive states
419
+
420
+ **Domain Logic:**
421
+ - [ ] Business rules are explicit and testable
422
+ - [ ] Data and behavior are appropriately separated
423
+ - [ ] Workflows are modeled as clear data transformations
424
+ - [ ] Domain logic is pure (no side effects)
425
+ - [ ] Temporal coupling is eliminated or made explicit
426
+
427
+ **Aggregates & Boundaries:**
428
+ - [ ] Aggregate boundaries are explicit
429
+ - [ ] Aggregates enforce their invariants
430
+ - [ ] External references to aggregates use IDs only
431
+ - [ ] Aggregates are kept small and focused
432
+ - [ ] Transactional boundaries are appropriate
433
+
434
+ **Consistency & Integration:**
435
+ - [ ] Inconsistencies with existing model are resolved or documented
436
+ - [ ] Cross-aggregate consistency strategy is defined (transactional vs eventual)
437
+ - [ ] Domain events are used for important occurrences
438
+ - [ ] Integration between bounded contexts uses anti-corruption layers
439
+
440
+ **Documentation:**
441
+ - [ ] Visualization diagrams clearly communicate the design
442
+ - [ ] Key decisions and invariants are documented
443
+ - [ ] Context map shows relationships between bounded contexts
444
+
445
+ ## Resources
446
+
447
+ ### references/
448
+
449
+ This skill includes reference documentation for deeper exploration:
450
+
451
+ - **ddd_foundations_and_patterns.md**: Eric Evans' foundational DDD concepts (entities, value objects, aggregates, bounded contexts, repositories, domain events), Martin Fowler's Ubiquitous Language guidance, and practical Clojure/functional patterns. Essential reading for understanding DDD building blocks and how to apply them.
452
+
453
+ - **rich_hickey_principles.md**: Core concepts from Rich Hickey's talks including Simple Made Easy, Value of Values, and The Language of the System. Focus on data-oriented design, simplicity, decomplecting, and the power of immutable values.
454
+
455
+ - **wlaschin_patterns.md**: Scott Wlaschin's type-driven design patterns, domain modeling recipes, functional architecture guidance, and railway-oriented programming. Emphasis on making illegal states unrepresentable and designing with types.
456
+
457
+ - **visualization_examples.md**: Comprehensive examples of Mermaid, Graphviz, and ASCII diagram patterns for domain modeling. Includes entity relationships, workflows, state machines, aggregate boundaries, and bounded context maps.
458
+
459
+ Load these references when deeper context is needed on specific principles or patterns.