Teaches how to budget and structure context for coding agents: when to trim, split, or write AGENTS.md/CLAUDE.md/rules files, and how to avoid context rot and agent drift.
Ships in knowledge-virtuoso. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
An agent's context window is a budget, not storage: reliability falls as the window fills (context rot). Give the agent the smallest set of high-signal tokens for the step it is on, and load everything else only when needed. Each line in an always-loaded file must change behavior, and a rule that must always hold belongs in a hook, linter or test, not text. Add a context file only for a failure you have seen.
| Source | Finding |
|---|---|
| ETH Zurich and LogicStar, arXiv 2602.11988 (2026) | Repository context files did not generally improve task success and raised inference cost by more than 20% on average, for both generated and developer-written files. Agents followed specific instructions, but repository overviews did not help. Useful for non-standard practices. |
| Vercel, AGENTS.md outperforms skills (2026-01-27) | On framework-API tasks, a passive 8 KB docs index in AGENTS.md passed 100%. Skills left on default behavior passed 53% (same as no docs) because the agent never invoked them in 56% of cases. |
| Chroma, context rot | Model reliability drops as input length grows, even on simple tasks. |
| Thoughtworks Radar vol. 34 (2026-04) | Adopt context engineering and curated shared instructions. Caution on agent instruction bloat. |
Read these together. Vercel's result is not "skills are bad". It says knowledge the agent needs on nearly every task belongs in always-on context as a compact index, and skills fit explicit, user-triggered workflows. ETH's result says the always-on file must stay short and specific. The two agree: put little in always-on context, and make all of it count.
Use the cheapest layer that still loads when the agent needs the content. Full decision table and examples are in placement-guide.
| Layer | Loads | Put here |
|---|---|---|
| Always-on file (AGENTS.md, CLAUDE.md, GEMINI.md, copilot-instructions.md) | Every session | Build, test and lint commands. Non-obvious conventions. Hard prohibitions. Pointers to deeper docs. |
Path-scoped rules (.claude/rules/ with paths:, .cursor/rules, Copilot .github/instructions/) | When matching files are touched | Rules for one language, directory or file type. |
| Nested instruction files in subdirectories | When the agent works there | Rules for one package or service in a monorepo. |
| Skills | Description always, body when invoked | Repeatable workflows and reference material the agent should pull in on a trigger. |
On-demand docs (docs/, ADRs, runbooks) | When the agent reads them | Architecture, history, long procedures, API detail. |
| Hooks, linters, CI, tests | Every time the event fires | Rules that must never be skipped. |
| Tool output | When a command runs | Facts the agent can discover itself. Do not copy these into instruction files. |
| Item | Budget | Notes |
|---|---|---|
| CLAUDE.md | Under about 200 lines per file | Anthropic guidance. Longer files reduce adherence. Imports with @path organize a file but do not reduce cost, because imported files also load at launch (memory docs). |
| Codex AGENTS.md chain | 32 KiB combined (project_doc_max_bytes) | Codex stops adding files once the limit is reached, so deep files can be silently left out. Raise the setting or split into nested directories (Codex docs). |
| Claude Code skill listing | 1% of the context window, scaled with the model | Overflow drops descriptions of the least-used skills first. Raise with skillListingBudgetFraction (for example 0.02) or a fixed character count via SLASH_COMMAND_TOOL_CHAR_BUDGET. Set rarely used personal or project skills to "name-only" in skillOverrides (plugin skills are managed through /plugin instead). |
| One skill entry | 1,536 characters for description plus when_to_use | Configurable with skillListingMaxDescChars. Put the key use case first. Aim for 200 to 400 characters (skills docs). |
| Skill body | Under 500 lines, key rules at the top | After compaction only the first 5,000 tokens of each invoked skill return, with 25,000 tokens shared across skills (context window docs). |
Other tools have their own caps and defaults. Check the vendor docs for the tool in use before assuming these numbers carry over. Use /context in Claude Code for a live breakdown, and /doctor prompt-audit to find outdated or conflicting instruction files.
AGENTS.md and CLAUDE.md, or in a tool file and a global file. Keep one copy and import or point to it.Fix by deleting first, then moving, then rewriting. For each line ask: what mistake would the agent make without this? If the answer is "none", delete it. For wording of the lines that stay (one word per concept, positive phrasing, a project glossary), see writing-levers.
Agents load every skill name and description into context each turn, within a fixed budget. With many installed skills the budget runs out.
| Symptoms | Skills appear as bare names with no description. Skills that should match a request are never picked. The agent does the work itself instead of invoking the skill. |
| Why | In Claude Code the listing is capped at 1% of the context window and 1,536 characters per skill. Past the cap, descriptions of the least-used skills are dropped first. The name stays, but the trigger text the agent matches against is gone. |
| Diagnose | /context shows the Skills row, sized after the budget is applied. /doctor estimates the listing's cost and biggest contributors. /skill-doctor (Claude Code 2.1.252 or later) shows each skill's cost and how often it is invoked. Count installed skills: user, project, and plugin caches. A warning also goes to the debug log (--debug). |
| Fix | Disable unused plugins and skills (/plugin for plugin skills). Set low-value personal or project skills to "name-only" or "off" in skillOverrides, or mark them disable-model-invocation: true and invoke them by name. Trim descriptions and put the key use case first. As a last step, raise the budget with skillListingBudgetFraction (for example 0.02) or SLASH_COMMAND_TOOL_CHAR_BUDGET, which spends more context on every turn. |
Sources: skills docs, descriptions are cut short, override skill visibility, settings reference. Other tools cap their listings differently, so check their docs.
Always-on instruction files load once at session start. As the conversation grows with file reads and tool output, they make up a smaller share of what the agent sees, and rules from early in the session are followed less (see context rot above). Symptoms: the agent follows the file for the first prompts, then stops using a convention, a persona, or a prohibition.
| Fix | How |
|---|---|
| Keep the file short and rules-only | A short file holds a larger share of attention. No overviews, no skill tables, no copies. Target under about 200 lines for CLAUDE.md. |
| Remind on every prompt | A UserPromptSubmit hook runs before each prompt, and its plain-text output is added as context the model can see (hooks reference). Have it print two or three rules that keep failing. Keep it to a few lines, since it costs tokens each turn. Setup is in the hooks-and-guardrails skill. |
| Enforce what must hold | Move must-never-fail rules to hooks, linters, or tests. |
| One session per task | Start a clean session (/clear) between unrelated tasks. |
| Compact with a focus | /compact focus on ... between phases. Project-root CLAUDE.md is re-read from disk after compaction (what survives compaction), but conversation-only instructions and not-yet-reloaded scoped rules are lost. |
Several tools means several files, and copies drift apart. Write project rules once in AGENTS.md. Claude Code reads AGENTS.md by itself only when no CLAUDE.md exists (v2.1.277 or later). If a CLAUDE.md is needed, make its first line @AGENTS.md and add only Claude-specific lines below. Never paste the same rules into both. The import avoids a second copy, but the imported text still loads at launch, so it does not lower cost (memory docs). For user-level files there is no shared standard: Codex reads ~/.codex/AGENTS.md, and Claude Code documents ~/.claude/CLAUDE.md. Keep each short. See placement-guide.
Respond by compacting with a focus, writing state to a file, or starting a clean session, in that order of effort. Do not keep pushing in a degraded window.
Compaction replaces history with a summary. Plan for what it keeps and drops. Details and a notes template are in long-task-notes.
/compact focus on the auth bug and the failing test list. The automatic pass guesses what matters./clear). Old conversation crowds out the files you need next and costs tokens on every message.Other agents compact differently. Check the tool's docs for what survives.
A subagent works in its own window. It may read tens of thousands of tokens and return a summary of about 1,000 to 2,000 tokens. Use one when the answer is small but the search is large: tracing a code path, auditing a directory, reading a long log, comparing many files.
For work that spans many sessions or compactions, keep a progress file and a task list in the repository, update them at each step, and begin every session by reading them. See long-task-notes for the file layouts, the one-feature-per-session pattern, and handoff notes.
| Reference | Contents |
|---|---|
| placement-guide | Decision flow for where each kind of instruction goes, per-tool file names and scoping, before and after examples, migration steps |
| long-task-notes | Progress file and task list layouts, one-feature-per-session pattern, handoff notes, compaction checklist |
| writing-levers | Leading words, positive phrasing instead of prohibitions, the no-op test, project glossary with Avoid lists |
What SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/accessibilityWeb accessibility patterns and WCAG 2.1/2.2 compliance. Use to build accessible components, audit a UI for a11y issues, fix screen reader or keyboard problems, check contrast, or add ARIA./debuggingSystematic debugging by root cause analysis. Use when facing a bug, test failure, flaky behavior, production error, or integration failure. Covers reproduce, hypothesize, fix, prevent, and post-mortems./docs-lookupLooks up current, version-correct docs before answering a library question from memory. Use when asked for an exact method signature, argument order, config key, CLI flag, or the call for 'our version' or a named version (for example 'in 7.2'). Check the docs or lockfile first even when sure, because APIs change between versions.No slash command · from knowledge-virtuoso
npx claudepluginhub krzysztofsurdy/code-virtuoso --plugin knowledge-virtuosoOther plugins' skills for the same job