agentleFS
ByronFinnByronFinn/dev-skills/skills/improve-architecture/SKILL.md

improve-architecture

Skill4 starsChanged 2 days agoMITView on GitHub

Run an architecture governance campaign: scan the codebase for design debt and entropy, then converge it toward its ideal form through closed-loop batches — plan the lowest-complexity fix, migrate every caller, delete the superseded implementation, verify gates, add anti-regression checks, record decisions, commit per batch. Use for periodic architecture health checks, design-debt or technical-debt cleanup campaigns, architecture reviews, or pre-feature architecture assessment (a scan-only report is a valid stopping point). Trigger words: architecture, improve-architecture, 架构治理, 降熵, 重构, 清理, 债务, 技术债, 架构审查, design debt, technical debt.

16 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use app-brief, design-from-app and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • StijnusSkill

    app-brief

    One-page brief (docs/BRIEF.md) for a new macOS app, written before any code. Use when the user has an app idea, wants to replace an app they pay for, or the research and clone skills are done.

    Also in 3 projects that use this

  • StijnusSkill

    design-from-app

    Rebuild the look of an app the user likes as a native SwiftUI design kit, by measuring its screenshots (sizes, spacing, type, colors, icons), building its parts, and comparing pixel by pixel until they match. Use when the user names an app whose look they want, shares screenshots of one, or says "make it look like X".

    Also in 3 projects that use this

  • launchapp-devSkill

    layout-grid

    Define responsive layout grid systems with columns, gutters, margins, and breakpoint behavior.

    Also in 3 projects that use this

  • MohamedAbdallah-14Skill

    app-icon

    Generate an app icon from a single 1024² master and fan out to iOS (AppIcon.appiconset with squircle-ready 1024 opaque), Android (adaptive foreground + background + Android 13 monochrome), PWA (192/512 + 512 maskable with 80% safe zone), and visionOS (3-layer parallax).

    Also in 3 projects that use this

  • CrystalPlatformsSkill

    agent-cli

    Design and audit CLIs that AI agents (Claude Code, Codex, automated pipelines) consume. Applies ten agent-native principles in two tiers — Tier 1 table stakes (non-interactive default, structured output, errors that enumerate, safe retries, bounded responses) and Tier 2 compounding (cross-CLI vocabulary, three-layer introspection, async-aware execution, persistent profiles, two-way I/O) — with a Blocker / Friction / Optimization severity rubric across six command classes (read, mutate, stream, bootstrap, async, config). Use when building, reviewing, or specifying a CLI for agent invocation, mentions argparse, click, cobra, clap, commander, yargs, oclif, thor, agent-friendly or agent-native CLI design, --json output, exit codes, idempotent commands, --wait flags, agent-context introspection, persistent profiles, --deliver routing, --force bypass, vocabulary consistency, or repos with cli.py, main.go, src/cli.rs, bin/<tool>. Skip general shell scripting and human-only TUIs.

    Also in 3 projects that use this

  • maxvyshniakovSkill

    improve-loop

    Run a bounded improvement program with parallel read-only planning, isolated Codex executor waves, independent opponent review, and serial host integration. Use when the user explicitly invokes improve-loop, asks to autonomously implement selected codebase improvements, or wants plans executed without manually opening separate sessions. Keep canonical improve and improve-codebase-architecture available as independent scout skills.

    Also in 4 projects that use this

  • +1 more from Stijnus

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Done when: Every high-value finding in the task pool is either completed as a closed-loop batch or parked as a pending decision with …

    line 13
  2. Very specific:

    PRD Traceability: If findings link to a PRD, fill the Arch reviewed by field:

    line 71

“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Improve Architecture: Governance Campaign

🥷 Scan for architecture entropy, then converge — closed-loop batches, each one fully migrated, deleted, verified, and recorded.

