context-engineering

Configures rules files, specs, and context budgets to improve AI agent output quality.

1|Updated Mar 2, 2025
One-click install
npx skills add https://github.com/marjorg/setup --skill context-engineering-marjorg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-engineering
Source: https://github.com/marjorg/setup/tree/main/home/.agents/skills/context-engineering
Command: npx skills add https://github.com/marjorg/setup --skill context-engineering-marjorg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI coding agents hallucinate APIs, ignore project conventions, and degrade in quality during long sessions because they receive too little, too much, or stale context. This Skill provides a structured methodology for curating exactly what the agent sees at each stage of a session. ## Core Features & Use Cases - Context Hierarchy: Organizes context into five levels from persistent rules files (CLAUDE.md, AGENTS.md, .cursorrules) down to transient conversation history, with templates for each. - Context Budget Management: Trims context at 75% capacity, compresses failed attempts into summaries, and positions task-critical content last to counter the lost-in-the-middle effect. - Confusion Management: Provides explicit patterns for surfacing spec conflicts and missing requirements instead of silently guessing. - Use Case: When starting a new project for AI-assisted development, use this Skill to write a rules file covering tech stack, commands, conventions, and boundaries so every agent session follows project patterns from the first prompt. ## Quick Start Ask the agent to create a CLAUDE.md rules file for your project covering the tech stack, build commands, code conventions, and boundaries before starting the next coding task.

Frequently Asked Questions about context-engineering

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

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

A CLAUDE.md file should cover your tech stack, build and test commands, code conventions, and boundaries such as never committing secrets. Include one short example of a well-written component in your style so the agent follows existing patterns.

How to fix AI agent output quality degrading mid-session?

Degrading output usually means stale or bloated context. Start trimming at 75% context capacity, compress failed attempts into one-line summaries, protect the active error and task definition, and start a fresh session when switching major features.

What is the equivalent of CLAUDE.md for Cursor and Copilot?

Cursor uses .cursorrules or .cursor/rules/*.md files, Windsurf uses .windsurfrules, GitHub Copilot uses .github/copilot-instructions.md, and OpenAI Codex uses AGENTS.md. All serve the same purpose of persistent project-wide rules.

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

Aim for under 2,000 lines of focused context per task. Loading more than 5,000 lines of non-task-specific content causes the agent to lose focus, so include only relevant source files, one pattern example, and the applicable spec section.

Why does my AI agent invent APIs that do not exist?

Hallucinated APIs indicate context starvation: the agent lacks your rules file and relevant source files. Load the files being modified, related tests, type definitions, and one existing example of the pattern before each task.

When should I start a fresh AI coding session?

Start fresh at completed task boundaries, not arbitrary token counts. Before leaving, persist the accepted decisions, current task status, changed files, verification results, and open questions so the next session can resume from durable artifacts.