refactor-agents-md

refactor-agents-md is a skill for Claude Code, Codex from vinta/hal-9000. It costs 55 tokens per session (1,386 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

Written for Claude Code and Codex: allowed-tools in frontmatter, but also agents/openai.yaml present. Also seen: reads .claude/ paths; mentions CLAUDE.md; names the AskUserQuestion tool.

Part of the hal-skills plugin — 13 skills shipped together

Good fit 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.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vinta/hal-9000/refactor-agents-md
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 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 hal-skills, the plugin that ships this one along with the rest of its 13 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/github.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/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-agents-md

Your own site · 80×15
<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="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,386 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00055 $0.01386
Opus 5.5 $0.00022 $0.00554
Sonnet 5.5 $0.00011 $0.00277
Haiku 4.5 $0.00006 $0.00139

Measured 20d ago against content hash cc9b762a8447, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 20d 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 · 53 lines

How it starts

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

Overview

Refactor an instruction file (CLAUDE.md or AGENTS.md). Every retained instruction competes for attention in the sessions that load it.

The file serves every agent and model that reads it, not only this session's. The filename does not say who reads it, since Claude Code reads AGENTS.md too. Each reader assembles its own system prompt, so a line that restates one reader's prompt can be the only copy for another. Audit each line against every reader.

Instructions

Use AskUserQuestion in Claude Code or request_user_input in Codex when available.

  1. Pick the target and its readers. If the invocation names a file, use it. Otherwise discover candidate files using the reader platforms' loading rules in the references below, and ask only if the target remains ambiguous. Resolve the readers from the invocation and context; ask only when uncertain. Read one reference per reader platform, both when both read the file:

    • Claude models: references/claude-code.md for which files load and when, its guides, its system-prompt probe, and its demote destinations.
    • GPT models: references/codex.md for which files load and when, its guides, and its demote destinations.

    For a targeted change, the verdicts below cover only the lines it adds or touches: the rest of the file stays as it is, and anything noticed there is a follow-up.

  2. Fetch the guides. Follow each loaded reference's guide-fetching instructions, for a one-line change too: a verdict without the guides rests on memory. Read each page's full text, not a fetch tool's summary of it: a summary misquotes long pages and misses parts of them. Reuse current guidance already fetched in this conversation. Done when each page a reference lists has been fetched for each reader in this session.

  3. Audit. Read the file and give every instruction in scope exactly one verdict, judged against the target's bar below. Done when no instruction in scope lacks one.

    • contradiction: conflicts with another instruction or a reader's requirements such that both cannot be satisfied. Record both sides.
    • delete: fails the no-op test on every reader, meaning each would behave the same without it, or a guide says to remove it because it was written for an earlier model's habits and no other reader needs it either. Judge defaults against the fetched pages and the reference's probe, not memory. Covers instructions the readers already follow by default, instructions too vague to act on, and platitudes like "write clean code". A line needed by one reader and harmless to the others is a keep.
    • demote: real instruction that only applies to some paths or tasks. Pick its destination from the references; it must load for every reader of the source file, and with no such destination the line is a keep. If it describes a multi-step workflow, propose a skill instead. Name the destination in the sign-off.
    • rewrite: right meaning, phrasing falls short of the fetched best practices. Also a rewrite when the line carries words that fail the no-op test on their own: a duplicate of another line, a definition of a term the model knows, or emphasis; a rationale or example stays, since both steer the model. Among wordings that pass the bar, the shortest wins. Where a reader's guide gives measured wording for the same instruction and every other reader's guide allows it, use that wording. Voice follows the system prompt: a line addresses the model as "you" and names the human as "the user", so "I" or "my" for the human, and "Claude" or "the agent" for the model, are rewrites; words quoted as user speech keep their own voice.
    • keep: earns its always-loaded cost as written, and no shorter wording has the same effect.

Read the full file on GitHub · 53 lines

Files

What ships with it

3 files 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. 20d ago Changed · +12 lines cc9b762a8447
  2. 22d ago Changed · -2 lines eff277562205
  3. 23d ago Changed · -7 lines 5eb8a78c2310
  4. 25d ago Changed e31c02fbb682
  5. 1mo ago Changed e9cebd4afbd5
  6. 1mo ago Changed c26e81f13c6d
  7. 1mo ago Changed · -4 lines · +32 tokens per session cbafedb2e607
  8. 1mo ago Changed · +1 lines cdd662556342
  9. 2mo ago Changed · +4 lines a52d3e37e3f8
  10. 2mo ago First seen · 49 lines · 23 tokens per session scan A a0c44fac5965

Subscribe to this mod's changes

refactor-agents-md is a skill published in the GitHub repository vinta/hal-9000 (144 stars, last pushed today), licensed MIT. It adds 55 tokens to every session and 1,386 once invoked, about $0.0002 per session on Opus 5.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

refactor-agents-md compared with skills from other repositories

refactor-agents-md next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
refactor-agents-mdvinta/hal-9000Skill144todayMITA55Claude Code, Codex
optimize-python-parallelismcloudguo123/atomlaneSkill1todayMPL-2.0A70Codex
jarvis-setupethanplusai/jarvisSkill1.0k2mo agononeA79Claude Code, Codex
cirqagentlas-ai/agentlas-desktopSkill102d agoApache-2.0A67Claude Code
biopythonagentlas-ai/agentlas-desktopSkill102d agoApache-2.0A76Claude Code
scikit-bioagentlas-ai/agentlas-desktopSkill102d agoApache-2.0A54Claude Code
simpyagentlas-ai/agentlas-desktopSkill102d agoApache-2.0A42Claude Code