improve-codebase-architecture

Identifies shallow modules and proposes deepening refactors to improve testability and AI-navigability.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Codebases accumulate shallow modules whose interfaces are nearly as complex as their implementations, spreading bugs and knowledge across callers and making code hard to test and navigate. This Skill surfaces that architectural friction and proposes deepening opportunities that consolidate behavior behind small, high-leverage interfaces. ## Core Features & Use Cases - Deepening Candidate Discovery: Explores the codebase with an Explore sub-agent, applies the deletion test, and presents a numbered list of refactoring candidates with files, problems, solutions, and benefits. - Shared Architecture Vocabulary: Enforces consistent terms (module, interface, depth, seam, adapter, leverage, locality) and integrates the project's domain language from docs/CONTEXT.md and decisions from docs/adr/. - Grilling Loop & Interface Design: Walks the design tree with the user, updates docs/CONTEXT.md, offers ADRs for rejected candidates, and spawns parallel sub-agents to design alternative interfaces (Design It Twice). - Use Case: A team notices that understanding order intake requires bouncing between six small files. The Skill identifies the cluster as shallow, proposes a single deep Order intake module, and designs its interface with dependency-aware testing strategy. ## Quick Start Ask the assistant to review this codebase for shallow modules and propose deepening opportunities using the improve-codebase-architecture skill.

Frequently Asked Questions about improve-codebase-architecture

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

FAQPage Schema
How do I find refactoring opportunities in a codebase?▼

Use this Skill to explore the codebase with an Explore sub-agent, noting where understanding one concept requires bouncing between many small modules. It applies the deletion test to suspected shallow modules and presents a numbered list of deepening candidates with files, problems, and benefits.

What is a deep module versus a shallow module?▼

A deep module hides a large amount of behavior behind a small interface, giving callers high leverage. A shallow module has an interface nearly as complex as its implementation, so deleting it just moves complexity rather than concentrating it.

How does this Skill use docs/CONTEXT.md and ADRs?▼

It reads the project's domain glossary and relevant ADRs before exploring, names candidates using domain vocabulary, and avoids re-litigating recorded decisions. Candidates that contradict an ADR are only surfaced when the friction justifies reopening it, and are clearly marked.

How are tests handled when deepening modules?▼

New tests are written at the deepened module's interface, which becomes the test surface, and old unit tests on shallow modules are deleted. Dependencies are categorized as in-process, local-substitutable, remote but owned, or true external to determine adapter and mocking strategy.

When should I not introduce a seam or port?▼

Do not introduce a port unless at least two adapters are justified, typically production plus test. A single-adapter seam is just indirection, and internal seams used only by a module's own tests should not be exposed through its external interface.