AI Skill Report Card

Building Claude Integrations

B+78·May 30, 2026·Source: Extension-page
15 / 15
Python
import anthropic client = anthropic.Anthropic(api_key="your-api-key") # Basic Claude integration pattern def call_claude(prompt, system_prompt=None, max_tokens=1000): response = client.messages.create( model="claude-3-5-sonnet-20241022", max_tokens=max_tokens, system=system_prompt, messages=[{"role": "user", "content": prompt}] ) return response.content[0].text # Example: Classification result = call_claude( "Classify this email as spam or not spam: 'Get rich quick!'", "You are an email classifier. Respond with only 'spam' or 'not spam'." )
Recommendation
Add concrete input/output pairs for the customer service agent example showing actual API responses
13 / 15

Progress:

  • Identify integration type (classification, RAG, tool use, vision)
  • Set up Claude API client
  • Design system prompt for consistent behavior
  • Implement core functionality
  • Add error handling and validation
  • Test with sample inputs
  • Optimize for production use

1. Choose Integration Pattern

Classification:

Python
def classify_text(text, categories, context=""): system_prompt = f"Classify text into one of these categories: {', '.join(categories)}. {context}" return call_claude(text, system_prompt)

RAG (Retrieval Augmented Generation):

Python
def rag_query(question, retrieved_docs): context = "\n".join([f"Doc {i+1}: {doc}" for i, doc in enumerate(retrieved_docs)]) prompt = f"Context:\n{context}\n\nQuestion: {question}\n\nAnswer based on the context:" return call_claude(prompt)

Tool Use:

Python
def setup_tool_use(): tools = [{ "name": "calculator", "description": "Perform mathematical calculations", "input_schema": { "type": "object", "properties": { "expression": {"type": "string", "description": "Mathematical expression"} } } }] return tools

2. Handle Vision Tasks

Python
def analyze_image(image_path, prompt): import base64 with open(image_path, "rb") as f: image_data = base64.b64encode(f.read()).decode() response = client.messages.create( model="claude-3-5-sonnet-20241022", max_tokens=1000, messages=[{ "role": "user", "content": [ {"type": "text", "text": prompt}, { "type": "image", "source": { "type": "base64", "media_type": "image/jpeg", "data": image_data } } ] }] ) return response.content[0].text

3. Implement JSON Mode

Python
def get_json_response(prompt, schema_description): system_prompt = f"""Respond only with valid JSON matching this schema: {schema_description} Do not include any text before or after the JSON.""" response = call_claude(prompt, system_prompt) import json return json.loads(response)
Recommendation
Include a complete working example with authentication setup and environment configuration
18 / 20

Example 1: Customer Service Agent Input: "I want to return a product I bought last week"

Python
def customer_service_agent(message): system_prompt = """You are a helpful customer service agent. Classify requests as: refund, exchange, complaint, or question. Provide helpful responses and next steps.""" response = call_claude(message, system_prompt) return response

Output: "I'd be happy to help with your return! I've classified this as a refund request..."

Example 2: PDF Processing

Python
def process_pdf(pdf_path): import PyPDF2 with open(pdf_path, 'rb') as file: reader = PyPDF2.PdfReader(file) text = "" for page in reader.pages: text += page.extract_text() summary = call_claude(f"Summarize this document:\n{text}") return summary

Example 3: Sub-agent Pattern

Python
def multi_agent_workflow(complex_task): # Haiku for quick classification task_type = call_claude( f"Classify this task type: {complex_task}", model="claude-3-haiku-20240307" ) # Sonnet for detailed processing if "analysis" in task_type.lower(): return call_claude(complex_task, model="claude-3-5-sonnet-20241022") else: return call_claude(complex_task, model="claude-3-haiku-20240307")
Recommendation
Reduce the workflow section length by combining related steps - it's getting verbose for Claude's intelligence level
  • Use system prompts for consistent behavior and role definition
  • Choose appropriate models: Haiku for speed, Sonnet for quality, Opus for complex reasoning
  • Implement prompt caching for repeated context (saves costs and latency)
  • Structure JSON schemas clearly when expecting structured output
  • Handle rate limits with exponential backoff
  • Validate inputs before sending to API
  • Use streaming for long responses to improve user experience
Python
# Error handling pattern def robust_claude_call(prompt, retries=3): for attempt in range(retries): try: return call_claude(prompt) except Exception as e: if attempt == retries - 1: raise time.sleep(2 ** attempt) # Exponential backoff
  • Don't send sensitive data without considering privacy implications
  • Don't assume Claude will always return valid JSON without proper prompting
  • Don't ignore rate limits - implement proper throttling
  • Don't use overly long contexts without prompt caching
  • Don't forget to validate and sanitize user inputs
  • Don't use Opus for simple tasks that Haiku can handle
  • Don't concatenate user input directly into prompts without escaping
0
Grade B+AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
15/15
Workflow
13/15
Examples
18/20
Completeness
15/20
Format
15/15
Conciseness
12/15