context-engineering

Guidance for deciding what information an AI coding agent should receive, retain, compress, or leave out of its working context.

In plain words
What is it for?
Use it when writing agent instructions, debugging weak agent results, reducing context-window pressure, or designing multi-agent workflows.
Why use it?
It helps prevent long or poorly chosen instructions from distracting the agent, raising costs, or reducing task success.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/builderced/agent-skills/context-engineering
Any agent
npx skills add BuilderCed/agent-skills --skill context-engineering
Clone the repo
git clone --depth 1 https://github.com/BuilderCed/agent-skills

Made for: Claude Code, Codex.

Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 915 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00028 $0.00915
Opus 5 $0.00014 $0.00458
Sonnet 5 $0.00006 $0.00183
Haiku 4.5 $0.00003 $0.00092

Measured 2d ago against content hash 945856399f0e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context-engineering 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 2d 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.

skills/meta/context-engineering/SKILL.md · 99 lines

How it starts

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

Context Engineering

Based on ETH Zurich research: overly detailed instructions reduce task success by 3%, increase token cost by 20%, and add 2-4 reasoning steps.

When to Use

  • Writing SKILL.md, AGENTS.md, or system prompts
  • Debugging poor agent performance
  • Optimizing token costs
  • Designing multi-agent workflows
  • Reducing context window pressure

Context Hierarchy (5 Levels)

Most persistent → most transient:

Level Content Persistence Example
1. Rules Project-wide standards Always loaded CLAUDE.md, AGENTS.md
2. Spec Feature/session scope Per feature PRD, architecture docs
3. Source Per task Per task Relevant source files
4. Errors Per iteration Per attempt Test failures, stack traces
5. History Accumulates Session Conversation history

Principle: Levels 1-2 are curated (high leverage). Levels 3-5 are per-call (keep minimal).

What to Include

Include ONLY what the agent cannot discover independently:

  • Non-obvious conventions ("we use snake_case for DB columns")
  • Project-specific constraints ("never modify the auth module")
  • Architectural decisions not in code ("we chose Drizzle over Prisma because...")
  • External dependencies not discoverable ("deploy via internal CI, not GitHub Actions")

What NOT to Include

The agent can discover these itself — including them wastes tokens:

  • Tech stack (visible in package.json / requirements.txt)
  • File structure (visible via ls / find)
  • Key files (visible via search)
  • Build commands (visible in scripts / Makefile)
  • Standard patterns (the model already knows React, Express, etc.)

Sizing Guidelines

Context Type Max Size Rationale
AGENTS.md 500-1000 tokens ETH Zurich: more = worse
SKILL.md (core) 1000-2500 tokens Balance detail vs overhead
references/ per skill 500-1000 tokens Support data, not duplicate
System prompt total < 5K tokens Beyond this: diminishing returns

Read the full file on GitHub · 99 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. 2d ago First seen · 99 lines · 28 tokens per session scan A 945856399f0e

Subscribe to this mod's changes

context-engineering is a skill published in the GitHub repository BuilderCed/agent-skills (2 stars, last pushed 4mo ago), licensed MIT. It adds 28 tokens to every session and 915 once invoked, about $0.0001 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-31.