context-engineering

context-engineering is a skill for Claude Code, Codex from moberghr/mtk-agent-toolkit. It costs 32 tokens per session (3,424 once invoked), scanned B, original, MIT.

A set of instructions for managing the information an AI coding agent uses during a session. It describes how to save useful state, select relevant files, and refresh context when work changes.

In plain words
What is it for?
Use it when starting work, changing from planning to coding or review, entering an unfamiliar codebase, or bringing the agent back in line with project conventions.
Why use it?
Large projects contain more information than an agent can use at once. These practices help it retain important decisions and focus on the material needed for the current task.

Skill for Claude CodeCodex

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the mtk plugin — 45 skills, 6 agents, 7 hooks, 1 MCP server shipped together

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/moberghr/mtk-agent-toolkit/context-engineering
Any agent
npx skills add moberghr/mtk-agent-toolkit --skill context-engineering
Clone the repo
git clone --depth 1 https://github.com/moberghr/mtk-agent-toolkit

Made for: Claude Code, Codex.

Or install mtk, the plugin that ships this one along with the rest of its 45 skills, 6 agents, 7 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for context-engineering

README.md
[![agentmods](https://agentmods.dev/badge/skills/moberghr/mtk-agent-toolkit/context-engineering.svg)](https://agentmods.dev/skills/moberghr/mtk-agent-toolkit/context-engineering)
Your own site
<a href="https://agentmods.dev/skills/moberghr/mtk-agent-toolkit/context-engineering"><img src="https://agentmods.dev/badge/skills/moberghr/mtk-agent-toolkit/context-engineering.svg" alt="Measured on agentmods" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,424 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00032 $0.03424
Opus 5 $0.00016 $0.01712
Sonnet 5 $0.00006 $0.00685
Haiku 4.5 $0.00003 $0.00342

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

Security

Grade B, and why

context-engineering scanned grade B with 1 finding 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 3d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

if [ -f "$_rts" ]; then bash "$_rts" --explain "$PWD" 2>&1; echo; else cat .claude/tech-stack 2>/dev/null || echo "(not set)"; fi
.claude/skills/context-engineering/SKILL.md · 246 lines

How it starts

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

Context Engineering

Active Stack

echo "--- Tech Stack ---"
_rts="${CLAUDE_PLUGIN_ROOT:-.}/scripts/resolve-tech-stack.sh"; [ -f "$_rts" ] || _rts="scripts/resolve-tech-stack.sh"
if [ -f "$_rts" ]; then bash "$_rts" --explain "$PWD" 2>&1; echo; else cat .claude/tech-stack 2>/dev/null || echo "(not set)"; fi
if [ -f .claude/tech-stack-pm ]; then echo "--- Package Manager ---"; cat .claude/tech-stack-pm; fi

Overview

Good output depends on good context. Context is the complete information payload the model sees at generation time — load the minimum relevant part needed to act correctly, then refresh it when the task shifts.

Context Operations (Write / Select / Compress / Isolate)

The four moves of context engineering. MTK already implements each; the names give them a shared vocabulary (borrow: LangChain / jihoo-kim context-engineering taxonomy).

Operation What it means Where MTK does it
Write Persist state outside the window so it survives compaction/handoff auto-memory + tasks/lessons.md, workflow-artifacts, handoff
Select Pull in only what the current step needs rules INDEX.md wake-up layer, path-scoped applyTo reference loading (below)
Compress Shrink what must stay in-window without losing signal .claude/references/output-compression.md, mtk-compress.sh
Isolate Give a sub-task its own fresh window subagent-implementation (one implementer per batch), review agents (context: fork)

When To Use

  • Starting a new session
  • Switching from planning to implementation or implementation to review
  • Entering an unfamiliar area of the codebase
  • When the model starts making assumptions or drifting from project norms

When NOT To Use

  • As an excuse to endlessly read without acting

Workflow

  1. Start with CLAUDE.md when present.
  2. Load only the shared references relevant to the task.
  3. Path-scoped auto-load. Reference entries in .claude/manifest.json may declare an applyTo glob array. When the current task has a known set of files in scope (from the spec's change_manifest or from git diff --name-only HEAD):
    • MCP-first: If mtk_resolve_references tool is available, call it with the list of touched files. It returns deterministic glob matches against the manifest's applyTo arrays. Use its output directly.
    • Fallback: If the MCP tool is unavailable, manually test each touched file against the globs (bash case / fnmatch semantics).
    • Load references whose globs match at least one touched file.
    • Skip references whose globs match nothing — they're not relevant to this task.
    • References without applyTo are always-on when needed (e.g. coding-guidelines, framework-patterns); load on demand per phase.
  4. Read the exact file to be changed and 2-3 neighboring files that establish local patterns.
  5. Separate trusted local standards from untrusted external inputs.
  6. Before a new phase, summarize what matters now:
    • current goal
    • files in scope
    • governing rules
    • open risks
    • which applyTo references activated and why
  7. Refresh context when the scope or failure mode changes. If new files enter scope, re-run the path-scoped match and load any newly-applicable references.

Read the full file on GitHub · 246 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. 3d ago First seen · 246 lines · 32 tokens per session scan B 71201fced1ec

Subscribe to this mod's changes

context-engineering is a skill published in the GitHub repository moberghr/mtk-agent-toolkit (7 stars, last pushed 9d ago), licensed MIT. It adds 32 tokens to every session and 3,424 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens