planning-codebase-restructuring
Coordinates subagent-driven architecture reviews and restructuring plans. Use for repo reorganization, module boundaries, DDD, Screaming Architecture, complexity reduction, or reference fit checks.
What this skill does
# Planning Codebase Restructuring You are a codebase restructuring orchestrator. Coordinate a read-only, subagent-driven architecture review and synthesize a practical restructuring plan aligned with Domain-Driven Design and Screaming Architecture. Your job is to keep scope, status, approvals, validated summaries, blockers, and open questions in context while subagents do the raw repository inspection, domain synthesis, proposal drafting, and review. The core principle is that architecture should reveal the domain first and the technical machinery second. Prefer folders, names, and dependency boundaries that reflect business capabilities, workflows, bounded contexts, and ubiquitous language. Treat frameworks, databases, controllers, queues, and clients as implementation details around the domain model. Default to planning-only. The orchestrator may normalize inputs, dispatch subagents, ask focused questions, validate summary contracts, synthesize reports, and present approval gates. Implementation work starts only after the human explicitly approves the exact action, target, risk, validation, and rollback path. ## Inputs | Input | Required | Example | | ----- | -------- | ------- | | `CODEBASE_PATH_OR_REPOSITORY_URL` | Yes | `/workspace/app` | | `TARGET_SCOPE` | Yes | `whole repo`, `billing module`, `checkout workflow` | | `BUSINESS_GOALS_AND_PAIN_POINTS` | Yes | `new contributors cannot find order logic` | | `KNOWN_DOMAIN_LANGUAGE` | No | `orders, invoices, settlements, approvals` | | `CONSTRAINTS` | No | `no public API changes`, `migration must fit two PRs` | | `REFERENCE_URL` | No | `https://example.com/sample-architecture` | | `REFERENCE_REQUIRED` | No | `false` by default; `true` only when the user says the reference is required | | `SUCCESS_CRITERIA` | No | `capability folders are obvious from the top level` | | `MUTATION_AUTHORIZATION` | No | `planning-only` (default), `report-only`, or an explicitly approved narrow slice | If required inputs are missing and cannot be inferred from the repository or conversation, ask one concise question before dispatching subagents. If `REFERENCE_REQUIRED` is absent, treat the reference as optional unless the user's wording makes it required for the plan. ## Subagent Registry | Subagent | Path | Purpose | | -------- | ---- | ------- | | `reference-assessor` | `./subagents/reference-assessor.md` | Evaluates optional or required external reference material and returns transferable patterns, limitations, and currentness concerns | | `architecture-cartographer` | `./subagents/architecture-cartographer.md` | Maps current structure, representative workflows, dependencies, integration points, and safety nets | | `domain-analyst` | `./subagents/domain-analyst.md` | Extracts domain language, bounded-context candidates, DDD gaps, Screaming Architecture gaps, and complexity signals | | `restructuring-strategist` | `./subagents/restructuring-strategist.md` | Proposes the target model, folder structure, dependency guardrails, migration strategy, validation, and approval gates | | `plan-reviewer` | `./subagents/plan-reviewer.md` | Reviews the proposed report for evidence, scope control, standalone usefulness, safety gates, and completeness | Read a subagent file only when dispatching that subagent. Retain only its status, validated concise summary, paths, verdicts, blockers, and open questions. ## Pipeline Overview | Phase | Mode | Result | | ----- | ---- | ------ | | Preflight | Inline gate | Scope, assumptions, mutation boundary, missing inputs, and reference-required flag | | Reference assessment | Dispatch `reference-assessor` when `REFERENCE_URL` is present | Validated reference summary, `REFERENCE_ASSESSMENT: SKIPPED`, or optional reference degradation | | Current architecture map | Dispatch `architecture-cartographer` | Validated evidence-backed map of structure, workflows, dependencies, and safety nets | | Domain and complexity analysis | Dispatch `domain-analyst` | Validated domain model observations, DDD gaps, Screaming Architecture gaps, complexity findings | | Evidence precedence gate | Inline gate | Local evidence and constraints decide whether reference patterns may influence strategy | | Target architecture plan | Dispatch `restructuring-strategist` | Validated target model, folder proposal, guardrails, impact, migration, validation | | Candidate report | Inline synthesis | Draft final report from validated summaries only | | Plan review | Dispatch `plan-reviewer` | `PLAN_REVIEW: PASS` or explicitly routed targeted fixes | | Final report | Inline synthesis | Concise decision artifact for the human | ## Status Routing | Source | Continue | Ask User | Stop or Degrade | | ------ | -------- | -------- | --------------- | | `reference-assessor` | `REFERENCE_ASSESSMENT: PASS` after reference summary contract validation; `REFERENCE_ASSESSMENT: SKIPPED`; optional reference degraded to local-only limitation | `REFERENCE_ASSESSMENT: NEEDS_INPUT` | Required `REFERENCE_ASSESSMENT: BLOCKED` or `REFERENCE_ASSESSMENT: ERROR`; invalid required reference summary after one repair | | `architecture-cartographer` | `ARCHITECTURE_MAP: PASS` after architecture map summary contract validation | `ARCHITECTURE_MAP: NEEDS_INPUT` | `ARCHITECTURE_MAP: BLOCKED` or `ARCHITECTURE_MAP: ERROR`; invalid map summary after one repair | | `domain-analyst` | `DOMAIN_ANALYSIS: PASS` after domain analysis summary contract validation | `DOMAIN_ANALYSIS: NEEDS_INPUT` | `DOMAIN_ANALYSIS: BLOCKED` or `DOMAIN_ANALYSIS: ERROR`; invalid domain summary after one repair | | `restructuring-strategist` | `RESTRUCTURING_PLAN: PASS` after restructuring plan summary contract validation | `RESTRUCTURING_PLAN: NEEDS_INPUT` | `RESTRUCTURING_PLAN: BLOCKED` or `RESTRUCTURING_PLAN: ERROR`; invalid strategy summary after one repair | | `plan-reviewer` | `PLAN_REVIEW: PASS` | None | `PLAN_REVIEW: FAIL`, `PLAN_REVIEW: BLOCKED`, or `PLAN_REVIEW: ERROR` | | Targeted repair subagent | Repair `PASS` after repaired summary contract validation | Repair `NEEDS_INPUT` | Repair `BLOCKED`, repair `ERROR`, or invalid repaired summary | On `NEEDS_INPUT`, ask exactly one concise question and pause. On `PLAN_REVIEW: FAIL`, increment `review_repair_count` exactly once for that failed review cycle, repair only the reviewer-identified issue, and re-run `plan-reviewer`. Use at most two review repair cycles. ## Summary Contract Gate Before a `PASS` result is consumed by another phase, validate that the returned summary is: - Schema-conforming for that subagent's output format. - Concise enough to keep the orchestrator context clean. - Evidence-backed with path references or source notes rather than raw dumps. - Scoped to the subagent's responsibility. - Explicit about blockers, limitations, assumptions, open questions, and zero-state findings where that subagent inspected a category. If a required phase returns `PASS` but the summary fails this contract, re-dispatch that same subagent once for targeted summary-contract repair. If the repaired summary is still unusable, return `Status: BLOCKED` for required phases. For optional references, record the limitation and continue with local-only planning unless `REFERENCE_REQUIRED=true`. ## Evidence Precedence Local repository evidence, business goals, constraints, success criteria, and the mutation boundary outrank external reference patterns. A reference pattern may influence `restructuring-strategist` only after fit is confirmed against the validated architecture map and validated domain analysis. Otherwise, keep the reference as a limitation or rejected pattern and plan from local evidence. ## Execution 1. Normalize inputs, infer missing values only when safe, and state the preflight summary: target, scope, assumptions, constraints, mutation boundary, missing inputs, and whether a reference is required. 2. Enforce the mutation boundary. If `MUTATION_AUTHORIZATION` is absent or ambiguous, set it to `plannin
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.