/han-ddd:ddd-analysis [size: small | medium | large] [focus area: module or directory to restrict analysis to]from han-ddd
Discovers bounded contexts, ubiquitous language, and semantic collisions via strategic DDD. Produces an evidence-backed domain and context map for a full repo or specified module.
Ships in han-ddd. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
which git 2>/dev/null || echo "not installed"find . -maxdepth 1 -name "CLAUDE.md" -type ffind . -maxdepth 3 -name "project-discovery.md" -type fbash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"cat .han/config.md 2>/dev/null || echo ""As your first action, use the Read tool on .han/config.md inside the personal config directory path above. A
read that returns no file is no personal configuration: continue silently. When that file or the
project .han/config.md probe supplies content, apply it per
config-rule.md, which governs precedence between the two files, relative-path
resolution, and what to do with a file that reads but cannot be used.
Read these before dispatching anything. They constrain every step below.
han-planning:plan-a-feature (to
specify a change) or han-coding:architectural-analysis (for a code-level view of a specific module). The
context model informs those steps; it does not replace them.han-communication:readability-guidance and applies the shared standard, holding one audience above the
writing: the engineer or product manager reading the context model and deciding what to do next.Bind $size. If the user passed small, medium, or large as the first positional argument, bind $size
to it. If $size is none provided and the project config supplies a default-swarm-size value via
config-rule.md, adopt that value as $size and note the config as the source. If no value is available from
either source, set $size to medium.
Resolve the focus area. Take the remaining argument and conversation context as the focus area. If a focus area was supplied, confirm it resolves to real files using Glob and Read. If it does not resolve to actual files, stop and ask the user to clarify before proceeding. If no focus area was supplied, the scope is the entire repository — do not ask for one.
Resolve project context. If CLAUDE.md is present (see Project Context), read its ## Project Discovery
section for language, framework, and convention signals. Fall back to project-discovery.md if present. If neither
exists, discovery agents will infer from surrounding code — note this in every agent brief.
Note git availability. Read the git installed value from Project Context. If it is empty or reads
not installed, git is unavailable: note this in the agent briefs and in the report.
State the driving concern, if any. If the user named a concern ("I think billing and subscriptions overlap", "we need to understand where auth ends and identity begins"), capture it. Pass it to each discovery agent as a directing note — it biases attention without narrowing scope.
Resolve the run folder. Determine where this run's artifacts will land before dispatching any agent:
output-directory: When the config read above supplied an output-directory, resolve it per
config-rule.md (relative path resolves against the file that declared it;
~/ expands to home; full path is used as-is). Write the run folder beneath that resolved base.${TMPDIR:-/tmp} as the base. This keeps an
unconfigured analysis out of version control, matching the same principle that governs code-overview.Run date +%Y%m%d-%H%M%S via Bash to obtain a timestamp suffix. Name the run folder ddd-analysis-{timestamp}
inside the resolved base. If that directory already exists, check for -2, -3 suffixes until the name is free.
Run mkdir -p {run_folder}/discovery {run_folder}/synthesis to create the full directory tree. Set $run_folder
to the absolute resolved path — this value threads through every subsequent step.
If the resolved base cannot be written (permission error, path does not exist), fall back to
${TMPDIR:-/tmp}/ddd-analysis-{timestamp} and record the failed path so Step 12 can name it.
Survey the repository structure within the resolved scope. Use Bash and Glob to identify:
find {scope} -maxdepth 2 -type d | head -60)main.*, index.*, app.*, server.*, cli.*, or bootstrap.*model, models, entity, entities, schema, schemas,
migration, migrations, repository, repositoriesroutes, controllers, handlers, api, endpoints,
resolvers, clients, adapters, connectors, external, integrationsjob, worker, task, queue, consumer,
subscriber, event, EventRecord the inventory as a compact list of paths — this is context for later briefs, not a finding.
For large repositories: If the resolved scope is the entire repository and the top-level source tree contains
more than ten distinct application areas by directory, identify 3-5 meaningful partitions based on the directory
structure and names (for example: billing, fulfillment, identity). Include these partitions in the
han-core:structural-analyst and han-core:behavioral-analyst briefs in Step 4 to keep those analyses
tractable. These partitions are not context candidates and must not be named as such.
Depth bands control the calibration directive passed to the discovery agents. They do not change which agents are dispatched; this skill always dispatches exactly five discovery agents.
Announce in one line before dispatching:
Scope: {entire repository | focus area path}. Depth: {small | medium | large}. Dispatching
han-ddd:domain-language-analyst,han-ddd:business-capability-analyst,han-ddd:domain-ownership-analyst,han-core:structural-analyst, andhan-core:behavioral-analystin parallel. Git {available | unavailable}.
State any driving concern the user supplied. Proceed without a blocking confirmation — this analysis is read-only and re-runnable.
Dispatch all five agents with concurrent Agent calls. Each agent reads the codebase independently.
Brief for han-ddd:domain-language-analyst:
DL1, DL2, … exactly.$run_folder/discovery/domain-language.md and return only the path
written, the total DL# count, and a two-sentence summary of the highest-value signals.Brief for han-ddd:business-capability-analyst:
CAP1, CAP2, … exactly.$run_folder/discovery/business-capabilities.md and return only the
path written, the total CAP# count, and a two-sentence summary of the strongest behavioral signals.Brief for han-ddd:domain-ownership-analyst:
OWN1, OWN2, … exactly.$run_folder/discovery/domain-ownership.md and return only the path
written, the total OWN# count, and a two-sentence summary of the most significant authority signals.Brief for han-core:structural-analyst:
S1, S2, … exactly.Brief for han-core:behavioral-analyst:
B1, B2, … exactly.Wait for all five agents to return before proceeding.
The three han-ddd discovery agents have written their own artifacts and returned the paths. Use the Read tool to confirm each reported path exists. If an artifact is absent, note the shortfall — the skill continues without it, but Step 12 must name the missing file.
The han-core agents do not write their own artifacts. Write their verbatim returned output now:
$run_folder/discovery/structural.md using the
Write tool. Preserve every S# finding and its prefix exactly, including any "no findings" statements.$run_folder/discovery/behavioral.md using the
Write tool. Preserve every B# finding and its prefix exactly, including any "no findings" statements.The five discovery artifacts are now stable at:
$run_folder/discovery/domain-language.md$run_folder/discovery/business-capabilities.md$run_folder/discovery/domain-ownership.md$run_folder/discovery/structural.md$run_folder/discovery/behavioral.mdDo not carry their contents transiently in context. All downstream stages read from these paths directly.
Dispatch han-ddd:bounded-context-modeler with one Agent call. The brief must contain:
$run_folder/synthesis/context-model-initial.md and return only the path written, the BCM# count
by status, and the Bounded Context Model Summary.Wait for the modeler to return. Capture the reported path as $context_model_initial. Use Read to verify the file
was written. This is the first-pass model.
Dispatch han-ddd:bounded-context-critic with one Agent call. The brief must contain:
$context_model_initial. Instruct the agent to read this file with the Read tool before evaluating.$run_folder/synthesis/critique.md and return only the path written, the BCR# count with verdict
distribution, and the Bounded Context Model Critique Summary.Wait for the critic to return. Capture the reported path as $critique. Use Read to verify the file was written.
Dispatch han-ddd:bounded-context-modeler a second time with one Agent call. This is the final and only
revision pass. The brief must contain:
$context_model_initial. Instruct the agent to read this file with the Read tool.$critique. Instruct the agent to read this file with the Read tool.$run_folder/synthesis/context-model-final.md and return only the path written and a brief
revision summary (what changed from the first pass and why).Wait for the modeler to return. Capture the reported path as $context_model_final. Use Read to verify the file
was written. The revision loop is now closed — do not dispatch the modeler or critic again.
Before rendering the report, run a deterministic cross-reference check on the final context model. This step uses Read and Grep only — no new agent is dispatched.
$context_model_final. Extract every evidence identifier cited in BCM# entries and DC# entries — all
DL#, CAP#, OWN#, S#, and B# references appearing in Evidence fields.$run_folder/discovery/domain-language.md$run_folder/discovery/business-capabilities.md$run_folder/discovery/domain-ownership.md$run_folder/discovery/structural.md$run_folder/discovery/behavioral.mdRead $context_model_final to load the final BCM# model before rendering. Read
references/ddd-analysis-report-template.md. Render it into the
report draft. Render rules:
$context_model_final sorted by status; Boundary Problems from BCR# failure modes in
$critique and OWN# contestation findings; Context Map from BCM# relationship fields where evidence exists;
Context Details by expanding each CURRENT and LATENT BCM# entry's fields verbatim from $context_model_final;
Rejected or Weak Candidates from BCR# weak and reject verdicts; Questions for Domain Experts consolidated and
deduplicated from BCR# domain-expert questions.$run_folder/synthesis/ddd-analysis.md; omit the intermediate critique from this section). For each:
filename, absolute path, and finding type with count from the agents' return summaries.Readability. Invoke han-communication:readability-guidance to surface the shared readability standard into
your context. Apply it to every synthesized section as you write: main point first, descriptive headings, one
idea per paragraph, and progressive disclosure. The finding IDs (BCM#, BCR#, DL#, CAP#, OWN#, S#, B#) and
file-path references are citation identifiers; they survive any rewrite and self-check unchanged.
Dispatch han-communication:readability-editor with one Agent call to audit and rewrite the report draft
against the shared readability standard. Pass it the draft report text and the named audience: the engineer or
product manager reading the context model and deciding what to do next; the editor reads han-communication's own
canonical rule, so pass no rule path. It preserves every fact and edits prose regions only — never inside
code fences, diagram bodies, or finding-ID and file-path citation identifiers. Scope its rewrite to all
synthesized prose sections — Executive Summary, Domain Landscape, Ubiquitous Language, Business Capabilities,
the overview paragraphs in Current/Latent/Speculative sections, Boundary Problems, Rejected or Weak Candidates,
Questions for Domain Experts, and Evidence / Analysis Artifacts. Leave Context Details unchanged (it carries BCM#
field values directly) and do not edit within the Context Map Mermaid block. Apply its rewrite.
Run the standardized readability self-check (the shared standard is in your context from the
readability-guidance invocation in Step 9) over the report's prose regions only — never inside code fences,
diagram bodies, or finding-ID / file-path citation identifiers. Confirm each criterion and correct any failure
before presenting:
After the readability rewrite and self-check, verify that the rendered report contains every entry from the canonical final model. This step uses Read and Grep only — no new agent is dispatched.
$context_model_final. Extract the canonical registry:
$context_model_final and replacing the defective section text before presenting. This is a
hard gate: do not present the report until set equality holds.Unlike the soft gate in Step 8.5, this check must block presentation until resolved. An entry dropped during readability editing is a correctness failure, not a style issue.
Write the rendered report to disk. Use the Write tool to write the complete rendered report to
$run_folder/synthesis/ddd-analysis.md. This persists the reader-facing report as a stable artifact and
provides the domain visualizer with the consolidated Questions for Domain Experts section.
Create the visuals directory. Run mkdir -p $run_folder/visuals via Bash.
Dispatch han-ddd:domain-visualizer with one Agent call. The brief must contain:
$run_folder/synthesis/ddd-analysis.md — the rendered report$context_model_final — the canonical context model$critique — the BCR# evaluations and domain-expert questions$run_folder/discovery/domain-language.md$run_folder/discovery/business-capabilities.md$run_folder/discovery/domain-ownership.md$run_folder/discovery/structural.md$run_folder/discovery/behavioral.md$run_folder/visuals/.Wait for the visualizer to return. On success, capture:
$visual_paths: the list of generated artifact paths$visual_types: the list of generated visual types$visual_skips: any visuals that were skipped and the reasonFailure handling. If the visualizer fails or returns an error, record the failure message as
$visual_failure. Do not invalidate the DDD model or the rendered report. Proceed to Step 13 either way.
Visual-generation failure must never affect the underlying DDD model's validity.
Present the rendered report directly in the conversation. Close by telling the user, in a short message:
$run_folder (or the fallback path if the configured destination failed,
naming which path failed and which fallback was used instead).$run_folder/visuals/ path. When generation failed, note the failure and that the DDD model is unaffected.han-coding:architectural-analysis to examine a named module's code-level structure, or
a narrower /ddd-analysis restricted to a single focus area. If the team has gathered domain-expert input
on the open questions above and wants to specify next steps for a confirmed boundary,
han-planning:plan-a-feature starts that conversation. If the contexts raise cross-service or integration
questions, han-core:system-architect provides a topology read after the team has confirmed which boundaries
are real. Do not assert that any boundary violation can or should be fixed, prescribe a correction, or
recommend extraction, refactoring, or migration in this closing message.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub testdouble/han --plugin han-dddOther plugins' skills for the same job