Claude Code: XML-теги, <file_scope> и STOP-гейты без лишних правок
EN: Claude Code: XML Boundaries, <file_scope> & STOP-Gates Without Scope Drift
Как заставить Claude и Claude Code править только нужные файлы, не выдумывать API и экономить до 40% контекста.
3 ключевых правила
Обозначь чёткие границы: <rules>, <file_scope>, <context>, <output_contract>. Claude обучен уважать XML-контейнеры и перестаёт путать данные с инструкциями.
Wrap constraints in <rules>, <file_scope>, <context>, and <output_contract> so Claude never blurs instructions with pasted logs.
Перед рефакторингом пиши: «STOP после шага 1: покажи план правок по 2 файлам и дождись подтверждения». Это полностью убирает случайные поломки соседних модулей.
Require a STOP checkpoint after analysis: list the exact files and diff plan before writing any patch.
Всегда заканчивай промпт критерием готовности: какие тесты или tsc/lint команды должны пройти после правок.
End every engineering prompt with the exact test, type-check, or build command required to verify correctness.
Fix the bug in our auth middleware and clean up the codebase nicely without breaking anything.
<rules>Read-only audit first. STOP and wait for confirmation before editing.</rules> <file_scope>src/lib/auth.ts, src/app/api/user/action/route.ts</file_scope> <task>Trace why expired token_version passes session validation and propose a minimal diff + curl verification.</task>
<role>Senior Systems Engineer</role> <file_scope>ONLY touch files explicitly listed below: - path/to/target.ts </file_scope> <rules> 1. Do NOT invent helper functions or env vars not present in the repo. 2. Step 1: Output root cause + 3-bullet patch plan, then STOP. 3. Wait for approval before writing code. </rules> <verification>Run type-check + affected unit test after patch.</verification>
Открой интерактивные задания и проверь свой промпт в живом грейдере Prompter 3.0.