Skip to content
Skills Library
AI & agents · Review & audit

optimize-agent-context

/optimize-agent-context

Create, audit, or optimize agent.md, claude.md, cursorrules, or any AI coding agent context file using the "Band-Aid Philosophy." Strips bloat, enforces minimalism, and ensures only failure-correcting rules remain. Use when the user mentions: "agent.md", "claude.md", "cursorrules", ".clinerules", "AGENTS.md", "context file", "optimize context", "agent instructions", "reduce agent bloat", "agent keeps making mistakes", "fix my agent file", "create agent file", "audit agent context", or any variant of writing/improving AI coding agent instruction files.

Licence
ISC
Last repository change
17.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 17.10.2026, without references to retired models or APIs.

Licence

ISC, otwarta.

What it does and when to use it

Create, audit, or optimize agent.md, claude.md, cursorrules, or any AI coding agent context file using the "Band-Aid Philosophy." Strips bloat, enforces minimalism, and ensures only failure-correcting rules remain. Use when the user mentions: "agent.md", "claude.md", "cursorrules", ".clinerules", "AGENTS.md", "context file", "optimize context", "agent instructions", "reduce agent bloat", "agent keeps making mistakes", "fix my agent file", "create agent file", "audit agent context", or any variant of writing/improving AI coding agent instruction files.

Triggers from the description

Band-Aid Philosophy.agent.mdclaude.mdcursorrules.clinerulesAGENTS.mdcontext fileoptimize context
Original author description

Create, audit, or optimize agent.md, claude.md, cursorrules, or any AI coding agent context file using the "Band-Aid Philosophy." Strips bloat, enforces minimalism, and ensures only failure-correcting rules remain. Use when the user mentions: "agent.md", "claude.md", "cursorrules", ".clinerules", "AGENTS.md", "context file", "optimize context", "agent instructions", "reduce agent bloat", "agent keeps making mistakes", "fix my agent file", "create agent file", "audit agent context", or any variant of writing/improving AI coding agent instruction files.

How it works

  1. Core Rules (Non-Negotiable)
  2. Why This Matters
  3. Workflow
  4. Output Format
  5. Anti-Patterns to Reject
Original SKILL.md headings · 88 lines, 639 words
SKILL.md preview
---
name: optimize-agent-context
description: >
  Create, audit, or optimize agent.md, claude.md, cursorrules, or any AI coding agent context file
  using the "Band-Aid Philosophy." Strips bloat, enforces minimalism, and ensures only failure-correcting
  rules remain. Use when the user mentions: "agent.md", "claude.md", "cursorrules", ".clinerules",
  "AGENTS.md", "context file", "optimize context", "agent instructions", "reduce agent bloat",
  "agent keeps making mistakes", "fix my agent file", "create agent file", "audit agent context",
  or any variant of writing/improving AI coding agent instruction files.
---

# 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?"

### Mode B: Audit Existing Agent File

When the user has an existing `agent.md` / `claude.md` / `cursorrules` and wants it optimized:

1. **Read the file** using `view_file`.
2. **Classify every line** into one of:
   - ✅ **KEEP** — Fixes a known failure or states an ungessable constraint
   - ❌ **BLOAT** — Directory trees, dependency lists, file structures
   - ❌ **SUMMARY** — Vague app descriptions, project overviews
   - ❌ **OBVIOUS** — Things the agent can discover via tools (package.json, tsconfig, etc.)
   - ⚠️ **MAYBE** — Potentially useful but needs user confirmation
3. **Present the audit** as a table showing each section and its classification.
4. **Generate the optimized version** with only ✅ KEEP and confirmed ⚠️ MAYBE lines.
5. **Show before/after line count** to demonstrate the reduction.

### Mode C: Add a Band-Aid

When the user reports a specific agent mistake mid-session:

1. Ask: "What did the agent do wrong?"
2. Write a single, precise negative constraint: `Do NOT [wrong thing]. Instead, [correct thing].`
3. Suggest appending it to the existing context file.

## Output Format

The generated file should follow this structure:

```markdown
# Agent Rules

- [Negative constraint or correction]
- [Negative constraint or correction]
- [Build/test quirk]
- [Architectural constraint]
```

**No headers beyond the title. No explanations. No examples. Just rules.**

## Anti-Patterns to Reject

If the user or another agent tries to include any of these, push back:

| Anti-Pattern | Why It's Bad |
|---|---|
| Folder tree / file structure | Agent has `list_dir` and `find_by_name` |
| Dependency list | Agent reads `package.json` / `requirements.txt` |
| "This app is a..." summary | Distracts model, triggers hallucination |
| Tech stack overview | Agent reads config files |
| Code style rules already in linter config | Redundant — linter enforces these |
| Long code examples | Bloats context, agent writes its own code |

Versions

The database has no other skills named optimize-agent-context.

Database snapshot: 13.11.2026 · package version 510d9ad37791 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100agent-config
    Create, update, or audit AGENTS.md (default) or CLAUDE.md agent instructions: set up, prune, add a rule, or merge CLAUDE.md or .cursorrules into one file Claude Code, Codex, and Cursor all read. Don't use for READMEs, skills, or subagents.
  • 100agents-md-lint
    Audit and trim AI agent instruction files (AGENTS.md, CLAUDE.md, CONVENTIONS.md, .cursorrules, etc.) by testing which facts an AI agent can discover from code alone. Use when asked to lint, audit, optimize, prune, or trim any agent instruction file in a repository. Removes…
  • 100agents-md-optimizer
    Audit bloated agent-instruction files (CLAUDE.md, AGENTS.md, and their local/user-level variants) and rewrite them lean, or author a new one from scratch following the 200-line "recipe book" principle. Use this skill whenever the user mentions CLAUDE.md, AGENTS.md, agent…
  • 100ai-instruction-standards
    Create and maintain AI instruction files (CLAUDE.md, AGENTS.md, .cursor/rules/, etc.) with proper structure. Use when: creating AI instruction files, separating universal vs project-specific rules, configuring AI tools. Not for: shaping the codebase so AI can navigate it — use…
  • 100agent-instructions
    Create, audit and maintain repository agent instructions and context architecture. Use when working on AGENTS.md, CLAUDE.md, .claude/rules/, or instruction-related SKILL.md content - always-loaded context cost, stale, duplicated or conflicting instructions, agent memory drift.…
  • 100measure-ai-proficiency
    Assess and improve repository AI coding proficiency and context engineering maturity. Use when users ask about: (1) AI readiness or AI maturity assessment, (2) context engineering quality or improvement, (3) CLAUDE.md, .cursorrules, or copilot-instructions files, (4) measuring…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.