refactor-agents-md

refactor-agents-md is a skill for Claude Code, Codex from vinta/hal-9000. It costs 22 tokens per session (716 once invoked), scanned A, original, MIT.

A guide for reorganising an AGENTS.md file, which gives coding agents instructions for a user account or project. It moves narrow rules to more suitable locations and keeps only guidance that affects the agent's behaviour.

In plain words
What is it for?
Use it to review and restructure user-level, project-level, or nested AGENTS.md files. It checks each instruction and can move guidance into a closer scope or reusable skill.
Why use it?
It reduces the amount of repeated or irrelevant guidance loaded into every coding session. It also helps ensure that rules apply at the right project or folder level.

Skill for Claude CodeCodex

Part of the skills plugin — 10 skills shipped together

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.

agentmods
npx agentmods add skills/vinta/hal-9000/refactor-agents-md
Any agent
npx skills add vinta/hal-9000 --skill refactor-agents-md
Clone the repo
git clone --depth 1 https://github.com/vinta/hal-9000

Made for: Claude Code, Codex.

Or install skills, the plugin that ships this one along with the rest of its 10 skills.

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-agents-md

README.md
[![agentmods](https://agentmods.dev/badge/skills/vinta/hal-9000/refactor-agents-md.svg)](https://agentmods.dev/skills/vinta/hal-9000/refactor-agents-md)
Your own site
<a href="https://agentmods.dev/skills/vinta/hal-9000/refactor-agents-md"><img src="https://agentmods.dev/badge/skills/vinta/hal-9000/refactor-agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 716 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00022 $0.00716
Opus 5 $0.00011 $0.00358
Sonnet 5 $0.00004 $0.00143
Haiku 4.5 $0.00002 $0.00072

Measured 5d ago against content hash 32d32030c03d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refactor-agents-md 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 5d 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.

skills/refactor-agents-md/SKILL.md · 37 lines

How it starts

The opening of the file, as written. The whole thing — 37 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Refactor AGENTS.md

Refactor an AGENTS.md toward progressive disclosure. Every retained line enters each Codex session in its scope, so it must earn that attention. Move narrower guidance to the closest applicable scope or a reusable skill, and remove instructions that do not change behavior.

Instructions

  1. Pick the target. Use a target named by the invocation. Otherwise ask the user to choose among the files that exist:

    • The user-level file at $CODEX_HOME/AGENTS.md, defaulting to ~/.codex/AGENTS.md when CODEX_HOME is unset.
    • The current project's root AGENTS.md.
    • Any nested AGENTS.md on the path from the project root to the current working directory.
  2. Fetch the yardsticks. Fetch these pages to calibrate the audit:

  3. Audit. Read the target and applicable broader AGENTS.md files. Give every instruction in the target exactly one verdict against the target's bar below. Finish only when every instruction has a verdict.

    • contradiction: conflicts with another applicable instruction. Record both instructions and their source files.
    • delete: fails the no-op test because Codex would behave the same without it. This includes default behavior, vague directions, and platitudes such as "write clean code."
    • demote: changes behavior but applies only to a narrower directory or task. Choose and name its destination. Put directory-specific guidance in the closest nested AGENTS.md; put a multi-step task workflow in a skill; put reference material in a linked document.
    • rewrite: has the right scope and meaning, but its phrasing falls short of the fetched prompting guidance.
    • keep: earns its always-loaded cost as written.

    Apply the bar for the target:

    • User-level: a keep must apply across all projects. Demote project or directory guidance to the applicable project's AGENTS.md, and task workflows to skills.
    • Project or nested: a keep must apply to every task and file in the target directory's subtree and be underivable from the repository. Keep concise project context, commands Codex would otherwise guess wrong, domain concepts, constraints, and gotchas. Delete restatements of the code and volatile inventories such as file trees. Demote narrower guidance to a closer nested AGENTS.md, a linked document, or a skill.

Read the full file on GitHub · 37 lines

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. 5d ago First seen · 37 lines · 22 tokens per session scan A 32d32030c03d

Subscribe to this mod's changes

refactor-agents-md is a skill published in the GitHub repository vinta/hal-9000 (125 stars, last pushed 7d ago), licensed MIT. It adds 22 tokens to every session and 716 once invoked, about $0.0001 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-30.

Related

Other skills, from other repositories

configure-nightwatch

Configures Laravel Nightwatch data collection, sampling rates, filtering rules, and redaction policies. Use when setting up Nightwatch, managing data volume, protecting sensitive data (PII), or optimizing event collection for production workloads.

coollabsio/coolify · 49 tokens

laravel-actions

Build, refactor, and troubleshoot Laravel Actions using lorisleiva/laravel-actions. Use when implementing reusable action classes (object/controller/job/listener/command), converting service classes/controllers/jobs into actions, orchestrating workflows via faked actions, or debugging action entrypoints and wiring.

coollabsio/coolify · 62 tokens

debugging-output-and-previewing-html-using-ray

Use when user says "send to Ray," "show in Ray," "debug in Ray," "log to Ray," "display in Ray," or wants to visualize data, debug output, or show diagrams in the Ray desktop application.

coollabsio/coolify · 58 tokens

fortify-development

ACTIVATE when the user works on authentication in Laravel. This includes login, registration, password reset, email verification, two-factor authentication (2FA/TOTP/QR codes/recovery codes), passkeys, profile updates, password confirmation, or any auth-related routes and controllers. Activate when the user mentions…

coollabsio/coolify · 199 tokens

pest-testing

Use this skill for Pest PHP testing in Laravel projects only. Trigger whenever any test is being written, edited, fixed, or refactored — including fixing tests that broke after a code change, adding assertions, converting PHPUnit to Pest, adding datasets, and TDD workflows. Always activate when the user asks how to…

coollabsio/coolify · 171 tokens

configuring-horizon

Use this skill whenever the user mentions Horizon by name in a Laravel context. Covers the full Horizon lifecycle: installing Horizon (horizon:install, Sail setup), configuring config/horizon.php (supervisor blocks, queue assignments, balancing strategies, minProcesses/maxProcesses), fixing the dashboard…

coollabsio/coolify · 137 tokens