functional-ddd

Embeds domain knowledge into types and data using functional domain-driven design.

Updated Oct 14, 2024
One-click install
npx skills add https://github.com/tktcorporation/food-shop-search --skill functional-ddd-tktcorporation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: functional-ddd
Source: https://github.com/tktcorporation/food-shop-search/tree/main/.claude/skills/functional-ddd
Command: npx skills add https://github.com/tktcorporation/food-shop-search --skill functional-ddd-tktcorporation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Domain rules often live only in documents, comments, or developers' memory, causing duplicated conditionals, invalid states, and modules organized by technical role instead of concept. This Skill diagnoses where knowledge has leaked out of the code and guides moving it into types, ADTs, and pure functions. ## Core Features & Use Cases - Diagnostic Smell Detection: Identifies eight concrete symptoms of missing domain knowledge, such as duplicated conditionals, boolean-flag state combinations, and modules split by technical role. - Four-Layer Design Framework: Classifies problems into boundary (Parse, don't validate), core (ADT + total functions), placement (Functional Core, Imperative Shell), and dependency (Port & Adapter) layers so the right technique is chosen first. - Executable Specifications: Converts documentation-only rules into single declarations from which behavior is derived, with tests that verify the declaration actually drives the implementation. - Use Case: When a state transition table exists only in a Markdown file and the same conditional is scattered across handlers, use this Skill to model states as a tagged union, declare transitions as data, and derive all conditionals from that single source of truth. ## Quick Start Ask the AI to review a module using functional DDD principles and refactor scattered conditionals and nullable state combinations into ADTs and pure functions.

Frequently Asked Questions about functional-ddd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply domain-driven design in functional programming?▼

Replace class-based patterns with functional equivalents: aggregates become sets of pure state-transition functions, value objects become branded types, domain services become pure functions, and repositories become injected port interfaces. Knowledge is expressed through module structure and type shapes rather than object behavior.

How to make illegal states unrepresentable with types?▼

Model mutually exclusive states as a tagged union (ADT) instead of boolean flags or nullable field combinations, then write total functions that handle every variant exhaustively. This makes impossible state combinations unconstructable at compile time.

What is the difference between Parse don't validate and regular validation?▼

Parse don't validate converts external input into a precise type at the system boundary, so code after that point never re-validates. Regular validation checks data but leaves the imprecise type unchanged, forcing repeated checks throughout the codebase.

When should I not use functional DDD modeling?▼

Skip it when there is only one state with no transitions, when a rule exists in exactly one place without duplication, or when the domain concept is not yet stable. Often just naming a conditional as a constant removes the smell without introducing new types.

How do I verify a declaration actually drives the implementation?▼

Intentionally change the declared value to a wrong one and check that a test observing real behavior fails, then revert. Tests that only scan the declaration itself do not prove the declaration drives anything, since they fail even if the implementation ignores it.