agentleFS
sohaibdevvsohaibdevv/AI-AGENT-SKILLS/skills/context-engineering/SKILL.md

context-engineering

Skill2 starsChanged 6 months agoMITView on GitHub

Manage what goes into the AI agent context window for maximum quality and minimum waste

82 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use constraint-driven-development, shipping-and-launch and 2 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.
  • 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

  • LLl0k0laDSkill

    frontend-ui-engineering

    Use when building or modifying user-facing interfaces. Use when creating components, implementing layouts, managing state, or when the output needs to look and feel production-quality rather than AI-generated.

    Also in 24 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

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 77 edited versions we read keep these.

  • 4

    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:

    When an agent produces low-quality outputs despite correct instructions

    line 14
  2. Distinctive:

    When designing a system prompt for a production agent

    line 15
  3. Distinctive:

    When a long conversation is causing quality degradation

    line 16
  4. Distinctive:

    When context costs are higher than expected

    line 17

“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

Overview

Context is finite. What you put in the context window determines what the agent can reason about. Too much noise → the relevant signal is diluted. Too little context → the agent makes uninformed decisions. This skill manages context deliberately.

When to Use

  • When an agent produces low-quality outputs despite correct instructions
  • When designing a system prompt for a production agent
  • When a long conversation is causing quality degradation
  • When context costs are higher than expected

Process

Step 1: Define the context budget

For your model and use case: how many tokens is your budget? Reserve: 20% for the system prompt, 20% for the output, 60% for the dynamic context (documents, history, tools).

Step 2: Prioritize context by relevance

Include in this order:

  1. Task instructions (always)
  2. The most relevant documents or code (retrieved, not full codebase)
  3. Relevant conversation history (not all history)
  4. Supporting context (schemas, type definitions)

Cut: long documents that contain 1 relevant paragraph, full file contents when only a function is needed, conversation history beyond the last N relevant turns.

Step 3: Structure context for retrieval

Agents pay more attention to the beginning and end of context. Put instructions at the top. Put the most relevant context closest to the task.

Step 4: Use explicit context delimiters

Mark different sections clearly:

<system>Your role and constraints</system>
<documents>Retrieved content</documents>
<task>What to do</task>

This prevents the model from confusing instructions with retrieved data.

Step 5: Compress context aggressively

Summarize long histories. Extract the relevant portions of long documents. Use structured data (JSON, tables) instead of prose where possible.

Step 6: Monitor context quality

Track: output quality vs. context length. If longer context is producing worse results, you have a context quality problem, not a context quantity problem.

Verification Requirements

  • Context budget defined
  • Context prioritized: instructions → relevant docs → history
  • Long content compressed or chunked
  • Context sections delimited clearly
  • Output quality monitored relative to context composition

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.