Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

code-quality

FreeRuns bundled scriptsNot checked

two-stage review (spec compliance first, then code quality), refactoring, and quality improvement. Use when reviewing code, eliminating code smells, reducing…

PracticalSwanby PracticalSwan★ 25 GitHub stars

About this skill

Code Quality Management

Comprehensive skill for improving code quality through two-stage review (spec compliance first, then code quality), surgical refactoring, and self-evaluation loops.

  • Leverage native parallel subagent dispatch and 200k+ context windows where available.

Activation Conditions

Use symptom -> action triggers: when one matches, apply this skill and verify with the protocol below.

two-stage review (spec compliance first, then code quality):

  • Performing two-stage reviews (spec compliance first, then code quality), analyzing pull requests
  • Checking code quality, security auditing, performance reviews
  • Examining code for bugs, vulnerabilities, best practices violations
  • "Review code", "check for issues", "audit code", "analyze PR"

Refactoring:

  • Code is hard to understand or maintain
  • Functions/classes are too large, code smells need addressing
  • Adding features is difficult due to code structure
  • User asks "clean up this code", "refactor this", "improve this"

Self-Evaluation:

  • Implementing self-critique and reflection loops for agent outputs
  • Building evaluator-optimizer pipelines for quality-critical generation
  • Creating test-driven code refinement workflows
  • Designing rubric-based or LLM-as-judge evaluation systems
  • Adding iterative improvement to agent outputs (code, reports, analysis)
  • Measuring and improving agent response quality

Part 1: two-stage review (spec compliance first, then code quality)

Review Priorities

When performing a two-stage review (spec compliance first, then code quality), prioritize issues in this order:

🔴 CRITICAL (Block merge)

  • Security: Vulnerabilities, exposed secrets, authentication/authorization issues
  • Correctness: Logic errors, data corruption risks, race conditions
  • Breaking Changes: API contract changes without versioning
  • Data Loss: Risk of data loss or corruption

🟡 IMPORTANT (Requires discussion)

  • Code Quality: Severe violations of SOLID principles, excessive duplication
  • Test Coverage: Missing tests for critical paths or new functionality
  • Performance: Obvious performance bottlenecks (N+1 queries, memory leaks)
  • Architecture: Significant deviations from established patterns

🟢 SUGGESTION (Non-blocking improvements)

  • Readability: Poor naming, complex logic that could be simplified
  • Optimization: Performance improvements without functional impact
  • Best Practices: Minor deviations from conventions
  • Documentation: Missing or incomplete comments/documentation

Review Principles

  1. Be specific: Reference exact lines, files, and provide concrete examples
  2. Provide context: Explain WHY something is an issue and potential impact
  3. Suggest solutions: Show corrected code when applicable, not just what's wrong
  4. Be constructive: Focus on improving code, not criticizing the author
  5. Recognize good practices: Acknowledge well-written code and smart solutions
  6. Be pragmatic: Not every suggestion needs immediate implementation
  7. Group related comments: Avoid multiple comments about the same topic

Part 2: Refactoring

The Golden Rules

  1. Behavior is preserved - Refactoring doesn't change what code does, only how
  2. Small steps - Make tiny changes, test after each
  3. Version control is your friend - Commit before and after each safe state
  4. Tests are essential - Without tests, you're not refactoring, you're editing
  5. One thing at a time - Don't mix refactoring with feature changes

When NOT to Refactor

  • Code that works and won't change again (if it ain't broke...)
  • Critical production code without tests (add tests first)
  • When you're under a tight deadline
  • "Just because" - need a clear purpose

Refactoring Techniques

Extract Method

// Before
function processOrder(order) {
    if (order.status === 'pending') {
        // 20 lines of validation logic
        // 15 lines of calculation logic
        // 10 lines of notification logic
    }
}

// After
function processOrder(order) {
    if (order.status === 'pending') {
        validateOrder(order);
        calculateTotals(order);
        sendNotification(order);
    }
}

Rename Variable/Function

Use meaningful names that describe purpose:

// Before
const d = new Date();
process(v, u);

// After
const currentDate = new Date();
processValidation(validatedValue, userId);

Extract Class

// Before
function calculateCartTotal(cart, user, shippingMethod, taxRate) {
    // Complex logic mixing user details, cart items, shipping, tax
}

// After
class OrderCalculator {
    constructor(cart, user) {
        this.cart = cart;
        this.user = user;
    }

    calculate(shippingMethod, taxRate) {
        const subtotal = this.calculateSubtotal();
        const shipping = this.calculateShipping(shippingMethod);
        const tax = this.calculateTax(taxRate);
Full SKILL.md on GitHub

Install code-quality in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

CHANGELOG.mdLICENSE.txtexamples/refactoring-walkthrough.mdreferences/code-smells.mdreferences/refactoring-catalog.mdscripts/review-checklist.py

FAQ

What does the code-quality skill do?

two-stage review (spec compliance first, then code quality), refactoring, and quality improvement. Use when reviewing code, eliminating code smells, reducing technical debt, refactoring methods, running self-critique loops, or improving maintainability and readability.

How do I install the code-quality skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the code-quality skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare code-quality with