context-engineering

Configures rules files, context hierarchy, and budget management for AI coding agents.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/Qiuyi-Hong/addyosmani-skills --skill context-engineering-qiuyi-hong
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-engineering
Source: https://github.com/Qiuyi-Hong/addyosmani-skills/tree/main/skills/context-engineering
Command: npx skills add https://github.com/Qiuyi-Hong/addyosmani-skills --skill context-engineering-qiuyi-hong

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI coding agents produce inconsistent or hallucinated output when they receive too little context, too much context, or stale context. This Skill provides a structured methodology for curating what the agent sees at each stage of a session so output follows project conventions instead of inventing APIs. ## Core Features & Use Cases - Five-Level Context Hierarchy: Organizes context from persistent rules files (CLAUDE.md, .cursorrules, AGENTS.md) down through specs, source files, error output, and conversation history. - Context Budget Management: Trims failed attempts and verbose tool output starting at 75% window capacity, compresses exploration into summaries, and positions task-critical content last to counter the lost-in-the-middle effect. - Confusion Management: Surfaces spec-versus-code conflicts and missing requirements as explicit options instead of silently guessing, with an inline planning pattern for multi-step tasks. - Use Case: When starting a new feature, you load the relevant spec section, the files to modify, and one existing pattern example, then restart with a persisted handoff record when the session grows stale. ## Quick Start Ask the agent to audit the current session context and create a CLAUDE.md rules file covering the tech stack, commands, conventions, and boundaries for this project.

Frequently Asked Questions about context-engineering

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a CLAUDE.md rules file for my project?

Create a CLAUDE.md at the project root covering tech stack, build and test commands, code conventions, and boundaries such as never committing secrets. Include one short example of a well-written component so the agent follows your style.

How much context should I give an AI coding agent per task?

Include only files relevant to the current task, aiming for under 2,000 lines of focused context. Loading more than roughly 5,000 lines of non-task-specific material causes the agent to lose focus rather than improve.

Does this work with Cursor, Windsurf, and GitHub Copilot?

Yes, the same rules-file pattern maps to .cursorrules or .cursor/rules for Cursor, .windsurfrules for Windsurf, .github/copilot-instructions.md for Copilot, and AGENTS.md for OpenAI Codex.

Why does agent output quality degrade during long sessions?

Conversation history accumulates failed attempts, replaced drafts, and verbose tool output that fragment the model's attention. Start trimming at 75% context capacity, compress old exploration into one-sentence summaries, and keep the active error and task definition last in context.

When should I start a fresh agent session instead of continuing?

Start fresh when switching between major features or when the agent references outdated patterns. Before leaving, persist the accepted scope, current task status, changed files, verification results, and open questions so the new session can resume safely.