context-engineering

A method for choosing and organizing the information given to Claude Code, an AI coding assistant, so it can work within its context window. The context window is the amount of project and conversation information the assistant can consider at once.

In plain words
What is it for?
Use it when a conversation approaches context limits, when preparing prompts, after major refactoring, when switching tasks, or when the supplied project information feels outdated. It covers trimming, measuring, and prioritizing project instructions and documentation.
Why use it?
It helps prevent important details from being crowded out by old, repeated, or irrelevant material. This can improve task accuracy and control the amount of context used.

Skill for Claude CodeCodex

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

Made for: Claude Code, Codex.

Per session 62 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,221 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00062 $0.01221
Opus 5 $0.00031 $0.00611
Sonnet 5 $0.00012 $0.00244
Haiku 4.5 $0.00006 $0.00122

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

Security

Grade A, and why

context-engineering scanned grade A with 0 findings 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 2d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/context-engineering/SKILL.md · 199 lines

How it starts

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

Context Engineering Skill

Optimizes Claude Code context for better performance and accuracy.

Tracked files in repo: !git ls-files 2>/dev/null | wc -l || true

Auto-Invoke Triggers

  • Every 50 messages in conversation
  • After major refactoring
  • When context feels stale
  • Task switching
  • User requests /context command

Context Principles

Active Curation

  • Keep only relevant information
  • Remove completed task details
  • Archive outdated patterns
  • Focus on current work

Signal-to-Noise Ratio

High Signal Low Signal
Current APIs Old experiments
Active patterns Completed tasks
Recent decisions Historical context
Project structure Implementation details

Token Budget

File Limit Purpose
CLAUDE.md < 2000 tokens Quick reference
Agent docs < 500 per agent Role definition
Skills < 300 per skill Methodology

Context Analysis Process

Step 1: Measure Current State

## Context Analysis

### Token Counts
- CLAUDE.md: XXX tokens
- Agent docs: XXX tokens total
- Skills: XXX tokens total
- Total: XXXX tokens

### Staleness Check
- [ ] Last updated: [date]
- [ ] References current project state
- [ ] No deprecated APIs/patterns

Step 2: Identify Issues

### Issues Found

#### Stale Content
- Section X: Outdated [reason]
- Section Y: No longer relevant

#### Redundant Content
- Duplicated in files A and B
- Can consolidate X and Y

#### Missing Content
- Current API not documented
- New pattern not captured

Step 3: Optimization Actions

### Optimization Plan

1. **Archive**: Move section X to knowledge-core.md
2. **Remove**: Delete duplicate Y
3. **Update**: Refresh API documentation
4. **Add**: Document new pattern Z

CLAUDE.md Structure

Optimal structure for quick reference:

# Project Name

[One-line description]

## Quick Reference
| Action | Command |
|--------|---------|
| Run | command |
| Test | command |
| Build | command |

## Agent System
[Link to detailed docs]

## Tech Stack
- Frontend: [stack]
- Backend: [stack]

## Project Structure
[Key directories only]

## Key Rules
1. [Critical rule]
2. [Critical rule]

Read the full file on GitHub · 199 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. 2d ago First seen · 199 lines · 62 tokens per session scan A 3d8a34f271ef

Subscribe to this mod's changes

context-engineering is a skill published in the GitHub repository komluk/scaffolding (15 stars, last pushed 27d ago), licensed MIT. It adds 62 tokens to every session and 1,221 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

prompt-engineering

ComfyUI prompt engineering knowledge covering CLIP text encoding syntax, weight modifiers, model-specific prompting strategies, and best practices.

artokun/comfyui-mcp · 28 tokens

prompt-architect

Build a high-quality, structured prompt for any task using Anthropic's 10-block prompting framework from the "Prompting 101" workshop (Code w/ Claude, May 2025). Primary trigger is the slash command /prompt-architect. Also triggers when the user asks to "write a prompt", "build a prompt", "improve this prompt", "make…

hosanxiv/prompt-architect · 131 tokens

prompt-shield

프롬프트 품질을 진단·개선·설계하는 스킬. /ps:build, /ps:r, /ps:a, /ps:lint, /ps:eval 입력 또는 프롬프트 점검/설계 요청에서 사용.

joseph0926/prompt-shield · 60 tokens

prompt-cookbook

Build a prompt cookbook for one company's actual vertical and roles rather than generic examples. Each recipe names the job it does, who runs it, the prompt itself, what good output looks like, and how to tell when it went wrong. Written for people who have never written a prompt and will not read documentation about…

enalbenerraw/blanewarrene · 69 tokens

ai-pm-frameworks

Use when scoping AI features, deciding build-vs-buy-vs-rule, designing eval harnesses, choosing models for cost/latency trade-offs, or planning guardrails for LLM-based products. Trigger when the user is doing AI product management work — feasibility, architecture, or reliability decisions for probabilistic systems.

shwetank/bettersense · 70 tokens

ai-chat-studio

AI Chat Studio provides a multi-LLM chat orchestration framework with 300+ assistant presets, intelligent model routing, and conversation management.

itallstartedwithaidea/claude-googleadsagent · 33 tokens