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 anahelenasilva/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 and propose deepening opportunities — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.
Use these terms exactly in every suggestion. Consistent language is the point — don't drift into "component," "service," "API," or "boundary." Full definitions in LANGUAGE.md.
Key principles (see LANGUAGE.md for the full list):
This skill is informed by the project's domain model. The domain language gives names to good seams; ADRs record decisions the skill should not re-litigate.
Read the project's domain glossary and any ADRs in the area you're touching first.
Then use the Agent tool with subagent_type=Explore to walk the codebase. Don't follow rigid heuristics — explore organically and note where you experience friction:
Apply the deletion test to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.
Present a numbered list of deepening opportunities. For each candidate:
Use CONTEXT.md vocabulary for the domain, and LANGUAGE.md vocabulary for the architecture. If CONTEXT.md defines "Order," talk about "the Order intake module" — not "the FooBarHandler," and not "the Order service."
ADR conflicts: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly (e.g. "contradicts ADR-0007 — but worth reopening because…"). Don't list every theoretical refactor an ADR forbids.
Do NOT propose interfaces yet. Ask the user: "Which of these would you like to explore?"
Once the user picks a candidate, drop into a grilling conversation. Walk the design tree with them — constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.
Side effects happen inline as decisions crystallize:
CONTEXT.md? Add the term to CONTEXT.md — same discipline as /grill-with-docs (see CONTEXT-FORMAT.md). Create the file lazily if it doesn't exist.CONTEXT.md right there.tools
Merges a specified branch into the current branch using pnpm-based verification (typecheck + tests), resolves conflicts, and optionally closes a GitHub issue via gh CLI. Use when the user mentions "Sandcastle", asks to merge a branch and close an issue, or references the Sandcastle merge protocol.
tools
Autonomously implements open GitHub issues labeled "Sandcastle" one at a time using the RALPH workflow (explore, plan, RGR test-first, verify, commit, close). Use when the user says "implement next Sandcastle issue", "process open issues", "run RALPH", or asks to work through the Sandcastle backlog. Assumes pnpm, gh CLI, and git are configured in the current repo.
development
Reviews and refines code on a branch for the Sandcastle project. Use when asked to "review", "clean up", "refine", or "code review" on a branch. Call as `/sandcastle-code-review` to review the current branch, or `/sandcastle-code-review [branch-name]` to review a specific branch. Makes improvements in place — reads the diff, fixes issues, runs tests, commits. Do NOT use for general code questions or reviews outside the Sandcastle project.
development
Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.