- Home
- Skills
- Code Quality & Review
- Refactoring Prioritizer — Find What To Fix First
Works with the AI Agents you already use
Refactoring Prioritizer — Find What To Fix First
Rank codebase technical debt using churn and coupling data to identify what to fix first and what to leave alone.
$12
Refactoring Prioritizer — Find What To Fix First
Example session with this skill installed
I'm taking over this repo and it's a mess. Where should I start refactoring to get the most impact with the least risk? Give me a prioritized backlog.
- Read your context and instructions
- Compiled the refactoring prioritizer
I have analyzed the repository using Git history and the dependency graph. The churn signal is verified via 428 recent commits.
Refactoring Backlog
| Module | Value | Risk | Category | Tag | Why |
|---|---|---|---|---|---|
src/auth/session.ts | 12 | 3 | Fix First | volatile-hub | 15 commits in 30 days; 80% are bug fixes. |
src/api/gateway.ts | 10 | 7 | Plan Carefully | untested-hub | High coupling (12 dependents) with 0% test coverage. |
src/utils/logger.ts | 2 | 1 | Do Not Touch | stable | Load-bearing foundation; zero churn in 6 months. |
src/ui/legacy-button.ts | 4 | 2 | Ignore | volatile | High churn but low coupling; impact is localized. |
Start Here: src/auth/session.ts
This is your highest impact move. It is a volatile hub that changes frequently due to bugs rather than features. Extract the token validation logic into a standalone utility to reduce the module's complexity. Risk is acceptable because the module already has 85% test coverage.
Do Not Touch: src/utils/logger.ts
Despite being imported by every module in the system, it has not changed in 180 days. Refactoring this now provides zero value and risks breaking the entire logging pipeline.
Next steps
- Review the
src/auth/session.tspublic API to identify extraction candidates. - Draft a test suite for
src/api/gateway.tsbefore attempting any structural changes. - Run
agent-context explain src/api/gateway.tsfor a full transitive impact map.
Connects securely to your tools. The creator never sees your data.
About this skill
Codebases accumulate technical debt faster than teams can fix it. The Refactoring Prioritizer solves the "where do we start?" problem by replacing gut feeling with a reproducible, data-driven ranking of your repository's modules. It identifies which code is volatile, which is a risky dependency hub, and which modules are stable foundations that should never be touched.
What it does
- Calculate priority scores by measuring churn, coupling, value, and risk for every module in the repository.
- Categorize technical debt into actionable buckets: fix first, plan carefully, ignore, or do not touch.
- Analyze dependency coupling to identify risky hubs that lack a test safety net.
- Correlate Git activity with structural health to separate active feature work from frequent bug-fixing.
- Detect structural defects including import cycles and layering violations that compromise maintainability.
How it works
- Repository scanning using
gitand optionalagent-contextCLI to map dependencies and commit history. - Signal gathering to measure how often files change and how many other modules depend on them.
- Scoring and tagging against a standardized model to label modules as
volatile,hub, oruntested. - Strategic classification to determine the single best first move for the next sprint.
Frameworks & tools
This skill works with any Git-managed repository. It leverages the optional ai-agent-context CLI for deep dependency graph analysis and symbol indexing, but falls back to git log and grep for environments where node-based tools are unavailable.
Why this beats prompting it yourself
Generic prompts often label complex code as "bad" without considering its business value or stability. This skill uses a formal scoring contract that prevents you from refactoring stable, load-bearing modules that don't actually need fixing.
Use cases
- Planning a refactoring sprint for a legacy repository with high churn.
- Identifying high-risk dependency hubs that require better test coverage.
- Onboarding to a new codebase and finding the most volatile components.
- Justifying technical debt work to stakeholders with evidence-based rankings.
Known limitations
Shallow Git clones limit churn analysis accuracy. Dependency mapping is most accurate when the agent-context CLI is available. The skill does not perform the actual refactors or edit code.
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scanned
Verified clean today
- Passed all security checks, Safe to install
Requires