Outcome Contract

  • Outcome: The codebase measurably converges toward its ideal form. Each completed batch leaves one canonical implementation per semantic, all callers migrated, the superseded implementation deleted, gates green, an anti-regression check where the batch established a norm, and records updated. (A scan-only request stops after Step 2 with the report — that is a valid completion.)
  • Done when: Every high-value finding in the task pool is either completed as a closed-loop batch or parked as a pending decision with recorded rationale; gates green; progress file and task pool current.
  • Evidence: Task-pool states, gate outputs (paste real command output — anti-pattern #6), commits, ADRs, progress file.
  • Output: Round report + updated docs/governance/PROGRESS.md, docs/governance/TASKS.md, ADRs, and one commit per batch.

Prerequisites

Apply the Skill Entry Protocol. Read CONTEXT.md, docs/adr/, docs/prd/, docs/audits/ (most recent first), plus the campaign state files when present — docs/governance/PROGRESS.md (what previous rounds did) and docs/governance/TASKS.md (the task pool). Any missing file degrades gracefully: a first run builds the map and creates the state files; no ADRs means no compliance check; a missing task pool means the scan seeds one.

Process Summary

Step 0 — Entry. Skill Entry Protocol + campaign state files (above). Note what is missing before starting.

Step 1 — Map. First run: build the architecture map (modules, responsibilities, public interfaces), the dependency graph, and the inventories (duplication, parallel implementations, tech options in use, convention deviations). Later runs: refresh what changed since the last round. See REFERENCE.md §Step 1.

Step 2 — Scan. Prioritized strategy (PRD-linked modules → high-change-frequency → cross-cutting), the mechanical debt signals (REFERENCE.md §2.2), the governance property signals (REFERENCE.md §2.5), and the ADR compliance check (REFERENCE.md §2.3). Each finding: location, evidence, named consequence (anti-pattern #25), priority.

Step 3 — Plan the round. Group findings into candidate batches (one semantic per batch); sketch the end state for each; choose the lowest-total-complexity plan; apply the Deletion Test to every abstraction the plan touches; park items needing product decisions or breaking migrations as 待确认 in the task pool and continue independent work. Baseline: run the project's gates before editing — a batch starts from green.

Step 4 — Execute the batch. Complete migration (every caller, template, doc, script, eval), then delete the superseded implementation in the same batch. Old and new must not coexist afterwards, unless a recorded external contract requires a compatibility layer.

Step 5 — Independent re-review + verify. Re-review the diff with fresh context (dispatch a sub-agent when the runtime provides one; otherwise re-read from disk after finishing). Then run all gates and paste output as evidence. Fix or split the batch if review finds an incomplete migration.

Step 6 — Enforce. Convert each norm the batch established into a machine check — lint rule, AST check, contract test, CI step, or a check-docs.py-style script assertion. A norm without a check will be re-introduced.

Step 7 — Record & commit. Update PROGRESS.md (round entry), TASKS.md (statuses), write an ADR when the decision was hard to reverse or a real trade-off. Commit the batch as one commit. Then loop: next batch from the task pool, until the high-value pool is empty or fully decision-parked.

See REFERENCE.md for the loop mechanics, property signals, Deletion Test procedure, migration-completeness checklist, acceptance criteria, and state-file conventions.

Gotchas

What happenedRule
New abstraction built, old callers not migratedStep 4: a batch without full caller migration is incomplete — no old/new coexistence
Deleted code "temporarily" kept alongside its replacementStep 4: deletion is part of the batch, not a follow-up; compatibility layers need a named external contract
An abstraction layer that only forwardsDeletion Test (REFERENCE §Step 3): if deleting it just spreads complexity to callers, delete it; keep only layers that encapsulate
Two semantically different things merged for uniformityStep 3: uniformity is not the goal — merge only when the semantic is the same
Directory reshuffle or rename without a complexity winStep 3: lowest-total-complexity plan wins; churn with no win is rejected
Docs restated facts the code already shows (trees, counts, file lists)Reference ../rules/writing-skills.md — documents cache decisions and reasons, not disk-derivable facts; treat a restatement as an entropy finding
Stopped after the report while the directive is a campaignStep 7: scan-only is a stop point only when the user asked for a report; otherwise keep looping
Batch needs a product decision or breaking migrationStep 3: park as 待确认 in the task pool with rationale, continue independent batches; ask one question with a recommendation only when the current batch cannot proceed
Destructive or outward-facing action (mass deletion, force-push, publish)Explicit current-turn authorization required (anti-pattern #16); in-repo git commits within the campaign scope are the default authorized action
Violated a still-valid ADRREFERENCE §2.3: classify (drift / obsolete / violated); a violation is Blocking

Output

Governance round <N> complete.

Scan:        <N> findings (signals fired by §2.2 / §2.5 / §2.3)
Batches:     <done: N> (<one line each: semantic → migration → deletion>)
             <parked: N> (<item> — waiting on <decision>)
Gates:       <gate: pass/fail, ...>
Commits:     <hash> <message>, ...
Records:     PROGRESS.md round <N>; TASKS.md updated; ADR-<NNNN> (if any)

Next: <next batch from the pool> | converged | blocked on decisions

PRD Traceability: If findings link to a PRD, fill the Arch reviewed by field:

- **Arch reviewed by**: `/improve-architecture` (<YYYY-MM-DD>) — <one-line finding + priority>

Workflow Position

Independent activity — periodic maintenance or an explicit campaign, not part of the main feature flow:

New feature dev:   think → grill → story → implement → review
Bug fix:           debug → review (optional)
Governance:        improve-architecture (campaign loop; approved findings may
                   route to grill/story/implement when they are plan- or
                   feature-shaped rather than batch-shaped)

The campaign loops internally (like implement's per-seam loop); it still stops at cross-skill handoffs — routing a finding to /story waits for the user.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.