К основному содержанию
скилл CX Codex

cc-best-practices — скилл для Claude Code: как работать с агентом

Скилл-инструкция по работе с Claude: управление контекстом, режим планирования, проверка результата и разбор типичных ошибок.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add dboeckli/ai-agent-skills --skill cc-best-practices -a claude-code
Открыть на GitHub

Что делает cc-best-practices

Скилл подключается к агенту как набор правил и срабатывает, когда вы спрашиваете, как выжать больше из Claude, как писать промпты или почему агент повторяет одну и ту же ошибку. Внутри — шесть шагов: дать агенту способ проверить свою работу, пройти путь «изучить → спланировать → реализовать», писать узкие промпты с именами файлов, держать CLAUDE.md коротким, чистить контекст через /clear и /compact, отдавать разведку и ревью субагентам.

Главная мысль, из которой выведено всё остальное: контекстное окно заполняется быстро, и качество ответов падает по мере заполнения. Поэтому после двух неудачных правок одной и той же проблемы скилл советует не спорить с агентом дальше, а очистить сессию и переписать исходный промпт. Для проверки предлагается запускаемый сигнал — тесты, код возврата сборки, линтер или скрипт сравнения вывода, а не заверения агента, что всё готово.

Планирование стоит включать не всегда: для опечатки или переименования в одной строке режим плана только добавляет возни. Если правка затрагивает несколько файлов или код вам незнаком, сначала разведка и план, потом код. Установка идёт через npx skills add с флагом под вашу платформу.

Какие задачи решает

  • понять, почему агент бросает работу, как только код выглядит готовым
  • разложить крупный рефакторинг на план до первой правки
  • переписать расплывчатый промпт в конкретный, с файлами и симптомами
  • выбраться из сессии, где агент повторяет одну и ту же ошибку
  • решить, когда чистить контекст, а когда уплотнять его с подсказкой

Примеры запросов агенту

  • Почему Claude повторяет одну и ту же ошибку после трёх правок?
  • Как мне подойти к рефакторингу на 10 файлов?
  • Как писать промпты для Claude, чтобы результат не был случайным?

Как установить cc-best-practices

1Через Skills CLI (Vercel)

npx skills add dboeckli/ai-agent-skills --skill cc-best-practices -a claude-code

2Вручную: положить файлы

~/.claude/skills/cc-best-practices/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/cc-best-practices/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о cc-best-practices

Как установить cc-best-practices в Claude?

Выполните npx skills add dboeckli/ai-agent-skills --skill cc-best-practices -a claude-code. Скилл окажется в ~/.claude/skills/cc-best-practices/SKILL.md.

Что делает cc-best-practices?

Даёт агенту инструкции по работе с Claude: как проверять свою работу, как проходить путь «изучить → спланировать → реализовать», как управлять контекстом и что делать, когда агент зациклился.

На каких платформах работает скилл?

Кроме Claude есть установка для Codex, Cursor, GitHub Copilot, Gemini CLI и OpenCode — у каждой свой флаг или команда.

Исходный текст

SKILL.md · MIT
---
name: cc-best-practices
description: "Guidance on how to use Claude Code effectively — covering context management, verification strategies, the explore-plan-implement workflow, prompting techniques, session management, parallel sessions, and common failure patterns. Use this skill whenever the user asks how to get the most out of Claude Code, how to write better prompts, how to manage context, when to use plan mode, how to automate tasks, or when they describe a frustrating pattern like Claude repeating mistakes or losing track of instructions."
---

---

# Claude Code Best Practices

Based on the official Anthropic documentation at https://code.claude.com/docs/en/best-practices.

The single most important constraint: **Claude's context window fills up fast,
and performance degrades as it fills.** Every best practice flows from this.

---

## Instructions

### Step 1: Always give Claude a way to verify its work

Provide a runnable check (test suite, build exit code, linter, diff script) so Claude can confirm success independently. Ask for **evidence** (test output, command result), not just assertions.

### Step 2: Use the Explore → Plan → Implement workflow for non-trivial tasks

Enter `/plan` mode, let Claude read the codebase first, then draft a plan before writing any code. Exit plan mode to implement. Skip this only for small, obvious changes.

### Step 3: Write specific, scoped prompts

Name files (`@filename`), describe symptoms rather than guesses, reference existing patterns. Vague prompts produce vague results.

### Step 4: Keep CLAUDE.md short and actionable

Include only what Claude cannot infer from the code. Every line should answer: "Would removing this cause Claude to make mistakes?" If not — cut it.

### Step 5: Manage context aggressively

Use `/clear` between unrelated tasks. After two failed corrections on the same issue: clear and write a better prompt. Use `/compact <hint>` to compact with focus.

### Step 6: Use subagents for investigation and review

Let subagents explore unfamiliar code or review your implementation — they run in a fresh context without bias toward the code they just wrote.

---

## Examples

### Example 1: Implementing a feature correctly

User says: "I keep getting flaky results when I ask Claude to implement something"

Actions:

1. Add a verification step to the prompt: "write a validateEmail function — run the existing test suite after implementing, show me the output"
2. If no tests exist: "write the function AND write tests for it, run them, show results"
3. Set a Stop hook to block turn completion until tests pass

Result: Claude iterates until tests pass instead of stopping when the code _looks_ done.

### Example 2: Tackling a complex, multi-file change

User says: "How should I approach a big refactor across 10 files?"

Actions:

1. Enter `/plan` mode — Claude explores without making changes
2. Ask: "read the affected files and write a step-by-step implementation plan"
3. Edit the plan directly with `Ctrl+G` if needed
4. Exit plan mode — Claude implements and commits per the plan
5. Run a subagent to review the diff in a fresh context

Result: Structured refactor with a reviewable plan, no context-thrashing from mixed explore/write turns.

### Example 3: Claude keeps repeating the same mistake

User says: "I've corrected Claude 3 times on the same issue and it keeps doing it wrong"

Actions:

1. Run `/clear` — start a fresh context
2. Identify what was missing from the original prompt (missing constraint, missing example, ambiguous scope)
3. Write a new initial prompt that includes the constraint explicitly: "IMPORTANT: do not use mocks in these tests — use real database connections"
4. Add the constraint to CLAUDE.md if it applies project-wide

Result: Clean session with a better-specified prompt outperforms a long session with accumulated corrections.

---

---

## 1. Give Claude a way to verify its work

Claude stops when the work _looks_ done. Without a runnable check, you become
the verification loop. Provide something that returns a pass/fail signal Claude
can read: a test suite, a build exit code, a linter, a script that diffs output.

- Ask Claude to run the check and iterate in the same prompt.
- Set `/goal` conditions for multi-turn verification.
- Use a **Stop hook** to block the turn from ending until a script passes.
- Use a **verification subagent** so the reviewer has a fresh context.

Ask Claude to show **evidence** (test output, command result, screenshot) rather
than just asserting success.

**Example upgrade:**

> Before: _"implement a function that validates email addresses"_
> After: *"write a validateEmail function. test cases: [email protected] → true,
>
> > invalid → false. run the tests after implementing"*

---

## 2. Explore first, then plan, then code

Use **plan mode** (`/plan` or the UI toggle) to separate reading from writing.

1. **Explore** — enter plan mode; Claude reads files without making changes.
2. **Plan** — ask Claude to write a detailed implementation plan. Press `Ctrl+G`
   to open the plan in your editor for direct edits.
3. **Implement** — exit plan mode; Claude codes and verifies against the plan.
4. **Commit** — ask Claude to commit and open a PR.

Skip planning when the scope is clear and the fix is small (typo, rename,
single-line change). Plan mode adds overhead — use it when the change touches
multiple files or you are unfamiliar with the code.

---

## 3. Provide specific context in your prompts

Claude can infer intent but cannot read your mind.

| Strategy             | Vague                                           | Specific                                                                                                              |
| -------------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| Scope the task       | _"add tests for foo.py"_                        | _"write a test for foo.py covering the edge case where the user is logged out. avoid mocks."_                         |
| Point to sources     | _"why does ExecutionFactory have a weird API?"_ | _"look through ExecutionFactory's git history and summarize how its API evolved"_                                     |
| Reference patterns   | _"add a calendar widget"_                       | _"look at HotDogWidget.php as a pattern reference and follow it to implement a calendar widget"_                      |
| Describe the symptom | _"fix the login bug"_                           | _"users report login fails after session timeout. check src/auth/ token refresh. write a failing test, then fix it."_ |

**Rich context techniques:**

- Use `@filename` to reference files directly.
- Paste screenshots or drag images into the prompt.
- Pipe data: `cat error.log | claude`
- Give URLs for documentation (allowlist domains via `/permissions`).

---

## 4. Write an effective CLAUDE.md

