Skip to content

๐Ÿค– Supercharge your Claude Code workflows with battle-tested command snippets, development patterns, and automated hooks

Notifications You must be signed in to change notification settings

genicsecops/claude-code-snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Claude Code Snippets ๐Ÿค–

Supercharge your Claude Code workflows with battle-tested command snippets and development patterns

License: MIT Claude Compatible PRs Welcome

A curated collection of powerful command snippets that transform how you work with Claude Code. These snippets establish clear patterns, workflows, and guardrails to help you write better code faster while maintaining high quality standards.

๐ŸŽฏ Why Use These Snippets?

  • ๐Ÿ›ก๏ธ Production-Ready: Battle-tested patterns for production codebases
  • โšก Efficiency Boost: Streamline repetitive workflows and enforce best practices
  • ๐ŸŽฎ Full Control: Choose your level of autonomy from guided approval to full TDD
  • ๐Ÿ” Quality First: Built-in code review and quality checks
  • ๐Ÿ“š Best Practices: Follows KISS, YAGNI, and DRY principles out of the box

๐Ÿช Hooks - Automated Workflows

Claude Code hooks allow you to automate repetitive tasks and enforce standards. Configure them in your .claude/settings.json file.

Available Hooks

  • ๐ŸŽจ auto-prettier - Automatically format code after every edit

How to Install Hooks

  1. Create a .claude directory in your project root (if not exists)
  2. Create or edit .claude/settings.json
  3. Copy the hook configuration from the desired hook file
  4. Save and restart Claude Code

Example .claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      // Your hooks here
    ]
  }
}

See the hooks/ directory for detailed configurations and examples.

๐Ÿ“‹ Available Commands

๐Ÿ”’ /approval-mode - Controlled Development Workflow

The perfect companion to Claude's Plan Mode - while Plan Mode helps you strategize, Approval Mode gives you granular control over the actual implementation.

How it Works with Plan Mode

  1. Plan Mode: Claude creates a high-level implementation strategy
  2. Approval Mode: Takes that plan and breaks it into controlled, reviewable steps
  3. You Stay in Control: Guide the implementation, correct course when needed

Key Features

  • โœ… Step-by-Step Control: Review each implementation chunk before execution
  • ๐Ÿ“ Detailed Previews: See exactly what will change before it happens
  • ๐Ÿ”„ Course Correction: Redirect Claude if implementation drifts from intent
  • ๐Ÿ›ก๏ธ Safety First: Prevent unintended modifications to critical code
  • ๐ŸŽฏ Thoughtful Implementation: Uses sequential thinking for each major step

What Requires Approval

  • Creating/deleting files or folders
  • Installing packages or dependencies
  • Major refactoring (>20 lines)
  • Git operations
  • Database changes
  • Each feature implementation chunk

Use when: After planning phase, working on production code, implementing complex features, or when you need to ensure implementation matches your exact requirements

๐Ÿ” /review - Comprehensive Code Review

Get professional-grade code reviews with focus on:

  • ๐Ÿ” Security vulnerabilities and best practices
  • ๐Ÿ—๏ธ Architecture and design patterns
  • ๐Ÿ“Š Performance optimization opportunities
  • ๐Ÿงน Code quality and maintainability
  • ๐Ÿ“– Documentation completeness

Use when: Before merging PRs, after major features, or for code audits

๐Ÿงช /tdd - Pure Test-Driven Development

Enforces strict TDD with the classic Red-Green-Refactor cycle:

  • ๐Ÿ”ด Red: Write failing tests first
  • ๐ŸŸข Green: Implement minimal code to pass
  • ๐Ÿ”„ Refactor: Improve code while tests stay green
  • ๐Ÿšซ No implementation without tests

Use when: Building new features, ensuring high test coverage, or learning TDD

๐Ÿ“ Repository Structure

claude-code-snippets/
โ”œโ”€โ”€ commands/
โ”‚   โ”œโ”€โ”€ approval-mode.md    # Controlled development workflow
โ”‚   โ”œโ”€โ”€ review.md          # Code review command
โ”‚   โ””โ”€โ”€ tdd.md            # Test-driven development
โ”œโ”€โ”€ claudefiles/
โ”‚   โ””โ”€โ”€ CLAUDE_USER.md    # Global development principles
โ”œโ”€โ”€ hooks/
โ”‚   โ””โ”€โ”€ auto-prettier.md   # Auto-format code after edits
โ””โ”€โ”€ README.md            # This file

๐Ÿ’ก Special Files

  • CLAUDE_USER.md: Core development principles including:
    • KISS, YAGNI, DRY principles for maintainable code
    • Testing Philosophy: Behavior-focused testing, no implementation details
    • Communication Guidelines: Clear, proactive communication
    • Over-engineering Prevention: Red flags and best practices

๐Ÿš€ Getting Started

Quick Start (Single Use)

  1. Browse the commands/ directory
  2. Copy the content of your desired command
  3. Paste it in your Claude Code conversation
  4. Start with the command, e.g., /approval-mode

Global Configuration (Recommended)

For consistent development practices across all projects:

# Create Claude configuration directory
mkdir -p ~/.claude

# Copy global principles
cp claudefiles/CLAUDE_USER.md ~/.claude/CLAUDE.md

Now these principles apply to all your Claude Code sessions!

๐Ÿ“š Command Examples

Using Approval Mode

User: /approval-mode
Claude: Approval mode activated. I'll request your approval before making changes.

User: Add error handling to the payment processor
Claude: I'll add error handling. Here's my plan:
1. Add try-catch blocks around payment API calls
2. Implement retry logic for transient failures
3. Add proper error logging

Shall I proceed with these changes? [yes/no]

Running Code Review

User: /review
Claude: I'll perform a comprehensive code review. Starting analysis...

[Reviews code for security, performance, maintainability, etc.]

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. ๐Ÿ› Report Issues: Found a bug or have a suggestion? Open an issue
  2. ๐Ÿ’ก Share Snippets: Have a useful workflow? Submit a PR!
  3. ๐Ÿ“ Improve Docs: Help us make the documentation even better
  4. โญ Star & Share: If you find this helpful, star the repo and share with others

Contribution Guidelines

  • Follow the existing format for new commands
  • Test your snippets thoroughly
  • Include clear use cases and examples
  • Keep commands focused on a single workflow

๐ŸŽ‰ Success Stories

"The approval mode snippet saved our production database from an accidental migration. Can't imagine working without it!" - Senior Developer

"TDD mode helped our team increase test coverage from 40% to 85% in just two sprints." - Tech Lead

๐Ÿ“„ License

MIT License - Use these snippets freely in your projects and share with your team!


Made with โค๏ธ by developers, for developers
โญ Star us on GitHub

About

๐Ÿค– Supercharge your Claude Code workflows with battle-tested command snippets, development patterns, and automated hooks

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published