optimize-agent-context

optimize-agent-context is a skill for Claude Code, Codex from J-StaR-Films-Studios/VibeCode-Protocol-Suite. It costs 143 tokens per session (1,105 once invoked), scanned A, original, ISC.

A tool for creating and trimming instruction files that guide coding agents, such as AGENTS.md, agent.md, claude.md, or cursorrules.

In plain words
What is it for?
Use it to create, review, or simplify coding-agent guidance files in a project.
Why use it?
It removes unnecessary instructions and keeps rules that help prevent real mistakes, so the agent's context is shorter and clearer.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions AGENTS.md.

Good fit Use it to create, review, or simplify coding-agent guidance files in a project.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/j-star-films-studios/vibecode-protocol-suite/optimize-agent-context
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 J-StaR-Films-Studios/VibeCode-Protocol-Suite --skill optimize-agent-context
Clone the repo
git clone --depth 1 https://github.com/J-StaR-Films-Studios/VibeCode-Protocol-Suite

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-agent-context

README.md
[![agentmods](https://agentmods.dev/badge/skills/j-star-films-studios/vibecode-protocol-suite/optimize-agent-context.svg)](https://agentmods.dev/skills/j-star-films-studios/vibecode-protocol-suite/optimize-agent-context)
Your own site
<a href="https://agentmods.dev/skills/j-star-films-studios/vibecode-protocol-suite/optimize-agent-context"><img src="https://agentmods.dev/badge/skills/j-star-films-studios/vibecode-protocol-suite/optimize-agent-context.svg" alt="Measured on agentmods" height="20"></a>
Per session 143 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,105 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 warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Rogue Agent · line 8
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
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.00143 $0.01105
Opus 5 $0.00072 $0.00553
Sonnet 5 $0.00029 $0.00221
Haiku 4.5 $0.00014 $0.00111

Measured 8d ago against content hash 80b1c8c74214, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

optimize-agent-context 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 8d 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.

assets/.agent/skills/agent-engineering/optimize-agent-context/SKILL.md · 98 lines

How it starts

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

Optimize Agent Context

Enforce the Band-Aid Philosophy: an agent context file should only contain rules that fix mistakes the agent is actively making. Everything else is bloat that degrades performance and increases cost.

Core Rules (Non-Negotiable)

  1. NO BLOAT — Never include directory structures, file trees, dependency lists, or package inventories. The agent has tools to discover these.
  2. NO SUMMARIES — Never include vague app descriptions ("This is a video sharing app"). This distracts the model and triggers hallucinations.
  3. ONLY FIX KNOWN FAILURES — Every line must correct a specific, observed agent mistake or enforce an architectural constraint the agent cannot guess.
  4. USE NEGATIVE CONSTRAINTS — When the agent uses the wrong tool/library, explicitly state what NOT to use, then what TO use.
  5. BE MINIMAL — Target under 20 lines. Bullet points preferred. If a rule can be removed without the agent breaking, remove it.

Why This Matters

Studies show bloated, AI-generated context files:

  • Degrade agent performance by ~3%
  • Increase token costs by 20%+
  • Trigger hallucinations by surfacing legacy code the agent then tries to use ("pink elephants" effect)

Workflow

Mode A: Create New Agent File (Interview)

When the user wants to create a new context file from scratch:

  1. Ask these questions one at a time (do not dump all at once):

    • "What specific mistakes has the AI agent been making repeatedly?" (e.g., wrong imports, forgetting to format, modifying wrong files)
    • "Are there legacy tools/libraries the agent keeps using but shouldn't?" (e.g., "We have Redux but use Zustand for new features")
    • "Any build/test/env quirks the agent can't figure out on its own?" (e.g., special env vars, non-standard test commands)
  2. Synthesize answers into a ruthlessly minimal bulleted markdown file.

  3. Validate the output against the Core Rules above. Strip anything that violates them.

  4. Present the file and ask: "Does this capture the mistakes? Anything to add or remove?"

Read the full file on GitHub · 98 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. 8d ago First seen · 98 lines · 143 tokens per session scan A 80b1c8c74214

Subscribe to this mod's changes

optimize-agent-context is a skill published in the GitHub repository J-StaR-Films-Studios/VibeCode-Protocol-Suite (24 stars, last pushed 3d ago), licensed ISC. It adds 143 tokens to every session and 1,105 once invoked, about $0.0007 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

happiness-skill

A Chinese-language guide to happiness based on reducing unmet wants, focusing on the present, and treating happiness as a trainable skill.

kangarooking/cangjie-skill · 136 tokens

setup-matt-pocock-skills

A setup skill that configures engineering skills for a repository, including its issue tracker, labels, and documentation layout. A repository is the project folder managed by version control.

devcxl/mattpocock-skills-zh · 43 tokens

frontend-design

A design guide for building polished web interfaces such as pages, dashboards, forms, navigation, and reusable UI components. It covers HTML, CSS, JavaScript, and common frontend frameworks.

AnastasiyaW/codex-claude-code-config · 264 tokens

alterlab-cobrapy

Build and analyze genome-scale constraint-based metabolic models with COBRApy — flux balance analysis (FBA), flux variability analysis (FVA), gene and reaction knockouts, flux sampling, and SBML model I/O. Use when simulating metabolic networks, predicting growth or knockout phenotypes, or running systems-biology and…

AlterLab-IEU/AlterLab-Academic-Skills · 91 tokens

alterlab-depmap

Query the Cancer Dependency Map (DepMap) for cancer cell line gene dependency scores (CRISPR Chronos), drug sensitivity data, and gene effect profiles. Use when identifying cancer-specific genetic vulnerabilities, finding synthetic lethal interactions, checking whether a gene is essential in given cell lines, or…

AlterLab-IEU/AlterLab-Academic-Skills · 77 tokens

alterlab-syllabus-ai-policy

Drafts course-level generative-AI use policies and syllabus statements: assigns each graded task a permitted/restricted/prohibited tier (modeled on Cornell's prohibit/allow-with-attribution/encourage framework), writes the disclosure clause with a verbatim APA (OpenAI, 2023) or MLA Works Cited citation template for…

AlterLab-IEU/AlterLab-Academic-Skills · 222 tokens