Skip to main content
anth-architecture-variants Choose and implement Claude API architecture patterns for different scales:
serverless, microservice, event-driven, and edge deployment.
Trigger with phrases like "anthropic architecture", "claude serverless",
"claude microservice design", "edge claude deployment".
Ir para a instalação Skills Marketplace Descubra e explore skills de IA criadas pela comunidade.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Copiar promptMostrar detalhes do prompt Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill anth-architecture-variantsO comando permanece em uma só linha. Role horizontalmente para revisá-lo antes de copiar.
Prefere uma cópia local? Baixe os arquivos disponíveis atualmente no SkillsMP.
Baixar Zip Baixando... Mais deste repositório Implement user sign-up and sign-in flows with Clerk.
Use when building authentication UI, customizing sign-in experience,
or implementing OAuth social login.
Trigger with phrases like "clerk sign-in", "clerk sign-up",
"clerk login flow", "clerk OAuth", "clerk social login".
Implement session management and middleware with Clerk.
Use when managing user sessions, configuring route protection,
or implementing token refresh and custom JWT templates.
Trigger with phrases like "clerk session", "clerk middleware",
"clerk route protection", "clerk token", "clerk JWT".
Configure enterprise SSO, role-based access control, and organization management.
Use when implementing SSO integration, configuring role-based permissions,
or setting up organization-level controls.
Trigger with phrases like "clerk SSO", "clerk RBAC",
"clerk enterprise", "clerk roles", "clerk permissions", "clerk organizations".
Ocupações relacionadas SOC
Baseado na classificação ocupacional SOC
name anth-architecture-variants description Choose and implement Claude API architecture patterns for different scales:
serverless, microservice, event-driven, and edge deployment.
Trigger with phrases like "anthropic architecture", "claude serverless",
"claude microservice design", "edge claude deployment".
allowed-tools Read, Write, Edit, Grep version 1.6.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","ai","anthropic"] compatibility Designed for Claude Code
Anthropic Architecture Variants
Overview Four validated architecture patterns for Claude API integrations at different scales and use cases.
Variant 1: Serverless (AWS Lambda / Cloud Functions)
import anthropic
import json
def handler (event, context ):
client = anthropic.Anthropic()
body = json.loads(event["body" ])
msg = client.messages.create(
model="claude-haiku-4-20250514" ,
max_tokens=512 ,
messages=[{"role" : "user" , "content" : body["prompt" ]}]
)
return {
"statusCode" : 200 ,
"body" : json.dumps({
"text" : msg.content[0 ].text,
"tokens" : msg.usage.input_tokens + msg.usage.output_tokens
})
}
Trade-offs: Cold starts add 1-3s. Lambda timeout (15min) limits long generations. No connection pooling between invocations.
Variant 2: Streaming Microservice (FastAPI + WebSocket)
from fastapi import FastAPI, WebSocket
import anthropic
app = FastAPI()
client = anthropic.Anthropic()
@app.websocket("/chat" )
async def chat_ws (websocket: WebSocket ):
await websocket.accept()
while True :
prompt = await websocket.receive_text()
with client.messages.stream(
model="claude-sonnet-4-20250514" ,
max_tokens=2048 ,
messages=[{"role" : "user" , "content" : prompt}]
) as stream:
for text in stream.text_stream:
await websocket.send_text(text)
await websocket.send_text("[DONE]" )
Variant 3: Queue-Based Pipeline (Celery / Cloud Tasks)
from celery import Celery
import anthropic
app = Celery("tasks" , broker="redis://localhost" )
@app.task(bind=True , max_retries=3 , default_retry_delay=30 )
def process_document (self, doc_id: str , content: str ):
try :
client = anthropic.Anthropic()
msg = client.messages.create(
model="claude-sonnet-4-20250514" ,
max_tokens=2048 ,
messages=[{"role" : "user" , "content" : f"Summarize:\n\n{content} " }]
)
save_result(doc_id, msg.content[0 ].text)
except anthropic.RateLimitError as e:
self .retry(exc=e, countdown=int (e.response.headers.get("retry-after" , 30 )))
Variant 4: Multi-Model Orchestrator
class ClaudeOrchestrator :
def __init__ (self ):
self .client = anthropic.Anthropic()
def classify_then_respond (self, user_input: str ) -> str :
classification = self .client.messages.create(
model="claude-haiku-4-20250514" ,
max_tokens=32 ,
messages=[{
"role" : "user" ,
"content" : f"Classify as: question|task|creative|code\nInput: {user_input[:200 ]} "
}]
)
intent = classification.content[0 ].text.strip().lower()
model = {
"question" : "claude-haiku-4-20250514" ,
"task" : "claude-sonnet-4-20250514" ,
"creative" : "claude-sonnet-4-20250514" ,
"code" : "claude-sonnet-4-20250514" ,
}.get(intent, "claude-sonnet-4-20250514" )
msg = self .client.messages.create(
model=model,
max_tokens=4096 ,
messages=[{"role" : "user" , "content" : user_input}]
)
return msg.content[0 ].text
Architecture Selection Guide Factor Serverless Microservice Queue-Based Orchestrator Latency High (cold start) Low (streaming) N/A (async) Medium Volume Low (<100 RPM) Medium High Medium Cost Pay-per-use Fixed infra Batch savings Optimized per-task Complexity Low Medium Medium High Best for APIs, triggers Chatbots ETL, processing Complex workflows
Resources
Next Steps For common pitfalls, see anth-known-pitfalls.