From claude-tweaks
Use when you want an architectural-depth pass on recently changed code — finds shallow modules (interface nearly as complex as implementation) and proposes deepening or collapsing them, ranked by leverage. Catches architecture entropy that line-level simplification misses. Works standalone or surfaced as a Next Action by /claude-tweaks:review and /claude-tweaks:reflect.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-tweaks:deepenThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> **Interaction style:** Present decisions as numbered options so the user can reply with just a number. For multi-item decisions, present a table with recommended actions and offer "apply all / override." Never present more than one batch decision table per message — resolve each before showing the next. End skills with a Next Actions block (context-specific numbered options with one recommend...
Interaction style: Present decisions as numbered options so the user can reply with just a number. For multi-item decisions, present a table with recommended actions and offer "apply all / override." Never present more than one batch decision table per message — resolve each before showing the next. End skills with a Next Actions block (context-specific numbered options with one recommended), not a navigation menu.
Find shallow modules and make them deeper. /claude-tweaks:simplify cleans up within files (verbose patterns, dead code, line-level complexity); /claude-tweaks:deepen works at the module level — it asks whether each abstraction earns its keep, and proposes deepening the ones that leak or collapsing the ones that only move complexity around. Architecture entropy is the silent tax on AI-assisted development; this is the pass that catches it. Part of the workflow lifecycle:
/claude-tweaks:build → /claude-tweaks:test → /claude-tweaks:review → /claude-tweaks:wrap-up
│
[ /claude-tweaks:deepen ]
(standalone, or surfaced as a Next Action
by /review and /reflect on structural signals)
/claude-tweaks:review lens 3e (Architecture) or /claude-tweaks:reflect's structural-debt lens flagged shallow abstractions, wrong boundaries, or pass-through wrappersThis is not a code-quality or bug pass — use /claude-tweaks:review for correctness and /claude-tweaks:simplify for line-level cleanup. /deepen only judges module depth.
$ARGUMENTS controls scope.
42) — scope to files changed for that specgit diff --name-only against the base branch or recent commits/claude-tweaks:deepen → analyze recently changed modules
/claude-tweaks:deepen src/payments/ → analyze modules under that directory
/claude-tweaks:deepen 42 → analyze modules changed for spec 42
A parent skill (or the user) may pass a file scope and a structural seed (e.g., the architecture finding that prompted the pass). Analyze only the provided scope — never expand to the whole codebase. A whole-repo depth audit is out of scope for this skill; it reviews recent work.
This skill uses a controlled vocabulary so proposals stay precise and comparable: module, interface, implementation, depth, seam, adapter, leverage. Do not drift into component, service, API (unless it literally means a network API), or boundary. Definitions live in _shared/criteria-architecture-depth.md (the shared depth criteria). depth-analysis.md shows how /deepen applies them. Inconsistent language is the failure that makes refactor proposals impossible to weigh against each other.
Parallel execution: Use parallel tool calls aggressively — read all in-scope files and their call sites (Grep for importers) concurrently. Depth is judged from call sites, so gather them before analyzing.
grep for imports of its exports).Apply the depth criteria in _shared/criteria-architecture-depth.md; depth-analysis.md (this skill's directory) shows how those criteria map onto Steps 2-4:
Rank candidates by leverage per unit of churn (callers affected, interface shrink, blast radius — see _shared/criteria-architecture-depth.md). Present them as a numbered list. Do not propose interfaces yet — present what is shallow and why, then ask which to explore. Proposing concrete interfaces for every candidate up front is the runaway-rewrite this skill exists to prevent.
Found {N} depth opportunities in {scope}, ranked by leverage:
| # | Module | Kind | Why it's shallow | Leverage | Blast radius |
|---|--------|------|------------------|----------|--------------|
| 1 | {path} | deepen | {one line — what leaks / what callers must know} | {callers affected, interface shrink} | {files touched} |
| 2 | {path} | collapse | {one line — what it only moves} | {…} | {…} |
Which would you like to explore? (number, several numbers, or "none")
If zero candidates, state: "No shallow modules found in scope — the abstractions in this change are earning their keep." and stop (skip to Report).
Depth refactors are architectural and low-reversibility. In auto mode (a pipeline run directory exists), never apply a refactor autonomously. Stage the ranked candidate list to {run-dir}/staged/deepen-{n}.md and log one entry to decisions.md per _shared/auto-decision-log.md:
- STAGED {HH:MM:SS} — Step 3: {N} depth candidates in {scope}. Architectural — staged for Review Console. Reversibility: low.
Surface at the Wrap-Up Review Console. Do not run Steps 4-5 in auto mode — interface design requires the user. See _shared/auto-mode-contract.md.
For each candidate the user picked, hold a focused interface conversation — do not jump to code. Per the Brainstorm / section-confirmation: adaptive convention, if the user accepts two consecutive candidates' designs without modification, batch the rest into a single approval.
_shared/criteria-architecture-depth.md. State how the deepened module will be tested.[ADR-candidate] so wrap-up can record it (see _shared/decision-records.md).verification.md in the /claude-tweaks:test skill's directory (types, lint, tests). Apply the Working Directory Discipline rule from _shared/subagent-output-contract.md before any verification command.BLOCKED
Reason: verification failed after a depth refactor.
Failing check: {typecheck | lint | tests}
Next: caller decides whether to revert the refactor, fix the regression, or stage for review.
A depth refactor that breaks tests is suspect — it likely changed behavior, not just structure. Prefer reverting over patching.
### Architectural Depth Pass
| # | Module | Kind | Change | Lines | Tested via |
|---|--------|------|--------|-------|------------|
| 1 | {path} | deepen | {interface before → after} | {-N/+M} | {pure / stand-in / port+adapter} |
Verification: {pass/fail}
Candidates not actioned: {N} (staged / declined — listed for follow-up)
If no changes were made: "No depth changes — abstractions reviewed are earning their keep." List any candidates the user declined so they aren't silently dropped.
When invoked directly (not by a parent skill), end with:
1. `/claude-tweaks:test` — verify the refactor end-to-end **(Recommended)**
2. `/claude-tweaks:review {spec}` — re-review the changed architecture
3. `/claude-tweaks:simplify` — line-level cleanup on the refactored files
When invoked by a parent, omit Next Actions — the parent handles flow control.
When $PIPELINE_RUN_DIR is set, /claude-tweaks:deepen is running inside a pipeline (invoked by /claude-tweaks:flow at its Pipeline Summary, or surfaced by /claude-tweaks:review / /claude-tweaks:reflect). In that case:
## Next Actions block — the parent owns the handoff./flow's Depth Opportunities block). Log a STAGED entry per Step 3's auto path; never an AUTO-applied entry.Direct invocation may pass --source <parent-skill> as an explicit fallback when ambiguity exists (rare; $PIPELINE_RUN_DIR is the primary signal).
| Pattern | Why It Fails |
|---|---|
| Measuring depth as implementation-lines ÷ interface-lines | Rewards padding the implementation and punishes simple-but-deep modules — judge leverage from call sites, not line counts |
| Proposing interfaces for every candidate up front | That's the runaway rewrite — Stage 1 presents what and why; interface design happens only for candidates the user picks |
| Dressing a collapse up as a deepening | A pass-through that fails the deletion test should be inlined, not "deepened" — call it what it is |
| Drifting into component / service / boundary vocabulary | Inconsistent language makes proposals impossible to compare — use the controlled vocabulary |
| Changing behavior during a depth refactor | Depth refactors change structure only — if behavior must change, that's a different skill. Broken tests mean you changed behavior |
Auto-applying a refactor in auto mode | Architecture is low-reversibility — auto mode stages candidates for the Review Console, never refactors silently |
| Running a whole-repo depth audit | This skill reviews recent work — a codebase-wide audit is a different, deliberate exercise |
| Deepening a module by pushing a network call into previously pure code | That trades testability for a smaller surface — flag it as a risk, don't do it silently |
| Skill | Relationship |
|---|---|
/claude-tweaks:simplify | Complementary, different altitude — /simplify cleans up within files (line-level), /deepen restructures across module interfaces. Run /simplify after /deepen for line-level cleanup on the refactored files. |
/claude-tweaks:review | /review lens 3e (Architecture) flags shallow abstractions and wrong boundaries; when it does, /review surfaces /claude-tweaks:deepen as a Next Action. /deepen is the deeper, dedicated follow-up to that lens. |
/claude-tweaks:reflect | /reflect's structural-debt lens ("premature abstractions, wrong boundaries") seeds /deepen candidates; /reflect surfaces /deepen as a Next Action when it finds structural debt. |
/claude-tweaks:test | /deepen uses the shared verification procedure from /test's verification.md to confirm a refactor preserved behavior. |
/claude-tweaks:build | Produces the modules /deepen evaluates. Architectural deviations build catches in Common Step 4.5 can route to /deepen for restructuring. |
/claude-tweaks:ledger | When invoked in a pipeline, staged depth candidates and declined candidates are tracked so they aren't dropped; /deepen appends entries with phase deepen. |
/claude-tweaks:help | /help references /deepen in the workflow diagram and reference card. |
/claude-tweaks:flow | Invoked BY /flow at the Pipeline Summary (Step 5) in analysis-only mode — /flow runs the read-only depth analysis hands-off and renders the ranked candidates as a Depth Opportunities recommendation block, but never applies a refactor (the responsible boundary for low-reversibility work in an auto pipeline). Skipped by no-deepen. |
_shared/decision-records.md | Hard-to-reverse interface trade-offs surfaced in Step 4 are flagged [ADR-candidate] for /wrap-up to record. |
_shared/auto-mode-contract.md | Single source of truth for auto-mode behavior — /deepen always stages in auto (architecture is low-reversibility), never auto-refactors. |
_shared/subagent-output-contract.md | The Working-Directory Discipline rule referenced by Step 5 verify lives here (CWD anchoring before git / node --test). |
_shared/criteria-architecture-depth.md | The shared depth criteria (leverage, deletion test, dependency classification, vocabulary) — single source of truth read by both /deepen and /recon's architecture-depth lens. |
npx claudepluginhub thomasholknielsen/claude-tweaks-marketplace --plugin claude-tweaksGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.