improve-codebase-architecture/SKILL.md
Find deepening opportunities in a codebase, informed by the domain language in CONTEXT.md and the decisions in docs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable.
npx skillsauth add sanurb/skills improve-codebase-architectureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Surface architectural friction in a codebase and propose deepening opportunities — refactors that turn shallow modules into deep ones — using the project's own domain language and respecting its recorded decisions. The aim is testability and AI-navigability: high leverage at small interfaces, change concentrated in one place, tests written at the seam where callers and tests cross the same surface.
Read the architecture vocabulary and the project's own docs BEFORE generating any candidates.
references/language.md. Use these terms exactly: module, interface, implementation, depth, seam, adapter, leverage, locality. Do not drift into "component," "service," "API," or "boundary."CONTEXT.md (or follow CONTEXT-MAP.md) and every ADR in docs/adr/ that touches the area being explored.subagent_type=Explore to walk the codebase. Note where you experience friction: where understanding requires bouncing between many small modules; where modules are shallow (interface nearly as complex as implementation); where pure functions exist for testability without locality; where seams leak; where parts are untested or hard to test through their current interface.Present a numbered list of deepening opportunities, then halt for user selection. Do NOT propose interfaces yet.
CONTEXT.md vocabulary for domain things ("the Order intake module," not "the FooBarHandler" or "the Order service").references/language.md vocabulary for architecture things.Once the user picks one candidate, drop into a grilling conversation. Walk the design tree: constraints, dependency category, shape of the deepened module, what sits behind the seam, what tests survive.
references/deepening.md for dependency categorisation and seam strategy (in-process / local-substitutable / remote-but-owned / true external).references/interface-design.md and follow its parallel-sub-agent pattern.CONTEXT.md immediately. Format: ../grill-with-docs/references/context-format.md. Create the file lazily.../grill-with-docs/references/adr-format.md. Skip ADR offers for ephemeral reasons ("not worth it right now") or self-evident ones.The skill delivers nothing if any of these fails:
references/language.md was read before any candidate was generated.CONTEXT.md and relevant ADRs were read before any candidate was generated.CONTEXT.md vocabulary, not invented names or framework names.CONTEXT.md updates during grilling happened inline (same turn as the resolution), never batched at the end.Phase 1 output — numbered candidates list. Exactly this shape per item:
### {N}. {Module name in CONTEXT.md vocabulary}
**Files:** {paths}
**Problem:** {friction described in references/language.md vocabulary}
**Solution:** {plain-English description of the deepened shape}
**Benefits:** {locality + leverage + how the test surface improves}
{optional: contradicts ADR-NNNN — but worth reopening because …}
End the list with the literal question: "Which of these would you like to explore?"
Phase 2 output — problem-space framing for the chosen candidate:
references/deepening.md) and the test/adapter strategy that follows from it.Phase 3 output — inline file artifacts (only if the conversation produces them):
CONTEXT.md per ../grill-with-docs/references/context-format.md.docs/adr/NNNN-slug.md per ../grill-with-docs/references/adr-format.md (only on accepted ADR offers).If the user requested alternative interfaces, the parallel-sub-agent output schema in references/interface-design.md is binding and replaces nothing in this list.
development
Sets up an `## Agent skills` block in AGENTS.md/CLAUDE.md and `docs/agents/` so the engineering skills know this repo's issue tracker (GitHub, GitLab, fp, or local markdown), triage label vocabulary, and domain doc layout. Run before first use of `fp-plan`, `fp-implement`, `fp-review`, `to-issues`, `to-prd`, `triage`, `diagnose`, `tdd`, `improve-codebase-architecture`, or `zoom-out` — or if those skills appear to be missing context about the issue tracker, triage labels, or domain docs.
development
Build a throwaway prototype to flush out a design before committing to it. Routes between two branches — a runnable terminal app for state/business-logic questions, or several radically different UI variations toggleable from one route. Use when the user wants to prototype, sanity-check a data model or state machine, mock up a UI, explore design options, or says "prototype this", "let me play with it", "try a few designs".
tools
Control herdr (a terminal-native agent multiplexer) from inside it. Manage workspaces and tabs, split panes, spawn sibling agents, read pane output, and wait for state changes — all via CLI commands that talk to the running herdr instance over a local unix socket. Use when running inside herdr (HERDR_ENV=1). Do not use outside herdr.
documentation
Compact the current conversation into a handoff document for another agent to pick up.