refactor skill (github/awesome-copilot): small, behavior-safe code refactors
A refactoring guide that makes your agent clean up code in small steps without changing what it does.
- Installs
- 22.5K
- on skills.sh
- Stars
- 40.7K
- on GitHub
- Updated
- Oct 2026
- last repo commit
This refactor skill makes your agent improve code structure while keeping behavior the same. It triggers on requests like "clean up this code", "refactor this" or "improve this". The SKILL.md says it is gradual and less drastic than the repo-rebuilder skill.
It sets five golden rules, ten code smells with before and after examples, extract-method and typing walkthroughs, two design pattern refactors and a five-step process. It bundles no scripts. The examples are short JavaScript and TypeScript code samples.
Good for
- Developers cleaning up long functions, duplicated code and god classes
- Teams that want refactors in small, tested, committed steps
- Anyone moving untyped code toward typed code
Install refactor
Claude Code
- 1
Copy this prompt.
Install the refactor skill in Claude Code. Run this command: npx skills add https://github.com/github/awesome-copilot --skill refactor Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires Node.js.
From its listing on skills.sh. Source.
What's in the skill
When it loads
Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.
Sections in SKILL.md
- Overview
- When to Use
- Refactoring Principles
- The Golden Rules
- When NOT to Refactor
- Common Code Smells & Fixes
- 1. Long Method/Function
- 2. Duplicated Code
- 3. Large Class/Module
- 4. Long Parameter List
- 5. Feature Envy
- 6. Primitive Obsession
- 7. Magic Numbers/Strings
- 8. Nested Conditionals
- 9. Dead Code
- 10. Inappropriate Intimacy
Key facts
- Repository
- github/awesome-copilot (skills/refactor)
- Installs on skills.sh
- 22,465 as of 2026-11-02
- License
- MIT (as detected by GitHub)
- Last commit to the repo
- 2026-10-30
- What is inside
- 1 file (SKILL.md only)
What it includes
Keep behavior, small steps, version control, tests, one thing at a time
Without tests, the skill says you are editing, not refactoring.
Read ·
Five golden rulesWorking code that will not change, untested critical code, tight deadlines
Says to add tests first for critical production code without them.
Read ·
When not to refactorLong method, duplication, large class, long parameter list and more
Also feature envy, primitive obsession, magic numbers, nested conditionals, dead code and inappropriate intimacy. Each has a BAD and GOOD example.
Try: “Refactor this 200-line function into focused functions and add types.”
Write ·
Ten code smellsBefore and after for splitting a function and adding types
Walks through breaking one long function into extracted methods, and moving from untyped to fully typed code.
Write ·
Extract method and typingStrategy and Chain of Responsibility
Shows replacing conditional logic with a strategy, and nested validation with a chain.
Write ·
Design patternsPrepare, identify, refactor in small steps, verify, clean up
Ensure tests exist, commit, branch, change one thing, run tests, commit if they pass.
Runs code ·
Safe refactoring processQuality, structure, type safety and testing checks
Includes a table of 17 common refactoring operations from Extract Method to Replace Inheritance with Delegation.
Read ·
Checklist and operations table
From the official docs
Questions
What does the refactor skill do?
It makes your agent refactor code in small steps that keep behavior the same. It covers code smells, extract method, type safety and a few design patterns, with a checklist at the end.
How do I install it in Claude Code, the Claude app or Codex?
Use the install box at the top of this page. The awesome-copilot README describes the collection as customizations for GitHub Copilot, and the SKILL.md does not list other clients.
Which languages does it cover?
The SKILL.md's examples are JavaScript and TypeScript (the typing walkthrough uses TypeScript types and interfaces). Its rules are stated in general terms, so they apply to other languages, but there are no examples for them.
Does it run my tests?
It bundles no scripts. Its process tells the agent to run tests after each small change, so your project needs tests it can run. Without tests, the skill says to write them first.
How is it different from repo-rebuilder?
The SKILL.md describes itself as less drastic than repo-rebuilder and for gradual improvements. This page does not cover repo-rebuilder.
Is it safe to install?
It is one markdown file with no scripts. The risk is the code changes your agent makes. Commit before you start and review each diff, as the skill itself advises.
Information
updated Nov 2, 2026
- Repository
- github/awesome-copilot
- Folder
skills/refactor
Sources
Docs, issue trackers and discussions this page is built from.
Show all 2Hide
- refactor SKILL.md · github.com
- awesome-copilot README · github.com