improve-codebase-architecture

Identify refactoring opportunities that consolidate shallow modules into deeper ones.

2|Updated May 5, 2026
One-click install
npx skills add https://github.com/OrestesK/pi --skill improve-codebase-architecture-orestesk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: improve-codebase-architecture
Source: https://github.com/OrestesK/pi/tree/main/packages/context-mode/skills/improve-codebase-architecture
Command: npx skills add https://github.com/OrestesK/pi --skill improve-codebase-architecture-orestesk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps uncover architectural friction when a codebase is difficult to understand, test, or change because behaviour is scattered across shallow or tightly coupled modules.

Core Features & Use Cases

  • Architecture Exploration: Inspect domain language, ADRs, and code structure to identify where understanding and maintenance become difficult.
  • Deepening Opportunities: Find candidates for consolidating shallow modules into deeper modules with stronger interfaces, better locality, and greater leverage.
  • Design Grilling: Explore dependencies, seams, adapters, testing strategies, and alternative interfaces before committing to a refactor.
  • Use Case: Use it to evaluate a tangled feature area, produce a prioritized list of refactoring opportunities, and collaboratively design a testable deepened module without re-litigating documented architectural decisions.

Quick Start

Ask the skill to explore the codebase and identify the highest-value opportunities for turning shallow modules into deeper, more testable modules.

Frequently Asked Questions about improve-codebase-architecture

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

FAQPage Schema
How do I identify refactoring opportunities in a tangled codebase?

To identify refactoring opportunities in a tangled codebase, explore the domain glossary, architectural decisions, and source code to locate tightly coupled, shallow modules. This analysis highlights candidates for consolidating into deeper modules with stronger interfaces and better locality.

What makes a module shallow and how do I deepen it?

A shallow module has a simple interface hiding complex internal behavior, offering low leverage. You deepen it by consolidating tightly coupled modules into a single unit with a stronger, more comprehensive interface that hides internal complexity and increases testability.

How do I improve codebase testability through architecture refactoring?

Improving codebase testability through architecture refactoring involves exploring dependency seams and adapters to isolate behavior. By designing alternative interfaces and consolidating scattered logic into deeper modules, you establish stronger boundaries that make modules significantly easier to test.

Do I need a domain glossary to review codebase architecture?

Yes, accessing the repository's domain glossary and documented architectural decisions is required. These inputs ensure the architectural exploration respects existing domain language and avoids re-litigating prior decisions when designing alternative interfaces and refactoring modules.

What is the best way to design alternative interfaces for existing modules?

The best way to design alternative interfaces for existing modules is to analyze dependency seams and testing strategies in parallel. This exploratory design process grills the module boundaries to ensure the new interface provides greater leverage and testability before committing to a refactor.

When should I avoid refactoring tightly coupled modules?

You should avoid refactoring tightly coupled modules when the architectural decisions documenting their current design are still valid and should not be re-litigated. The refactoring process explicitly requires ADR-aware exploration to respect these documented constraints.