
Domain First Architecture Delphi
- 16 installs
- Updated January 1, 1970
- cygnusfear/agent-skills
Refactors component-based code toward domain ownership when responsibility is split across technical buckets, fixing god files and hidden dependency flow.
About
Domain-first-architecture-delphi is a Claude Code skill for when a codebase feels component-based but ownership is scattered across technical buckets like tables, init, and debug - producing god files, duplicate paths, and hidden dependency flow. A solo builder uses it to restructure the code around domains so ownership and dependencies become clear.
- Shifts to domain-first ownership
- Breaks up god files
- Untangles hidden dependency flow
Domain First Architecture Delphi by the numbers
- 16 all-time installs (skills.sh)
- Ranked #10,994 of 16,556 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/cygnusfear/agent-skills --skill domain-first-architecture-delphiAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 16 |
|---|---|
| Last updated | January 1, 1970 |
| Repository | cygnusfear/agent-skills ↗ |
What it does
Refactors component-based code toward domain ownership when responsibility is split across technical buckets, fixing god files and hidden dependency flow.
Who is it for?
Restructuring scattered ownership
Skip if: Greenfield projects
Files
Domain-First Architecture Delphi
Overview
Use Delphi to expose one specific structural failure: the code claims domain modeling, but ownership is organized by technical buckets (all tables together, all init together, all debug together).
This skill does not ask “what files are big?” It asks: 1. What is the canonical path per concept? 2. Where are alternate paths? 3. Which alternates are duplicates vs diverged behavior? 4. What is the minimum replace→wire→delete sequence?
REQUIRED SUB-SKILL: delphi
---
Use This Skill When
Use when 2+ are true:
- A single file defines many domains (or 1000+ lines with unrelated ownership).
- Init logic for multiple domains is fused into one orchestration block.
- Adding one domain feature touches 4+ files across 3+ directories.
- You see repeated “must match X in Y” comments.
- You suspect multiple sources of truth for one concept.
- You need ticketable seams, not generic “refactor” advice.
Do not use for style cleanup, naming cleanup, or lint-only reviews.
---
Required Artifacts (Non-Negotiable)
Every run must produce these artifacts.
1) Concept Inventory
| Concept | Canonical Path | Alternate Paths Found | Divergence Type | Evidence |
|---|
Divergence types:
DUP_PATH— copy of same logicDIVERGENT_PATH— same concept with behavior driftMULTI_SOURCE— multiple sources of truthLAYER_MISMATCH— ownership split by layer bucketHIDDEN_DAG— init dependency exists but not explicit
2) Architectural Mismatch Matrix
| Domain | Schema Owner | Init Owner | Runtime Owner | Debug Owner | Files Touched for One Change | Mismatch | Severity |
|---|
3) Init Dependency DAG (with payloads)
Must include data carried by each edge, not just control flow.
Example:
spawn_planets -> planet_entity_ids
planet_entity_ids -> seed_markets
planet_entity_ids -> spawn_npcs4) Replace→Wire→Delete Map (per finding)
Replace: old_fn_a, old_fn_b
Wire: callers X/Y/Z -> canonical_fn
Delete: old_fn_a, old_fn_b after verificationNo map = no actionable finding.
---
Process
Phase 0 — RED Baseline (Before Guidance)
Run 3 workers without this skill prompt. Force scenario tasks: 1. Planet feature change crossing map+zone+market 2. Ship/module change crossing spawn+tactics+loot 3. NPC debug command + trace change
Record:
- Files touched
- Dirs touched
- Cross-layer hops
- Worker rationalizations (verbatim)
Phase 1 — Parallel Delphi Lenses
Run 5 workers in parallel using worker-prompts.md:
- Domain ownership mismatch
- Change-coupling / friction
- Init DAG extraction
- False-constraint audit (framework myths vs real constraints)
- Safe seam extraction
Phase 2 — Synthesis
Merge findings into the 4 required artifacts. Reject any finding lacking file/symbol evidence.
Phase 3 — Ticketization
Create: 1. One synthesis ticket 2. One ticket per P0/P1 finding
Each ticket must contain:
- Goal
- Exact seam boundary
- First move-only step
- Acceptance criteria
- Verification commands
- Dependencies
---
Scoring Rules
Per finding:
- Severity:
P0 | P1 | P2 - Friction score:
files_touched + (dirs_touched * 2) + (cross_layer_hops * 3) - Blast radius:
low | medium | high - Confidence:
high | medium | low - Evidence:
file + symbol + line range
If score or evidence is missing, drop the finding.
---
Guardrails
- Do not propose “lint rules” as primary solution for semantic duplication.
- Do not substitute PR process templates for architectural detection.
- Do not open with monolithic rewrites.
- Start with move-only splits + re-exports, then extraction, then behavior changes.
- Re-run concept inventory after each stage and compare deltas.
Success means alternate paths shrink and divergence labels resolve.
Worker Prompts — Domain-First Architecture Delphi
Use these prompts verbatim. Fill placeholders in {braces}.
---
Worker 1 — Domain Ownership Mismatch
You are analyzing architectural ownership mismatch.
Scope: {scope_paths} Primary domains: {domains}
Task: 1. For each domain, identify owner files for:
- schema/table definitions
- initialization/seed logic
- runtime logic
- debug/reducer logic
2. Flag domains where ownership is split across technical buckets with no deliberate boundary. 3. Produce Architectural Mismatch Matrix rows with evidence.
Output format:
- One row per domain:
Domain | Schema Owner | Init Owner | Runtime Owner | Debug Owner | Files touched for one change | Mismatch | Severity | Evidence
- Include exact file + symbol + line ranges.
Reject vague findings.
---
Worker 2 — Change-Coupling / Friction
You are analyzing change-coupling.
Scope: {scope_paths} Scenarios:
{scenario_1}{scenario_2}{scenario_3}
Task: 1. For each scenario, simulate implementation and list touched files + dirs. 2. Count cross-layer hops (schema ↔ init ↔ runtime ↔ debug). 3. Compute friction score: files_touched + (dirs_touched * 2) + (cross_layer_hops * 3) 4. Identify recurring bundles that always move together.
Output format:
- Scenario table with file list, dir list, hops, friction score
- Recurring coupling groups with evidence
- Severity suggestion per group
---
Worker 3 — Init Dependency DAG (Hidden Flow)
You are extracting initialization dependencies.
Scope: {init_files}
Task: 1. Build explicit DAG for init/seed flow. 2. For every edge, include payload (what data is passed). 3. Mark hidden dependencies currently encoded implicitly in long functions. 4. Label hidden edges as HIDDEN_DAG.
Output format:
- DAG edges in text form:
producer_fn -> payload -> consumer_fn
- Hidden dependency list with file/symbol/line evidence
- Suggested function boundaries to expose edges clearly
---
Worker 4 — False Constraint Audit
You are auditing architectural assumptions.
Scope: {scope_paths} Framework constraints: {framework_constraints}
Task: 1. List assumptions currently driving layout decisions. 2. Validate each assumption with concrete evidence from framework behavior/docs/code. 3. Split into:
- Real constraints
- False constraints (myths)
4. For each false constraint, propose safer structure unlocked by disproving it.
Output format:
- Assumption table:
Assumption | Real/False | Evidence | Refactor unlocked
- Confidence per assumption
---
Worker 5 — Safe Seam Extraction Plan
You are generating execution seams.
Scope: {scope_paths} Input findings: Concept inventory + mismatch matrix + DAG
Task: 1. Identify move-only seams (no behavior change). 2. For each seam produce Replace→Wire→Delete map:
- Replace: what old symbols/functions are superseded
- Wire: exactly which callers switch first
- Delete: what is removed only after verification
3. Order seams from lowest blast radius to highest.
Output format:
- Ordered seam plan (S1, S2, S3...)
- For each seam:
- Goal
- Files
- Replace→Wire→Delete
- Verification commands
- Risk
No monolithic rewrites.
---
Synthesis Prompt
You are the synthesis worker for domain-first architecture delphi.
Input: outputs from workers 1–5.
Produce: 1. Concept Inventory (canonical vs alternates) 2. Architectural Mismatch Matrix 3. Init Dependency DAG (payload edges) 4. Prioritized P0/P1 findings with scores 5. Replace→Wire→Delete plan per finding 6. Ticket-ready decomposition (epic + child tasks)
Rules:
- Drop findings without evidence.
- Drop findings without clear seam.
- Prefer smallest safe move first.
- Call out unresolved decisions explicitly.