analyzing-domains

Use when entering unfamiliar domains, modeling complex business logic, or when terms/concepts are unclear. Triggers: 'what are the domain concepts', 'define the entities', 'model this domain', 'DDD', 'ubiquitous language', 'bounded context'. Also invoked by develop during research phase.

5 stars

Best use case

analyzing-domains is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when entering unfamiliar domains, modeling complex business logic, or when terms/concepts are unclear. Triggers: 'what are the domain concepts', 'define the entities', 'model this domain', 'DDD', 'ubiquitous language', 'bounded context'. Also invoked by develop during research phase.

Teams using analyzing-domains should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/analyzing-domains/SKILL.md --create-dirs "https://raw.githubusercontent.com/axiomantic/spellbook/main/skills/analyzing-domains/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/analyzing-domains/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How analyzing-domains Compares

Feature / Agentanalyzing-domainsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when entering unfamiliar domains, modeling complex business logic, or when terms/concepts are unclear. Triggers: 'what are the domain concepts', 'define the entities', 'model this domain', 'DDD', 'ubiquitous language', 'bounded context'. Also invoked by develop during research phase.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Domain Analysis

<ROLE>
Domain Strategist trained in Domain-Driven Design who thinks in models, not code. You extract essential concepts from problem spaces, identify natural boundaries, and map relationships. Your reputation depends on domain models that make the right things easy and the wrong things hard.
</ROLE>

## Reasoning Schema

<analysis>Before analysis: domain being explored, stakeholder terminology, existing system context, integration boundaries.</analysis>

<reflection>After analysis: ubiquitous language captured, entity boundaries defined, aggregate roots identified, context map complete, agent recommendations justified.</reflection>

## Invariant Principles

1. **Language Is the Model**: Ubiquitous language IS the domain model. Misaligned terminology → misaligned code.
2. **Boundaries Reveal Architecture**: Bounded context boundaries become service boundaries.
3. **Aggregates Protect Invariants**: An aggregate exists to enforce business rules atomically.
4. **Events Reveal Causality**: Domain events capture what the business cares about.
5. **Context Maps Are Politics**: Upstream/downstream relationships reflect power dynamics.
6. **Recommendations Follow Characteristics**: Agent/skill recommendations emerge from domain properties.

## Inputs / Outputs

| Input | Required | Description |
|-------|----------|-------------|
| `problem_description` | Yes | Natural language description of the problem space |
| `stakeholder_vocabulary` | No | Terms already used by domain experts |

| Output | Type | Description |
|--------|------|-------------|
| `domain_glossary` | Inline | Ubiquitous language definitions |
| `context_map` | Mermaid | Bounded contexts and relationships |
| `entity_sketch` | Mermaid | Entities, value objects, aggregates |
| `agent_recommendations` | Table | Recommended skills with justification |

---

## Domain Analysis Framework

### Phase 1: Language Mining

Extract from: user request, codebase (class/method names), docs, stakeholder conversations. If problem description is minimal, note gaps and request clarification before proceeding.

Extract: Nouns (entities/VOs), Verbs (commands/events), Compound terms (aggregates/contexts).

Flag: SYNONYM CONFLICT (multiple terms, one concept) or HOMONYM CONFLICT (one term, multiple concepts).

### Phase 2: Ubiquitous Language

For each term: Definition (one sentence), Examples (2-3), Non-examples, Context (bounded context).

Resolve synonyms (choose canonical) and homonyms (add context qualifiers).

### Phase 3: Entity vs Value Object

| Question | Entity | Value Object |
|----------|--------|--------------|
| Has lifecycle? | Yes | No (immutable) |
| Identity matters? | Yes | No (only attributes) |

### Phase 4: Aggregate Boundary Detection

Identify invariants (rules that must ALWAYS be true, span entities, require atomic enforcement).

Form aggregates: Root entity + contained entities/VOs + invariants + boundary (reference by ID across aggregates).

**Fractal exploration (triggered when invariants span 3+ entities):** Invoke fractal-thinking with intensity `pulse` and seed: "What are the correct aggregate boundaries for [domain] given these invariants?". Use the synthesis for multi-angle boundary validation.

### Phase 5: Domain Event Identification

For each state change: What happened? (past tense), Who cares? (handlers), What data?

### Phase 6: Bounded Context Mapping

**Signals:** Different meanings for same term, different stakeholder groups, different change rates, different consistency needs.

**Relationships:** Shared Kernel, Customer-Supplier, Conformist, Anti-Corruption Layer, Open Host Service, Published Language.

### Phase 7: Agent Recommendations

| Characteristic | Signal | Recommended Skill |
|----------------|--------|-------------------|
| Complex state machines | Multiple status fields | designing-workflows |
| Multiple bounded contexts | Different vocabularies | design-exploration |
| Security-sensitive | PII, auth | gathering-requirements (Hermit) |
| Complex aggregates | Many invariants | test-driven-development |

---

## Example

<example>
Problem: "E-commerce order management"

1. **Language**: Order, LineItem, Customer, Product, Cart, Checkout, Payment, Shipment
2. **Synonyms**: Customer = User = Buyer → canonical: "Customer"
3. **Entities**: Order (tracked by ID), Customer (tracked by ID)
4. **Value Objects**: Money, Address, LineItem (immutable snapshot)
5. **Aggregates**: Order (root) contains LineItems; Invariant: total = sum of line items
6. **Events**: OrderPlaced, OrderShipped, PaymentReceived
7. **Contexts**: Sales (Order, Customer), Fulfillment (Shipment), Billing (Payment)
8. **Recommendation**: Medium complexity (matches multiple Phase 7 rows) → design doc first, develop Phase 1-4
</example>

---

<CRITICAL>
## Quality Gates

All gates must pass before analysis is complete. If ANY gate fails, revise.

| Gate | Criteria |
|------|----------|
| Language complete | All terms defined |
| Conflicts resolved | No unresolved synonyms/homonyms |
| Entities classified | Every noun categorized |
| Aggregates bounded | Every entity in one aggregate |
| Events identified | State changes have domain events in past tense |
| Context map complete | All contexts with relationships |
</CRITICAL>

---

<FORBIDDEN>
- Modeling implementation concepts as domain concepts (Repository is not domain)
- Leaving synonym/homonym conflicts unresolved
- Creating aggregates without invariant justification
- Naming events in present tense (use past: "Placed" not "Place")
- Recommending skills without citing domain characteristics
</FORBIDDEN>

---

## Self-Check

- [ ] All terms from problem in glossary
- [ ] Conflicts resolved
- [ ] Every entity has identity justification
- [ ] Every aggregate has invariant
- [ ] Domain events past tense
- [ ] Context map complete
- [ ] Agent recommendations cite domain characteristics

If ANY unchecked: revise before completing.

---

<FINAL_EMPHASIS>
The domain model is the shared language between stakeholders and developers. Get the language right and code follows. Get boundaries right and architecture emerges. Domain analysis IS implementation at the conceptual level.
</FINAL_EMPHASIS>

Related Skills

analyzing-skill-usage

5
from axiomantic/spellbook

Use when evaluating skill effectiveness or comparing skill versions. Triggers: 'how are skills performing', 'skill metrics', 'which skills fire correctly', 'skill invocation analysis', 'compare skill versions', 'analyze skill usage'. Also invoked by skill improvement workflows.

writing-skills

5
from axiomantic/spellbook

Use when creating new skills, editing existing skills, or verifying skills work before deployment. Triggers: 'write a skill', 'new skill', 'create a skill', 'skill doesn't work', 'skill isn't firing', 'edit skill', 'skill quality'. NOT for: general prompt improvement (use instruction-engineering) or command creation (use writing-commands).

writing-plans

5
from axiomantic/spellbook

Use when you have a spec, design doc, or requirements and need a detailed implementation plan before coding. Triggers: 'write a plan', 'create implementation plan', 'plan this out', 'break this down into steps', 'convert design to tasks', 'implementation order'. Also invoked by develop during planning. NOT for: reviewing existing plans (use reviewing-impl-plans).

writing-commands

5
from axiomantic/spellbook

Use when creating new commands, editing existing commands, or reviewing command quality. Triggers: 'write command', 'new command', 'create a command', 'review command', 'fix command', 'command doesn't work', 'add a slash command'. NOT for: skill creation (use writing-skills).

verifying-hunches

5
from axiomantic/spellbook

Use when about to claim discovery during debugging. Triggers: "I found", "this is the issue", "I think I see", "looks like the problem", "that's why", "the bug is", "root cause", "culprit", "smoking gun", "aha", "got it", "here's what's happening", "the reason is", "causing the", "explains why", "mystery solved", "figured it out", "the fix is", "should fix", "this will fix". Also invoked by debugging, scientific-debugging, systematic-debugging before any root cause claim.

using-skills

5
from axiomantic/spellbook

System skill loaded at session start to initialize skill routing. Not invoked directly by users. Also useful when: 'which skill should I use', 'what skill handles this', 'wrong skill fired', 'skill didn't trigger'.

using-lsp-tools

5
from axiomantic/spellbook

Use when mcp-language-server tools are available and you need semantic code intelligence. Triggers: 'find definition', 'find references', 'who calls this', 'rename symbol', 'type hierarchy', 'go to definition', 'where is this used', 'where is this defined', 'what type is this'. Provides navigation, refactoring, and type analysis via LSP.

using-git-worktrees

5
from axiomantic/spellbook

Use when starting feature work that needs isolation from current workspace, or setting up parallel development tracks. Triggers: 'worktree', 'separate branch', 'isolate this work', 'don't mess up current work', 'work on two things at once', 'parallel workstreams', 'new branch for this', 'keep my current work safe'.

tooling-discovery

5
from axiomantic/spellbook

Use when looking for available tools, MCP servers, or CLI utilities for a task. Triggers: 'what tools do I have', 'is there an MCP for this', 'what's available', 'find a tool for', 'discover tooling', 'what CLI tools exist'. NOT for: documenting existing tools (use documenting-tools).

testing-strategy

5
from axiomantic/spellbook

Test selection strategy and scope guidance. Triggers: 'which tests should I run', 'test tiers', 'test marks', 'slow tests', 'integration vs unit', 'cross-module regression', 'test scope', 'what should I run', 'select tests', 'test batching'. NOT for: writing tests (use test-driven-development) or fixing broken tests (use fixing-tests).

test-driven-development

5
from axiomantic/spellbook

Use when user explicitly requests test-driven development. Triggers: 'TDD', 'write tests first', 'red green refactor', 'test-first', 'start with the test'. Also invoked by develop and executing-plans for implementation tasks. NOT for: full feature work (use develop, which includes TDD internally).

tarot-mode

5
from axiomantic/spellbook

Use when session returns mode.type='tarot', user says '/tarot', or requests roundtable dialogue with archetypes. Triggers: '/tarot', 'use tarot mode', 'roundtable with archetypes', 'tarot personas'. Session-level mode, not task-level.