agentleFS
sergeeeysergeeey/Claude-cod-top-2026/skills/core/context-engineering/SKILL.md

context-engineering

Skill9 starsChanged 7 months agoMITView on GitHub

[STATUS: review] [CONFIDENCE: high] [REVIEWED: 2026-04-18] Техники управления контекстом: как уменьшить потребление токенов не теряя качество, как структурировать длинные сессии, когда делать /compact, как не терять важное при compaction. Актуально для сессий с большими проектами и длинными задачами. Триггеры: "context engineering", "токены заканчиваются", "контекст переполнен", "как сэкономить токены", "оптимизируй контекст", "compaction strategy", "сессия стала медленной", "context window". НЕ использовать для: написания кода или анализа — только управление контекстом.

82 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use using-agent-skills, constraint-driven-development and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • LLl0k0laDSkill

    using-agent-skills

    Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.

    Also in 24 projects that use this

  • vinvcnSkill

    constraint-driven-development

    把一个项目的质量线确立为书面契约,并阻止 agent 悄悄降低它。通过访谈确定用户在意哪些维度,当用户心里没有数字时提供合理的默认阈值,把一切记录进 CONSTRAINTS.md,并盯住 diff 中质量线被削弱的迹象——新增的 @ts-ignore 或 eslint-disable 抑制注释、被跳过或删除的测试、被剥掉的断言、未实现的 stub、被调低的阈值。当没有任何质量线被写下来时使用;当用户说 "set up constraints" 或 "define our standards" 时;当用户希望把他们在意的维度——无障碍性、Web 性能、覆盖率——设置成被强制执行的约束时;当 agent 为了变绿不断静默检查或跳过测试时;当你需要一个覆盖率或性能阈值却不知道该选什么数字时;或者当 agent 写下的代码超出任何人会读的体量时。

    Also in 4 projects that use this

  • LLl0k0laDSkill

    shipping-and-launch

    Use when preparing to deploy to production. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.

    Also in 26 projects that use this

  • galandoSkill

    source-driven-development

    Version-aware, source-driven development — fetch official docs before writing framework code

    Also in 25 projects that use this

  • az9713Skill

    deprecation-and-migration

    Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when deciding whether to maintain or sunset existing code.

    Also in 22 projects that use this

  • +7 more from LLl0k0laD

The file

Files
SKILL.md

Context Engineering — Управление контекстом сессии

Зачем это нужно

Контекстное окно = рабочий стол. Когда на нём слишком много всего:

  • Claude начинает "забывать" детали из начала сессии
  • Ответы становятся медленнее и дороже
  • Важные решения теряются при compaction

Эта инструкция — система управления "рабочим столом".


Правило 1: Горячее vs Холодное

Горячий контекст (держать в окне):

  • Текущая задача и её статус
  • Последние 3 ошибки и их причины
  • Файлы которые редактируются прямо сейчас

Холодный контекст (вынести в файлы):

  • Архитектурные решения → .claude/memory/decisions.md
  • Паттерны → ~/.claude/memory/_auto/patterns.md
  • История сессий → ~/.claude/memory/_auto/wiki/

Если что-то важное — сохрани в файл, а не держи в промпте.


Правило 2: Когда делать /compact

Делай /compact когда:

  • Контекст > 60% заполнен (смотри statusline)
  • Закончена логическая единица работы (фича, PR, дебаг сессия)
  • Перед сменой задачи

НЕ делай /compact:

  • В середине дебага (потеряешь стек трейс)
  • Если не сохранил activeContext.md

Правило 3: Перед /compact — сохрани

Обязательный чеклист:

1. Обновить .claude/memory/activeContext.md (## Current Focus)
2. Если был bug fix → добавить в patterns.md [AVOID]
3. Если было решение → добавить в decisions.md
4. Если длинный дебаг → session_save сохранит в wiki автоматически

Правило 4: Структура промптов

Плохо (тратит токены на повторение):

"Помни что мы используем Python 3.11, Neo4j 5.x, pytest,
и что вчера мы решили использовать asyncpg вместо SQLAlchemy,
и что тесты запускаются через make test..."

Хорошо (ссылка на файл):

"Смотри CLAUDE.md для стека. Задача: [конкретное действие]"

Контекст уже в файлах благодаря session_start.py и knowledge_librarian.py. Не дублируй его в промптах.


Правило 5: Агенты для длинных задач

Если задача требует >20 tool calls — запускай через агента:

Agent(builder) → получает изолированный контекст

Это не тратит токены основной сессии на промежуточные шаги.


Диагностика: Признаки переполненного контекста

СимптомПричинаРешение
Claude повторяет вопросы которые уже задавалЗабыл начало сессии/compact + сохранить контекст
Ответы стали короче и поверхностнееЭкономит токены/compact
"Я не нашёл файл X" хотя читал его 5 минут назадContext evictionПрочитай файл снова явно
Медленная реакцияБольшой контекст = больше обработки/compact

Метрика

Хорошая сессия: <40% контекстного окна на середине задачи. Если больше → применяй правила 1-3 и делай /compact.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.