/groundwork:improve-codebase-architecture [module/subsystem/pain-point] [--project name]from groundwork
Surveys a codebase for deepening opportunities where shallow module clusters can consolidate into deep modules, shows candidates in chat and as an HTML report, and guides through a design-it-twice process. Optionally scoped to a module, subsystem, or monorepo project.
Ships in groundwork. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A survey, not a rescue. It surfaces deepening opportunities — places where a cluster of shallow modules can consolidate into one deep module: a lot of behavior behind a small interface, tested through that interface. The aim is leverage for callers, locality for maintainers, and testability for everyone. On a genuinely tangled codebase it finds real candidates; it does not untangle the mud in one run.
This is proactive upkeep for the agent's working environment: a codebase that is deep is one the next session navigates cheaply.
If arguments include --project <name>, resolve that project directly from the repository's .groundwork.yml for this invocation. Treat it as authoritative; do not depend on or change persisted project selection.
.groundwork.yml exist at the repo root?
{{project_name}} non-empty?
Skill(skill="groundwork:select-project") to select a project, then restart this skill.{{project_name}}, specs at {{specs_dir}}/.--project.
.groundwork.yml: the repo root or the selected project's path → fine, proceed; no project's path → proceed without warning (shared directory).--noninteractive, keep the selected project and continue; otherwise warn via AskUserQuestion:
"You're working from
<cwd>(inside [cwd-project]), but the selected Groundwork project is [selected-project] ([selected-project-path]/). What would you like to do?"
- "Switch to [cwd-project]"
- "Stay with [selected-project]" If the user switches, invoke
Skill(skill="groundwork:select-project").
{{specs_dir}}/ paths resolve to the correct location.in-process (pure computation, no I/O), local-substitutable (has a local test stand-in, such as an in-memory database), ports & adapters (your own service across a network), or external — mock (a third party you do not control).Deepening pays off where change is frequent — it makes future changes to the module cheaper. So decide where to look before looking:
git log --oneline -200 (inside the project root), find the files and areas that keep recurring, and let those pull the survey's attention first. Scattered changes with no hot spot → widen the net once, then stop.Read {{specs_dir}}/glossary.md (if present) for naming candidates, and the architecture decision records: a candidate that contradicts a standing decision record is only surfaced when the friction is real enough to justify reopening it, and it must carry a callout ("contradicts DR-NNN, worth reopening because …"). Never re-litigate silently.
Dispatch an exploration subagent with a fresh context window over the scoped area. It hunts, in priority order:
The subagent returns per candidate: files involved, what hurts, the consolidation in one sentence, its evidence, and its dependency category. No interface proposals yet — the survey names opportunities, not designs.
Present the candidates twice — each half does a job the other can't:
In chat, as a numbered list (the durable, copyable half). Per candidate:
Strong / Worth exploring / Speculative (Strong = recent hot-spot evidence + passes the deletion test + no decision-record conflict)As a visual HTML report (the half that makes shallowness visible) — one self-contained file with a before/after diagram per candidate and a top recommendation. When producing it, follow HTML-REPORT.md for its location, structure, diagram patterns, and skeleton; then tell the user the path to open.
Then stop and ask which (if any) to take further. A survey that finds nothing worth exploring is a successful run — say so.
With the user's pick:
${CLAUDE_PLUGIN_ROOT}/references/engineering-principles.md), capture it in the architecture document in design-architecture's Decision Record Format: what was consolidated, the interface chosen, and the alternatives design-it-twice rejected. Implementation and every later reader rely on that record; without it the decision dies with the session. When no architecture document exists, carry the record in the hand-off instead of creating one unasked./groundwork:create-tasks with the decision record in hand (the lifecycle router lists it as user-initiated), or invoke [[plan-task]] for a single candidate; either way the new consolidated interface is the task's recorded test seam. This skill does not implement.A candidate the user parks rather than pursues goes under Open decisions in section 12 of the architecture document (when one exists), so it survives the session. A candidate the user rejects for a load-bearing reason deserves more: when that reason should stop a future survey from suggesting it again, offer to record it as a decision record ("record this so future surveys don't re-suggest it?"). Skip ephemeral reasons ("not right now") and self-evident ones.
| Excuse | Reality |
|---|---|
| "The whole codebase is a mess, start everywhere" | A survey that scans everything prioritizes nothing. Hot spots first. |
| "It's legacy, don't touch it" | Files that never change are cheap to leave shallow — the deletion test decides, not age. |
| "We should redesign the architecture" | This is a deepening survey, not a rewrite. Candidates are local consolidations. |
| "Just propose the new interface now" | Survey first, design second. Candidates chosen without the user are solutions without a sponsor. |
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (etr/groundwork) — no native marketplace selected
npx claudepluginhub p/etr-groundwork44 skills in this plugin
/build-unplannedBuild a feature from a description with worktree isolation and TDD. Optional flag - --on-unrelated-failure stop-and-ask|expand-and-fix|ignore-and-merge - how validation treats gate failures unrelated to the active project (default stop-and-ask)./check-specs-alignmentVerify alignment between code and specs./create-tasksGenerate implementation tasks from architecture document./debugUse when investigating bugs, unexpected behavior, test failures, or any code that does not work as expected - enforces systematic root cause analysis before any fix/design-architectureUse when the user asks to design system architecture, make architectural decisions, or translate PRD into technical design/design-it-twiceUse before committing to a non-trivial module, service boundary, or public API - generate 2-3 divergent interface designs, compare them on depth/locality/seam, and recommend oneOther plugins' skills for the same job