### Few-shot Example for Output Formatting Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Provide examples to guide the model in generating structured output, such as JSON objects with specific fields. ```json { "location": "src/auth/login.ts:42", "issue": "SQL injection in the username parameter", "severity": "critical", "suggested_fix": "Use a parameterized query" } ``` -------------------------------- ### Few-shot Examples for Ambiguous Scenarios Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Use these examples to demonstrate how to handle ambiguous user requests by showing the desired action and rationale. ```text Request: "My order is broken" Action: Call get_customer -> lookup_order -> check status. Rationale: “broken” may mean a damaged item; you need order details. Request: "Get me a manager" Action: Immediately call escalate_to_human. Rationale: The customer explicitly requests a human. Do not attempt to solve autonomously. ``` -------------------------------- ### Few-shot Examples for Informal Measurements Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Use these examples to guide the model in converting informal measurements into standardized formats, particularly useful for diverse units. ```text Text: "about two handfuls of rice" -> {"amount": "~100g", "original_text": "two handfuls", "precision": "approximate"} ``` ```text Text: "a pinch of salt" -> {"amount": "~1g", "original_text": "a pinch", "precision": "approximate"} ``` -------------------------------- ### Write Tool Usage Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Demonstrates the use of the Write tool for creating new files from scratch. ```text Create a file from scratch ``` -------------------------------- ### Initial Application Setup Source: https://github.com/paullarionov/claude-certified-architect/blob/main/practical_test_en.html Initializes the application by building the sidebar, rendering the first question, and updating the sidebar. This runs when the page loads. ```javascript buildSidebar(); renderQuestion(0); updateSidebar(); ``` -------------------------------- ### Read Tool Usage Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Shows the basic usage of the Read tool to load the entire content of a file for analysis. ```text Load a file for analysis ``` -------------------------------- ### Few-shot Examples for Data Extraction Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Demonstrate how to extract specific information, like measurements and citations, from different document formats using few-shot examples. ```text Document with inline citations: "As shown in the study (Smith, 2023), the rate is 42%." -> {"value": "42%", "source": "Smith, 2023", "type": "inline_citation"} ``` ```text Document with bibliography references: "The rate is 42%. [1]" -> {"value": "42%", "source": "reference_1", "type": "bibliography"} ``` -------------------------------- ### Glob Tool Usage Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Provides examples of using the Glob tool to find files by name or pattern, useful for code navigation and analysis. ```text **/*.test.tsx`, `src/components/**/*.ts` ``` -------------------------------- ### Bash Tool Usage Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Provides examples of using the Bash tool to execute shell commands, such as git operations, npm commands, or running tests. ```text git, npm, run tests, build ``` -------------------------------- ### Fixed Pipelines (Prompt Chaining) Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Illustrates a fixed pipeline for task decomposition, where each step is defined in advance for predictable workflows. ```text Document -> Metadata extraction -> Data extraction -> Validation -> Enrichment -> Final output ``` -------------------------------- ### Subagent Delegation Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Demonstrates how a main agent can delegate tasks to subagents and how context is managed. The main agent receives a summary instead of raw file data. ```text Main agent: "Investigate dependencies of the payments module" -> Subagent (Explore): reads 15 files, traces imports -> Returns: "Payments depends on AuthService, OrderModel, and the external PaymentGateway API" Main agent: keeps one line in context instead of 15 files ``` -------------------------------- ### Directory Structure for .claude/rules/ Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Provides an example directory structure for organizing Claude Code rules by topic within the .claude/rules/ directory. ```tree .claude/rules/ testing.md -- testing conventions api-conventions.md -- API conventions deployment.md -- deployment rules react-patterns.md -- React patterns ``` -------------------------------- ### Few-shot Examples for Code Quality Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Illustrate the difference between acceptable and problematic code patterns to help the model identify and flag code quality issues. ```javascript // Acceptable (do not flag): const items = data.filter(x => x.active); ``` ```javascript // Problem (flag): const items = data.filter(x => x.active == true); // Use strict equality === ``` -------------------------------- ### Dynamic Adaptive Decomposition Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Illustrates a step-by-step process for breaking down an open-ended task based on intermediate results. Useful when the full scope is unknown upfront and each step depends on the previous one. ```text 1. "Add tests for a legacy codebase" 2. -> First: map the structure (Glob, Grep) 3. -> Found: 3 modules with no tests, 2 with partial coverage 4. -> Prioritize: start with the payments module (high risk) 5. -> During work: discovered a dependency on an external API 6. -> Adapt: add a mock for the external API before writing tests ``` -------------------------------- ### Message Batches API Request Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD An example of a request payload for the Message Batches API, demonstrating the use of `custom_id` for linking and managing requests. ```json { "custom_id": "doc-invoice-2024-001", "params": { "model": "claude-sonnet-4-6", "max_tokens": 1024, "messages": [{"role": "user", "content": "Extract data from: ..."}] } } ``` -------------------------------- ### Agent State Persistence Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Shows the JSON structure for exporting an agent's state, including execution details and findings. This is used for crash recovery. ```json // agent-state/web-search-agent.json { "status": "completed", "queries_executed": ["AI music 2024", "AI music composition"], "results_count": 12, "key_findings": [...], "coverage": ["music composition", "music production"], "gaps": ["music distribution", "music licensing"] } ``` -------------------------------- ### AgentDefinition Configuration in Python Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Example of configuring an agent using the AgentDefinition class in the Claude Agent SDK. Key parameters include name, description, system prompt, and allowed tools. ```python agent = AgentDefinition( name="customer_support", description="Handles customer requests for returns and order issues", system_prompt="You are a customer support agent...", allowed_tools=["get_customer", "lookup_order", "process_refund", "escalate_to_human"], # For a coordinator: # allowed_tools=["Task", "get_customer", ...] ) ``` -------------------------------- ### Grep Tool Usage Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Illustrates using the Grep tool to search for specific text within files, such as function names, error messages, or import statements. ```text Function name, error message, import ``` -------------------------------- ### Claude Interview Pattern Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Claude asks clarifying questions before implementing a solution, useful for unfamiliar domains or tasks with non-obvious implications. ```text Claude: "Before implementing caching for the API, a few questions: 1. Which cache invalidation strategy do you prefer—TTL or event-based? 2. Is stale data acceptable when the cache is unavailable? 3. Should caching be per-user or global? 4. What is the expected data volume to cache?" ``` -------------------------------- ### Incremental Investigation Strategy Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Outlines a step-by-step strategy for investigating codebases incrementally using tools like Grep and Read, starting with entry points and progressively exploring usages. ```text 1. Grep: find entry points (function definition, export) 2. Read: read the found files 3. Grep: find usages (import, calls) 4. Read: read consumer files 5. Repeat until you have a complete picture ``` -------------------------------- ### Trimming Tool Results with PostToolUse Hook Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD A Python example using a hook to filter and retain only essential fields from a tool's result, optimizing context usage by reducing noise. ```python # PostToolUse hook: keep only relevant fields @hook("PostToolUse", tool="lookup_order") def trim_order_fields(result): return { "order_id": result["order_id"], "status": result["status"], "total": result["total"], "items": result["items"], "return_eligible": result["return_eligible"] } ``` -------------------------------- ### Agent Scratchpad for Long Investigations Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD A Markdown example of an agent's scratchpad file used to store key findings during long investigations. This allows the agent to consult findings without re-running discovery. ```markdown # investigation-scratchpad.md ## Key findings - PaymentProcessor in src/payments/processor.ts inherits from BaseProcessor - refund() is called from 3 places: OrderController, AdminPanel, CronJob - External PaymentGateway API has a rate limit of 100 req/min - Migration #47 added refund_reason (NOT NULL) — 2024-12-01 ``` -------------------------------- ### PostToolUse Hook for Data Normalization Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD The `PostToolUse` hook intercepts tool results before they are returned to the model. This example demonstrates normalizing date formats from different tools into a consistent ISO 8601 format. ```python # Example: normalize date formats from different MCP tools @hook("PostToolUse") def normalize_dates(tool_result): # Convert Unix timestamp -> ISO 8601 # Convert "Mar 5, 2025" -> "2025-03-05" return normalized_result ``` -------------------------------- ### Severity Criteria with Examples for Code Issues Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Define clear severity levels (CRITICAL, HIGH, MEDIUM, LOW) for code issues, accompanied by concrete examples to guide assessment. ```text CRITICAL: Runtime failure for users Example: NullPointerException while processing a payment HIGH: Security vulnerability Example: SQL injection, XSS, missing authorization checks MEDIUM: Logic bug without immediate impact Example: Wrong sorting, off-by-one error LOW: Code quality Example: Duplication, suboptimal algorithm for small data ``` -------------------------------- ### Attribution for Claim Provenance Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Contrasts a bad example of a claim without source information to a good example that includes claim details, source, and confidence. ```text Bad: "The AI music market is estimated at $3.2B." (No source, no year.) ``` ```json Good: { "claim": "The AI music market is estimated at $3.2B.", "source_url": "https://example.com/report", "source_name": "Global AI Music Report 2024", "publication_date": "2024-06-15", "confidence": 0.9 } ``` -------------------------------- ### Organizing Rules with .claude/rules/ and Paths Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Shows how to use the .claude/rules/ directory with YAML frontmatter and 'paths' to conditionally load rules based on file types or locations. ```yaml --- paths: ["src/api/**/*"] --- For API files, use async/await with explicit error handling. Each endpoint must return a standard response wrapper. ``` ```yaml --- paths: ["**/*.test.tsx", "**/*.test.ts"] --- Tests must use describe/it blocks. Use data factories instead of hardcoding. Do not mock the database—use a test database. ``` -------------------------------- ### Escalation for Policy Gap Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Provides an example of escalating a customer request when the current policy does not cover the situation, such as competitor price matching. ```text Customer: "Competitor X has this item 30% cheaper—give me a discount" Policy: covers price adjustments only on your own site Agent: [escalates — policy does not cover competitor price matching] ``` -------------------------------- ### Interpreting Temporal Differences Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Highlights the importance of including dates to avoid misinterpreting temporal differences as contradictions. Shows 'bad' and 'good' examples. ```text Bad: "Source A says 10%, source B says 15%. Contradiction." Good: "Source A (2023) says 10%, source B (2024) says 15%. Likely +5% growth over a year." ``` -------------------------------- ### Using @path for File Imports in CLAUDE.md Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Demonstrates how to use the @path syntax in a project's CLAUDE.md file to reference external configuration files, promoting modularity. ```markdown # Project CLAUDE.md Coding standards are described in @./standards/coding-style.md Test requirements are in @./standards/testing-requirements.md Project overview is in @README.md and dependencies are in @package.json ``` -------------------------------- ### Initialize Agent with Task Tool Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD When initializing an AgentDefinition, ensure the 'Task' tool is included in the `allowed_tools` list if you intend to spawn subagents. ```python # The coordinator's allowedTools must include "Task" coordinator_agent = AgentDefinition( allowed_tools=["Task", "get_customer"] ) ``` -------------------------------- ### Self-Correction Pattern JSON Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD This JSON structure helps detect internal contradictions by comparing stated and calculated values, flagging discrepancies. ```json { "stated_total": "$150.00", "calculated_total": "$145.00", "conflict_detected": true, "line_items": [ {"name": "Widget A", "price": 75.00}, {"name": "Widget B", "price": 70.00} ] } ``` -------------------------------- ### Tool Choice Any Configuration Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Sets the tool_choice parameter to 'any', forcing the model to call some tool. This is useful when guaranteed structured output is required. ```json {"type": "any"} ``` -------------------------------- ### Legacy .claude/commands/ Structure Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Illustrates the legacy directory structure for defining custom slash commands using individual Markdown files. ```tree .claude/commands/ review.md -- /review -- standard code review test-gen.md -- /test-gen -- test generation ``` -------------------------------- ### Edit Tool Usage Example Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Explains the Edit tool's purpose: precisely modifying an existing file by replacing a specific snippet identified by unique text. ```text Replace a specific snippet via unique text match ``` -------------------------------- ### Coordinator Manifest for Resume Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Illustrates the JSON manifest file used by a coordinator to resume agent tasks after a crash. It tracks the status of different agents. ```json // agent-state/manifest.json { "web-search": "completed", "doc-analysis": "in_progress", "synthesis": "not_started" } ``` -------------------------------- ### Prompt Chaining for Complex Task Decomposition Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Illustrate prompt chaining by breaking down a complex task, like code review, into sequential, focused steps to avoid attention dilution and ensure consistent analysis. ```text Step 1: Analyze auth.ts (local issues only) -> Output: list of issues in auth.ts Step 2: Analyze database.ts (local issues only) -> Output: list of issues in database.ts Step 3: Integration pass (cross-file dependencies) -> Output: issues at module boundaries ``` -------------------------------- ### Annotating Coverage Gaps in Synthesis Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Demonstrates how to use Markdown to indicate partial coverage in a synthesized report, specifically noting the cause of the limitation (e.g., agent timeout). ```markdown ## Report: AI Impact on Creative Industries ### Visual Art (FULL COVERAGE) [research results] ### Music (PARTIAL COVERAGE — search agent timeout) [partial results] ⚠️ Note: coverage for this section is limited due to a timeout in the search agent. ### Literature (FULL COVERAGE) [research results] ``` -------------------------------- ### Agentic Loop Steps Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Illustrates the core pattern for autonomous task execution using Claude. The loop involves sending requests with tools, receiving responses, checking the stop reason, and repeating until the task is complete. ```text 1. Send a request to Claude with tools 2. Receive a response 3. Check stop_reason: - "tool_use" -> execute the tool, append the result to history, go back to step 1 - "end_turn" -> the task is complete, show the result to the user 4. Repeat until completion ``` -------------------------------- ### PreToolUse Hook for Policy Enforcement Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD The `PreToolUse` hook allows interception of tool calls before they are executed. This example shows how to enforce a policy by blocking refund operations exceeding a specified amount. ```python # Example: block refunds above $500 @hook("PreToolUse") def enforce_refund_limit(tool_call): if tool_call.name == "process_refund" and tool_call.args.amount > 500: return redirect_to_escalation(tool_call) ``` -------------------------------- ### Current .claude/skills/ Structure Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Shows the current directory structure for defining custom slash commands and skills, using subdirectories for each skill. ```tree .claude/skills/ review/SKILL.md -- /review -- with frontmatter configuration test-gen/SKILL.md ``` -------------------------------- ### Immediate Escalation Protocol Source: https://github.com/paullarionov/claude-certified-architect/blob/main/guide_en.MD Demonstrates an immediate escalation scenario where the agent directly calls an 'escalate_to_human' function upon a customer's explicit request for a manager. ```text Customer: "I want to speak to a manager" Agent: [immediately calls escalate_to_human] NOT: "I can help with your issue, let me..." ```