context-engineering

Optimizes agent context setup. Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure rules files and context for a project.

Install

Hot:34

Download and extract to your skills directory

Copy command and send to AI Agent for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=addyosmani-skills-context-engineering&locale=en&source=copy

Context Engineering - A Systematic Method for Optimizing AI Agent Context Configuration

Skill Overview

Context Engineering is a set of practices for optimizing the context configuration of AI agents such as Claude, Cursor, and GitHub Copilot. By carefully managing the information, timing, and structure visible to the agent, it finds a balance between hallucinations caused by insufficient context and distraction caused by excessive context, significantly improving Agent output quality.

Applicable Scenarios

1. When initializing a new project

Before beginning AI-assisted development, define the project's technology stack, commands, coding conventions, and boundaries through CLAUDE.md or an equivalent rules file. This allows the agent to follow project standards from the first interaction and avoids repeated corrections later.

2. When Agent output quality declines

When the agent begins hallucinating, inventing nonexistent APIs, ignoring project conventions, or reimplementing existing functionality, use context engineering methods to reorganize the rules file and refresh relevant source-file examples to restore output quality.

3. When switching tasks or code areas

When switching from the project's authentication module to its task module, selectively load the architecture documentation, key source files, and pattern examples for that area. This prevents the agent from confusing conventions and patterns across different modules.

Core Features

Hierarchical Context Management

Organize context into five levels based on persistence: rules files (project-level)specification documents (feature-level)source files (task-level)error output (iteration-level)conversation history (cumulative-level). Load each level at the appropriate time to ensure the agent always sees the most relevant information without losing focus due to excessive context.

Multi-Tool Rules File Support

Provide rules file templates for different AI coding tools: Claude Code's CLAUDE.md, Cursor's .cursorrules, Windsurf's .windsurfrules, and GitHub Copilot's .github/copilot-instructions.md. These uniformly cover the technology stack, commands, coding conventions, boundary conditions, and pattern examples, ensuring that project rules take effect consistently across all tools.

Explicit Ambiguity Management

When specifications conflict with existing code, requirements are incomplete, or multiple implementation paths exist, do not rely on the agent to guess. Instead, use structured ambiguity-management templates—such as option lists and inline plans—to clearly present conflicts and seek human decisions, preventing the agent from making incorrect choices amid ambiguity.

Frequently Asked Questions

What is context engineering, and why is it important for AI agents?

Context engineering is the deliberate management of the information visible to an AI agent. An agent's output quality depends directly on the context it receives—too little context can cause it to invent nonexistent APIs (hallucinations), while too much context can make it lose focus. By carefully selecting information, controlling when it is loaded, and presenting it in a structured way, context engineering enables the agent to consistently work within an appropriate context window, significantly improving code generation quality and adherence to project conventions.

Why do AI agents hallucinate, and how can this be prevented?

Hallucinations usually occur when the agent fills in missing information because it lacks sufficient context. When the agent does not know the project's conventions, API structure, or available tools, it "guesses," which can result in fabricated imports, ignored naming conventions, or reimplementation of existing functionality. Prevention methods include creating a rules file—such as CLAUDE.md—in the project root to clearly define the technology stack and conventions; loading relevant source files and pattern examples at the beginning of a task; and, when the agent's output does not meet expectations, checking whether critical context is missing instead of simply correcting the output.

Does having too much context affect AI agent performance?

Yes. Research shows that more than 2,000 lines of context unrelated to the task can degrade agent performance, resulting in distraction, overlooked key constraints, or inconsistent output. Context engineering uses a strategy of "selective inclusion": load only the files and specification excerpts directly relevant to the current task; use layered summaries instead of complete documents; and refresh rather than accumulate context when switching tasks. The goal is to keep the agent working within the "optimal context window," not to maximize the amount of context.