optimize-agents-md

optimize-agents-md is a skill for Claude Code, Codex from youdotcom-oss/dx-toolkit. It costs 38 tokens per session (850 once invoked), scanned A, original, MIT.

A tool for reviewing and improving AGENTS.md files, which contain instructions for coding agents working in a repository. It also handles instruction files that apply only to specific folders.

In plain words
What is it for?
Use it to shorten bloated instructions, clarify workflows, record lessons from mistakes, reorganize rules, or update guidance about commits, pull requests, validation, skills, and evidence collection.
Why use it?
It helps remove repeated, unclear, or outdated guidance without losing rules needed for safe repository work. It uses the repository's code and history to check whether instructions still match reality.

Skill for Claude CodeCodex

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/youdotcom-oss/dx-toolkit/optimize-agents-md
Any agent
npx skills add youdotcom-oss/dx-toolkit --skill optimize-agents-md
Clone the repo
git clone --depth 1 https://github.com/youdotcom-oss/dx-toolkit

Made for: Claude Code, 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 optimize-agents-md

README.md
[![agentmods](https://agentmods.dev/badge/skills/youdotcom-oss/dx-toolkit/optimize-agents-md.svg)](https://agentmods.dev/skills/youdotcom-oss/dx-toolkit/optimize-agents-md)
Your own site
<a href="https://agentmods.dev/skills/youdotcom-oss/dx-toolkit/optimize-agents-md"><img src="https://agentmods.dev/badge/skills/youdotcom-oss/dx-toolkit/optimize-agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 850 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.1 $0.00038 $0.00850
Opus 5 $0.00019 $0.00425
Sonnet 5 $0.00008 $0.00170
Haiku 4.5 $0.00004 $0.00085

Measured 5d ago against content hash d51d14b71955, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

optimize-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.

.agents/skills/optimize-agents-md/SKILL.md · 135 lines

How it starts

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

Optimize AGENTS.md

Purpose

Improve AGENTS.md and scoped agent instruction files without weakening the repo's operational contract.

Use this skill when the user asks to:

  • reduce instruction bloat
  • clarify confusing workflow rules
  • add a lesson learned from a recent mistake
  • remove stale or duplicate guidance
  • reorganize agent instructions for better retrieval
  • update commit, PR, validation, skill, or evidence-collection rules

Do not optimize by chasing a fixed token target. Preserve rules that encode repo-specific safety, validation, or workflow constraints even when they are verbose.

Authority

Before editing instructions, collect current evidence:

git log --oneline -20
git diff main...HEAD --stat
git log --oneline -- AGENTS.md
find .agents/skills -name 'SKILL.md' | sort

When sources conflict, use the repo hierarchy:

  1. src/ code and executable behavior
  2. git history
  3. AGENTS.md by scope
  4. docs and skills

Update stale prose rather than making code conform to stale docs.

Editing Rules

  • Keep concrete rules that prevent real failures, even if they cost tokens.
  • Prefer one precise rule over several overlapping reminders.
  • Preserve current repo conventions: Bun-first workflow, gh for GitHub, conventional commits, scoped validation, directory boundaries, module naming, and skill-trigger guidance.
  • Remove references to retired surfaces only after verifying with rg.
  • Do not introduce a public validation CLI unless it exists in the repo.
  • Do not replace operational rules with generic advice agents already know.
  • Do not add broad "always run everything" gates when AGENTS.md already requires area-aware validation.

Workflow

  1. Identify the target scope:

    • root AGENTS.md
    • nested AGENTS.md
    • skill-local instructions
    • all of the above
  2. Search before changing:

rg -n "stale-term|removed-command|old-path" AGENTS.md docs skills src package.json
git log --oneline -- AGENTS.md
  1. Classify each candidate edit:
    • remove: stale, duplicated, or generic instruction
    • merge: repeated project-specific rule
    • clarify: correct rule that caused confusion
    • add: recent failure mode or missing project constraint

Read the full file on GitHub · 135 lines

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 · 135 lines · 38 tokens per session scan A d51d14b71955

Subscribe to this mod's changes

optimize-agents-md is a skill published in the GitHub repository youdotcom-oss/dx-toolkit (25 stars, last pushed 15d ago), licensed MIT. It adds 38 tokens to every session and 850 once invoked, about $0.0002 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

gameobject-component-destroy

Destroy one or more Components from a target GameObject. Missing (null) components are skipped — they cannot be destroyed. Use 'gameobject-find' and 'gameobject-component-get' to identify the components first.

IvanMurzak/Unity-MCP · 49 tokens

unity-version-split

Split a C# file into Unity 6.5+ and pre-Unity 6.5 variants. Use when a file needs different implementations for different Unity versions due to API changes (e.g., EntityId vs int, GetEntityId vs GetInstanceID).

IvanMurzak/Unity-MCP · 59 tokens

assets-create-folder

Create a new folder under a parent folder inside 'Assets/'. The parent path must start with 'Assets/' and every intermediate folder in it must already exist. Refreshes the AssetDatabase at the end and returns the GUID(s) of the created folder(s).

IvanMurzak/Unity-MCP · 55 tokens

console-get-logs

Retrieve Unity Editor logs from the MCP plugin's LogCollector, optionally filtered by log type or time window. Useful for debugging and monitoring Editor activity.

IvanMurzak/Unity-MCP · 35 tokens

assets-prefab-save

Save the currently opened prefab edit stage back to its prefab asset without exiting the stage. Pair with 'assets-prefab-open' to enter the edit mode first.

IvanMurzak/Unity-MCP · 37 tokens

opik-diagnose

Surface the Opik traces worth a developer's attention, ranked by signal — errors, failed tool calls, latency, regressions, and low online-eval scores — plus Diagnostics issues. Reads live/production traces via the SDK (searchtraces and agentinsights) and works with no MCP; uses the MCP issue entity when connected.…

comet-ml/opik-mcp · 147 tokens