refactor | Skill Performance & Reviews | TopRankSkills

TopRank Skills

Home / Skills / tools / refactor

refactor

maintained by myobie

star 7 account_tree 0 verified_user MIT License
bolt View GitHub

name: refactor description: Use Codex CLI to refactor a module, file, or code pattern. Use when you want an independent take on how to restructure complex or tangled code.

Codex Refactor

Use Codex CLI to analyze code and apply a refactor.

1) Build the prompt

From the user's request, construct a prompt for Codex that includes:

  • The target (file, module, pattern, or concept to refactor)
  • The goal (simplify, extract, decouple, rename, restructure, etc.)
  • Any constraints (preserve API, maintain backwards compat, etc.)

2) Run Codex

Log output to a tmp directory:

CODEX_DIR="$(mktemp -d)/codex-refactor"
mkdir -p "$CODEX_DIR"
codex --sandbox danger-full-access -a never exec "$PROMPT" | tee "$CODEX_DIR/refactor.log"

3) Follow response contract

Structure the response as:

  • Current state — what the code looks like now and why it's problematic
  • Changes applied — what was changed, with file paths and line references
  • Trade-offs — what improves, what gets more complex, what might break

After Codex finishes, review the changes and run tests to verify nothing broke.

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!

Skill Details

GitHub Stars 7
GitHub Forks 0
Created Mar 2026
Last Updated 3 months ago
tools tools automation tools

Related Skills

specs-gen
chevron_right
glm-coding-agent
chevron_right
creating-pr
chevron_right
writing-skills
chevron_right
reviewing-pr
chevron_right

Build your own?

Join 12,000+ developers contributing to the Claude ecosystem.