context-engineering
Skill0 starsChanged 7 months agoMITView on GitHub
Optimize AI agent context for maximum effectiveness using a 5-level hierarchy. Use when setting up a new project for AI-assisted development, when Claude keeps losing context, when responses are inconsistent across sessions, or when you want to reduce token waste. Also use when asked about "context", "rules files", or "how to set up Claude for this project".
146 other projects use a version of this.
Adopted by
Most recently taken up by
- dzikrisyairozi/agent-skillstheir own version, first seen Nov 29, 2026
- aakash1552005/universal-agent-skillstheir own version, first seen Nov 29, 2026
- karanmrn/karanagentskillstheir own version, first seen Nov 29, 2026
- karanmrn/kstacktheir own version, first seen Nov 29, 2026
- e-landeros/gauntlettheir own version, first seen Nov 29, 2026
- Thoven-CORP/agent-skillstheir own version, first seen Nov 29, 2026
Used with
Projects with it also use accessibility-engineering, using-agent-skills 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.
steven123397Skillaccessibility-engineering
Audits existing interfaces for WCAG 2.2 AA conformance and remediates the violations found. Use when auditing a page or component for accessibility, running axe-core or pa11y, triaging a11y violations, or checking screen reader and contrast issues before shipping.
Also in 4 projects that use this
LLl0k0laDSkillusing-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 42 projects that use this
LLl0k0laDSkillidea-refine
Refine ideas through structured divergent and convergent thinking. Use "idea-refine" or "ideate" to trigger.
Also in 48 projects that use this
HK-hubSkillsource-driven-development
Grounds every implementation decision in official documentation. Use when you want authoritative, source-cited code free from outdated patterns. Use when building with any framework or library where correctness matters.
Also in 49 projects that use this
jaydubya818Skilldeprecation-and-migration
Retire APIs or migrate consumers and persistent data across releases.
Also in 45 projects that use this
MrCipherSmithSkillconstraint-driven-development
Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.
Also in 18 projects that use this
- +5 more from LLl0k0laD
Other versions146 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 146
- addyosmani/agent-skills★ 121ksame name
- bojieli/ai-agent-book-projects★ 60ksame name
- bojieli/ai-agent-book★ 60ksame name
- rohitg00/pro-workflow★ 2.9ksame name
- mrgoonie/claudekit-skills★ 2.2ksame name
- kdlbs/kandev★ 1.2ksame name
- liza-mas/liza★ 426same name
- typv/nest-turbo-starter★ 224same name
- VAMFI/claude-user-memory★ 206same name
- shashankswe2020-ux/whoop-mcp★ 181same name
136 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository59 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- cavemanSkill
- deprecation-migrationSkill
- design-an-interfaceSkill
- domain-modelSkill
- edit-articleSkill
- git-guardrails-claude-codeSkill
- github-triageSkill
- grill-meSkill
- autoplanSkill
- benchmarkSkill
- browseSkill
- canarySkill
- carefulSkill
- codexSkill
- context-restoreSkill
- context-saveSkill
- csoSkill
- design-consultationSkill
- design-htmlSkill
- design-reviewSkill
- design-shotgunSkill
- devex-reviewSkill
- document-releaseSkill
- freezeSkill
- guardSkill
- healthSkill
- investigateSkill
- land-and-deploySkill
- learnSkill
- make-pdfSkill
- office-hoursSkill
- plan-ceo-reviewSkill
- plan-design-reviewSkill
- plan-devex-reviewSkill
- plan-eng-reviewSkill
- qa-onlySkill
- qaSkill
- retroSkill
- reviewSkill
- setup-deploySkill
- shipSkill
- unfreezeSkill
- improve-codebase-architectureSkill
- incremental-implementationSkill
- performance-optimizationSkill
- pr-triageSkill
- qaSkill
- request-refactor-planSkill
- security-hardeningSkill
- setup-pre-commitSkill
- spec-driven-developmentSkill
- tddSkill
- to-issuesSkill
- to-prdSkill
- triage-issueSkill
- ubiquitous-languageSkill
- write-a-skillSkill
- zoom-outSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 9 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 132 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 21
NOT: when debugging a specific bug — use triage-issue instead
- Distinctive: line 28
Check what context already exists in the project:
- Distinctive: line 55
Keep these concise — every token here is loaded on every request.
- Distinctive: line 71
Keep Level 1 rules under 2000 words total
- Distinctive: line 72
Use progressive disclosure — summary in CLAUDE.md, details in linked files
- Distinctive: line 73
Remove stale context — outdated rules cause confusion, not just waste
- Distinctive: line 77
Test that the context is working by asking Claude to perform a common task without any additional explanation.
- Distinctive: line 93
No Level 2 specs for active features — Claude fills gaps with assumptions
- Distinctive: line 106
DO NOT: put everything in CLAUDE.md — use progressive disclosure across all 5 levels
- Distinctive: line 107
DO NOT: write rules about things that are obvious from the code — only non-obvious constraints
“Common” is measured: kept by at least 6 in 10 of the 132 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.
Files
Context Engineering
Structure project context so AI agents produce consistent, high-quality results without re-explanation every session. The 5-level hierarchy ensures the right information is available at the right time — always-loaded rules at the top, conversation-specific details at the bottom.
When to Use
- Setting up a new project for AI-assisted development
- Claude keeps forgetting conventions or making the same mistakes
- Responses are inconsistent across sessions or workspaces
- Token usage is high because you're re-explaining context every time
- NOT when debugging a specific bug — use
triage-issueinstead - NOT for one-off tasks that won't repeat — just explain in the conversation
Process
1. Audit existing context
Check what context already exists in the project:
# Check for existing context files
ls -la CLAUDE.md .claude/settings.json .claude/rules/ 2>/dev/null
find . -name "CONTEXT.md" -o -name "*.rules.md" 2>/dev/null2. Apply the 5-level hierarchy
| Level | What | When Loaded | Examples |
| 1. Rules files | Non-negotiable constraints | Always (every request) | CLAUDE.md, .claude/rules/*.md |
| 2. Specs/Plans | Current feature context | When referenced | PRDs, design docs, plan files |
| 3. Source code | Implementation reality | When files are read | The actual codebase |
| 4. Error output | Runtime feedback | During debugging | Test failures, stack traces, lint errors |
| 5. Conversation | Session-specific context | Current session only | User messages, clarifications |
3. Write Level 1 — Rules files
CLAUDE.md and .claude/rules/ are always in context. They should contain:
- Architecture decisions — "Routes → Services → CRUD → Models"
- Conventions — naming, file structure, import patterns
- Boundaries — "never import from X in Y", "always use Z for database access"
- Tool commands — how to run tests, lint, build
Keep these concise — every token here is loaded on every request.
4. Write Level 2 — Specs and plans
For active features, create spec files that capture:
- What the feature does (user perspective)
- Key decisions already made (so Claude doesn't re-litigate)
- Acceptance criteria
- Out of scope
Link from CLAUDE.md: "For feature X, see docs/specs/feature-x.md"
5. Optimize for token efficiency
- Move detailed reference material to files Claude reads on-demand (Level 3)
- Keep Level 1 rules under 2000 words total
- Use progressive disclosure — summary in CLAUDE.md, details in linked files
- Remove stale context — outdated rules cause confusion, not just waste
6. Verify context effectiveness
Test that the context is working by asking Claude to perform a common task without any additional explanation. If it follows conventions correctly, the context is sufficient.
Common Rationalizations
| Shortcut | Why It Fails |
| "I'll just explain things in the conversation each time" | Conversation context is ephemeral. You're paying tokens every session to re-teach what should be in Level 1. It also drifts — you'll explain differently each time. |
| "I'll put everything in CLAUDE.md so it's always available" | CLAUDE.md is loaded on EVERY request. A 5000-word CLAUDE.md burns tokens even for simple questions. Use progressive disclosure — summary at Level 1, details at Level 3. |
| "The code is self-documenting, no rules needed" | Code shows WHAT exists, not WHY it's that way or WHAT to do next time. Without explicit rules, Claude will infer conventions from whatever code it reads first — which may be the exception, not the rule. |
| "I'll add context as issues come up" | Reactive context accumulates as patches. Every 2-3 months, audit and restructure. Proactive context engineering prevents the drift in the first place. |
Red Flags
- CLAUDE.md over 3000 words — too much always-loaded context, burning tokens on every request
- Rules contradict each other — Claude will follow whichever it sees last, which is non-deterministic
- Stale rules reference deleted files or patterns — causes confusion and hallucination
- No Level 2 specs for active features — Claude fills gaps with assumptions
Verification Checklist
- CLAUDE.md under 2000 words and contains only non-negotiable constraints
- .claude/rules/ files cover common workflows without being overly prescriptive
- Active features have Level 2 spec files linked from CLAUDE.md
- Claude follows project conventions without re-explanation on a fresh session
- No contradictions between rules files
- Stale context removed (no references to deleted files/patterns)
Anti-patterns
- DO NOT put everything in CLAUDE.md — use progressive disclosure across all 5 levels
- DO NOT write rules about things that are obvious from the code — only non-obvious constraints
- DO NOT reference specific file paths in rules (they go stale) — describe patterns and conventions instead
- DO NOT skip the audit step — existing context may contradict what you're about to add
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
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.

