Deft directive gh arch

From deftai/directive · View interactive version

Deft directive gh arch is an AI agent skill from the GitHub repository deftai/directive. Explore a codebase for architectural improvement opportunities -- deepen shallow modules, generate competing interface designs in parallel via sub- agents, and file a refactor RFC as a GitHub Issue. Use when improving architecture, finding refactoring opportunities, or making a codebase more testabl

How to use this skill

Skill file

<!-- AUTO-GENERATED by task packs:render -- DO NOT EDIT MANUALLY -->

<!-- Purpose: rendered skill -->

<!-- Source of truth: packs/skills/skills-pack-0.1.json -->

<!-- Regenerate with: task packs:render -->

<!-- Edit the source, not this file. Slice instead of loading every SKILL.md: task packs:slice skills by-trigger --trigger <kw> (or list) -->

Deft GH Arch

Explore a codebase for architectural friction, surface opportunities to deepen shallow modules, generate competing interface designs in parallel, and file a refactor RFC as a GitHub Issue.

Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.

Inspired by improve-codebase-architecture from mattpocock/skills. Adapted to deft's domain model conventions and GitHub CLI workflow.

When to Use

Prerequisites


Core Concept: Deep Modules

A deep module (John Ousterhout, A Philosophy of Software Design) has a small interface hiding a large implementation. Deep modules are more testable, more AI-navigable, and let you test at the boundary instead of inside.

Shallow modules are the inverse: their interface is nearly as complex as the implementation. They force callers to know too much.


Process

Step 1: Explore the codebase

Navigate the codebase naturally. Note where you experience friction — the friction IS the signal:

Step 2: Present candidates

Present a numbered list of deepening opportunities. For each:

⊗ Propose interfaces at this step — present candidates only.

! Ask: "Which of these would you like to explore?"

Step 3: Frame the problem space

Before spawning sub-agents, write a brief user-facing explanation:

Show this to the user, then immediately proceed to Step 4. The user reads while sub-agents work.

Step 4: Design multiple interfaces in parallel

Spawn 3+ sub-agents with radically different design constraints. Each produces:

  1. Interface signature (types, methods, params)
  2. Usage example showing how callers use it
  3. What complexity it hides internally
  4. How dependencies are handled
  5. Trade-offs

Agent constraints:

Present designs sequentially, then compare in prose. Give your own recommendation — which is strongest and why. If elements combine well, propose a hybrid. Be opinionated.

Step 5: User picks an interface

! Wait for explicit user selection (or acceptance of your recommendation) before filing.

Step 6: File the GitHub Issue

Issue template:

## Problem

Describe the coupling or shallowness found. What makes this hard to test or extend?
Describe modules and behaviors — NOT specific file paths or line numbers.

## Proposed Interface

The chosen interface design (from the parallel session).

Include:
- Interface signature (types / methods / params)
- Usage example
- What complexity it hides

## Dependency Strategy

How the new interface handles its dependencies (injection, ports & adapters, etc.)

## Test Impact

What existing tests this replaces, and what new boundary tests become possible.

## Trade-offs

What this design gains and gives up vs the current implementation.

## Acceptance Criteria

- [ ] Interface is implemented and passes all boundary tests
- [ ] Existing callers are migrated
- [ ] Old internal tests replaced by boundary tests
- [ ] task check passes

Anti-Patterns

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.