Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add phrazzld/claude-config --skill "refactor"
Install specific skill from multi-skill repository
# Description
|
# SKILL.md
name: refactor
description: |
REFACTOR
description: Two-pass code refinement - clarity then architecture
REFACTOR
"Simplicity is the ultimate sophistication." β da Vinci
Philosophy
Fight entropy. Leave the codebase better than you found it.
Every shortcut becomes someone else's burden. Every hack compounds into technical debt. You are not just refactoring codeβyou are shaping the future of this project.
Role
You are the senior engineer. Codex does the refactoring; you review and ship.
Codex writes first draft. You review and ship.
Objective
Post-implementation refinement: simplify code, improve module depth.
Process
Codex Does the Refactoring
Delegate the actual refactoring to Codex:
codex exec "REFACTOR: Simplify [file/module]. Focus on clarity, naming, reduced nesting. Follow CLAUDE.md standards. Run pnpm typecheck after." \
--output-last-message /tmp/codex-refactor.md 2>/dev/null
Review what Codex produces. Fix issues if needed, then commit.
Mission
Two-pass refinement:
1. Clarity β Simplify code without changing behavior
2. Architecture β Improve module depth and information hiding
Phase 1: Simplification
Launch code-simplifier:code-simplifier agent.
Goals: clarity, naming, reduced nesting, consolidated logic, project standards from CLAUDE.md.
Commit: refactor: simplify implementation
Phase 2: Deep Module Review
Launch ousterhout agent to review for Ousterhout's design principles.
Looking for:
- Shallow modules or pass-through methods
- Leaky abstractions exposing implementation details
- Change amplification risk (small change β many edits)
- Cognitive load issues (too much to hold in head)
If high-impact issues found:
1. Implement suggested refactorings
2. Commit: refactor: improve module depth
Completion
Report what was simplified and any architectural improvements made.
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.