CLAUDE.md is read at the start of every session. Keep it **short and
human-readable** — bloated CLAUDE.md files cause Claude to ignore actual
instructions.

**Include:**

- Bash commands Claude cannot guess (e.g., build/test commands)
- Code style rules that differ from language defaults
- Testing instructions and preferred test runners
- Repository etiquette (branch naming, PR conventions)
- Architectural decisions specific to the project
- Developer environment quirks, required env vars
- Common gotchas or non-obvious behaviors

**Exclude:**

- Anything Claude can figure out by reading the code
- Standard language conventions Claude already knows
- Detailed API documentation (link instead)
- Self-evident practices like "write clean code"

For each line: _"Would removing this cause Claude to make mistakes?"_ If not, cut it.

Use `/context` to confirm Claude loaded the file. Use `@path/to/file` imports
in CLAUDE.md to pull in other files selectively.

---

## 5. Manage session context aggressively

- `/clear` — reset context between **unrelated** tasks.
- `/compact <instructions>` — compact with focus (e.g., `/compact Focus on API changes`).
- `Esc + Esc` / `/rewind` — open the rewind menu; restore conversation and/or
  code state to any previous checkpoint.
- `/btw` — ask a quick side-question; answer appears in an overlay and never
  enters conversation history.

**After two failed corrections on the same issue:** run `/clear` and write a
better initial prompt incorporating what you learned. A clean session with a
better prompt outperforms a long session with accumulated corrections.

Customize compaction in CLAUDE.md:

> *"When compacting, always preserve the full list of modified files and any
>
> > test commands"*

---

## 6. Use subagents for investigation and review

Subagents run in their own context window and report back summaries, keeping
your main conversation clean.

```
Use subagents to investigate how our authentication system handles token
refresh, and whether we have any existing OAuth utilities I should reuse.
```

After implementation:

```
use a subagent to review this code for edge cases
```

Use `/code-review` skill for a bug-focused adversarial review of the current diff.

---

## 7. Automate and scale

**Non-interactive mode** — integrate Claude into CI, pre-commit hooks, scripts:

```bash
claude -p "List all API endpoints" --output-format json
claude -p "Analyze this log file" --output-format stream-json --verbose
```

**Fan out across files** — loop through tasks:

```bash
for file in $(cat files.txt); do
  claude -p "Migrate $file from React to Vue. Return OK or FAIL." \
    --allowedTools "Edit,Bash(git commit *)"
done
```

**Parallel sessions** — run multiple Claude sessions with git worktrees so
edits don't collide. Writer/Reviewer pattern:

- Session A implements a feature.
- Session B reviews the diff in a fresh context (no bias toward the code it
  just wrote).

**Auto mode** — uninterrupted execution with background safety checks:

```bash
claude --permission-mode auto -p "fix all lint errors"
```

---

## 8. Common failure patterns and quick reference

For the full failure patterns table, all CLI commands, and non-interactive mode examples, consult `references/commands.md`.

© dboeckli · MIT · dboeckli/ai-agent-skills

Похожие скиллы

Все скиллы по теме «Настройка агента: память, контекст, субагенты» →
readchk LilMGenius Скилл проверяет, правильно ли агент понял вашу инструкцию, до того как потратит работу. Пригодится на длинных и необратимых задачах. CX Codex +1 1 200установок qwenchance thananon Скилл помогает на длинных многоэтапных задачах: ловит повторяющиеся шаги, останавливает бесконечный перебор вариантов и следит за лимитом контекста. Срабатывает, когда модель зависает в кругах или контекст вот-вот кончится. CX Codex +1 2 400установок thinking-model-router tjboudreaux Скилл-маршрутизатор: по домену и типу задачи выбирает один подходящий thinking-скилл или честно отвечает NONE. Нужен, когда непонятно, какой подход применить. CX Codex +1 605установок planning-with-files zhaono1 Скилл ведёт план, заметки и результат задачи в markdown-файлах, а не в контексте. Пригодится на многошаговых задачах и ресёрче. CX Codex +1 1 200установок context-master JosiahSiegel Скилл для планирования сложных задач и многофайловых проектов. Заставляет агента сначала составить план, а потом писать файлы. CX Codex +1 397установок session-management alinaqi Скилл ведёт файлы состояния, решений и ориентиров в коде, чтобы работа продолжалась с того же места после перерыва или упора в лимит контекста. CX Codex +1 301установок

Из того же набора3

Спонсоры проекта

Компании, которые помогают держать аналитику открытой