improve-codebase-architecture

Identify shallow modules and classify dependencies to guide interface-first refactoring.

1|Updated Jan 24, 2026
One-click install
npx skills add https://github.com/mattbutlerengineering/mattbutlerengineering --skill improve-codebase-architecture-mattbutlerengineering
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: improve-codebase-architecture
Source: https://github.com/mattbutlerengineering/mattbutlerengineering/tree/main/.agents/skills/improve-codebase-architecture
Command: npx skills add https://github.com/mattbutlerengineering/mattbutlerengineering --skill improve-codebase-architecture-mattbutlerengineering

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reduce architectural friction by identifying where the codebase is shallow—where interfaces expose complexity, where dependencies are hard to test, and where understanding behavior requires bouncing across many modules.

Core Features & Use Cases

  • Find deepening opportunities: surface candidate modules/slices where consolidating behind a smaller Interface increases Depth, improves Locality, and boosts Leverage for callers and tests.
  • Classify dependencies to guide refactors: use dependency categories (in-process, local-substitutable, remote-but-owned via ports/adapters, and true external via mocks) to determine the safest deepening strategy.
  • Design for seams and adapters: identify where behaviour can change without editing in place, and ensure seams are real (two adapters) rather than hypothetical (one adapter).
  • Align refactoring with test strategy: replace brittle shallow-module tests by moving the test surface to the deepened module’s Interface.

Quick Start

Use the improve-codebase-architecture skill to walk your repository, list deepening candidates with expected locality/leverage benefits, and then drill into one candidate by mapping seams, adapters, and an interface-first testing plan.

Frequently Asked Questions about improve-codebase-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor tightly-coupled code to make it more testable?

Refactoring tightly-coupled code for testability involves finding deepening opportunities that turn shallow modules into deep ones. You consolidate complex logic behind a smaller interface, ensuring dependencies are categorized and replaced using real seams and adapter strategies.

What is the best way to identify shallow modules in a codebase?

Shallow modules are identified by interfaces that expose complexity and dependencies that are hard to test. Analyzing architectural friction reveals these shallow slices, where understanding behavior requires bouncing across many modules rather than leveraging a single deep interface.

How do ports and adapters simplify dependency management during refactoring?

Ports and adapters simplify dependency management by isolating remote-but-owned dependencies behind interfaces. This clarifies dependency categorization, ensuring true seams exist with two adapters rather than hypothetical ones, allowing behavior to change without editing in place.

How do I align my testing strategy with architectural refactoring?

Align testing strategy with refactoring by moving the test surface to the deepened module's interface. This replaces brittle shallow-module tests with interface-first testing discipline, leveraging the new deep modules to test behavior comprehensively.

When should I use dependency categorization for codebase refactoring?

Use dependency categorization when determining the safest deepening strategy across tightly-coupled systems. Classifying dependencies as in-process, local-substitutable, remote-but-owned, or true external guides how seams and adapters should be applied during refactoring.