refactor

refactor is a skill for Codex from dayfinggg/openai-codex-agent-skills. It costs 52 tokens per session (379 once invoked), scanned A, original, MIT.

A workflow for improving the structure of existing code while preserving its observable behavior, meaning what users and other code can see. It focuses on simplifying modules, removing duplication, and making boundaries and names clearer.

In plain words
What is it for?
Use it to consolidate duplicated logic, simplify modules, clarify interfaces, remove unnecessary layers, and verify that a cleanup did not alter behavior.
Why use it?
It reduces the amount of code and mental effort needed to understand or change a system without intentionally changing its contract. It also encourages focused checks before and after each structural change.

Skill for Codex

Written for Codex: agents/openai.yaml present.

Good fit Use it to consolidate duplicated logic, simplify modules, clarify interfaces, remove unnecessary layers, and verify that a cleanup did not alter behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dayfinggg/openai-codex-agent-skills/refactor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add dayfinggg/openai-codex-agent-skills --skill refactor
Clone the repo
git clone --depth 1 https://github.com/dayfinggg/openai-codex-agent-skills

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/dayfinggg/openai-codex-agent-skills/refactor/github.svg)](https://agentmods.dev/skills/dayfinggg/openai-codex-agent-skills/refactor)
Your own site
<a href="https://agentmods.dev/skills/dayfinggg/openai-codex-agent-skills/refactor"><img src="https://agentmods.dev/badge/skills/dayfinggg/openai-codex-agent-skills/refactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/dayfinggg/openai-codex-agent-skills/refactor"><img src="https://agentmods.dev/badge/skills/dayfinggg/openai-codex-agent-skills/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 379 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.00379
Opus 5 $0.00026 $0.00189
Sonnet 5 $0.00010 $0.00076
Haiku 4.5 $0.00005 $0.00038

Measured 2d ago against content hash 3bfab4f4cfcf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

codex/skills/refactor/SKILL.md · 33 lines

What it actually says

Refactor

Follow the governing instructions and the user's requirements for communication, code style, authorization, and delegation. This skill supplies task-specific guidance, not permission to expand the task. Its workflow and output fields describe internal checks and relevant content, not a mandatory response layout or a progress report. When used within broader authorized work, continue that work through completion rather than stopping to deliver this skill's intermediate result.

Improve the shape of the code without changing its contract.

Fix the invariant

Identify the observable behavior, public interfaces, performance constraints, and compatibility properties that must remain unchanged. Establish a passing focused test or another reliable baseline before editing.

Find the load

Locate duplicated decisions, scattered state, shallow wrappers, hidden mutation, misleading names, weak types, and boundaries that force readers to cross many files. Prefer deletion, consolidation, and narrower interfaces over new layers.

Change incrementally

Make one structural move at a time and rerun the focused checks. Preserve callers unless the request includes an interface migration. Do not mix unrelated formatting or feature changes into the refactor.

Within code already touched by the authorized refactor, make a small verified clarity improvement or remove local dead code when doing so reduces reader load. Do not use this as permission for adjacent cleanup or a repository-wide "boy scout" pass.

Verify

Compare behavior and public surfaces before and after. Inspect the diff for accidental semantic changes and run broader checks based on the affected dependency graph.

Output

Report the structural problem removed, the invariant preserved, the material simplification, and the evidence that behavior did not change.

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago Changed · +2 lines 3bfab4f4cfcf
  2. 3d ago Changed · +2 lines ae09bc5fc655
  3. 8d ago First seen · 29 lines · 52 tokens per session scan A 7755b665042f

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository dayfinggg/openai-codex-agent-skills (4 stars, last pushed 3d ago), licensed MIT. It adds 52 tokens to every session and 379 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

code-review-excellence

This skill should be used when the user asks to review a diff or pull request, write review comments, audit code quality, establish review standards, or improve how a team performs code review.

Galaxy-Dawn/claude-scholar · 43 tokens

git-workflow

This skill should be used when the user asks to "create git commit", "manage branches", "follow git workflow", "use Conventional Commits", "handle merge conflicts", or asks about git branching strategies, version control best practices, pull request workflows. Provides comprehensive Git workflow guidance for team…

Galaxy-Dawn/claude-scholar · 64 tokens

architecture-design

Use only when creating new registrable ML components that require Factory or Registry patterns.

Galaxy-Dawn/claude-scholar · 19 tokens

results-analysis

This skill should be used when the user asks to "analyze experimental results", "run strict statistical analysis", "compare model performance", "generate scientific figures", "check significance", "do ablation analysis", or mentions interpreting experiment data with rigorous statistics and visualization. It focuses on…

Galaxy-Dawn/claude-scholar · 68 tokens

review-response

Systematic review response workflow from comment analysis to professional rebuttal writing. Use when the user asks to "write rebuttal", "respond to reviewers", "draft review response", or "analyze review comments". Improves paper acceptance rates.

Galaxy-Dawn/claude-scholar · 51 tokens

daily-paper-generator

Use when the user asks to generate daily paper digests on a general topic. This skill supports both arXiv and bioRxiv (or either one), then produces structured Chinese/English summaries for selected papers.

Galaxy-Dawn/claude-scholar · 47 tokens