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ê.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
system="You are an expert on Specification-Driven Development. Be concise and practical.",
messages=[
{"role": "user", "content": "What are the key phases of SDD?"}
]
)
Multi-turn Conversation
messages = [
{"role": "user", "content": "What is SDD?"},
{"role": "assistant", "content": "SDD (Specification-Driven Development) is a methodology..."},
{"role": "user", "content": "How does it compare to TDD?"}
]
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=messages
)
Parameters
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=4096, # Required: max response tokens
messages=[...],
# Optional
system="System prompt", # Set behavior
temperature=1.0, # 0-1, higher = more creative
top_p=0.9, # Nucleus sampling (alternative to temp)
top_k=40, # Top-k sampling
stop_sequences=["END"], # Stop generation at these
metadata={"user_id": "123"} # Track requests
)
# PDFs are sent as documents (up to 100 pages)
pdf_data = encode_image("document.pdf") # Same base64 encoding
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=4096,
messages=[
{
"role": "user",
"content": [
{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": pdf_data
}
},
{
"type": "text",
"text": "Summarize this document"
}
]
}
]
)
Supported Formats
Format
Media Type
Max Size
JPEG
image/jpeg
20MB
PNG
image/png
20MB
GIF
image/gif
20MB
WebP
image/webp
20MB
PDF
application/pdf
32MB / 100 pages
Vision Best Practices
Place images before text for better understanding
Use high resolution for text extraction (OCR)
Describe what you need specifically
Combine multiple images for comparisons
Extended Thinking
Extended thinking enables Claude to show its reasoning process for complex problems.
Enable Extended Thinking
message = client.messages.create(
model="claude-opus-4-5-20251101", # Works best with Opus
max_tokens=16000,
thinking={
"type": "enabled",
"budget_tokens": 10000# Max tokens for thinking
},
messages=[
{"role": "user", "content": "Solve this step by step: If a train leaves..."}
]
)
Access Thinking
for block in message.content:
if block.type == "thinking":
print("Thinking:", block.thinking)
elif block.type == "text":
print("Answer:", block.text)
Use Cases
Use Case
Benefit
Math problems
Step-by-step reasoning
Logic puzzles
Explicit deduction
Code debugging
Trace through logic
Research synthesis
Structured analysis
Strategic planning
Consider alternatives
Thinking Pricing
Extended thinking tokens are charged at output rate:
Claude Opus 4.5: $75/M tokens for thinking
Budget wisely based on complexity
Best Practices
Use appropriate budget - 5K-10K for most problems
Ask for step-by-step - triggers deeper thinking
Complex problems only - overkill for simple tasks
Review thinking - validate reasoning quality
Computer Use
Computer use allows Claude to control a computer via screenshots and actions.
# When batch is completeif batch.processing_status == "ended":
for result in client.beta.messages.batches.results(batch.id):
print(f"ID: {result.custom_id}")
print(f"Type: {result.result.type}") # succeeded | erroredif result.result.type == "succeeded":
print(f"Response: {result.result.message.content[0].text}")
else:
print(f"Error: {result.result.error}")
Batch Pricing
Model
Regular
Batch (50% off)
Claude Opus 4.5
$15/$75
$7.50/$37.50
Claude Sonnet 4
$3/$15
$1.50/$7.50
Claude Haiku 3.5
$0.80/$4
$0.40/$2
Use Cases
Content generation - Blog posts, translations
Data processing - Classification, extraction
Analysis - Document review, summarization
Testing - Prompt evaluation, benchmarks
Streaming
Basic Streaming
with client.messages.stream(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user", "content": "Write a poem about AI"}]
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)
Event-Based Streaming
with client.messages.stream(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
) as stream:
for event in stream:
if event.type == "content_block_start":
print(f"Block started: {event.content_block.type}")
elif event.type == "content_block_delta":
if event.delta.type == "text_delta":
print(event.delta.text, end="", flush=True)
elif event.type == "message_stop":
print("\n[Complete]")
Stream with Tools
with client.messages.stream(
model="claude-sonnet-4-20250514",
max_tokens=1024,
tools=tools,
messages=[{"role": "user", "content": "What's the weather in Kyiv?"}]
) as stream:
for event in stream:
if event.type == "content_block_start":
if event.content_block.type == "tool_use":
print(f"Tool: {event.content_block.name}")
elif event.type == "content_block_delta":
if event.delta.type == "input_json_delta":
print(event.delta.partial_json, end="")
Collect Full Response
with client.messages.stream(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
) as stream:
response = stream.get_final_message()
print(response.content[0].text)
Async Streaming
import asyncio
asyncdefstream_response():
asyncwith client.messages.stream(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
) as stream:
asyncfor text in stream.text_stream:
print(text, end="", flush=True)
asyncio.run(stream_response())
# MCP is primarily for Claude Desktop# For API, use tool use pattern instead# Tools provide similar functionality:# - filesystem -> custom file tools# - github -> GitHub API tools# - database -> SQL execution tools
# Bad - vague
messages = [{"role": "user", "content": "Write something about AI"}]
# Good - specific
messages = [
{
"role": "user",
"content": """Write a 200-word introduction about AI for developers.
Requirements:
- Focus on practical applications
- Include one Python code example
- Use technical but accessible language
Format: Markdown with code block"""
}
]
3. System Prompts
# Effective system prompt structure
system = """You are an expert SDD consultant.
Role: Help developers implement Specification-Driven Development
Behavior:
- Be concise and practical
- Use examples from real projects
- Provide actionable advice
Format:
- Use markdown for structure
- Include code examples when relevant
- Add links to resources when helpful"""
4. Tool Design
# Good tool definition
{
"name": "search_docs",
"description": "Search Faion Network documentation. Use when user asks about SDD, agents, or skills.",
"input_schema": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Search query (2-5 keywords)"
},
"category": {
"type": "string",
"enum": ["sdd", "agents", "skills", "methodology"],
"description": "Documentation category"
}
},
"required": ["query"]
}
}