mikeparcewski/wicked-garden / skills/domain-modeler
wicked-garden-domain-modeler
VerifiedDomain-graph worker for the modernize archetype. Proposes the repository's BUSINESS domains (3 to 9 areas named for what the code does for its users, each with a one-line purpose and the code that shows it) and assigns each rule one with a confidence. Groups estate's Louvain communities as advisory provenance, invokes wicked-core's domain-graph build (reads the annotated store, recomputes coverage, fail-closed below the configured minimum), then validates core's output against the vendored schema. Use when: dispatched by wicked-garden-domain after rule extraction; when a domain-extraction worklist asks for the repository's business domains; "what are this repo's business areas", "group these into domains", "build the requirements graph", "translate clusters into a domain model". NOT for mining the rules themselves (that is domain-extractor) or threat-modeling (that is domain-coverage).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.0 KB |
SKILL.md
View on GitHub---
name: wicked-garden-domain-modeler
description: |
Domain-graph worker for the modernize archetype. Proposes the repository's
BUSINESS domains (3 to 9 areas named for what the code does for its users, each
with a one-line purpose and the code that shows it) and assigns each rule one
with a confidence. Groups estate's Louvain communities as advisory provenance,
invokes wicked-core's domain-graph build (reads the annotated store, recomputes
coverage, fail-closed below the configured minimum), then validates core's
output against the vendored schema.
Use when: dispatched by wicked-garden-domain after rule extraction; when a
domain-extraction worklist asks for the repository's business domains; "what
are this repo's business areas", "group these into domains", "build the
requirements graph", "translate clusters into a domain model".
NOT for mining the rules themselves (that is domain-extractor) or
threat-modeling (that is domain-coverage).
metadata:
role: worker
---
# Domain Modeler
You turn a **flat set of extracted rules** into a **cluster-keyed domain model**
and invoke core's domain-graph build to produce the requirements graph. Your
grouping is *derived from* estate's Louvain communities, not hand-partitioned.
## Contract you emit against
Same vendored domain-model schema as the extractor (`1.1.0`; `1.0.0` documents
stay valid). Your `domains{}`
grouping — each domain groups the requirements whose components fall in one estate
community, carries an advisory `cluster_id` (the Louvain index), and declares its
`entities{}` — is **advisory provenance**. The authoritative requirements graph is
**built by core** from the annotated store, and core keys its domains by package
directory (the parent directory of each behaviour's file; it sets no `cluster_id`),
because dense modern code collapses into one community. That key is not the business
domain: each requirement also carries the business domain its rule picked
(`business_domain`), and the model lists them (`metadata.business_domains`), from the
"Business domains" catalog below. You **invoke core**, you
don't reimplement it.
## Business domains (propose, then assign)
A requirement's directory is not its domain: `backend/integrations/oauth` is where the code
lives, "Credential management" is what it does for the product's users. Package-directory
domains fit a product owner's view on about half of the rows measured, so the repository gets a
small catalog of business areas, and every rule picks one. The directory is evidence, never the
name.
**Propose** (once per repository: a domain-extraction worklist says
`business_domains.propose: true`; a stored catalog is never replaced, so pick from
`business_domains.catalog` when it is there):
1. Read the code for what the product does for its users, not how it is laid out: entry points
(`main`, CLI commands and their verbs, workers and schedulers), HTTP or RPC routes and their
handlers, the nouns in public APIs and data models, and what the README or docs say the
product is for.
Cover every entry-point group the code shows, including scheduled and housekeeping jobs
(cron/scheduler jobs, maintenance, notices).
2. Propose **3 to 9** domains. Each is `{"id": "<lowercase-slug>", "name": "<2 to 5 words>",
"purpose": "<one line: what this area does for its users>", "evidence": [...]}`. Name the
area a product owner would recognise ("Credential management", "Workflow scheduling",
"Usage billing"), never a directory, package, module or class name (the host refuses a name
that is a directory name in this repository: the worklist's `business_domains.directory_names`).
Prefer fewer, broader areas over many thin ones; one area per user-facing capability.
3. Ground every domain in code. `evidence` lists 1 to 8 items `{"kind": "entry-point" | "route" |
"cli-verb" | "api-noun" | "directory", "file": "<repo-relative path>", "symbol": "<optional
name in that file>", "text": "<optional: the route or verb, as it appears in the file>"}`.
Every item other than a directory names a product-code file (not a test, data or document
file) and a `symbol` or `text` in it, and every domain names at least one symbol. The host
checks each file is tracked by git, each symbol is in the code graph at that file and each
text occurs in the file. An item the code does not show is dropped, and a domain left with
no symbol the graph holds is dropped. The catalog is refused only when fewer than 3 domains
remain. The seat's `--check-rules` names a bad file or text first. The page's review then
judges whether that code is really the area's.
**Assign** each rule one domain with a confidence in [0,1]: the area the rule serves, judged
from what the rule does for the product's users, with the file's directory as one piece of
evidence. High (0.8 or more) when the rule plainly serves that area; lower when two areas
compete. A multi-purpose module's symbols can land in different domains. When no area fits,
leave the rule without a domain rather than forcing one.
In a domain-extraction run all of this goes into the rules file the extractor writes
(`.wicked/domain/rules.json`): the catalog as its top-level `business_domains` list (only when
proposing), each rule entry's `"domain": "<id>"` and `"domain_confidence": <0..1>`, and, for the
worklist's `assign` list (requirements an earlier page resolved before there was a catalog), a
top-level `"assignments": [{"symbol_id": "<verbatim>", "domain": "<id>", "confidence": <0..1>}]`.
The host's apply step stores the catalog beside the code graph and writes each pick on its code
node; `wicked-core domain-graph` reads it into each requirement's `business_domain`. Requirement
keys (`<directory>::REQ-NNN`) do not change, so existing links, overrides and citations hold.
## The loop
1. **Read clusters from estate** — the full-membership feed
`clusters --json --summary` → `[{id, size, members:[symbol_id], …}]`, via
`estate_client(db).read_clusters()` (CLI) or `_mocks.EstateClient` (hermetic).
On the real path this is **informational** (core builds the authoritative
domains itself when it builds the graph); the id is a volatile positional index, so
key durable grouping on a hash of the sorted member set, not the raw id (record
the raw id only as advisory `cluster_id`).
2. **Assign each requirement to a domain** by the community its
`legacy_components[]` SymbolIds belong to (advisory grouping / provenance for
the coverage evaluator). A requirement whose components span communities goes to the
dominant one; note the split.
3. **Invoke core's domain-graph build.** `core_client().domain_graph(db, out)`
shells `wicked-core domain-graph --db <db> --out requirements_graph.json`,
which **reads the annotated store**, recomputes front-half coverage, and saves
the requirements graph **into the estate store** (domain, requirement and
business-rule nodes, `SatisfiedBy` edges to code — the source of truth crew
reads); `--out` also writes it as the `requirements_graph.json` export this
step validates (a capability plan, not a code skeleton). It **fails
closed below the configured minimum** (writes nothing, non-zero exit, and says
"N% real requirements, minimum M% (…)") — real requirements (behaviours with a
business rule at or above the confidence threshold, or a validated requirement;
placeholders never count) must reach at least that share of the behaviours in
product code (the repository's own minimum, else
`WICKED_REQUIREMENTS_MIN_COVERAGE_PCT`, which crew exports from its
`requirementsGraph.minCoveragePct`, else 80). There is
**no doc handed in and no `--overlay`**: the store is the input. When
`core_client()` is `None` (no peer), fall back to the hermetic lane —
`emit_domain_model.py` assembles the doc and `_mocks.BrainClient` stands in.
4. **Validate core's output.** Cross-check the built `requirements_graph.json`
with `scripts/domain/validate_domain_model.py` (schema + hard invariants)
before returning.
## Invariants you must not break
- `domains` is required; every domain has `requirements` **and** `entities`.
- `cluster_id` is **advisory provenance only** — never authoritative. estate is
the sole owner of graph structure; you reference it.
- No silent drop: a requirement dropped from a domain needs `disposition:"drop"`
**and** a `disposition_reason`, or it counts against coverage.
- `metadata.migration_mode ∈ {structural, functional}` — `functional`
(capability-grouped) is the default; `structural` is 1:1.
## What is wired vs stubbed
The estate `clusters` read and core's `domain-graph` build are **wired to the
live CLIs** via `scripts/domain/_clients.py` (`estate_client` / `core_client`),
falling back to `_mocks.py` when the peers are absent. The grouping heuristic
(community → domain) and the schema validation are real. A real build
additionally needs an INDEXED store whose real requirements reach the configured
minimum; a crew `domain-extraction` run maps it there, not this worker. Full field map:
the `wicked-garden-domain` skill's `refs/domain-model-emit.md`.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |