Skip to content

antonzmiievskyi/cc-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Claude Code — Best Practices & Setup Guide (Feb 2026)

A single comprehensive reference for using Claude Code productively — prompt patterns, agent workflows, configuration, MCP servers, hooks, plugins, and team setup.

What's Inside

Everything lives in one file: claude-code-best-practices.md — 23 sections covering:

  • Quick start, commands cheat sheet, plan mode
  • Project configuration, CLAUDE.md templates, .claudeignore
  • Prompt patterns (Explore → Plan → Execute, scoped prompts, code review)
  • Parallel agents, agent loops, Ralph Wiggum autonomous mode
  • Custom commands (skills), hooks, permissions & security
  • MCP servers, plugins, IDE integrations
  • Environment variables, output styles, extended thinking
  • Community plugins & cross-agent delegation (Codex, Gemini, OpenCode)

Quick Start

Step 1: Install Claude Code

curl -fsSL https://claude.ai/install.sh | bash

Step 2: Navigate to your project and launch

cd ~/projects/my-app
claude

Step 3: Initialize project memory

/init

Using the Reference

Don't rename claude-code-best-practices.md to CLAUDE.md — at 2,400+ lines it would bloat every session. Your project's CLAUDE.md should stay under 100 lines with only project-specific rules. Instead, turn the guide into a skill so teammates can invoke it on demand:

mkdir -p .claude/skills/cc-guide
cp claude-code-best-practices.md .claude/skills/cc-guide/SKILL.md

Now anyone on the team can run /cc-guide "how do I set up parallel agents?" and get answers from the full reference without it living in context permanently. Alternatively, use @claude-code-best-practices.md to pull in specific sections mid-session.

Reading Suggestions

Beginners: Start with sections 1-3 (quick start, commands, project configuration), then jump to section 10 (context management).

Advanced users: Use it as a searchable reference — sections 5-6 (parallel agents, agent loops), section 13 (hooks), section 15 (MCP servers), and section 19 (environment variables) are the most information-dense.

My Standard Workflow

This is the loop I follow for every non-trivial task. It keeps Claude focused, avoids wasted iterations, and produces code that's reviewed before it lands.

  1. Setup — Launch claude in the project directory. First time only: install plugins (see Plugin & MCP Setup below). Then /init to generate CLAUDE.md if the project doesn't have one yet.
  2. Brainstorm — Run /superpowers:brainstorm. Claude asks clarifying questions, explores alternatives, and produces a design document. This prevents building the wrong thing — 10 minutes here saves hours later.
  3. Plan — Press Shift+Tab to enter plan mode, or run /superpowers:write-plan to break the design into discrete tasks for sub-agents. Each task should be small enough to complete and commit independently.
  4. Execute — Run /superpowers:execute-plan. Sub-agents pick up tasks in parallel, each working in isolation. Claude commits after every completed task so you always have a rollback point.
  5. Review — Superpowers automatically triggers a two-stage code review between tasks (spec compliance, then code quality). You don't need to invoke this manually — just watch for its feedback and address anything flagged.
  6. Commit & wrap up — After all tasks pass review, run /superpowers:finishing-a-development-branch. It verifies tests, then offers merge, PR, or cleanup options.

Between each cycle: /clear to reset context. Start the next task with a clean slate.

Key mindset: think in agents, not single prompts. Most real tasks — feature implementation, refactoring, migrations — should be broken into parallel sub-agent work. A single Claude session orchestrates while sub-agents each get their own clean context. This is not an advanced technique; it's the default way to work. Steps 4-5 above do this automatically via Superpowers, but you can also do it manually: "Implement @docs/spec.md using subagents, commit after each task". See section 5 (Parallel Agents) and section 5.6 (Agent Teams) for the full picture.

Plugin & MCP Setup

Install these once per machine (global) or once per project. Restart Claude after installing (/exit then claude -r).

Global — always install these:

