improve-codebase-architecture

Scan a codebase for shallow modules and present deepening refactors as a visual HTML report.

1|Updated Jul 23, 2026
One-click install
npx skills add https://github.com/sanjanb/my-agent-harness --skill improve-codebase-architecture-sanjanb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: improve-codebase-architecture
Source: https://github.com/sanjanb/my-agent-harness/tree/main/skills/mp-improve-codebase-architecture
Command: npx skills add https://github.com/sanjanb/my-agent-harness --skill improve-codebase-architecture-sanjanb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Codebases accumulate shallow modules whose interfaces are nearly as complex as their implementations, making them hard to test and hard for AI agents to navigate. This Skill surfaces that architectural friction and turns it into concrete, visualized refactoring candidates. ## Core Features & Use Cases - Architecture exploration: Uses an Explore subagent plus git history hot-spot analysis to find shallow modules, seam leakage, and poor locality, applying the deletion test to validate candidates. - Visual HTML report: Generates a self-contained HTML file in the OS temp directory with Tailwind and Mermaid via CDN, rendering before/after diagrams, recommendation-strength badges, and ADR conflict callouts for each candidate. - Grilling loop: After the user picks a candidate, runs a decision-tree grilling session that updates CONTEXT.md, offers ADRs for rejected candidates, and can invoke design-it-twice exploration of alternative interfaces. - Use Case: Point it at a subsystem where bugs keep recurring; it identifies that pricing logic leaks across seams, renders a before/after diagram of a deepened module, and walks you through the refactor decision. ## Quick Start Ask the agent to review the architecture of the order intake subsystem and show deepening opportunities as an HTML report.

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 shallow modules in my codebase?

Run this Skill to explore the codebase with an Explore subagent, weighting recently changed files from git history. It flags modules whose interface is nearly as complex as their implementation and applies the deletion test to confirm the finding.

What is a deepening refactor in software architecture?

A deepening refactor turns a shallow module into a deep one: a small interface hiding a substantial implementation. The Skill presents each candidate with before/after diagrams and explains benefits in terms of locality and leverage.

Does the architecture review write files into my repository?

No. The HTML report is written to the OS temp directory resolved from $TMPDIR, falling back to /tmp or %TEMP%, and opened in your browser. Only CONTEXT.md updates and optional ADRs touch the repo, and only during the grilling phase.

How does the review handle conflicts with existing ADRs?

Candidates that contradict an ADR in docs/adr/ are only surfaced when the friction justifies revisiting the decision. They are marked with a warning callout naming the ADR and the reason to reopen it.

What happens after I pick a refactoring candidate?

The Skill runs a grilling loop that walks constraints, dependencies, and the shape of the deepened module. It updates CONTEXT.md with new domain terms, offers ADRs for load-bearing rejections, and can explore alternative interface designs.