refactor
Safe, systematic refactoring workflow — same behavior, better structure
Skill by Hbin77
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/hbin77-refactor
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: productivity
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/refactor
What's inside
- Skill name
refactor- Description
- Safe, systematic refactoring workflow — same behavior, better structure
- License
- MIT
- Instructions
- 67 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
Execute a safe, systematic refactoring workflow on the target scope. Task: the task/scope the user described when invoking this skill (if none given, ask or infer from context) ## Phase 1: Analysis Do the analysis yourself: - **Code smells** (see `~/.codex/skills/code-smells`): long functions, deep nesting, duplication, large classes, long parameter lists, feature envy, primitive obsession, dead code. - **Dependencies & coupling**: map module dependency direction, identify tight coupling and leaf vs core modules. Synthesize into a unified findings list. ## Phase 2: Refactoring Plan Present findings with severity ratings. Create a **safe refactoring order** based on: 1. Dependency direction (leaf modules first, core last) 2. Test coverage (well-tested first; untested code needs characterization tests first) 3. Risk level (pure functions → utilities → business logic → public API) Each step specifies: target file(s), smell addressed, refactoring pattern (Extract Method, Move Function, Replace Conditional with Polymorphism, etc.), and that behavior MUST remain identical. **Wait for user approval before proceeding.** ## Phase 3: Test Baseline 1. Run the full test suite → record baseline pass count. 2. If no tests exist for target code, write characterization tests first. 3. Store baseline: `build PASS | lint PASS | test X/Y PASS`. ## Phase 4: Execution For each approved step: 1. Apply ONE refactoring pattern at a time. 2. Run build + lint + test immediately after. 3. Tests fail → revert that step and report. Never fix forward. 4. Tests pass → commit atomically (`refactor(scope): pattern applied`) → next step. Execute sequentially in leaf → root order (dependent modules strictly sequential). ## Phase 5: Verification Run full build + lint + full test suite. Compare test count: baseline vs current (must be equal or greater). Distinguish failure cause: - **Breakage caused by a refactoring step** (green before, now fails) → revert that step immediately. - **Pre-existing failures or environment/build issues unrelated to the refactor** → fix separately (root-cause, minimal diffs), don't revert refactoring. ## Phase 6: Review Review the refactoring yourself: verify (1) no behavior changes, (2) improved structure, (3) no regressions. ## Phase 7: Report ``` ## Refactoring Report ### Before → After | Metric | Before | After | | Files changed / Lines removed / Lines added / Avg function length / Max nesting / Test count | ### Applied Refactorings | # | Pattern | Target | Result | ### Smells Resolved - [x] ... ### Remaining (deferred) - [ ] ... — reason ### Verification Build: PASS | Lint: PASS | Tests: X/Y PASS ``` ## Rules - NEVER change behavior. Refactoring = same behavior, better structure. - ONE pattern per commit — easy to revert. - TEST FIRST. No refactoring without a green baseline. - If a step breaks a previously-green test, revert that step immediately — don't fix forward. - Don't refactor code you don't understand. Read it first. - Preserve public API unless the user explicitly approves breaking changes.
From Hbin77/codex-kit, MIT.
More from Hbin77/codex-kit
- 0.518score
plan
Hbin77
Analyze the project and produce a detailed implementation plan
SkillBFreshness: BClaude Code +9 - 0.518score
qa
Hbin77
Browser QA — automation, accessibility audit, user flow verification
SkillBFreshness: BClaude Code +9 - 0.518score
retro
Hbin77
Run a sprint/session retrospective to capture what worked, what didn't, and what to improve.
SkillBFreshness: BClaude Code +9 - 0.518score
design-audit
Hbin77
Audit UI code against ui-ux-pro-max UX guidelines; report by severity
SkillBFreshness: BClaude Code +9 - 0.518score
code-smells
Hbin77
Analyze code for smells, anti-patterns, and refactoring opportunities.
SkillBFreshness: BClaude Code +9 - 0.518score
guard
Hbin77
Activate safety guard mode — restrict edit scope, confirm destructive ops
SkillBFreshness: BClaude Code +9 - 0.518score
design-system
Hbin77
Generate a MASTER design system using the ui-ux-pro-max skill
SkillBFreshness: BClaude Code +9 - 0.518score
dev
Hbin77
Full sequential dev pipeline — understand, plan, implement, verify, review
SkillBFreshness: BClaude Code +9 - 0.518score
explore
Hbin77
Explore and explain the project's architecture and structure
SkillBFreshness: BClaude Code +9 - 0.518score
extract-errors
Hbin77
Parse and analyze error logs, stack traces, and build output to identify and fix issues.
SkillBFreshness: BClaude Code +9 - 0.518score
investigate
Hbin77
Systematically diagnose a bug via structured root cause analysis
SkillBFreshness: BClaude Code +9 - 0.515score
browse
Hbin77
Open a URL in a headless browser, screenshot, and report
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 7, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Hbin77/codex-kit
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Hbin77
- 0.518score
explore
Hbin77
Explore and explain the project's architecture and structure
SkillBFreshness: BClaude Code +9 - 0.518score
extract-errors
Hbin77
Parse and analyze error logs, stack traces, and build output to identify and fix issues.
SkillBFreshness: BClaude Code +9 - 0.518score
design-system
Hbin77
Generate a MASTER design system using the ui-ux-pro-max skill
SkillBFreshness: BClaude Code +9 - 0.518score
dev
Hbin77
Full sequential dev pipeline — understand, plan, implement, verify, review
SkillBFreshness: BClaude Code +9 - 0.518score
code-smells
Hbin77
Analyze code for smells, anti-patterns, and refactoring opportunities.
SkillBFreshness: BClaude Code +9 - 0.518score
investigate
Hbin77
Systematically diagnose a bug via structured root cause analysis
SkillBFreshness: BClaude Code +9
Cite this page
refactor skill. Agent Mart. https://agentmart.dev/skills/hbin77-refactor (last updated 2026-10-24)