Skip to content
Skills Library
Programming · Building & coding

refactor

/refactor

Use when simplifying or restructuring existing code while preserving observable behavior and staying within an agreed scope.

Repository
skills ↗
Licence
MIT
Last repository change
12.11.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 12.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when simplifying or restructuring existing code while preserving observable behavior and staying within an agreed scope.

Original author description

Use when simplifying or restructuring existing code while preserving observable behavior and staying within an agreed scope.

How it works

  1. Understand and bound the work
  2. Establish evidence and improve
  3. Verify the result
Original SKILL.md headings · 24 lines, 441 words
SKILL.md preview
---
name: refactor
description: "Use when simplifying or restructuring existing code while preserving observable behavior and staying within an agreed scope."
---

# Refactor

Improve the target code with the smallest complete, evidence-backed change. Preserve its intended behavior and the project's conventions; clarity and correctness matter more than minimizing lines.

## Understand and bound the work

1. Use [adapt](../adapt/SKILL.md) to understand the target, its purpose, connected behavior, project patterns and the human's constraints. Reuse a current orientation when it covers the same scope. Inspect callers, inputs, outputs, side effects, errors, ordering, validation and existing checks relevant to the change. Preserve the human's existing work.
2. Define the requested scope, structural improvement and observable behavior to preserve. Route consequential system boundary decisions to [Architect](../architect/SKILL.md) and performance targets to the [measured improvement method](../../references/MeasuredImprovement.md). Obtain the human's direction if the change requires a product rule or public behavior to change.
3. When the required development or verification environment is unknown or blocked, use [Preflight](../preflight/SKILL.md) to assess it. Reuse existing readiness evidence when current. Follow its confirmation requirements for installations, environment changes and inferior fallbacks.

## Establish evidence and improve

4. Choose the most efficient reliable way to establish the relevant behavior before changing it. Use an existing focused check or reproduction when sufficient; add a meaningful targeted characterization check when important behavior is untested and at risk. Do not add tests solely because a refactor occurred. Include relevant edge cases and project-required checks. Record any baseline failure or unavailable verification rather than treating it as a pass.
5. Choose a simple approach that addresses the actual problem. Reuse existing facilities, remove unnecessary complexity and duplication where doing so improves clarity, and make coherent, reviewable changes. Avoid unrelated cleanup, speculative abstractions or new dependencies. Preserve necessary validation, error handling, security, accessibility and externally observable behavior.
6. If orientation or verification reveals a defect or unexpected failure, use [debug](../debug/SKILL.md) to investigate the evidence and cause. Repair it only when the human's request or existing authorization covers the fix; report unrelated defects and keep the refactor within scope. Do not stack guesses onto a failing change.

## Verify the result

7. Use [Test](../test/SKILL.md) for focused behavior and required project checks. Compare with the baseline, including public inputs, outputs, errors and side effects. Use [Critique](../critique/SKILL.md) when an artifact's qualitative result needs assessment; a cleaner structure alone does not establish a speedup.
8. Inspect the full affected diff and relevant surrounding code. Confirm the change stays within the requested scope and has not shifted complexity or changed behavior unintentionally. Recheck after material corrections; report actual checks and results, baseline failures, remaining risks and anything that could not be verified.

**Done:** The requested code is improved within scope, the intended behavior is supported by appropriate evidence, and any verification gaps are explicit.
Files in this package (2)
  • SKILL.md 3 KB
  • agents/openai.yaml 1 KB

Versions

RepositoryScoreLicence
This page · nazmirket/skills90MIT
froglet-studio/cosmic-shore100MIT
mgiovani/cc-arsenal100MIT
jongio/skills100MIT
boshu2/agentops100Apache-2.0
y-miyazaki/terraform-aws-base100Apache-2.0
mickeyyaya/evolve-loop100Apache-2.0
j0hanz/j0hanz-marketplace100MIT
kriscard/kriscard-claude-plugins100MIT

Database snapshot: 13.11.2026 · package version f662a460b634 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90safe-refactor-pass
    Use when restructuring or simplifying code without changing behavior, removing AI slop, or writing a refactor plan. Not for repeated mechanical edits across many files (sweep-rewriter).
  • 95oma-refactor
    Restructure existing code while preserving observable behavior. Use for targeted technical debt or hotspot work with characterization tests.
  • 100oma-refactor
    Restructure existing code while preserving observable behavior. Use for targeted technical debt or hotspot work with characterization tests.
  • 90simplifier
    Expertise in simplifying and refining code for clarity, consistency, and maintainability while preserving all functionality. Use when the user asks to "simplify code", "refactor for clarity", or "clean up this file".
  • 100test-preserving-refactor
    Use when code needs restructuring and observable behavior must stay unchanged, with existing tests kept green at every step.
  • 100debloat
    Use when reviewing or simplifying code, tests, prose, or repository gates while preserving public behavior, typing, performance, and project conventions.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.