Skip to content
Back to skills

Refactoring

ASecurity

Improves structure without behavior changes, using tests and focused slices; not for features unless behavior change is explicit.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
ai-agentsgorefactoringapi

Works with

  • api

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add Mesteriis/Engineering-Bible-AI --skill refactoring --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Refactoring?

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

Security grade badge for Refactoring
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mesteriis-refactoring/badge)](https://www.skillsdirectory.com/skills/mesteriis-refactoring)

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: refactoring
description: "Improves structure without behavior changes, using tests and focused slices; not for features unless behavior change is explicit."
---

# Skill: refactoring

## Purpose

Improve structure without changing behavior unless behavior change is explicitly requested.

## Refactoring Rules

- Refactor only when it serves the task.
- Identify behavior that must remain unchanged.
- Prefer small mechanical steps.
- Keep tests green between steps when possible.
- Do not mix broad refactoring with feature changes unless necessary.
- Do not rename public APIs casually.
- Do not move code across architectural boundaries without understanding dependencies.

## When Refactoring Is Justified

Refactoring is justified when it improves:

- correctness;
- maintainability;
- cohesion;
- boundary clarity;
- testability;
- safety;
- removal of duplication of knowledge;
- reduction of large/god files;
- isolation of infrastructure details.

## Large File Refactoring

For large files:

1. Identify responsibilities.
2. Identify public API surface.
3. Identify tests or behavior contracts.
4. Extract cohesive units.
5. Keep imports and dependency direction sane.
6. Validate after each meaningful slice.

Do not split files mechanically by line count. Split by responsibility.

## Safe Extraction Checklist

Before extraction:

- know callers;
- preserve public names or provide compatibility where required;
- avoid circular imports/dependencies;
- keep private helpers private;
- move tests or add tests for extracted behavior;
- preserve errors and logging behavior unless intentionally changed.

## Reporting

Report:

- behavior preserved;
- responsibilities extracted;
- files moved/changed;
- validation;
- risks.
## Extended References


For deeper refactoring work, read:

- `../../engineering/07_complexity_budget.md`
- `../../engineering/08_engineering_smells.md`
- `../../engineering/11_refactoring_catalog.md`

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…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.