נבדק לאחרונה: מאי 2026
תרגלו את נושאי מבחן CCA-F מהטרמינל — פקודות Claude Code CLI, קריאות API של Anthropic, שרתי MCP ודפוסי ריבוי סוכנים, כל אחד קשור לתחום מבחן.
עד סוף מעבדה זו תתקינו את Claude Code, תגדירו פרויקט עם CLAUDE.md, תבנו פקודת סלאש מותאמת אישית, תחברו שרת MCP, תתרגלו את ה-API של tool-use עם פלט מובנה, תחקרו חשיבה מורחבת (extended thinking), ותבנו צינור עבודה של מפקח מרובה סוכנים (multi-agent supervisor pipeline) — המכסה את כל חמשת תחומי הבחינה של CCA-F מהטרמינל שלכם. אין צורך בחשבון ענן או חיוב; הכל רץ באופן מקומי.
node --version)ANTHROPIC_API_KEY במעטפת שלכם (export ANTHROPIC_API_KEY=sk-ant-...)mkdir cca-f-lab && cd cca-f-lab)קריאות API ל-Anthropic כרוכות בתשלום לפי שימוש. שלבים 6–8 ו-10 משתמשים ב-claude-sonnet-4-6 שעולה כ-3$ למיליון אסימוני קלט וכ-15$ למיליון אסימוני פלט. העלות הכוללת עבור מעבדה זו היא בדרך כלל פחות מ-0.15$. חשיבה מורחבת (Extended thinking, שלב 7) משתמשת באסימוני "חשיבה" נוספים המחויבים בתעריף הפלט.
Claude Code הוא ה-CLI שהבחינה של CCA-F בודקת באופן הישיר ביותר — תצורה, Hooks, פקודות סלאש ומצבי הרשאות, כולם נמצאים כאן. אנו מתחילים בהתקנתו גלובלית כדי שכל שלב מאוחר יותר יוכל לקרוא ל-claude.
לאחר ההתקנה, פקודת claude --version מהירה מוכיחה שהקובץ הבינארי נמצא ב-PATH שלכם, ו-claude --print-system-prompt מאשרת שמפתח ה-API תקין (היא מבצעת קריאה קלה מתחת למכסה המנוע).
# Install Claude Code globally
npm install -g @anthropic-ai/claude-code
# Verify installation
claude --version
# Confirm API connectivity (prints the built-in system prompt)
claude --print-system-prompt | head -20הבחינה בודקת בהרחבה את היררכיית שלושת הרמות של CLAUDE.md: משתמש (~/.claude/CLAUDE.md), פרויקט (שורש הריפו), ומודול (תתי-ספריות). כל רמה יורשת מהרמה שמעליה ויכולה לדרוס אותה.
אנו ניצור קובץ ברמת הפרויקט שיגדיר מוסכמות קידוד וקובץ ברמת המשתמש שיגדיר העדפות אישיות. כאשר Claude Code קורא את הפרויקט, הוא ממזג את כל שלוש הרמות — בדיוק ההתנהגות שהבחינה שואלת עליה.
# Create project root CLAUDE.md
cat > CLAUDE.md << 'EOF'
# Project: CCA-F Lab
## Coding conventions
- Use TypeScript for all new files
- Prefer const over let
- Use single quotes for strings
- No semicolons (Prettier default)
## Testing
- Run `npm test` before committing
- All new functions must have at least one test
EOF
# Create user-level CLAUDE.md (applies to ALL your projects)
mkdir -p ~/.claude
cat > ~/.claude/CLAUDE.md << 'EOF'
# User preferences
- Be concise in responses
- Prefer functional programming patterns
- Always explain the "why" before showing code
EOF
# Verify Claude Code sees both files
claude "What instructions do you see in CLAUDE.md?" --printפקודות סלאש מותאמות אישית נמצאות ב-.claude/commands/ כקבצי Markdown. שם הקובץ הופך לשם הפקודה (לדוגמה, scaffold.md ← /scaffold). תוכן הקובץ הוא תבנית הפרומפט — הוא יכול לכלול $ARGUMENTS לקלט משתמש.
זהו נושא נפוץ בבחינה: היכן פקודות נמצאות, כיצד מועברים ארגומנטים, וכיצד הן נבדלות מ-Hooks.
# Create the commands directory
mkdir -p .claude/commands
# Create a scaffold command
cat > .claude/commands/scaffold.md << 'EOF'
Create a new TypeScript module named $ARGUMENTS with:
1. A main source file at src/$ARGUMENTS/index.ts
2. A test file at src/$ARGUMENTS/__tests__/index.test.ts
3. Export the module from the project root index.ts
Follow the coding conventions in CLAUDE.md.
EOF
# Test the command (Claude Code will execute it interactively)
claude /scaffold calculatorHooks מריצים פקודות Shell בתגובה לאירועים של Claude Code. הבחינה בודקת שלושה סוגי Hooks: PreToolUse (לפני הפעלת כלי), PostToolUse (לאחר מכן), ו-Notification (בשינויי סטטוס). Hooks מוגדרים ב-.claude/settings.json.
אנו נוסיף Hook מסוג PostToolUse שיריץ Linter לאחר כל עריכת קובץ — תבנית ייצור נפוצה שהבחינה שואלת עליה לעיתים קרובות.
# Initialize a package.json so we have a lint script
npm init -y
npm install --save-dev typescript @typescript-eslint/parser
# Create project-level settings with a post-tool hook
mkdir -p .claude
cat > .claude/settings.json << 'EOF'
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"command": "npx tsc --noEmit 2>&1 | head -5"
}
]
},
"permissions": {
"allow": [
"Read",
"Write",
"Edit"
]
}
}
EOF
# Verify settings are recognized
cat .claude/settings.jsonModel Context Protocol (MCP) הוא תחום ליבה בבחינה. שרתי MCP חושפים כלים, משאבים והנחיות (prompts) ללקוחות LLM באמצעות פרוטוקול JSON-RPC מתוקנן. ה-stdio transport הוא הפשוט ביותר — השרת קורא מ-stdin וכותב ל-stdout.
אנו נבנה שרת MCP מינימלי החושף כלי get_weather, ולאחר מכן נגדיר את Claude Code להתחבר אליו. זה מתרגל את מחזור החיים המלא של MCP שהבחינה בודקת: הגדרת כלי, חיבור Transport, הפעלת כלי וטיפול בתוצאות.
# Install the MCP SDK
npm install @modelcontextprotocol/sdk
# Create the MCP server
cat > mcp-weather.mjs << 'EOF'
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new McpServer({ name: "weather", version: "1.0.0" });
server.tool("get_weather", { city: { type: "string" } }, async ({ city }) => ({
content: [{ type: "text", text: `Weather in ${city}: 72°F, sunny` }],
}));
const transport = new StdioServerTransport();
await server.connect(transport);
EOF
# Register the MCP server in Claude Code settings
cat > .claude/settings.json << 'EOF'
{
"mcpServers": {
"weather": {
"command": "node",
"args": ["mcp-weather.mjs"]
}
}
}
EOF
# Ask Claude Code to use the MCP tool
claude "What is the weather in Tokyo? Use the get_weather tool."הבחינה בודקת בפירוט את זרימת ה-tool-use של ה-Messages API: אתם שולחים tools בבקשה, המודל מגיב עם בלוק תוכן tool_use, אתם מבצעים אותו ומחזירים tool_result, ואז המודל מייצר את התשובה הסופית.
שלב זה משתמש ב-curl כדי לקרוא ל-API ישירות — הגישה המותאמת ביותר לבחינה, מכיוון שהבחינה בודקת את פורמט הבקשה/תגובה הגולמי, ולא עטיפות SDK.
# Call the Messages API with a tool definition
curl -s https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 1024,
"tools": [{
"name": "calculate",
"description": "Evaluate a math expression",
"input_schema": {
"type": "object",
"properties": {
"expression": { "type": "string", "description": "Math expression to evaluate" }
},
"required": ["expression"]
}
}],
"messages": [{
"role": "user",
"content": "What is 15% tip on a $85.50 dinner bill?"
}]
}' | python3 -m json.toolחשיבה מורחבת (Extended thinking) מאפשרת למודל להשתמש בבלוק thinking כדי להסיק מסקנות צעד אחר צעד לפני מתן תגובה. הבחינה בודקת מתי להשתמש בה (הסקת מסקנות מורכבת, מתמטיקה, יצירת קוד) וכיצד להגדיר את budget_tokens.
אנו שולחים חידת היגיון מכוונת ומורכבת ומשווים תגובות עם ובלי חשיבה מורחבת כדי לראות את הבדלי האיכות במו עינינו.
# Request WITH extended thinking
curl -s https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 16000,
"thinking": {
"type": "enabled",
"budget_tokens": 10000
},
"messages": [{
"role": "user",
"content": "A farmer has 17 sheep. All but 9 run away. How many does he have left? Explain your reasoning step by step."
}]
}' | python3 -m json.tool
# The response includes a "thinking" block showing the model's
# internal reasoning before the final answer.זיכרון מטמון לפרומפטים (Prompt caching) מאפשר לכם לסמן חלקים מהבקשה כניתנים לשמירה במטמון. קידומות שמורות במטמון עולות 90% פחות בקריאות עוקבות ואין להן שיהוי נוסף. הבחינה בודקת את מיקום בלוק ה-cache_control ואת כותרות ה-Cache Hit.
אנו שולחים את אותו פרומפט מערכת גדול פעמיים ובודקים את כותרות התגובה כדי לאשר את פגיעת המטמון בקריאה השנייה.
# First call — creates the cache entry
curl -s -D /dev/stderr https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 256,
"system": [{
"type": "text",
"text": "You are a helpful assistant specialized in cloud architecture. You follow AWS Well-Architected Framework principles. You always recommend infrastructure as code. You prefer Terraform over CloudFormation. You prioritize security and cost optimization.",
"cache_control": { "type": "ephemeral" }
}],
"messages": [{ "role": "user", "content": "How should I set up VPC peering?" }]
}' > /dev/null 2>&1
# Second call — should hit the cache (check usage.cache_read_input_tokens)
curl -s https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 256,
"system": [{
"type": "text",
"text": "You are a helpful assistant specialized in cloud architecture. You follow AWS Well-Architected Framework principles. You always recommend infrastructure as code. You prefer Terraform over CloudFormation. You prioritize security and cost optimization.",
"cache_control": { "type": "ephemeral" }
}],
"messages": [{ "role": "user", "content": "What about NAT gateway sizing?" }]
}' | python3 -c "import sys,json; d=json.load(sys.stdin); print(f\"Cache read tokens: {d['usage'].get('cache_read_input_tokens', 0)}\")"הבחינה בודקת כיצד להריץ את Claude Code באופן לא אינטראקטיבי — הדגל --print מוציא את התוצאה ל-stdout ללא הפעלת אינטראקטיבית, ו---output-format json נותן פלט מובנה עבור סקריפטים.
זוהי התבנית המשמשת בצינורות CI: מזינים פרומפט, מקבלים תוצאה, מנתחים אותה באופן תכנותי.
# Headless mode: prompt in, text out
claude --print "List 3 TypeScript best practices, one per line"
# JSON output for programmatic use
claude --print --output-format json "What is 2+2?"
# Pipe a file for code review (CI pattern)
echo 'const x: any = "hello";' > example.ts
claude --print "Review this TypeScript file for type safety issues: $(cat example.ts)"תחום 1 (אדריכלות מבוססת סוכנים, 27%) הוא בעל המשקל הגבוה ביותר בבחינה. תבנית המפקח (supervisor pattern) — מתאם יחיד המפזר משימות לסוכני משנה מומחים, שלכל אחד מהם פרומפט מערכת וסט כלים משלו — היא הארכיטקטורה הנבדקת ביותר.
אנו נבנה סקריפט Node.js עצמאי שמיישם מפקח המתאם בין שני מומחים: חוקר (researcher) שקורא קבצים ומסכם, וכותב (writer) שמפיק פלט. המפקח מפרק משימה, מאציל סמכויות לכל מומחה באמצעות קריאות API נפרדות, ומאחד את התוצאות. הריצו אותו מהטרמינל וצפו באצילה מתרחשת בזמן אמת.
# Install the Anthropic SDK
npm install @anthropic-ai/sdk
# Create sample data for the agents to work with
cat > sales-data.csv << 'EOF'
month,revenue,units
Jan,12500,150
Feb,15200,180
Mar,11800,140
Apr,18900,220
May,22100,260
Jun,19500,230
EOF
# Create the multi-agent supervisor script
cat > supervisor.mjs << 'SCRIPT'
import Anthropic from "@anthropic-ai/sdk";
import { readFileSync } from "fs";
const client = new Anthropic();
async function callAgent(role, systemPrompt, userMessage) {
console.log(`\n--- ${role} agent ---`);
const response = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 1024,
system: systemPrompt,
messages: [{ role: "user", content: userMessage }],
});
const text = response.content
.filter((b) => b.type === "text")
.map((b) => b.text)
.join("\n");
console.log(text);
return text;
}
// --- Supervisor: decompose, delegate, aggregate ---
const data = readFileSync("sales-data.csv", "utf-8");
console.log("=== SUPERVISOR: Decomposing task ===");
console.log("Task: Analyze sales data and write a brief executive summary.\n");
console.log("Step 1: Delegate analysis to Researcher agent");
console.log("Step 2: Delegate writing to Writer agent");
console.log("Step 3: Combine results\n");
// Sub-agent 1: Researcher — extracts insights
const analysis = await callAgent(
"Researcher",
"You are a data analyst. Extract key trends, highs, lows, and growth rates. Be precise with numbers. Output bullet points only.",
`Analyze this CSV data:\n\n${data}`
);
// Sub-agent 2: Writer — produces the summary from the analysis
const summary = await callAgent(
"Writer",
"You are a business writer. Write a 3-sentence executive summary from the analysis provided. Use a professional tone. Include specific numbers.",
`Write an executive summary based on these findings:\n\n${analysis}`
);
console.log("\n=== SUPERVISOR: Final aggregated output ===");
console.log(summary);
SCRIPT
# Run the supervisor
node supervisor.mjsמעבדה זו רצה כולה באופן מקומי — אין משאבי ענן להסיר.
# Remove the lab directory
cd .. && rm -rf cca-f-lab
# Optionally remove the user-level CLAUDE.md we created
rm -f ~/.claude/CLAUDE.md
# Optionally uninstall Claude Code
npm uninstall -g @anthropic-ai/claude-code
מעבדה זו מתמקדת בתרגילי CLI ו-API מעשיים. היא אינה מכסה: