codewithbehnam/cc-docs/refactor

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Refactor a target file, function, or module while preserving behavior. Runs tests before and after to verify correctness. Use when the user says "refactor this", "clean up", "improve this code", or "simplify this function".

Install

npx vskill@latest install codewithbehnam/cc-docs/refactor

SKILL.md

Refactor $ARGUMENTS while preserving all existing behavior:

  1. Establish a baseline:
  • Run the test suite and record the result: tests must be passing before you start
  • If tests are failing, stop and report - do not refactor broken code
  • Note which files are covered by tests
  1. Read and understand the target:
  • Read the file(s) mentioned in $ARGUMENTS
  • Identify code smells: long functions, deep nesting, duplication, unclear names, magic numbers, mixed abstraction levels
  • Read callers and dependencies to understand the full contract
  1. Plan the refactoring (do not modify files yet):
  • List the specific changes to make
  • Confirm none of them changes observable behavior (inputs/outputs, side effects, public API)
  • If a behavior change would improve things, note it separately and ask the user first
  1. Apply the refactoring in small, safe steps:
  • Rename for clarity
  • Extract repeated logic into named helpers
  • Flatten deep nesting using early returns
  • Replace magic values with named constants
  • Break large functions at natural seams
  • Preserve all existing public interfaces and function signatures
  1. Run tests after each significant step to catch regressions early
  1. Final verification:
  • Run the full test suite
  • All previously passing tests must still pass
  • No new failures allowed
  1. Report the result:
  • List what was changed and why
  • Show a diff summary
  • Note any follow-up improvements that would require behavior changes (flagged, not applied)

Requirements

  • Tests must be passing before refactoring begins
  • The target ($ARGUMENTS) must be a valid file, function name, or module path

Error Handling

  • If tests are failing before the refactor: stop and report, suggest fixing them first
  • If a refactoring step causes test failures: revert that step and try a safer approach
  • If no tests cover the target code: warn the user and ask whether to proceed or write tests first

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
2
Repository forks
1
7-day trend score
5

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/codewithbehnam/cc-docs/refactor/badge)](https://verified-skill.com/skills/codewithbehnam/cc-docs/refactor)

Something wrong with this skill or its page? Tell us.