AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Refactor Advisor

skill-aldianriski-lean-flow-refactor-advisor · by aldianriski

Use when code has become hard to change — surface deepening opportunities that turn shallow modules into deep ones (small interface, lots of behaviour) for testability and AI-navigability. Informed by the domain glossary (CONTEXT.md) and ADRs. Do not use to debug a failure (use /diagnose) or to build new behaviour (use /tdd); this finds and designs refactors, it doesn't chase bugs.

No reviews yet
0 installs
7 views
0.0% view→install

Install

$ agentstack add skill-aldianriski-lean-flow-refactor-advisor

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-aldianriski-lean-flow-refactor-advisor)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Refactor Advisor? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

refactor-advisor

Surface architectural friction and propose deepening — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability. Markdown only, no agents, read-then-propose.

This is the home for /diagnose's Phase-6 finding ("no good test seam = architecture preventing lockdown") and /tdd's "shallow module → deepen" candidates.

Vocabulary (use these exactly — full definitions → ${CLAUDE_SKILL_DIR}/references/deepening.md)

  • Module — anything with an interface + an implementation (function, class, package, slice).
  • Interface — everything a caller must know: types, invariants, ordering, error modes, config. Not just the signature.
  • Depth — leverage at the interface: lots of behaviour behind a small interface. Deep = high leverage; shallow = interface nearly as complex as the implementation.
  • Seam — where the interface lives; a place to alter behaviour without editing in place. (Say seam, not "boundary".)
  • Adapter — a concrete thing satisfying an interface at a seam. Leverage = what callers get; locality = what maintainers get.

Three rules that do most of the work:

  • Deletion test — imagine deleting the module. Complexity vanishes → it was a pass-through. Complexity reappears across N callers → it earned its keep. (The simplicity ladder's delete > add — favour removing over adding.)
  • The interface is the test surface — callers and tests cross the same seam. Needing to test past the interface = wrong shape.
  • One adapter = a hypothetical seam; two = a real one. Don't add a port unless something actually varies across it.

Process

1. Explore

Read the domain glossary (CONTEXT.md) + ADRs in the area first — the glossary names good seams; ADRs record decisions not to re-litigate. Then walk the code, noting friction (don't follow rigid heuristics):

  • Understanding one concept means bouncing between many small modules.
  • Modules where the interface is nearly as complex as the implementation (shallow).
  • Pure functions extracted only for testability, while the real bugs hide in how they're called (no locality).
  • Tightly-coupled modules leaking across their seams; parts hard to test through the current interface.

Apply the deletion test to anything you suspect is shallow.

2. Present candidates (markdown)

For each: Files · Problem (one line) · Solution (one line) · Wins (in terms of locality / leverage / how tests improve) · Before → After (prose, or a small mermaid block if graph-shaped) · Strength (Strong / Worth exploring / Speculative) · Dependency category (in-process / local-substitutable / ports & adapters / mock — see reference). Flag an ADR conflict only when the friction is real enough to reopen the ADR. End with a Top recommendation. Use glossary vocab for the domain, deepening vocab for the architecture. Then ask which to explore — don't design interfaces yet.

3. Grill the chosen candidate

Walk the design tree with the user — constraints, dependency category, the shape of the deepened module, what sits behind the seam, which tests survive. Side effects happen inline as decisions crystallise:

  • New concept named? → add the term to the glossary (CONTEXT.md), opinionated canonical + _Avoid_.
  • Load-bearing rejection? → offer an ADR — only if a future explorer would otherwise re-suggest it (skip ephemeral/self-evident reasons).
  • Want alternative interfaces? → design it twice, inline: sketch 2–3 radically different interfaces (minimal / flexible / common-case-trivial), compare by depth · locality · seam placement, then recommend one (or a hybrid). Be opinionated.

Actionable refactors become TASK-NNN (via /task-decomposer) or a TD-NNN tech-debt entry — never a silent in-place rewrite.

Red flags

A single-adapter seam — one adapter is indirection, not a seam; needs two (prod + test) to be real. ❌ Testing past the interface — if a test must reach behind the seam, the module is the wrong shape. ❌ Layering new tests over old shallow-module tests — replace them; the deepened interface is the test surface. ❌ Re-litigating an ADR — surface a conflict only when the friction warrants reopening it. ❌ Refactoring in place from this skill — it finds + designs; execution goes through a task, gated by /orchestrator.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.