0 Refactor Advisor

    2

    Transform technical debt into a prioritized roadmap with professional-grade refactoring reports.

    Free

    8 usesSecurity scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    0-refactor-advisor

    Example session with this skill installed

    // userService.js
    async function processUser(u, t, r, adminKey) {
      if (adminKey === 'secret_key_2024') {
        if (u && u.email && u.email.includes('@')) {
          const db = require('./db');
          const existing = await db.query(`SELECT * FROM users WHERE email='${u.email}'`);
          if (existing.length === 0) {
            await db.query(`INSERT INTO users (email, type, role) VALUES ('${u.email}', '${t}', '${r}')`);
            console.log('user created');
            // TODO: send welcome email
            const db2 = require('./db');
            await db2.query(`UPDATE stats SET user_count = user_count + 1 WHERE id=1`);
          } else {
            console.log('user exists');
          }
        }
      }
    }
    
    • Read your context and instructions
    • Compiled the 0-refactor-advisor

    REFACTOR ADVISOR REPORT
    ════════════════════════════════════════
    File/Module: userService.js — processUser()
    Language: JavaScript (Node.js)
    Lines: ~20
    ════════════════════════════════════════

    TECHNICAL DEBT SCORE: 8/10
    Smells found: 7 total (3 critical · 3 medium · 1 low)

    QUICK WINS (each < 15 min)
    ────────────────────────────

    1. Line 2 — Magic String — extract 'secret_key_2024' to process.env.ADMIN_KEY
    2. Line 13 — Dead Code — remove duplicate const db2 = require('./db'); use existing db
    3. Line 1 — Poor Naming — rename u→user, t→type, r→role

    PRIORITY REFACTORS
    ──────────────────────────────────────────────────────
    #1 Severity: CRITICAL
    Smell: SQL Injection (Magic String in query)
    Location: Lines 6, 8, 10 — template literals inside db.query()
    Problem: String interpolation in SQL queries is not escaped. An attacker controlling
    u.email can exfiltrate or destroy the database.
    Fix: Replace with parameterized queries:

                  db.query('SELECT * FROM users WHERE email = $1', [user.email])
    [... abbreviated ...]
    

    Connects securely to your tools. The creator never sees your data.

    About this skill

    High-Level Code Quality Analysis

    Refactor Advisor is a specialized developer tool designed to bridge the gap between "working code" and "clean code." It acts as a deep-scanning auditor that identifies technical debt, structural flaws, and security risks using industry-standard patterns like SOLID principles and Martin Fowler’s refactoring catalog.

    What it does

    Unlike generic AI prompts, this skill applies a strict heuristic framework to your codebase. It categorizes issues from "Poor Naming" to "God Classes," calculates a quantitative Technical Debt Score, and identifies "Quick Wins" that provide immediate value with minimal risk.

    • Detailed Auditing: Scans for 10+ specific code smells including Feature Envy, Deep Nesting, and Magic Numbers.
    • Prioritized Reporting: Ranks issues by severity (Critical/Medium/Low) so you know exactly where to start.
    • Risk Management: Explicitly flags when a refactor requires "Tests First" to prevent silent regressions.
    • Framework Agnostic: Works across any language or environment, from legacy Node.js monoliths to modern Python microservices.

    Why use this skill

    Prompting a standard AI to "make my code better" often results in subjective style changes or dangerous rewrites. Refactor Advisor provides a structured report with exact line ranges and concrete transformation steps, ensuring that code quality is improved without breaking existing contracts or introducing security vulnerabilities like SQL injection.

    Small file with no smells found (< 20 lines, clean code):: Generated code (ORM migrations, protobuf stubs, gRPC generated files): Identify the file as generated at the top of the report, mark all smell ratings as N/A, and only flag issues if it's clear that manual edits were made inside the generated section.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    8 uses

    Times used to date

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 6 months ago

    • Free with an Agensi account

    Permissions

    Write Files
    Read Files
    Listed6 months ago

    What's inside

    Frequently Asked Questions

    Refactor Advisor performs a heuristic audit of your code to identify specific 'code smells' and architectural flaws, providing a prioritized roadmap rather than just subjective style changes.

    The tool is framework-agnostic and supports virtually any programming language, making it equally effective for legacy monoliths and modern microservices.

    The skill delivers a structured report featuring a quantitative Technical Debt Score, prioritized issue rankings (Critical/Medium/Low), and step-by-step refactoring instructions.

    Simply provide the skill with the relevant code snippets or files; it will immediately begin its multi-point analysis based on SOLID principles and industry standards.

    Yes, the advisor identifies 'Critical' issues and 'Tests First' scenarios to ensure you address high-risk security vulnerabilities and structural flaws without causing regressions.

    You receive full access to the current version of the Refactor Advisor skill, including its specialized heuristic framework and reporting templates for use with your AI agent.

    New in Code Quality & Review