context-engineering
Master the four operations of context engineering — Write, Select, Compress, Isolate. Manage token budgets, compaction strategies, and context partitioning to keep AI sessions sharp and efficient.
Install / Use
npx skills add rohitg00/pro-workflow --skill context-engineeringInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Tags
Our assessment of context-engineering
context-engineering scores 93/100 on our quality scale, 719th of 4,653 Development & Engineering skills we index (top 16%).
Its SKILL.md is 6.3 KB long, well organised into 11 sections with 5 code examples: a thorough specification that gives an agent plenty to work with.
With 2,876 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 8 days ago, so context-engineering is actively maintained.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands.
Automated pattern scan on 2026-10-02. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
context-engineering compared with similar skills
All 4 of these similar skills score higher than context-engineering; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| context-engineering (this skill)by rohitg00 | 93 | 2.9k | 8d ago | SKILL.md |
| ai-job-searchby MadsLorentzen | 100 | 44.7k | today | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 41.7k | 2d ago | CLAUDE.md |
| algorithmic-artby anthropics | 100 | 177.9k | 9d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 9d ago | SKILL.md |
Frequently asked questions
- How do I install context-engineering?
- Run
npx skills add rohitg00/pro-workflow --skill context-engineering. The install tabs above show the steps for each supported agent. - Which AI agents does context-engineering work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is context-engineering safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is context-engineering still maintained?
- The repository was last updated 8 days ago, so context-engineering is actively maintained.
Skill content
View source on GitHubname: context-engineering description: Master the four operations of context engineering — Write, Select, Compress, Isolate. Manage token budgets, compaction strategies, and context partitioning to keep AI sessions sharp and efficient. user-invocable: true
Context Engineering
Four operations control everything about how context flows through an AI coding session. Master them and you control the quality of every response.
The Four Operations
1. Write — Persist Info Outside Context
Move information out of the context window into durable storage so it survives compaction and session boundaries.
Where to write:
| Target | When | Example |
|--------|------|---------|
| CLAUDE.md | Permanent project rules | "Always use pnpm, never npm" |
| NOTES.md / scratchpad | Working state for current task | Architecture decisions, open questions |
| .claude/memory/ | Learnings and patterns | [LEARN] rules from corrections |
| External files | Data too large for context | Test plans, migration checklists |
Pattern — Scratchpad workflow:
1. Start complex task → create NOTES.md with goals and constraints
2. After research → write findings to NOTES.md
3. After compaction → NOTES.md survives, context does not
4. Resume → read NOTES.md to recover full state
2. Select — Retrieve Relevant Info
Pull the right information into context at the right time. Precision matters more than volume.
Methods ranked by precision:
@filereferences — exact file injectiongrep/Glob— targeted pattern search- Subagent exploration — delegated deep search
- RAG / embeddings — semantic retrieval for large codebases
Key principle: Focused 300 tokens > unfocused 113K tokens.
A surgical grep result that returns the exact function signature beats dumping an entire module into context. Every irrelevant token dilutes attention.
Pattern — Progressive retrieval:
1. Start with file names (Glob)
2. Narrow to specific functions (Grep)
3. Read only the relevant lines (Read with offset+limit)
4. Never read entire large files when you need one function
3. Compress — Reduce Tokens, Preserve Signal
Shrink context without losing the information that matters.
Compaction strategies:
| Strategy | How | When |
|----------|-----|------|
| /compact with focus | /compact focus: auth module changes | Task boundaries |
| Microcompact | Ask Claude to summarize tool output inline | After large reads/searches |
| Head+tail | Read first 20 + last 20 lines of large output | Log analysis, test results |
| Tool result clearing | Subagent results auto-clear after reporting | Heavy exploration |
| Semantic selection | Summarize findings, discard raw data | Research phases |
Compaction triggers:
- After planning, before implementation
- After completing a feature or milestone
- When context exceeds 50% (set
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50) - Before switching task domains
- After heavy search/read operations
PostCompact hook — Re-inject critical context:
{
"type": "PostCompact",
"command": "cat .claude/critical-context.md"
}
Use this to ensure project rules, current task state, or architecture constraints survive every compaction.
4. Isolate — Partition Across Execution Spaces
Don't load everything into one context. Split work across independent execution spaces.
| Method | Isolation Level | Use When |
|--------|----------------|----------|
| Subagents | Forked context | Heavy exploration, test runs, doc generation |
| Worktrees (claude -w) | Full repo copy | Parallel features, competing approaches |
| /btw (built-in Claude Code) | Temporary overlay | Quick questions without entering conversation history |
| Agent teams | Independent sessions | Cross-layer changes, parallel reviews |
| Fresh session (/resume) | Clean slate | Unrelated work, degraded context |
Pattern — Subagent delegation:
Main session: planning, coordination, commits
Subagent 1: explore auth module, report findings
Subagent 2: run test suite, report failures
Subagent 3: generate migration script
Main context stays clean. Subagents handle the volume.
Context Budget Planning
Example baseline (calibrate with /context): a 200K window (Haiku 4.5; Fable 5.1, Opus 5.5, and Sonnet 5 carry 1M) with ~20K overhead (CLAUDE.md, tool definitions, MCP schemas) leaves ~180K usable. Quality still drops as context fills, so keep the same discipline on 1M tiers. Actual budgets vary by model and configuration.
| Allocation | Budget | What Goes Here | |------------|--------|----------------| | Static context | 20-30K | CLAUDE.md, tool schemas, MCP definitions | | Dynamic context | 150-180K | Code, conversation, tool results |
Put static context first. CLAUDE.md and tool definitions load before conversation. Keeping them stable maximizes prompt cache hits — saves cost and latency.
| Phase | Target Usage | Action If Over | |-------|-------------|----------------| | Planning | < 20% | Keep plans concise, write to scratchpad | | Implementation | < 50% | Compact between files, delegate reads | | Testing | < 70% | Delegate test runs to subagents | | Review | < 85% | Start fresh session if degraded |
When to /clear vs /compact vs Subagent
| Situation | Action |
|-----------|--------|
| Task boundary, want to keep learnings | /compact with focus |
| Context degraded, Claude repeating itself | /compact, then /resume if still bad |
| Starting unrelated work | /clear or new session |
| Heavy read/search operation | Delegate to subagent |
| Quick side question | /btw (doesn't pollute main context) |
| Exploring multiple approaches | Worktrees or agent teams |
Anti-Patterns
- Loading entire files when you need one function
- Keeping MCP tool results in context after extracting what you need
- Running 15+ MCPs (each adds tool schema overhead to every request)
- Vague prompts that force Claude to search broadly ("fix the code")
- Never compacting until auto-compact triggers at 95%
Add to CLAUDE.md
## Context Engineering
Write to NOTES.md for working state that must survive compaction.
Select with precision — grep first, read specific lines, never dump whole files.
Compact at 50% or task boundaries. Set CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50.
Isolate heavy work to subagents. Main session stays for coordination and commits.
Related Skills
ai-job-search
44.7kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
41.7kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an em…
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
