### Custom Agent Advanced Usage Examples Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/custom-agent.doc.md Demonstrates advanced usage patterns for custom agents, including triggering SOPs for critical operations, using examples for standard tasks, querying architectural principles, and constraint checks. ```text @agent-payment-api-agent process a new payment following our payment SOP @agent-backend-api-agent create a product CRUD endpoint like our example @agent-backend-api-agent what's the best way to structure our repository layer? @agent-payment-api-agent create an endpoint that stores credit card numbers ``` -------------------------------- ### Payment Processing Agent Usage Examples Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/custom-agent.doc.md Provides specific usage examples for the payment processing agent, demonstrating how to request various functionalities like creating endpoints, handling webhooks, and processing refunds. ```text @agent-payment-api-agent create a payment endpoint with 3D Secure support @agent-payment-api-agent handle the payment.succeeded webhook @agent-payment-api-agent process a partial refund ``` -------------------------------- ### Example: User Prompt Without Hook Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/hooks-guide.md This illustrates a typical user interaction where Claude immediately starts coding upon receiving a request, potentially making assumptions without clarification. ```text User: "Add a login feature" Claude: *immediately starts coding a login system with assumptions* ``` -------------------------------- ### Python FastAPI CRUD Endpoint Example Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/custom-agent.doc.md A basic Python code snippet demonstrating the setup for a CRUD endpoint using FastAPI and Pydantic. This serves as a template for backend API development. ```python # examples/example-1-crud-endpoint.py from fastapi import FastAPI, HTTPException, Depends from pydantic import BaseModel # Complete working example... ``` -------------------------------- ### Example: User Prompt With Hook Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/hooks-guide.md This demonstrates how the UserPromptSubmit hook modifies Claude's behavior. Before coding, Claude asks clarifying questions based on the injected context, ensuring requirements are understood. ```text User: "Add a login feature" Claude: "Before I start, let me clarify a few things: - What authentication method? (email/password, OAuth, SSO?) - Should it include registration functionality? - Do you need password reset capability? - Any specific security requirements?" ``` -------------------------------- ### Add Multiple Instructions via JSON Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/hooks-guide.md This JSON snippet demonstrates how to provide multiple instructions within the 'additionalContext' field. These instructions are concatenated and provided to Claude before it begins processing a task, guiding its behavior. ```json { "additionalContext": "Before starting: 1) Ask clarifying questions 2) Review existing code 3) Propose architecture" } ``` -------------------------------- ### Payment Processing Agent Configuration Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/custom-agent.doc.md An example of the auto-research result for a payment processing agent, detailing its name, role, tech stack, constraints (Layer 1), SOPs (Layer 2), examples (Layer 3), and principles (Layer 4). ```yaml Agent Name: payment-api-agent Role: Senior Python backend developer specializing in payment processing APIs Tech Stack: - Python 3.12+ - FastAPI - PostgreSQL - Redis - Stripe API - Celery Layer 1 Constraints: HOWEVER: - Validate all inputs with Pydantic - Never store card numbers (tokens only) - JWT authentication required - Rate limiting: 100 req/min per user - PCI-DSS Level 1 compliance MUST NOT: - Store credit card numbers - Process payments without idempotency key - Skip webhook signature verification - Use synchronous blocking calls Layer 2 SOPs: - SOP-001: Process Payment - SOP-002: Handle Payment Webhook - SOP-003: Process Refund - SOP-004: Handle Chargeback Layer 3 Examples: - Payment endpoint with authorization - Webhook handler with signature verification - Refund processing endpoint - Payment retry background job Layer 4 Principles: - Repository pattern for data access - Event-driven architecture - Circuit breaker for external APIs - Correlation IDs for all operations ``` -------------------------------- ### Execute External Script for Context Injection (JSON) Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/hooks-guide.md This JSON configuration shows how to use the 'command' type hook to execute an external script, such as a Node.js script, to dynamically generate and inject context. This allows for more complex context generation logic. ```json { "type": "command", "command": "node .claude/scripts/inject-context.js" } ``` -------------------------------- ### Install Playwright Debugger Skill Source: https://context7.com/tomeraitz/dotclaude-templates/llms.txt The debugger skill utilizes the Playwright MCP server to verify frontend interactions. This command installs the necessary MCP server to enable automated browser testing and validation. ```bash claude mcp add playwright npx @playwright/mcp@latest ``` -------------------------------- ### Custom Agent Configuration Template (Markdown) Source: https://context7.com/tomeraitz/dotclaude-templates/llms.txt Defines a custom hybrid agent with detailed configurations across four layers: Core Constraints (MUST/MUST NOT), Standard Operating Procedures (SOPs), Examples, and Principles/Best Practices. This template provides full manual control over agent behavior and is intended for use within the .claude/agents directory. ```markdown # Manual Mode Template - Full Control Create a custom hybrid agent with the following configuration: **Agent Name:** payment-api-agent **Agent Role/Identity:** Senior Python backend developer specializing in payment processing APIs with FastAPI. Expert in PCI-DSS compliance, idempotent operations, and financial transaction processing. **Technology Stack:** - Python 3.11+ - FastAPI - PostgreSQL - Redis - Stripe API - Celery for background jobs - Docker ## LAYER 1: Core Constraints **MUST Requirements (Security):** - Validate all inputs with Pydantic models - Never store card numbers (use tokens only) - JWT authentication with refresh tokens - Rate limiting: 100 requests/min per user - Environment variables for all secrets - PCI-DSS Level 1 compliance patterns **MUST NOT Requirements:** - MUST NOT store credit card numbers - MUST NOT process payments without idempotency key - MUST NOT skip webhook signature verification - MUST NOT use synchronous blocking calls for external APIs ## LAYER 2: SOPs (Critical Operations) **SOP-001: Process Payment** - Validate request with Pydantic - Check idempotency key - Authorize payment with Stripe - Store transaction record - Return response **SOP-002: Handle Payment Webhook** - Verify webhook signature - Parse webhook payload - Update transaction status - Send confirmation email - Acknowledge webhook ## LAYER 3: Examples Needed **Example 1:** Payment endpoint with authorization and capture **Example 2:** Webhook handler with signature verification **Example 3:** Refund processing endpoint ## LAYER 4: Principles & Best Practices **Architecture Patterns:** - Repository pattern for database access - Service layer for business logic - Dependency injection with FastAPI Depends - Event-driven architecture for async operations Please create the complete hybrid agent structure in `.claude/agents/payment-api-agent/`. ``` -------------------------------- ### Agent Registration File Structure (YAML) Source: https://context7.com/tomeraitz/dotclaude-templates/llms.txt Defines metadata for a custom agent, enabling its use with @mentions in Claude Code. This YAML frontmatter specifies the agent's name, description, usage examples, model inheritance, and color coding. It also points to the detailed configuration file for the agent. ```yaml # File: .claude/agents/backend-api-agent.md --- name: backend-api-agent description: | Use this agent when tasks involve backend API development, FastAPI microservices, database design, or API architecture. Examples: - User: "I need to create a REST API endpoint for user management" Assistant: "I'm going to use the Task tool to launch the backend-api-agent." - User: "How should I structure my database schema for multi-tenancy?" Assistant: "Let me use the backend-api-agent to advise on database architecture." model: inherit color: blue --- You are a Senior Python Backend Developer specializing in FastAPI microservices. Your configuration and detailed instructions are located at: .claude/agents/backend-api-agent When activated, you should: 1. Reference the complete instruction set from the specified location 2. Apply all defined backend development best practices and methodologies 3. Follow any project-specific patterns and standards outlined in those instructions 4. Maintain consistency with the operational framework defined there 5. Leverage all tools, approaches, and knowledge bases specified in your configuration ``` -------------------------------- ### Inject Context on User Prompt Submit (JSON) Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/hooks-guide.md This JSON configuration defines a UserPromptSubmit hook that injects additional context into Claude's processing every time a user submits a prompt. It uses an 'echo' command to prepend a JSON string containing 'additionalContext' to Claude's input. ```json { "hooks": { "UserPromptSubmit": [ { "hooks": [ { "type": "command", "command": "echo '{\"additionalContext\": \"Before starting any task, ask clarifying questions to ensure you fully understand the requirements. Do not make assumptions.\"}'" } ] } ] } } ``` -------------------------------- ### Custom Agent Basic Usage Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/custom-agent.doc.md Illustrates how to invoke custom agents using the @mention syntax followed by a specific request. This is the primary method for interacting with the created agents. ```text @agent-backend-api-agent create a user registration endpoint @agent-payment-api-agent process a refund following our SOP @agent-frontend-react-agent create a product listing component ``` -------------------------------- ### Agent Registration File Structure Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/custom-agent.doc.md Defines the structure of an agent's registration file, which enables @mention functionality. It includes metadata like name, description, model, and color, along with the agent's core prompt. ```yaml --- name: backend-api-agent description: | Use this agent when tasks involve backend API development, FastAPI microservices, database design, or API architecture. model: inherit color: blue --- You are a Senior Python Backend Developer specializing in FastAPI microservices... ``` -------------------------------- ### Team Usage with Git Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/docs/custom-agent.doc.md Shows how to integrate custom agents into a team workflow using Git. This involves committing agent files and pulling changes to ensure all team members have access to the same agents. ```bash # Commit the agent git add .claude/agents/[agent-name]/ git commit -m "Add [agent-name] custom agent" git push # Team members get it automatically git pull @agent-[agent-name] [request] # Works immediately! ``` -------------------------------- ### Generate Implementation Plan Structure Source: https://context7.com/tomeraitz/dotclaude-templates/llms.txt The /create-plan command generates a Markdown-based implementation plan. It outlines phases, assigns agents, and lists tasks to ensure a structured development workflow. ```markdown # User Profile Modal - Implementation Plan ## Overview Implement a user profile modal with edit capabilities and avatar upload. ## Execution Strategy ### Phase 1: Database Setup **Agent:** `supabase-local-dev` **Tasks:** - [ ] Create migration for user_profiles table - [ ] Add RLS policies for profile access ``` -------------------------------- ### Clone dotclaude-templates Repository Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/README.md This snippet demonstrates how to clone the dotclaude-templates repository to your local machine using Git. It's the first step to using the provided templates. ```bash git clone https://github.com/tomeraitz/dotclaude-templates.git cd dotclaude-templates ``` -------------------------------- ### Copy .claude Directory to Project Source: https://github.com/tomeraitz/dotclaude-templates/blob/main/README.md These snippets show how to copy the .claude directory from the cloned repository to your project's root directory. This makes the Claude templates available for your project. ```bash cp -r .claude/ /path/to/your/project/.claude/ ``` ```cmd xcopy .claude/ /path/to/your/project/.claude/ /E /I ``` -------------------------------- ### Execute Plan Files with /run-plan Source: https://context7.com/tomeraitz/dotclaude-templates/llms.txt The /run-plan command automates the execution of task lists defined in Markdown files. It maps plan agents to specific tool subagents and handles sequential phase execution with automatic validation. ```bash # Execute a plan file /run-plan .notes/user-profile-modal-plan.md ``` -------------------------------- ### Create Custom Agent (Bash) Source: https://context7.com/tomeraitz/dotclaude-templates/llms.txt Initiates the creation of a custom agent for Claude Code in interactive or quick mode. It prompts the user for the agent's specialization and offers different creation paths. After creation, agents can be invoked using @mentions. ```bash # Quick start - Interactive Mode /custom-agent I need a backend Python developer # Claude will respond with options: # 1. 🔍 Research current best practices # 2. 📝 Let you specify your preferred stack # 3. 🎯 Quick mode (minimal agent with basic best practices) # After creation, use the agent with @mentions: @agent-backend-api-agent create a user registration endpoint @agent-payment-api-agent process a refund following our SOP ``` -------------------------------- ### Configure Automation Hooks Source: https://context7.com/tomeraitz/dotclaude-templates/llms.txt Hooks defined in .claude/settings.json allow for automated command execution during specific events like UserPromptSubmit. This enables context injection or custom script execution before Claude processes requests. ```json { "hooks": { "UserPromptSubmit": [ { "hooks": [ { "type": "command", "command": "echo '{\"additionalContext\": \"Before starting any task, ask clarifying questions...\"}'" } ] } ] } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.