context-engineering

Manages AI session context through write, select, compress, and isolate operations.

1|Updated May 6, 2026
One-click install
npx skills add https://github.com/surfingalien/FinSurfing --skill context-engineering-surfingalien
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-engineering
Source: https://github.com/surfingalien/FinSurfing/tree/main/.claude/skills/context-engineering
Command: npx skills add https://github.com/surfingalien/FinSurfing --skill context-engineering-surfingalien

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Long AI coding sessions degrade as the context window fills with irrelevant tokens, causing repeated mistakes, lost state after compaction, and diluted attention. This Skill provides a systematic framework for controlling what enters, stays in, and leaves the context window. ## Core Features & Use Cases - Four Operations Framework: Write (persist state to CLAUDE.md, NOTES.md, memory files), Select (precision retrieval via grep, glob, subagents), Compress (compaction strategies and triggers), and Isolate (subagents, worktrees, fresh sessions). - Context Budget Planning: Phase-based token budgets (planning <20%, implementation <50%, testing <70%) with concrete actions when thresholds are exceeded. - Decision Tables: Clear guidance on when to use /clear vs /compact vs subagents, plus anti-patterns to avoid like dumping whole files or running excessive MCP servers. - Use Case: During a large refactoring task, write architecture decisions to NOTES.md, delegate test runs to subagents, compact at 50% context usage, and recover full state after compaction by re-reading the scratchpad. ## Quick Start Ask the AI to apply context engineering principles to plan a long coding session with a scratchpad file, subagent delegation, and compaction checkpoints.

Frequently Asked Questions about context-engineering

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

FAQPage Schema
How do I prevent context loss during long Claude Code sessions?

Write critical state to durable files like NOTES.md or CLAUDE.md before compaction occurs. After compaction, re-read the scratchpad to recover full working state, since file contents survive while conversation context does not.

When should I use /compact vs /clear in Claude Code?

Use /compact with a focus argument at task boundaries when you want to keep learnings. Use /clear or a fresh session when starting unrelated work or when context has degraded and Claude repeats itself.

How do subagents help with context management?

Subagents run heavy exploration, test suites, and searches in forked contexts, reporting only summarized findings back. This keeps the main session's context clean for planning, coordination, and commits.

What is the best way to read large files without wasting tokens?

Use progressive retrieval: start with Glob for file names, narrow with Grep to specific functions, then Read with offset and limit for only the relevant lines. Never dump entire large files when you need one function.

At what context percentage should I compact a session?

Compact at 50% usage or at task boundaries, whichever comes first. You can set CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50 to enforce this, and use a PostCompact hook to re-inject critical context automatically.