# 07 Refactor

Improve code across four axes (cleanup, performance, security, architecture) by...

- Repository: https://github.com/ai-driven-dev/framework (542 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add ai-driven-dev/framework --skill 07-refactor -g -a claude-code -y`
Codex: `npx skills add ai-driven-dev/framework --skill 07-refactor -g -a codex -y`
Cursor: `npx skills add ai-driven-dev/framework --skill 07-refactor -g -a cursor -y`
Gemini CLI: `npx skills add ai-driven-dev/framework --skill 07-refactor -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add ai-driven-dev/framework`

## Description

Improve code across four axes (cleanup, performance, security, architecture) by scanning and fixing, or applying a pushed audit report. Use when the user wants to refactor, optimize, harden, or remove code. Not for read-only diagnosis or adding tests.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Skill: refactor

The act-side of code improvement: it changes code to make it better. Behavior-preserving for cleanup, performance, and architecture; security may change behavior on purpose to close a hole.

## Actions

| #   | Action         | Axis         | Lens                                                       |
| --- | -------------- | ------------ | ---------------------------------------------------------- |
| 01  | `performance`  | performance  | N+1, hot paths, batching, memoization, unnecessary I/O      |
| 02  | `security`     | security     | OWASP, input validation, authz, secrets: harden and fix    |
| 03  | `cleanup`      | code-quality | clean code: rename, extract, DRY, dead code, complexity     |
| 04  | `architecture` | architecture | extract layers, fix coupling, enforce boundaries            |

Run the one axis named, or offer all applicable when the request is unscoped.
Before running an action, read its file in `actions/`, not only the table or assets.

## Transversal rules

The rest: https://github.com/ai-driven-dev/framework/blob/HEAD/plugins/aidd-dev/skills/07-refactor/SKILL.md
