agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/ai-ml/claude/SKILL.md

claude

Skill15 starsChanged 44 days agoMITView on GitHub

Expert Anthropic Claude API assistance covering Claude 3.5 Sonnet / Haiku / Opus, tool use, prompt caching, and long-context processing. Use when integrating Anthropic models into LLM applications.

  • Reads credentials

35 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use compare-screenshots, implement-spec-with-codex and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • transitive-bullshitSkill

    compare-screenshots

    Compare screenshots against the intended design, distinguishing approved references from historical baselines. Use for iterative implementation matching, before/after visual review, objective image telemetry, or checking a lone capture for flat, empty, or badly framed content.

    Also in 5 projects that use this

  • dzhngSkill

    implement-spec-with-codex

    Run [implement-spec](../implement-spec/SKILL.md) with Codex doing the implementation passes while you orchestrate, integrate, and review. Use when the user asks to implement a spec with Codex, or to run implement-spec with Codex as the implementer.

    Also in 4 projects that use this

  • dzhngSkill

    close-spec

    When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).

    Also in 4 projects that use this

  • wolverin0Skill

    audit-decisions

    Standardize remediation decisions, baseline-policy entries, and legal-review banners for accepted, deferred, or policy-blocked audit findings.

    Also in 4 projects that use this

  • bergsideSkill

    ant

    Structured, enterprise-focused design system emphasizing clarity, consistency, and efficiency for data-dense web applications.

    Also in 3 projects that use this

  • bergsideSkill

    artistic

    High-contrast, expressive style with creative typography and bold color choices for visually striking interfaces.

    Also in 3 projects that use this

  • +4 more from dzhng
  • +2 more from bergside

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 29 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use system prompts with clear persona guidelines, constraints, and XML tags (<context>, <rules>).

    line 169
  2. Very specific:

    Leave temperature unconfigured.

    line 174

“Common” is measured: kept by at least 6 in 10 of the 29 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Claude

Claude (by Anthropic) is OpenAI's main competitor. It is famous for its large context window (200k+), low hallucination rates, and "Artifacts" UI.

When to Use

  • Advanced Reasoning & Complex Analysis: Claude 3.5 Sonnet / Opus for intricate coding, mathematics, and logic.
  • Prompt Caching on Large Contexts: Slashing latency and cost by up to 90% for repeated documentation, codebases, and books.
  • Reliable Tool & Function Calling: Multi-turn agentic workflows invoking APIs and external tools with strict schema adherence.
  • Vision & Document Intelligence: Transcribing, analyzing, and extracting data from charts, screenshots, and PDFs.

Quick Start

import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    system="You are an expert software architect.",
    messages=[
        {"role": "user", "content": "Explain event sourcing in 2 sentences."}
    ]
)

print(message.content[0].text)

Core Concepts

Tool Use (Function Calling) with Anthropic SDK

Exposing structured tools to Claude for agentic execution:

import os
from anthropic import Anthropic

client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"))

tools = [
    {
        "name": "lookup_user_balance",
        "description": "Retrieve current account balance and active currency for a customer.",
        "input_schema": {
            "type": "object",
            "properties": {
                "customer_id": {"type": "string", "description": "The unique customer UUID"},
            },
            "required": ["customer_id"],
        },
    }
]

response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    tools=tools,
    messages=[
        {"role": "user", "content": "What is the balance for customer cust_98234?"}
    ]
)

# Inspect tool use request
for content in response.content:
    if content.type == "tool_use":
        print(f"Tool Requested: {content.name}")
        print(f"Arguments: {content.input}")

Prompt Caching for Massive Contexts

Caching system prompts and large documentation blocks:

response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=2048,
    system=[
        {
            "type": "text",
            "text": "You are an expert enterprise API assistant with deep knowledge of internal specs...",
        },
        {
            "type": "text",
            "text": "LARGE_API_DOCUMENTATION_BLOB_HERE...",
            "cache_control": {"type": "ephemeral"} # Cache this block
        }
    ],
    messages=[
        {"role": "user", "content": "How do I authenticate with the v2 billing endpoint?"}
    ]
)

print(f"Cached tokens read: {response.usage.cache_read_input_tokens}")
print(f"Cached tokens created: {response.usage.cache_creation_input_tokens}")

Streaming Responses with Python Async Client

Consuming token streams in real-time:

import asyncio
from anthropic import AsyncAnthropic

async def stream_completion():
    client = AsyncAnthropic()
    async with client.messages.stream(
        max_tokens=1024,
        messages=[{"role": "user", "content": "Draft a refactoring plan for a monolith to microservices."}],
        model="claude-3-5-sonnet-20241022",
    ) as stream:
        async for text in stream.text_stream:
            print(text, end="", flush=True)

# asyncio.run(stream_completion())

Common Patterns

Structured Tool Calling with JSON Schema

Problem: Extracting structured parameters reliably from conversational LLM responses.

Solution: Define tool definitions and parse returned tool_use blocks:

tools = [{
    "name": "lookup_weather",
    "description": "Get current weather for a city",
    "input_schema": {
        "type": "object",
        "properties": {
            "city": {"type": "string"},
            "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
        },
        "required": ["city"]
    }
}]

response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    tools=tools,
    messages=[{"role": "user", "content": "What's the weather in Tokyo?"}]
)

for block in response.content:
    if block.type == "tool_use":
        print(f"Tool called: {block.name}, Args: {block.input}")

Best Practices

Do:

  • Target claude-3-5-sonnet for the optimal balance of intelligence, coding proficiency, and speed.
  • Apply cache_control: {"type": "ephemeral"} to static prompts exceeding 1,024 tokens to save 90% in costs.
  • Provide clear, explicit descriptions and JSON schemas for all tools to minimize hallucinations.
  • Use system prompts with clear persona guidelines, constraints, and XML tags (<context>, <rules>).

Don't:

  • Concatenate user input into system instructions without sanitization; use XML tags to prevent injection.
  • Leave temperature unconfigured; use temperature=0 for structured extraction/coding, 0.7 for creative writing.
  • Hardcode API keys; retrieve them from environment variables or secret vaults.

Troubleshooting

ErrorCauseSolution
anthropic.RateLimitError (429)Concurrency or token per minute (TPM) limit reached.Implement exponential backoff retry logic or use Prompt Caching to reduce tokens.
Invalid request: max_tokens must be <= ...Requested output tokens exceed model maximum output capacity.Set max_tokens within model limits (e.g. 4096 or 8192).
anthropic.AuthenticationError (401)Missing or invalid ANTHROPIC_API_KEY.Export valid key: export ANTHROPIC_API_KEY="sk-ant-...".

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.