AI Coding Token Optimizer
FreeNo executable scriptsNot checkedMake any repository cheap for an AI agent to work in. Measure the instruction file every session loads, cut it to the rules that bind every task, and move…
by asif2bd616 installs in other catalogsAbout this skill
AI Coding Token Optimizer
Why the entry point matters most
A coding agent pays for context twice.
- Always-loaded context. Files such as
CLAUDE.mdandAGENTS.mdload in full at the start of every session. A 40 KB entry point costs about 10,000 tokens before the agent has read the task. - Rediscovery. The agent searches folders, opens unrelated files and rereads docs to find where a change belongs.
A map on its own only helps with the second cost. The larger, more certain saving is shrinking what loads every time. Keep only the rules that bind every task in the entry point, and put everything else one link away, in a router the agent opens when the task needs it.
The target shape
AGENTS.md / CLAUDE.md ≤ ~8 KB, always loaded: purpose, read-first, hard rules,
workflow, commands, reflexes, Project map + upkeep rule
docs/map/ task routers (tables), opened on demand
PRODUCT.md code area → its README router → its design doc
OPERATIONS.md ops task → guide → notes (see references/operations.md)
DOCS.md | PLAN.md | CONTENT.md question → the one document that answers it
src/README.md, app/README.md… one short router beside each code area; that area's
own rules (e.g. UI design rules) live here
docs/guides/… reference material moved out of the entry point, verbatim
The names are defaults, not requirements. Reuse an existing index that already does the job. A small project may need only a Project map section and one router. In a monorepo, each package gets its own entry point and routers, and a root router links to them.
Workflow: run all of it when asked to adopt, apply or refresh
Do not ask a setup questionnaire when the root is clear. Ask one focused question only if several unrelated roots are plausible. Work in the current repository, following its own branch and PR conventions.
1. Measure
- Record the byte size of what each host loads at session start, and report each host separately; never add them together. For Claude Code that is
CLAUDE.mdor.claude/CLAUDE.mdplus its@pathimports. For Codex it isAGENTS.md, which doesn't follow imports. Record nested instruction files the host auto-loads per area too. - Estimate tokens as bytes ÷ 4.
- Read those files fully, then inspect the real tree, existing indexes,
git statusand recent history. - Sample the source files needed to understand ownership. Use targeted searches, not bulk reads.
2. Sort the entry point
Label every section of the entry point as one of two kinds:
- Binds every task. It stays.
- What the project is.
- What to read first, and which document wins when two disagree.
- Hard rules and security rules.
- Branch, commit and PR workflow.
- Core commands.
- "When you are about to X, do Y" reflexes.
- The Project map section.
- Reference. It moves. For example:
- source trees and file-by-file lists
- environment-variable tables
- CI and workflow walkthroughs
- server, box and deploy layouts
- release checklists
- gotcha lists
- one area's style or design rules
- long examples and history
Move each reference section verbatim to the guide or router that owns its topic: an existing guide when one exists, otherwise a new docs/guides/<topic>.md or the area's README. Move, don't copy. If the owning guide already covers the topic, merge in only the facts it's missing. Appending the whole section creates a second copy that drifts; in one adoption it left a guide stating two different bundle sizes. When a moved section contradicts the guide it joins, check the code and keep the true one. Fix relative links for the new location. A rule stays in the entry point. Shorten its wording if you like, but never weaken it.
3. Write the routers
Write every router as a table. That is | Task | Where | Notes | in the maps, and | Folder or file | What lives there | Read before changing | in area READMEs.
- Keep each router to about 15–35 lines, with one row per real task and a relative link to the authoritative file.
- Describe what a file is for, checked against the code. Never guess from its name.
- Mark current source, historical notes, generated output and runtime data outside Git for what they are.
- Link across areas where ownership overlaps, and keep procedures in their home document.
- Never put a router inside a folder that ships to users. Examples are a WordPress plugin's
includes/, a package's publisheddist/, or anything a build copies into a release archive. Read the packaging config (.distignore,filesinpackage.json,MANIFEST.in, the build script) to see what ships, and route shipped areas fromdocs/map/instead. Add new agent files such asAGENTS.mdto the exclude list when packaging works by exclusion. - Give operations full coverage using [references/op
Install AI Coding Token Optimizer in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the AI Coding Token Optimizer skill do?
Make any repository cheap for an AI agent to work in. Measure the instruction file every session loads, cut it to the rules that bind every task, and move reference material behind short task routers (docs/map/ plus a README next to each code area) that agents open only when a task needs them. Use it when asked to adopt, apply or refresh this skill, or to "map", "optimize tokens" or "slim CLAUDE.md/AGENTS.md" in a project. Also offer it when an entry point grows past about 8 KB. For Codex, Claude Code, OpenClaw and any agent with file access. It edits documentation only, never application behaviour.
How do I install the AI Coding Token Optimizer skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the AI Coding Token Optimizer skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic