agentleFS
BuilderCedBuilderCed/agent-skills/skills/meta/context-engineering/SKILL.md

context-engineering

Skill2 starsChanged 7 months agoMITView on GitHub

Manage AI agent context effectively — what to include, what to exclude, compression strategies, and context hierarchy for optimal performance.

82 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use using-agent-skills, constraint-driven-development and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • LLl0k0laDSkill

    using-agent-skills

    Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.

    Also in 24 projects that use this

  • vinvcnSkill

    constraint-driven-development

    把一个项目的质量线确立为书面契约,并阻止 agent 悄悄降低它。通过访谈确定用户在意哪些维度,当用户心里没有数字时提供合理的默认阈值,把一切记录进 CONSTRAINTS.md,并盯住 diff 中质量线被削弱的迹象——新增的 @ts-ignore 或 eslint-disable 抑制注释、被跳过或删除的测试、被剥掉的断言、未实现的 stub、被调低的阈值。当没有任何质量线被写下来时使用;当用户说 "set up constraints" 或 "define our standards" 时;当用户希望把他们在意的维度——无障碍性、Web 性能、覆盖率——设置成被强制执行的约束时;当 agent 为了变绿不断静默检查或跳过测试时;当你需要一个覆盖率或性能阈值却不知道该选什么数字时;或者当 agent 写下的代码超出任何人会读的体量时。

    Also in 4 projects that use this

  • LLl0k0laDSkill

    shipping-and-launch

    Use when preparing to deploy to production. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.

    Also in 26 projects that use this

  • galandoSkill

    source-driven-development

    Version-aware, source-driven development — fetch official docs before writing framework code

    Also in 25 projects that use this

  • az9713Skill

    deprecation-and-migration

    Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when deciding whether to maintain or sunset existing code.

    Also in 22 projects that use this

  • +7 more from LLl0k0laD

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 77 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Does not manage conversation memory (different problem)

    line 96
  2. Distinctive:

    Does not optimize the model itself (skill ≠ fine-tuning)

    line 97
  3. Distinctive:

    Does not handle multi-agent coordination (orchestration concern)

    line 98

“Common” is measured: kept by at least 6 in 10 of the 77 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

LevelContentPersistenceExample
1. RulesProject-wide standardsAlways loadedCLAUDE.md, AGENTS.md
2. SpecFeature/session scopePer featurePRD, architecture docs
3. SourcePer taskPer taskRelevant source files
4. ErrorsPer iterationPer attemptTest failures, stack traces
5. HistoryAccumulatesSessionConversation 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 TypeMax SizeRationale
AGENTS.md500-1000 tokensETH Zurich: more = worse
SKILL.md (core)1000-2500 tokensBalance detail vs overhead
references/ per skill500-1000 tokensSupport data, not duplicate
System prompt total< 5K tokensBeyond this: diminishing returns

Compression Strategies

  1. Remove examples when the pattern is clear — one example > three redundant ones
  2. Use tables over prose — 50% fewer tokens for structured info
  3. Remove "obvious" instructions — "write clean code" is noise
  4. Use references for static data — move schemas/checklists to files
  5. Lazy-load context — only load what's needed for current task

Anti-Patterns

Anti-PatternProblemFix
"Always be thorough"Forces effort=high, +35% tokensRemove — model handles this
"Think step by step"Redundant with adaptive thinkingRemove on modern models
Repeating the same rule 3xToken waste, no benefitState once, clearly
Including full API docsContext overflowLink to docs, summarize key parts
"You are a helpful assistant"Generic, no valueUse specific task context

What This Skill Does NOT Do

  • Does not manage conversation memory (different problem)
  • Does not optimize the model itself (skill ≠ fine-tuning)
  • Does not handle multi-agent coordination (orchestration concern)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.