# Superpowers: structured SDLC workflow (brainstorm → plan → execute → review)
/plugin marketplace add obra/superpowers-marketplace
/plugin install superpowers@superpowers-marketplace --user

Recommended per-project:

# Everything Claude Code: comprehensive skill collection (PDF, XLSX, frontend design, etc.)
/plugin install everything-claude-code@claude-plugins-official

Situational:

  • Context7 — MCP server for pulling up-to-date library docs directly into context. Useful for large codebases or unfamiliar frameworks. Install via claude mcp add context7.
  • Code Simplifier — Plugin for guided refactoring sessions. Useful when reducing complexity in legacy code.

See section 16 (Plugins) and section 20 (Community Plugins) in the full reference for more options.

Project Config Files

These files live in your project root and should be committed to Git so the whole team shares the same setup.

File Purpose Example
CLAUDE.md Project memory — architecture, conventions, build commands. Claude reads this at session start. Stack info, coding standards, "run pnpm test before committing"
.claude/settings.json Team permissions — what Claude can and can't do. Higher-scope deny rules always win. Allow Read, Write(src/**), deny Read(.env*)
.claude/settings.local.json Personal overrides (add to .gitignore). Model preference, output style. "model": "opus", "outputStyle": "explanatory"
.mcp.json Shared MCP servers for the project — databases, doc servers, APIs the team needs. Project-specific Postgres, internal docs search
.claude/commands/*.md Team slash commands — shared workflows everyone can invoke. /deploy, /review-pr, /test-fix
.claude/agents/*.md Team sub-agents — reusable specialized agents (code reviewer, security auditor). code-reviewer.md, api-specialist.md

Run claude mcp add --scope project <name> to add an MCP server to .mcp.json. See section 3 (Project Configuration) for the full config hierarchy.

Tips & Lessons Learned

Practical advice from real usage. Most of these come from the anti-patterns table in section 21 of the full guide.

  • /clear after every commit. Context rot is the #1 cause of bad output. Treat /clear like saving a file.
  • Check /context regularly, /compact at 70%. Use /compact Focus on [current task] to keep relevant context and drop the rest.
  • Scope prompts tightly. "Read @src/auth/jwt.ts and find why tokens expire early" beats "investigate the auth problem". Direct file references use far less context than search.
  • Use plan mode for anything non-trivial. It prevents the back-and-forth correction loop. If you're correcting Claude more than twice, /clear and start over in plan mode.
  • Keep CLAUDE.md under 100 lines. If Claude already does something correctly, don't add a rule for it. Long CLAUDE.md files get ignored.
  • Press Esc immediately when Claude goes off track. Every wrong token wastes context. Then /clear or Esc+Esc to rewind.
  • Sonnet for daily work, Opus for architecture. Don't use the most expensive model for everything — match the model to the task complexity.
  • Delegate routine tasks to GLM-4.7 via OpenCode to cut token costs — see section below.
  • Use the built-in claude-code-guide agent to ask Claude about its own features, commands, and settings — it searches the docs for you. Run /doctor if something feels broken.

Saving Tokens with OpenCode + GLM-4.7

The team runs a locally deployed GLM-4.7 (top open-source coding model, 73.8% SWE-bench). Instead of burning Anthropic tokens on routine work — bulk renames, boilerplate generation, simple analysis — delegate it to the local model via OpenCode:

npm i -g opencode-ai@latest                          # one-time install
opencode run -m zai-org/glm-4.7 "<prompt>"            # one-liner delegation

To let Claude decide when to delegate automatically, create a sub-agent or skill (.claude/agents/private-model.md or .claude/skills/private-model/SKILL.md) that calls opencode run for you. Add the required permission to .claude/settings.json:

{ "permissions": { "allow": ["Bash(opencode *)"] } }

Claude stays the orchestrator — it accepts the task, delegates the routine part, and validates the result. Data never leaves your infrastructure.

See section 20.6 Method 4 in the full reference for the complete opencode.json config, agent/skill YAML, and deployment options.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors