# Clean Code Refactorer

> Skill for identifying code smells and refactoring code using Clean Code, SOLID, and DRY principles. Use when requested to "clean up", "refactor", or "improve quality" of backend code. Use when this capability is needed.

- Skill: `tomevault-io/clean-code-refactorer` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/clean-code-refactorer`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/clean-code-refactorer/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/clean-code-refactorer

---


# Clean Code Refactorer

## Overview

This skill provides a systematic approach to improving code quality without changing external behavior. It enforces SOLID principles and project-specific FastAPI standards.

## Refactoring Workflow

Follow this cycle for every refactoring task:

1.  **Observe**: Identify *code smells* (long functions, duplication, tight coupling).
2.  **Orient**: Read the **[Clean Code Rules](references/clean-code-rules.md)** to determine the best pattern to apply.
3.  **Validate (Pre)**: Run existing tests to ensure the current state is stable.
4.  **Act**: Apply surgical changes (extract method, rename variable, etc.).
5.  **Validate (Post)**: Execute the **`scripts/check_quality.sh`** to verify linters and tests.

## Standards & Principles

Refer to the following for detailed guidance:

-   **[Clean Code & SOLID Reference](references/clean-code-rules.md)**: Mandatory rules for naming, function size, and architectural layers.

## Examples

-   **User**: "This service function is too long, can you refactor it?"
-   **Agent**: *Reads the function, identifies logic that can be extracted to a helper, verifies tests pass, refactors, and runs quality checks.*

## Resources

-   `scripts/check_quality.sh`: Automates Ruff, Black, and Pytest validation.
-   `references/clean-code-rules.md`: Comprehensive guide for SOLID and Clean Code.

---
> Source: [fike/fastapi-blog](https://github.com/fike/fastapi-blog) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-19 -->

