Common context optimization is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Manage context and prompt-cache costs without losing task state. Use for context management, orchestration cost, token budgets, large tool outputs, cache misses, or long-running conversations.
Claude Code: save it as .claude/skills/common-context-optimization/SKILL.md
Cursor: save it as .cursor/rules/common-context-optimization.md
Codex: save it as .agents/skills/common-context-optimization/SKILL.md
ChatGPT, Gemini and other assistants: paste it into custom or project instructions
Skill file
**Priority: P1 (HIGH)**
Workflow
Inspect host capabilities; do not assume agents can rewrite history, prompts, or memory.
Project outputs after consuming them: retain decisions, evidence, errors, and required values; point to complete logs/artifacts by stable reference.
Bound context at host-supported boundaries. Carry goal, active slice, authority, decisions, blockers, evidence links, and next action; preserve a stable append-only prefix where supported.
Compact only when useful and supported. Keep required details retrievable; never discard source evidence or rely on a fixed turn/token threshold.
Measure cache reads, replayed input, and total actor cost across the whole task. Separate observed usage from estimates; no invoice, savings, or efficacy claims without evidence.
Anti-Patterns
No history rewrite assumption: Project outputs or create artifact references; use only host-supported controls.
No fixed threshold: Compact from observed context pressure and task needs, not a universal turn/token count.
No evidence deletion: Keep stable references to source outputs, decisions, and verification. Archive required packets, reports and receipts at durable references before cleanup.
No omission-as-optimization: Never claim savings from suppressing required instruction bodies. Selection or body-return counts are not acknowledgment, comprehension, or enforcement.
No partial cost claim: Include cache reads, replay, and total actor cost; label estimates. Missing coverage or rates means no savings claim.
Use this skill with your AI agent:Open on Skill Issue to copy, download, or add to your library.
Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.