Discovers business domains in Swift codebases by tracing user capabilities, maps vertical slices (Types→Config→Repo→Service→Runtime→UI), identifies providers and cross-cutting concerns to produce a domain map for restructuring.
npx claudepluginhub joshuarweaver/cascade-code-general-misc-1 --plugin pproenca-dot-skills-1This skill is limited to using the following tools:
You discover business domains by tracing what users can DO — the
Applies Acme Corporation brand guidelines including colors, fonts, layouts, and messaging to generated PowerPoint, Excel, and PDF documents.
Builds DCF models with sensitivity analysis, Monte Carlo simulations, and scenario planning for investment valuation and risk assessment.
Calculates profitability (ROE, margins), liquidity (current ratio), leverage, efficiency, and valuation (P/E, EV/EBITDA) ratios from financial statements in CSV, JSON, text, or Excel for investment analysis.
You discover business domains by tracing what users can DO — the product's capabilities — and mapping each capability to a vertical slice through the architecture.
You do NOT start from folder names, architecture docs, or file counts. You start from the product.
A domain map — the single artifact that drives everything else:
Domain Map
├── Business Domains (vertical slices the user would recognize)
│ └── Per domain: Types, Config clients, Service reducers, UI views
├── Providers (external SDK bridges)
├── Cross-Cutting Concerns (Infra, Utils)
└── Questions (ambiguous boundaries to discuss with the team)
Once the domain map is right, folder structure, SPM targets, enforcement specs, and migration plans all follow mechanically. Get the domains wrong and everything downstream is wrong.
Read references/architecture.md for the full layer spec.
Read references/architecture.als for the formally verifiable model.
Litmus test: Can you describe it to a non-engineer in one sentence?
Types → pure data definitions for this domain's nouns
Config → @DependencyClient interfaces (what you can ask for)
Repo → implementations (how it's done — API, persistence, sync)
Service → @Reducer state machines (business decisions)
Runtime → dependency wiring (Config interfaces → Repo implementations)
UI → SwiftUI views (pixels)
Not every domain needs every layer. A thin domain might only have Config + Service + UI. But Types, Config, and Service are the minimum for something to be a real domain.
Cross-domain communication happens through:
Never by importing another domain's Service or Repo.
| Thing | What it is | Where it lives |
|---|---|---|
| Error handling | Cross-cutting | Infra |
| Logging/telemetry | Cross-cutting | Infra |
| Formatters, constants | Cross-cutting | Utils |
| Sentry, Stripe SDK, APNS | Provider (SDK bridge) | Providers |
| HTTP transport, persistence engine | Shared infrastructure | Repo |
| Design system tokens | Shared UI | DesignSystem |
| Background task scheduling | Platform integration | Runtime |
Start from the entry point. Read @main, the root reducer, the tab
structure. Every child scope or tab is a candidate domain.
grep -r "@main" <project-root> --include="*.swift" -l
Read the root reducer. Trace its Scope and CombineReducers to find
every child feature. Trace the tab enum to find every top-level
capability.
For multi-app products (e.g., patient app + clinic app), do this for EACH app. The same business domain often appears in both apps with different verbs.
Every @DependencyClient is a verb — a capability the system can perform.
grep -r "@DependencyClient" <project-root> --include="*.swift" -l
Read each client file. For each client, note:
fetch, create, cancel, observe)Appointment, Treatment, Patient)Group clients by domain. This gives you the Config layer map.
The nouns are in the Types layer — the universal vocabulary.
find <project-root> -name "Package.swift" -not -path "*/.build/*"
Read Package.swift files to find the Types target. Read its source files to understand the domain language: what entities exist, what IDs are typed, what operations are defined.
For each domain discovered in Steps 1-2, trace its full vertical:
| Layer | Question | How to find it |
|---|---|---|
| Types | What nouns does this domain speak? | Grep for domain nouns in Types package |
| Config | What can you ask for? | The @DependencyClient files from Step 2 |
| Repo | How is data fetched/stored? | Grep for DataService, Repository, Store + domain nouns |
| Service | What decisions are made? | Grep for @Reducer + domain name |
| Runtime | Where is it wired? | Grep for Registration + domain name |
| UI | What does the user see? | Grep for View + domain name |
Read at least one file per layer per domain. Don't guess from names.
Providers wrap external SDKs. They're NOT domains — they're bridges.
Look for:
grep -r "import Stripe\|import Firebase\|import Sentry\|import Amplitude" <project-root> --include="*.swift" -l
What's left after domains and providers? Cross-cutting concerns:
These are importable by any domain but contain no domain knowledge.
Some things are genuinely ambiguous. Flag them as questions:
Present these as questions, not decisions. The team has context you don't.
For each domain:
### [Domain Name] — "[one-sentence description]"
**Nouns**: [Types this domain speaks — Appointment, Treatment, etc.]
**Verbs**: [Client capabilities — fetch, create, cancel, observe]
| Layer | Files/Modules | Status |
|-------|--------------|--------|
| Types | [what exists] | present / missing / partial |
| Config | [clients] | present / missing |
| Repo | [implementations] | present / missing |
| Service | [reducers] | present / missing |
| Runtime | [wiring] | present / missing |
| UI | [views] | present / missing |
**Cross-app**: Patient app: [verbs]. Clinic app: [verbs].
| Provider | SDK | Used by domains |
|----------|-----|----------------|
| Sentry | Error monitoring | All (Infra) |
| Stripe Terminal | In-person payments | Payments |
| Concern | Layer | Purpose |
|---------|-------|---------|
| AppDomainError | Infra | Error vocabulary |
| Telemetry | Infra | Monitoring |
| AccessibilityId | Utils | UI testing |
1. Is Profile a domain or part of Auth? [evidence for each]
2. Should Booking be extracted from Calendar? [evidence]
Start from the product, not the files. "What can users do?" comes before "what files exist?"
Do not classify by folder path. A file in Services/ might
be UI code. Read before classifying.
Do not read architecture docs before forming your own opinion. If harness-spec.yml or ARCHITECTURE.md exists, read it AFTER you've mapped the domains. Compare your map against theirs — disagreements are the most valuable findings.
Do not skip domains because they look similar. Each domain gets its own vertical trace. Auth is not Profile.
Use subagents for codebases with >200 files. One agent per domain, each traces the full vertical. This prevents shortcuts from context pressure.
Flag ambiguities instead of deciding. You lack the team's context. Present evidence for both sides. Let the team decide.
@DependencyClient found and assigned to a domain@Reducer found and assigned to a domain