Build the project's shared language and bounded contexts before writing code, so names stay consistent and the agent stops paraphrasing domain concepts. Produces a CONTEXT.md glossary and decision records. Use at the start of a project or feature, or when the codebase and the people describing it speak different languages.
git clone https://github.com/rohitg00/pro-workflow.git--- name: domain-modeling description: Build the project's shared language and bounded contexts before writing code, so names stay consistent and the agent stops paraphrasing domain concepts. Produces a CONTEXT.md glossary and decision records. Use at the start of a project or feature, or when the codebase and the people describing it speak different languages. user-invocable: true --- # domain-modeling Most misbuilds start as a language gap: the agent is dropped into a project and left to infer the jargon, so it uses twenty words where the domain has one. A shared language closes the gap. When code, conversation, and the model all draw from the same vocabulary, names line up, navigation gets cheaper, and the model spends fewer tokens reasoning because it has a tighter language to reason in. ## Method 1. **Harvest the terms.** From the request, the codebase, and the user's own words, list the nouns and verbs that carry domain meaning - the concepts a newcomer would have to ask about. Prefer the user's word over a synonym you like better. 2. **Pin each one.** Write a one-line definition in the project's own language, not a dictionary definition. If two terms blur together, force the distinction or collapse them - ambiguity here becomes inconsistent names in code. 3. **Draw the boundaries.** Where the same word means different things in different parts of the system, that is a boundary. Name each context and note which terms belong to it. A term that means two things is two terms. 4. **Record the hard calls.** When a modeling choice was contested or will be questioned later, write a short decision record: context, choice, alternatives rejected, why. ## Outputs - **`CONTEXT.md`** - the shared-language glossary. One term per line: `term - what it means in this project`. Grouped by bounded context when there is more than one. Point every future session at this file. On re-run, add new terms and update definitions that changed; do not rewrite the file wholesale. - **Bounded-context sketch** - the contexts and which terms live in each, short enough to read in fifteen seconds. - **Decision records** in `docs/decisions/NNNN-slug.md` for the contested modeling calls only. Read the directory first and number from the highest existing record so two records never collide. Skip the obvious ones. ## Guardrails - The glossary is for the model as much as the human - write it to be loaded, not framed on a wall. - Do not invent terms the project does not use. Reflect the domain; do not rename it. - Keep it small and current. A glossary that lists everything and updates nothing is worse than none. Prune terms that fall out of use. ## Where it fits Run this before `plan-interrogate` on a new area, or let `plan-interrogate` call back here when it hits terms it cannot pin. The `CONTEXT.md` this produces is the same file `plan-interrogate` emits - one shared-language artifact, two ways in.
[{"step":"Define the project scope and key stakeholders","action":"Start with the prompt template, replacing [PROJECT_NAME] with your actual project name. Clearly describe the core business problem and identify all stakeholder groups (e.g., farmers, customers, delivery drivers).","tip":"Be specific about the business outcomes you're trying to achieve. The more concrete the problem statement, the more accurate the domain model will be."},{"step":"Identify core business processes and workflows","action":"Work with domain experts to map out the key processes that will be implemented. For each process, ask: 'What are the essential business concepts here?' and 'Where do these concepts change meaning?'","tip":"Focus on the 'why' behind each process. The answers will reveal the true domain invariants that should be modeled."},{"step":"Refine the glossary and bounded contexts","action":"For each identified concept, write a precise definition and determine which bounded context it belongs to. Use the example output as a template for structuring your CONTEXT.md file.","tip":"Look for terms that have different meanings in different contexts (e.g., 'order' might mean different things to customers vs. farmers). These are prime candidates for separate bounded contexts."},{"step":"Validate with stakeholders and iterate","action":"Present the draft CONTEXT.md to both technical and business stakeholders. Use their feedback to refine the model, then update the document accordingly.","tip":"Pay special attention to terms that stakeholders use differently. These often reveal hidden complexity that needs to be modeled explicitly."},{"step":"Use the model to guide implementation","action":"Before writing any code, review the CONTEXT.md file and ensure your implementation decisions align with the defined contexts and glossary. Update the document as new insights emerge during development.","tip":"Treat the CONTEXT.md as a living document. Update it whenever you discover new domain concepts or when existing ones need refinement."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/rohitg00/pro-workflow/tree/main/skills/domain-modelingCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Act as a domain-driven design expert. Before we write any code, let's define the project's shared language and bounded contexts. Start by asking me to describe the core business problem we're solving in [PROJECT_NAME]. Then, for each key business process or workflow, identify the core domain concepts, their relationships, and where the boundaries should be drawn between contexts. Produce a CONTEXT.md file that includes: 1) A glossary of domain terms with precise definitions, 2) Bounded context boundaries with clear responsibilities, 3) Context mapping diagram in Mermaid format, and 4) Key architectural decisions with rationale. Focus on eliminating ambiguity in terminology that could lead to miscommunication between technical and business stakeholders. Start with: 'Describe the core business problem we're solving in [PROJECT_NAME] and the key stakeholders involved.'
Here's a CONTEXT.md file for a fictional project called 'FarmFresh Direct' - a farm-to-table produce delivery service:
# FarmFresh Direct - Domain Model & Contexts
## Core Business Problem
Connecting local farmers directly with urban consumers through a subscription-based produce delivery service that guarantees freshness and supports sustainable agriculture.
## Glossary of Domain Terms
| Term | Definition | Example |
|------|------------|---------|
| **Farm** | A registered agricultural producer supplying produce | Green Acres Farm, Happy Hens Cooperative |
| **Harvest Lot** | A single batch of produce from a farm, tracked for freshness | Harvest Lot #2024-05-14-001: 50 lbs organic carrots from Green Acres |
| **Subscription** | A customer's recurring order for produce deliveries | Weekly vegetable box subscription for customer #C-4728 |
| **Delivery Window** | Time slot when produce will arrive (AM/PM) | AM Window: 7-9 AM, PM Window: 5-7 PM |
| **Freshness Score** | 0-100 metric tracking produce age since harvest | Freshness Score 95: harvested yesterday, delivered today |
## Bounded Contexts
### 1. Farm Management Context
**Responsibility:** Track farms, their produce availability, and harvest schedules
**Key Aggregates:** Farm, HarvestLot, Farmer
**Invariants:** A farm must have at least one active harvest lot to accept orders
**Dependencies:** None
```mermaid
graph TD
Farm[Farm] -->|has many| HarvestLot[Harvest Lot]
Farmer[Farmer] -->|manages| Farm
```
### 2. Subscription Context
**Responsibility:** Handle customer subscriptions and delivery scheduling
**Key Aggregates:** Subscription, Customer, DeliveryWindow
**Invariants:** A subscription must have exactly one delivery window per week
**Dependencies:** Farm Management Context for produce availability
```mermaid
graph TD
Customer[Customer] -->|has| Subscription[Subscription]
Subscription -->|specifies| DeliveryWindow[Delivery Window]
Subscription -->|includes| HarvestLot[Harvest Lots]
```
### 3. Delivery Context
**Responsibility:** Plan and execute produce delivery routes
**Key Aggregates:** Route, Delivery, Driver
**Invariants:** Each delivery must include exactly one freshness score report
**Dependencies:** Subscription Context for delivery requirements
```mermaid
graph TD
Route[Route] -->|contains| Delivery[Delivery]
Delivery -->|serves| Subscription
Driver[Driver] -->|executes| Route
```
## Context Mapping
```mermaid
graph TD
FarmMgmt[Farm Management] -->|Publishes| HarvestEvents[Harvest Events]
FarmMgmt -->|Publishes| FarmUpdates[Farm Updates]
SubMgmt[Subscription] -->|Subscribes| HarvestEvents
SubMgmt -->|Queries| FarmUpdates
Delivery[Delivery] -->|Subscribes| SubscriptionEvents[Subscription Events]
Delivery -->|Queries| FarmUpdates
```
## Architectural Decisions
1. **Harvest Lot Tracking**: We'll implement a Harvest Lot aggregate to track produce from farm to customer, ensuring freshness guarantees can be verified at any point.
2. **Freshness Score Calculation**: Freshness will be calculated as `(current_time - harvest_time) * decay_factor` where decay_factor varies by produce type (leafy greens decay faster than root vegetables).
3. **Delivery Window Standardization**: All deliveries will use standardized 2-hour windows (AM/PM) to simplify route planning and customer expectations.
4. **Event-Driven Updates**: Farm Management will publish Harvest Events when new lots become available, allowing the Subscription system to react without tight coupling.
## Next Steps
1. Validate these contexts with domain experts
2. Identify any missing domain terms or relationships
3. Determine which contexts will be implemented first
4. Plan the integration points between contextsskills-collection
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan