agentleFS
RichardBrayRichardBray/skills/prune-context-file/SKILL.md

prune-context-file

Skill5 starsChanged 44 days agoMITView on GitHub

Audit and prune bloated CLAUDE.md or AGENTS.md context files using evidence-based criteria from research on what actually helps coding agents. Use when a user asks to trim, audit, review, or improve their CLAUDE.md, AGENTS.md, or any repository context file for AI coding agents.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Wait for approval: before rewriting

    line 58
  2. Distinctive:

    When presenting the proposed changes, group by action:

    line 63

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Prune Context File

Audit and prune a CLAUDE.md or AGENTS.md file using findings from Gloaguen et al. (2025), the first rigorous study of whether context files improve coding agent performance.

Evidence Base (key findings)

  • LLM-generated context files reduce performance by 0.5–2% and increase cost 20%+. Never suggest auto-generating a context file.
  • Developer-written files marginally help (+4% avg) — except for Claude Code, which showed no benefit from developer-written files either.
  • Codebase overviews don't work. Agents find relevant files at the same speed with or without directory listings and project structure sections.
  • Context files are redundant with existing docs. They only help when a repo has no other documentation at all.
  • Tooling instructions are reliably followed. Naming a specific tool (e.g. uv, pytest, a repo CLI) increases its usage 1.6–2.5× vs. not naming it. This is the highest-value content.
  • Instructions cause more testing and exploration, increasing steps and cost. Unnecessary requirements make tasks harder.

Paper: "Evaluating AGENTS.md" — Gloaguen et al., arxiv.org/abs/2602.11988

The Decision Test

For every line or section, ask: Would the agent write different code, run different commands, or make different assumptions without this?

  • Yes, always relevant → keep in root
  • Yes, but only when working in a specific subdirectory → move to a nested CLAUDE.md in that directory
  • No / agent can discover it from the codebase → cut it

Classification

Cut (low value)

  • Directory listings and project structure sections
  • Tech stack entries discoverable from package.json / requirements.txt / go.mod (e.g. React, Express, Tailwind, TypeScript)
  • Links to docs files the agent can find itself
  • General coding standards Claude already applies by default (e.g. "use descriptive variable names", "avoid magic numbers")
  • Project overview prose beyond one sentence

Keep in root (high value, always relevant)

  • Specific commands: build, test, migrate, seed, lint — only if non-obvious or not already expressed as package.json / Makefile / config scripts the agent can read directly
  • Non-obvious tooling: libraries or CLIs the agent wouldn't default to (e.g. Better Auth vs. Passport, uv vs. pip)
  • Architectural constraints that would cause wrong assumptions if missing (e.g. non-standard i18n strategy, monorepo layout quirks)
  • Behavioral rules: git workflow, PR requirements, test requirements — things that must be enforced, not inferred
  • Project-specific conventions the agent can't infer from code alone

Move to subdirectory CLAUDE.md (relevant only in specific contexts)

Root CLAUDE.md loads every session regardless of task — content irrelevant to most work has a standing token cost. Subdirectory CLAUDE.md files (e.g. /web/CLAUDE.md, /api/CLAUDE.md) load on-demand only when the agent reads files in that subtree.

Move content here when it only applies to a specific part of the codebase:

  • Frontend-only conventions (component patterns, CSS framework rules, specific UI libraries)
  • Backend-only conventions (ORM patterns, API design rules, service layer constraints)
  • Any subsystem with its own tooling, patterns, or non-obvious constraints

Process

  1. Read the target context file
  2. Classify each section and bullet against the Cut/Keep criteria above
  3. Present a proposed diff: list what you'd remove and why (one line per item)
  4. Wait for approval before rewriting
  5. Write the pruned file, keeping the same structure but leaner

Output Format

When presenting the proposed changes, group by action:

REMOVE
- [Section/item] — [one-line reason]

KEEP
- [Section/item] — [one-line reason]

REWRITE
- [Section/item] → [what it becomes] — [one-line reason]

Then ask for confirmation before applying.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.