claude-code-best-practices

skill
Security Audit
Pass
Health Pass
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Community trust — 162 GitHub stars
Code Pass
  • Code scan — Scanned 1 files during light audit, no dangerous patterns found
Permissions Pass
  • Permissions — No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

💻 Best practices and examples for using Claude Code - Anthropic’s terminal-native AI - for writing, editing, and refactoring code with deep project awareness, prompt design, and safe automation.

README.md

đź§  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.md to 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 .gitmessage and .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-purpose agent 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:

  • PostToolUse matching Edit|Write — auto-format or lint files after Claude edits them.
  • PreToolUse matching Bash — 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."
  • 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."
  • 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 Tips by 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:

đź”— Related:

  • Awesome Claude Code by 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 Framework by SuperClaude-Org
    "A framework that extends Claude Code with specialized commands, personas, and MCP server integration."
  • Agent OS by buildermethods
    "Agent OS transforms AI coding agents from confused interns into productive developers."

Reviews (0)

No results found