Improve codebase architecture

From redpanda-data/ui-harness · View interactive version

Improve codebase architecture is an AI agent skill from the GitHub repository redpanda-data/ui-harness. Explore codebase for architectural improvement. Focus testability via deepening shallow modules. Use when user want improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make codebase more AI-navigable.

How to use this skill

Skill file

Improve Codebase Architecture

Surface architectural friction and propose deepening opportunities: refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.

This skill is _informed_ by the project's domain model. The domain glossary names good seams; ADRs in the area record decisions the skill should not re-litigate. Read both before exploring.

Use LANGUAGE.md vocabulary exactly: module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality. Do not drift into "component," "service," "API," or "boundary."

Key principles:

Process

1. Explore

Read the project's domain glossary and any ADRs in the area you're touching first.

Use Agent(subagent_type=Explore) when available. Otherwise explore with rg, find, tests, and call graph reading. Look for:

Apply the deletion test to anything that looks shallow.

2. Present candidates as an HTML report

Write a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve temp dir from $TMPDIR, falling back to /tmp (or %TEMP% on Windows), and write to <tmpdir>/architecture-review-<timestamp>.html so each run gets a fresh file. Open it for the user (open, xdg-open, or start) and tell them the absolute path.

Use Tailwind via CDN and Mermaid via CDN. Mix Mermaid with hand-crafted CSS/SVG visuals. Each candidate gets a before/after visualization. See HTML-REPORT.md for scaffold, diagram patterns, styling, and tone.

For each candidate card:

Use LANGUAGE.md vocabulary for architecture and the project's CONTEXT.md vocabulary for the domain. If a candidate contradicts an existing ADR, only surface it when friction is real enough to warrant revisiting the ADR. Mark it clearly.

Do not propose interfaces yet. After writing the report, ask: "Which of these would you like to explore?"

3. Grilling loop

Once the user picks a candidate, drop into a grilling conversation. Walk the design tree: constraints, dependencies, shape of the deepened module, what sits behind the seam, what tests survive.

Side effects happen inline as decisions crystallize:

4. Create GitHub Issue

Refactor RFC. See REFERENCE.md for template and dependency categories.

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.