Context Engineering logo

Context Engineering

CommunityPopular
rohitg00
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.

Overview

Publisherrohitg00
Repositorypro-workflow
Skill namecontext-engineering
Stars
2.9K
Forks
286
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by rohitg00 on GitHub. Read the source before you install it.

Installation

Install the Context Engineering AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/rohitg00/pro-workflow.git /tmp/pro-workflow
mkdir -p .claude/skills
cp -r /tmp/pro-workflow/skills/context-engineering .claude/skills/context-engineering
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Context Engineering in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Context Engineering on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Context Engineering is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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:

TargetWhenExample
CLAUDE.mdPermanent project rules"Always use pnpm, never npm"
NOTES.md / scratchpadWorking state for current taskArchitecture decisions, open questions
.claude/memory/Learnings and patterns[LEARN] rules from corrections
External filesData too large for contextTest plans, migration checklists

Pattern — Scratchpad workflow:

text
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:

  1. @file references — exact file injection
  2. grep / Glob — targeted pattern search
  3. Subagent exploration — delegated deep search
  4. 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:

text
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:

StrategyHowWhen
/compact with focus/compact focus: auth module changesTask boundaries
MicrocompactAsk Claude to summarize tool output inlineAfter large reads/searches
Head+tailRead first 20 + last 20 lines of large outputLog analysis, test results
Tool result clearingSubagent results auto-clear after reportingHeavy exploration
Semantic selectionSummarize findings, discard raw dataResearch 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:

json
{
  "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.

MethodIsolation LevelUse When
SubagentsForked contextHeavy exploration, test runs, doc generation
Worktrees (claude -w)Full repo copyParallel features, competing approaches
/btw (built-in Claude Code)Temporary overlayQuick questions without entering conversation history
Agent teamsIndependent sessionsCross-layer changes, parallel reviews
Fresh session (/resume)Clean slateUnrelated work, degraded context

Pattern — Subagent delegation:

text
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): ~200K total window, ~20K overhead (CLAUDE.md, tool definitions, MCP schemas). Plan around ~180K usable — actual budgets vary by model and configuration.

AllocationBudgetWhat Goes Here
Static context20-30KCLAUDE.md, tool schemas, MCP definitions
Dynamic context150-180KCode, 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.

PhaseTarget UsageAction 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

SituationAction
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 operationDelegate to subagent
Quick side question/btw (doesn't pollute main context)
Exploring multiple approachesWorktrees 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

markdown
## 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.

Frequently asked questions

What does the Context Engineering AI skill do?

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.

Why use Context Engineering on TypingMind?

Because you install it once and use it with any model. Context Engineering is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Context Engineering in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/rohitg00/pro-workflow/tree/main/skills/context-engineering. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Context Engineering?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Context Engineering?

As many as you like. As long as a model supports skills, you can use Context Engineering with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Context Engineering AI skill free?

It is published on GitHub by rohitg00. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