anth-advanced-troubleshooting

Featured

Debug complex Claude API issues including context window overflow, tool use failures, streaming corruption, and response quality problems. Trigger with phrases like "anthropic advanced debug", "claude complex issue", "claude tool use failing", "claude context overflow".

AI & Automation 2,944 stars 440 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Anthropic Advanced Troubleshooting ## Issue: Context Window Overflow ```python # Symptom: invalid_request_error about token count # Diagnosis: pre-check with Token Counting API import anthropic client = anthropic.Anthropic() count = client.messages.count_tokens( model="claude-sonnet-4-20250514", messages=conversation_history, system=system_prompt ) print(f"Input tokens: {count.input_tokens}") # Claude Sonnet: 200K context, Claude Opus: 200K context # Fix: truncate oldest messages or summarize def trim_conversation(messages: list, max_tokens: int = 180_000) -> list: """Keep recent messages within token budget.""" # Always keep first (system context) and last 5 messages if len(messages) <= 5: return messages return messages[:1] + messages[-5:] # Crude but effective ``` ## Issue: Tool Use Not Triggering ```python # Symptom: Claude responds with text instead of calling tools # Diagnosis checklist: # 1. Tool description must clearly state WHEN to use the tool # 2. User message must match the tool's trigger condition # BAD description (too vague): {"name": "search", "description": "Search for things"} # GOOD description (clear trigger): {"name": "search_products", "description": "Search the product catalog by name, category, or price range. Use whenever the user asks about products, pricing, or availability."} # Force tool use if needed: message = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category