
Context Engineering
Shape system prompts, tool schemas, and skill text so agents stay within a finite context budget without losing signal.
Overview
Context Engineering is a journey-wide agent skill that teaches how inference-time context is composed and constrained—usable whenever a solo builder needs to curate prompts, skills, and sub-agents before committing token
Install
npx skills add https://github.com/neolabhq/context-engineering-kit --skill context-engineeringWhat is this skill?
- Explains full inference-time context: system prompt, tools, retrieval, history, and tool outputs
- Frames attention as a finite budget and progressive disclosure as the primary constraint
- Covers system-prompt altitude—avoid brittle hardcoded logic vs vague high-level only guidance
- Positions smallest high-signal token sets as the engineering goal for reliable agents
- Use when editing commands, skills, or sub-agent prompts—not one-off app features
Adoption & trust: 601 installs on skills.sh; 1.1k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are stacking commands and skills without a model of what the agent can actually attend to, so prompts grow noisy and failures look like “model bugs” instead of context design.
Who is it for?
Builders authoring or refactoring agent skills, custom commands, and multi-agent splits who want theory-backed defaults before optimization passes.
Skip if: One-off feature implementation where prompts are frozen and you only need a single integration recipe with no skill packaging.
When should I use this skill?
Writing, editing, or optimizing commands, skills, or sub-agent prompts.
What do I get? / Deliverables
You can deliberately trim and layer system prompts, tools, and retrieved material so agents follow clearer constraints with less token waste across the rest of your stack.
- Clearer system-prompt structure and altitude choices
- Context budget mental model applied to a skill or command draft
Recommended Skills
Journey fit
Useful at every journey phase - explore requirements and options before committing to a direction.
Where it fits
Decide which docs and tools belong in v1 agent scope before you overstuff the default skill bundle.
Rewrite a SKILL.md so triggers stay short while deep guidance loads only when invoked.
Align tool definitions and return shapes so follow-up turns do not replay huge JSON blobs.
Review a PR that adds new commands and check whether system-prompt altitude still matches agent responsibilities.
Diagnose drifting behavior in long sessions by separating history noise from missing system constraints.
How it compares
Foundational prose discipline for agent prompts—not a code generator or MCP server that fetches external context for you.
Common Questions / FAQ
Who is context-engineering for?
Solo and indie builders maintaining Claude Code, Cursor, or Codex skills who need to reason about token budgets, tool definitions, and system-prompt structure.
When should I use context-engineering?
During build when drafting agent-tooling; also at validate when scoping agent workflows, at ship when reviewing prompt regressions, and at operate when debugging confused multi-turn sessions.
Is context-engineering safe to install?
It is instructional content about prompt design; review the Security Audits panel on this page before trusting any third-party skill package in your agent environment.
SKILL.md
READMESKILL.md - Context Engineering
# Context Engineering Fundamentals Context is the complete state available to a language model at inference time. It includes everything the model can attend to when generating responses: system instructions, tool definitions, retrieved documents, message history, and tool outputs. Understanding context fundamentals is prerequisite to effective context engineering. ## Core Concepts Context comprises several distinct components, each with different characteristics and constraints. The attention mechanism creates a finite budget that constrains effective context usage. Progressive disclosure manages this constraint by loading information only as needed. The engineering discipline is curating the smallest high-signal token set that achieves desired outcomes. ## Detailed Topics ### The Anatomy of Context **System Prompts** System prompts establish the agent's core identity, constraints, and behavioral guidelines. They are loaded once at session start and typically persist throughout the conversation. System prompts should be extremely clear and use simple, direct language at the right altitude for the agent. The right altitude balances two failure modes. At one extreme, engineers hardcode complex brittle logic that creates fragility and maintenance burden. At the other extreme, engineers provide vague high-level guidance that fails to give concrete signals for desired outputs or falsely assumes shared context. The optimal altitude strikes a balance: specific enough to guide behavior effectively, yet flexible enough to provide strong heuristics. Organize prompts into distinct sections using XML tagging or Markdown headers to delineate background information, instructions, tool guidance, and output description. The exact formatting matters less as models become more capable, but structural clarity remains valuable. **Tool Definitions** Tool definitions specify the actions an agent can take. Each tool includes a name, description, parameters, and return format. Tool definitions live near the front of context after serialization, typically before or after the system prompt. Tool descriptions collectively steer agent behavior. Poor descriptions force agents to guess; optimized descriptions include usage context, examples, and defaults. The consolidation principle states that if a human engineer cannot definitively say which tool should be used in a given situation, an agent cannot be expected to do better. **Retrieved Documents** Retrieved documents provide domain-specific knowledge, reference materials, or task-relevant information. Agents use retrieval augmented generation to pull relevant documents into context at runtime rather than pre-loading all possible information. The just-in-time approach maintains lightweight identifiers (file paths, stored queries, web links) and uses these references to load data into context dynamically. This mirrors human cognition: we generally do not memorize entire corpuses of information but rather use external organization and indexing systems to retrieve relevant information on demand. **Message History** Message history contains the conversation between the user and agent, including previous queries, responses, and reasoning. For long-running tasks, message history can grow to dominate context usage. Message history serves as scratchpad memory where agents track progress, maintain task state, and preserve reasoning across turns. Effective management of message history is critical for long-horizon task completion. **Tool Outputs** Tool outputs are the results of agent actions: file contents, search results, command execution output, API responses, and similar data. Tool outputs comprise the majority of tokens in typical agent trajectories, with research showing observations