🧠 Claude Code Best Practices
A practical guide to using Claude Code, Anthropic’s agentic coding assistant, effectively in real-world development workflows. This repo distills best practices, patterns, and examples for integrating Claude Code into your terminal-based coding environment.
✨ What is Claude Code?
Claude Code is a command-line tool that gives you direct access to Claude’s reasoning and coding capabilities. It’s designed for agentic coding - where Claude autonomously explores, edits, and explains code across your project. Think of it as a collaborative AI pair programmer that understands your repo structure, coding conventions, and workflows.
📦 What You’ll Find Here
- 🛠️ Setup Tips
- How to configure your environment for Claude Code
- 🧠 Prompt Design & Context Handling
- Effective ways to ask Claude for code generation, refactoring, or debugging
- Using
CLAUDE.mdto preload project context
- 🧪 Testing & Debugging
- Run tests, fix failures, and lint code—all from the CLI
- 🔄 Git Workflows
- Create commits, open PRs, and resolve merge conflicts with Claude
- ⚙️ Hooks & Automation
- Enforce naming conventions, testing protocols, and architectural rules
- 🛡️ Safety & Control
- How Claude Code handles read-only access and tool permissions
- Works with your tools, your standards, your repo
- 🧰 Real Examples
- Scripts and terminal sessions showing Claude Code in action
🧭 Why Use Claude Code?
Claude Code is optimized for agentic coding - AI that acts with autonomy and awareness:
- Understands your codebase structure and dependencies
- Makes coordinated edits across files
- Integrates with GitHub, GitLab, VS Code, and JetBrains IDEs
- Designed for flexibility, transparency, and developer control
🔧 Custom Slash Commands
This repository includes a collection of custom slash commands designed to streamline development workflows with Claude Code. Use /help-commands to get detailed information about all available commands.
Project Management & Documentation
-
/custom-init
Automatically generates comprehensive CLAUDE.md files for any project by analyzing project structure, technology stack, and development patterns. -
/help-commands
Provides comprehensive help documentation for all available custom commands, including usage examples and best practices.
Version Control & Git
-
/commit
Creates well-formatted conventional commits following best practices with automatic staging, diff analysis, and atomic commit recommendations. Uses standardized commit templates from.gitmessageand.github/COMMIT_CONVENTION.md. -
/issue
End-to-end GitHub issue resolution following GitHub Flow with automated planning, branch creation, and incremental implementation. Integrates with GitHub PR templates from.github/pull_request_template.md. -
/reviewpr
Comprehensive pull request review process with CI/CD checks, code quality analysis, and structured feedback via GitHub CLI.
Code Analysis & Testing
/test
Comprehensive test execution and improvement with framework detection, targeted test runs, coverage analysis, and automated fixes.
🤖 Specialized AI Agents
This repository includes a collection of 10 specialized AI agents that provide domain-specific expertise across all development workflows. These agents work automatically with commands to deliver expert-level capabilities in architecture, development, and quality assurance.
Note: Commands also leverage Claude Code's built-in
general-purposeagent for complex multi-step analysis and file searching. It ships with Claude Code, so it is not defined in this repository.
🏗️ Core Infrastructure Agents
-
general-solution-architect
Architecture analysis, technology stack decisions, scalability planning, and distributed systems design. -
general-technical-writer
Documentation creation, API documentation, formatting, and technical content organization. -
general-pm
Product management oversight — issue creation, prioritization, progress tracking, and lifecycle management.
💻 Development Specialists
-
general-fullstack-developer
End-to-end feature implementation spanning database, API, and frontend layers with seamless integration. -
general-backend-developer
API development, database design, server-side logic, and backend performance optimization. -
general-frontend-developer
UI/UX implementation, component patterns, browser automation, and modern JavaScript frameworks. -
general-devops
Infrastructure automation, CI/CD pipeline design, container orchestration, and reliability engineering.
🛡️ Quality Assurance & Leadership
-
general-qa
Testing strategies, test automation, comprehensive validation, and quality assurance methodologies. -
general-code-quality-debugger
Code review, systematic debugging, refactoring guidance, and technical debt reduction. -
general-technical-project-lead
Security assessments, strategic technical decisions, performance optimization, and architectural leadership.
Agent Integration: These specialized agents work seamlessly with all custom commands, automatically providing domain expertise when needed. Commands like /issue, /reviewpr, and /test leverage multiple agents to deliver comprehensive, expert-level results.
🧩 Skills
Skills are model-invoked capabilities: instead of being triggered by a slash command, Claude Code loads them automatically when the task matches the skill's description. Each skill lives in .claude/skills/<name>/SKILL.md with YAML frontmatter (name, description) and instructions in the body.
This repository includes one example:
conventional-commits
Automatically enforces the project's commit format whenever a commit message is being authored — no command needed.
Skills vs. commands vs. agents:
| Mechanism | Trigger | Best for |
|---|---|---|
| Slash command | User types /name | Explicit, on-demand workflows |
| Skill | Claude matches the description | Conventions and know-how that should apply automatically |
| Subagent | Delegated by Claude or a command | Heavy, focused work that should run in its own context window so it doesn't crowd the main session |
See the Skills documentation for authoring details, including bundling scripts and reference files alongside SKILL.md.
⚙️ Project Configuration
The repository ships a checked-in .claude/settings.json that demonstrates two of the most useful project-level configuration mechanisms:
Permissions
Scoped allow / ask / deny rules let Claude Code run safe, routine commands (git status, gh pr view, etc.) without prompting, require confirmation for riskier ones (git push), and block reads of sensitive files (.env, secrets/). Tune these to your team's risk tolerance — settings are merged from user, project, and local scopes.
Hooks
Hooks register shell commands that run automatically on lifecycle events (PreToolUse, PostToolUse, Stop, etc.). The bundled example uses a Stop hook to print git status --short at the end of every turn so you always see what changed. Other common patterns:
PostToolUsematchingEdit|Write— auto-format or lint files after Claude edits them.PreToolUsematchingBash— block dangerous commands before they execute.Stop— send a desktop/Slack notification when Claude finishes a long task.
See the Hooks documentation for the full event list and JSON schema.
📚 Claude Code Documentation
Models Overview
"Claude is a family of state-of-the-art large language models developed by Anthropic. This guide introduces our models and compares their performance with legacy models."Best Practices for Agentic Coding
"Claude Code is a command line tool for agentic coding. This post covers tips and tricks that have proven effective for using Claude Code across various codebases, languages, and environments."Common Workflows
"Learn about common workflows with Claude Code. Each task in this document includes clear instructions, example commands, and best practices to help you get the most from Claude Code."Run Parallel Claude Code Sessions with Git Worktrees
"Suppose you need to work on multiple tasks simultaneously with complete code isolation between Claude Code instances."
Manage Claude's Memory
"Learn how to manage Claude Code’s memory across sessions with different memory locations and best practices. Claude Code can remember your preferences across sessions, like style guidelines and common commands in your workflow."Hooks
"Customize and extend Claude Code’s behavior by registering shell commands."Sub-agents
"Create and use specialized AI sub agents in Claude Code for task-specific workflows and improved context management."Claude Code Subagents Collectionby davepoon
"A comprehensive collection of specialized AI subagents for Claude Code, designed to enhance development workflows with domain-specific expertise."
GitHub Actions
"Learn about integrating Claude Code into your development workflow with Claude Code GitHub Actions. Claude Code GitHub Actions brings AI-powered automation to your GitHub workflow. With a simple @claude mention in any PR or issue, Claude can analyze your code, create pull requests, implement features, and fix bugs - all while following your project's standards."
🔖 Other Documentation
My Claude Code Workflow and Personal Tipsby paradite
"How I use roadmap + task files to manage Claude Code, and my personal tips for effective Claude Code usage."Playwright MCP Server"A Model Context Protocol server that provides browser automation capabilities using Playwright. It lets Claude interact with web pages, fill forms, take screenshots, and run end-to-end checks against a real browser. The older Puppeteer MCP server is archived — Playwright MCP is the maintained replacement."
💡 Inspired by:
The Claude Code WORKFLOW with GitHub to Build Complex Appsby gregbaugues
"f you're struggling to build an app with Claude Code, it's probably because you need a better process. Writing code is only one part of shipping complex software. Thankfully, we have a workflow to help us build complex software, and it works great with Claude Code."How to Give Claude Code a Better "Memory" of Your Projectby iannuttall
"In this video I show you a set of custom slash commands I built that will help you to log all of the changes you make with Claude Code into a simple memory system that is so much better than using /compact."Claude Code Multitasking Made EASYby CasJam
"This video shows you how to use Git Worktrees and my method for automating the workflow for spinning up new worktrees to run multiple Claude Code agents simultaneously."Claude Code Hooks is AMAZING: "Text Message Me When AI Agent is Done"by AllAboutAI-YT
A hands-on demo showing how to use Claude Code hooks to send a text message when your AI coding agent finishes a task—automating notifications with shell commands.My Claude Code Sub Agents BUILD THEMSELVESby disler
"Are you using Claude Code Sub Agents the WRONG way? I have a BIG IDEA for you. Sub Agents just changed EVERYTHING about AI coding. With the right approach, your agents can now BUILD THEMSELVES."
🔗 Related:
Awesome Claude Codeby hesreallyhim
"This is a curated list of slash-commands, CLAUDE.md files, CLI tools, and other resources and guides for enhancing your Claude Code workflow, productivity, and vibes."SuperClaude Frameworkby SuperClaude-Org
"A framework that extends Claude Code with specialized commands, personas, and MCP server integration."Agent OSby buildermethods
"Agent OS transforms AI coding agents from confused interns into productive developers."