agentsclimarketplace

Anth reference architecture

Skill ComeOnOliver/skillshub/skills/jeremylongshore/claude-code-plugins-plus-skills/anth-reference-architecture

🧠 The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.

Install
npx -y skills add ComeOnOliver/skillshub --skill anth-reference-architecture

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Implement Claude API reference architectures for common use cases. Use when designing a Claude-powered application, choosing between direct API vs queue-based, or planning a multi-model architecture. Trigger with phrases like "anthropic architecture", "claude system design", "anthropic reference architecture", "design claude integration".

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

5.2 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

Anthropic Reference Architecture

Overview

Three validated architecture patterns for Claude API integrations: synchronous API gateway, async queue-based processing, and multi-model routing.

Architecture 1: Sync API Gateway (Simple)

User β†’ API Gateway β†’ Claude Service β†’ Messages API
                                     ↓
                                   Response β†’ User
# Best for: chatbots, interactive tools, low-volume (<100 RPM)
from fastapi import FastAPI
import anthropic

app = FastAPI()
client = anthropic.Anthropic(max_retries=3, timeout=60.0)

@app.post("/chat")
async def chat(prompt: str):
    msg = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=1024,
        messages=[{"role": "user", "content": prompt}]
    )
    return {"text": msg.content[0].text, "tokens": msg.usage.output_tokens}

Architecture 2: Async Queue-Based (Scalable)

User β†’ API β†’ Queue (Redis/SQS) β†’ Worker Pool β†’ Messages API
  ↑                                                ↓
  └──────────── Status/Result ←── Result Store β†β”€β”€β”€β”˜
# Best for: batch processing, high-volume, background tasks
from redis import Redis
from rq import Queue
import anthropic

redis = Redis()
task_queue = Queue("claude-tasks", connection=redis)
result_store = Redis(db=1)

def process_task(task_id: str, prompt: str, model: str):
    client = anthropic.Anthropic()
    msg = client.messages.create(
        model=model,
        max_tokens=1024,
        messages=[{"role": "user", "content": prompt}]
    )
    result_store.setex(f"result:{task_id}", 3600, msg.content[0].text)

# Enqueue
import uuid
task_id = str(uuid.uuid4())
task_queue.enqueue(process_task, task_id, prompt, "claude-sonnet-4-20250514")

Architecture 3: Multi-Model Router

User β†’ Router β†’ Haiku    (classify/extract)
              β†’ Sonnet   (general/code)
              β†’ Opus     (research/complex)
              β†’ Batches  (bulk/offline)
class ModelRouter:
    def __init__(self):
        self.client = anthropic.Anthropic()
        self.classifier = anthropic.Anthropic()  # Can be same client

    def route_and_execute(self, prompt: str, context: dict) -> str:
        # Step 1: Classify with Haiku (cheap, fast)
        classification = self.classifier.messages.create(
            model="claude-haiku-4-20250514",
            max_tokens=32,
            messages=[{
                "role": "user",
                "content": f"Classify this request as: simple|moderate|complex|bulk\n\n{prompt[:200]}"
            }]
        )
        complexity = classification.content[0].text.strip().lower()

        # Step 2: Route to appropriate model
        model_map = {
            "simple": "claude-haiku-4-20250514",
            "moderate": "claude-sonnet-4-20250514",
            "complex": "claude-opus-4-20250514",
        }
        model = model_map.get(complexity, "claude-sonnet-4-20250514")

        # Step 3: Execute with selected model
        msg = self.client.messages.create(
            model=model,
            max_tokens=4096,
            messages=[{"role": "user", "content": prompt}]
        )
        return msg.content[0].text

Project Layout

my-claude-app/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.py              # FastAPI app
β”‚   β”œβ”€β”€ claude/
β”‚   β”‚   β”œβ”€β”€ client.py         # Singleton + config
β”‚   β”‚   β”œβ”€β”€ router.py         # Model routing logic
β”‚   β”‚   β”œβ”€β”€ tools.py          # Tool definitions
β”‚   β”‚   └── prompts/          # System prompts as files
β”‚   β”œβ”€β”€ workers/
β”‚   β”‚   └── claude_worker.py  # Queue consumer
β”‚   └── middleware/
β”‚       β”œβ”€β”€ rate_limiter.py   # App-level rate limiting
β”‚       └── cost_tracker.py   # Spend monitoring
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ unit/                 # Mocked tests
β”‚   └── integration/          # Live API tests
└── config/
    β”œβ”€β”€ .env.development
    β”œβ”€β”€ .env.staging
    └── .env.production

Error Handling

ArchitectureFailure ModeMitigation
Sync Gateway429/5xx blocks userCircuit breaker + fallback response
Queue-BasedWorker crashesDead-letter queue + retry policy
Multi-ModelRouter misclassifiesDefault to Sonnet (safest middle)

Resources

Next Steps

For multi-environment setup, see anth-multi-env-setup.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,984. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.