clade-hello-world
Send your first message to Claude using the Anthropic SDK. Use when starting a new Claude integration, testing your setup, or learning the Messages API basics. Trigger with phrases like "anthropic hello world", "claude api example", "first claude call", "anthropic quick start".
- License 许可
- MIT
- 最近更新
- 2026-07-13
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- clade-hello-world
- tags
- [ "saas", "anthropic", "claude", "messages-api" ]
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Send your first message to Claude using the Anthropic SDK. Use when starting a new Claude integration, testing your setup, or learning the Messages API basics. Trigger with phrases like "anthropic hello world", "claude api example", "first claude call", "anthropic quick start".
- allowed-tools
- Read, Write, Edit
- compatible-with
- claude-code
03 SKILL.md 正文
Anthropic Hello World
Overview
Send your first message to Claude and get a response using the Messages API.
Prerequisites
- Completed
clade-install-authsetup ANTHROPIC_API_KEYenvironment variable set
Instructions
Step 1: Basic Message
import Anthropic from '@claude-ai/sdk';
const client = new Anthropic();
const message = await client.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
messages: [
{ role: 'user', content: 'What is the capital of France?' }
],
});
console.log(message.content[0].text);
// "The capital of France is Paris."
Step 2: Add a System Prompt
const message = await client.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
system: 'You are a helpful geography expert. Be concise.',
messages: [
{ role: 'user', content: 'What is the capital of France?' }
],
});
Step 3: Multi-Turn Conversation
const message = await client.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
messages: [
{ role: 'user', content: 'What is the capital of France?' },
{ role: 'assistant', content: 'The capital of France is Paris.' },
{ role: 'user', content: 'What is its population?' },
],
});
Python Example
import anthropic
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[
{"role": "user", "content": "What is the capital of France?"}
],
)
print(message.content[0].text)
Output
message.content[0].text— Claude's text responsemessage.model— model ID usedmessage.usage.input_tokens/message.usage.output_tokens— token countsmessage.stop_reason—end_turn,max_tokens, ortool_use
Error Handling
| Error | Cause | Solution |
|---|---|---|
authentication_error |
Bad API key | Check ANTHROPIC_API_KEY |
invalid_request_error |
Missing required field | Both messages and max_tokens are required |
not_found_error |
Invalid model ID | Use a valid model like claude-sonnet-4-20250514 |
Available Models
| Model | Best For | Context | Cost (input/output per MTok) |
|---|---|---|---|
claude-opus-4-20250514 |
Complex reasoning | 200K | $15 / $75 |
claude-sonnet-4-20250514 |
Balanced quality + speed | 200K | $3 / $15 |
claude-haiku-4-5-20251001 |
Fast, cheap tasks | 200K | $0.80 / $4 |
Examples
See Step 1 (basic message), Step 2 (system prompt), and Step 3 (multi-turn) above. Python example included in its own section.
Resources
Next Steps
Proceed to clade-model-inference for streaming and advanced patterns.
04 同仓库更多 Skills
zustand-store-creator
Create zustand store creator operations. Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like "zustand store creator", "zustand creator", "zustand".
zero-trust-config-helper
Configure with zero trust config helper operations. Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like "zero trust config helper", "zero helper", "zero".
zapier-integration-helper
Assist with zapier integration helper operations. Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like "zapier integration helper", "zapier helper", "zapier".
yaml-config-validator
Validate yaml config validator operations. Auto-activating skill for DevOps Basics. Triggers on: yaml config validator, yaml config validator Part of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like "yaml config validator", "yaml validator", "yaml".
xvary-stock-research
Thesis-driven equity analysis from public SEC EDGAR and market data; /analyze, /score, /compare workflows with bundled Python tools (Claude Code, Cursor, Codex).
xss-vulnerability-scanner
Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals. Triggers on: xss vulnerability scanner, xss vulnerability scanner Part of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like "xss vulnerability scanner", "xss scanner", "xss".