Skip to content
Back to skills

Refactor

ASecurity

Scan the project for refactoring opportunities, then fix them. No behavior/visual changes.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 5, 2026
code-qualitygorefactoringapi

Works with

  • api

Security analysis

A100/100

Scanned October 5, 2026

npx -y skills add im9/inboil --skill refactor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Refactor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Refactor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/im9-refactor/badge)](https://www.skillsdirectory.com/skills/im9-refactor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: refactor
description: Scan the project for refactoring opportunities, then fix them. No behavior/visual changes.
---

# Refactor

Identify and fix code quality issues across the project without changing behavior, visuals, or public API.

## Constraints

- NEVER change behavior, visuals, or public API
- NEVER add new dependencies
- NEVER add features or functionality
- Run `pnpm check` after all changes to verify no type errors were introduced

## Phase 1: Scan (read-only, use Agents for token efficiency)

Launch an Explore agent to scan `src/` for issues in these categories:

1. **Dead code**: unused imports, unreachable branches, commented-out code, unused exports
2. **Oversized components**: `.svelte` files > 300 lines that mix unrelated concerns and could be split (skip files with a `// NOTE: Large file by design` comment — these have been reviewed and deemed unsplittable)
3. **Redundant state**: `$state` that duplicates or could be `$derived` from other state
4. **Copy-paste**: near-duplicate code blocks across files that should share a helper
5. **Bug risks**: unguarded async, missing cleanup, event listener leaks, race conditions
6. **Inefficiency**: unnecessary re-computation, work in hot paths, unbounded allocations

Skip lines marked with `// REFACTOR-OK: <reason>` — these have been reviewed and intentionally kept as-is.

Output a numbered list of findings with file paths and line numbers, sorted by severity (high → low). Do NOT fix anything yet.

## Phase 2: User approval

Present the findings list to the user. Ask which items to fix (e.g. "all", specific numbers, or "skip"). Wait for the user to respond before proceeding.

## Phase 3: Fix approved items

Fix only approved items, one at a time. After all fixes, run `pnpm check` to verify.

Briefly summarize what was changed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…