Claude Code: настройте CLAUDE.md, rules и skills
CLAUDE.md хранит короткие постоянные инструкции, каталог .claude/rules даёт path-scoped guidance, а skills загружают domain knowledge и workflows по необходимости. Эти поверхности дополняют, а не дублируют друг друга.
Вот CLAUDE.md companion-проекта - только то, что нельзя вывести из кода.
# Companion project guidance
- Runtime: Node.js 24 or later, ESM, strict TypeScript.
- Install with `npm ci` and verify with `npm run check`.
- Keep runtime dependencies at zero unless the task explicitly requires one.
- Use exact command allowlists and `spawn` with `shell: false`.
- Keep changes inside the repository root and reject symbolic-link traversal.
- A task is complete only when typecheck, tests, and the end-to-end demo pass.Ищет инструкции Claude Code в нескольких местах: ~/.claude/CLAUDE.md для личных defaults, ./CLAUDE.md или ./.claude/CLAUDE.md для shared project guidance, ./CLAUDE.local.md для personal notes, parent-файлы для monorepo и дочерние CLAUDE.md, которые подгружаются при чтении соответствующей директории. Команда /init анализирует репозиторий и создаёт starter; документация рекомендует держать его human-readable и коротким, а /context помогает проверить, что файл загружен.
Повторяемый workflow оформляется как project skill в .claude/skills/<name>/SKILL.md.
---
name: verified-change
description: Implement a small repository change through explicit scope, plan, patch, tests, and independent evidence review. Use for bug fixes and focused refactors.
---
# Verified change
1. Restate the goal, allowed write paths, constraints, and acceptance checks.
2. Read the relevant implementation, tests, and repository instructions before editing.
3. Write a short plan naming files, symbols, risks, and verification commands.
4. Make the smallest coherent patch. Do not change generated output or unrelated files.
5. Run the narrowest relevant test first, then `npm run check`.
6. Inspect the final diff and report changed files, commands, exit codes, and residual risks.
Stop and ask for direction if the requested change requires credentials, a destructive operation, or writes outside the declared scope.Что куда класть, удобно решать по таблице.
Содержание · Куда
- Команда full check -
CLAUDE.md - React conventions только для
*.tsx-.claude/rules/с path scope - Release review из семи шагов - Skill
- Обязательный запрет risky command - Permission или
PreToolUsehook - Merge condition - CI
CLAUDE.md - advisory. Официальный best-practices guide прямо противопоставляет advisory instructions и deterministic hooks. Для действия, которое обязано происходить без исключений, используйте hook или внешний gate, а не более строгую формулировку в тексте.
Поверхности знаний настроены. Осталось самое важное для автономности - permissions, sandbox, hooks и automation.