Killer Code

Best Practices

Learn best practices for using ClaudeCode effectively

Best Practices

Common Best Practices (ranked by community frequency)

  • CLAUDE.md and memory: Maintain concise CLAUDE.md at repo root (and subfolders/home). Use # to capture commands, patterns, and rules the model should follow.
  • Plan before coding: Ask Claude to research and propose a plan (Explore → Plan → Code → Commit). Use extended thinking ("think hard/ultrathink") and avoid one-shot mega prompts.
  • Keep context focused: Use /clear between tasks, start fresh sessions per task, and /compact at natural breakpoints.
  • Tests first, human-written: Prefer TDD. Run tests/typecheck/lint after small edits. Do not let AI write or modify test expectations for critical areas.
  • Safety and permissions: Configure allowlists; use auto-accept sparingly. YOLO (--dangerously-skip-permissions) only in constrained environments with backups.
  • Be specific and reference context: State exact requirements, edge cases, and success criteria; reference files; attach images/URLs when relevant.
  • Iterate in small steps: Stage early and often, interrupt to course-correct, undo when needed, and avoid large, hard-to-review diffs.
  • Parallelize with subagents and worktrees: Use Task/subagents, multiple Claude instances, multiple checkouts or git worktrees for independent tasks.
  • Customize your setup: Create custom slash commands and hooks; fine-tune .claude/settings.json; install gh CLI; enable IDE/terminal integrations.
  • Use Claude for git/GitHub: Generate commits/PRs, fix failing builds, triage issues, and handle complex git flows via guided commands.
  • Headless/CI automation: Use headless mode in scripts and CI to lint, triage, or run structured workflows.
  • Respect "never-touch" zones: Keep migrations, API contracts, secrets, and security-critical code under human control with explicit boundaries.

Getting Started

Whether you're a beginner or an experienced user, these articles will help you better understand and use Best Practices.

Contributing

Have great content to share? We welcome community contributions! Please follow our contribution guidelines to help make this resource even better.


Explore these articles to enhance your Best Practices experience!