refactor
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.
Installation
Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.
Voir la source ↗GuidesInstructions
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.
Exemples
Consultez les exemples du dépôt source.
Voir la source ↗Historique source
- Date d’indexation
- 2026-03-11
- Mise à jour de l’index
- 2026-03-11
- Branch
- main
Les dates concernent ce répertoire. Consultez le dépôt pour l’historique du code.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!