अंतिम समीक्षा: मई 2026
अपने टर्मिनल से CCA-F परीक्षा के विषयों का अभ्यास करें — Claude Code CLI कमांड, Anthropic API कॉल, MCP सर्वर और मल्टी-एजेंट पैटर्न, प्रत्येक परीक्षा डोमेन से जुड़ा हुआ।
इस लैब के अंत तक, आप Claude Code स्थापित कर चुके होंगे, CLAUDE.md के साथ एक प्रोजेक्ट कॉन्फ़िगर कर चुके होंगे, एक कस्टम स्लैश कमांड बना चुके होंगे, एक MCP सर्वर को कॉन्फ़िगर कर चुके होंगे, संरचित आउटपुट के साथ टूल-यूज़ API का अभ्यास कर चुके होंगे, विस्तारित सोच का पता लगा चुके होंगे, और एक मल्टी-एजेंट सुपरवाइज़र पाइपलाइन बना चुके होंगे — जो आपके टर्मिनल से सभी पांच CCA-F परीक्षा डोमेन को कवर करेगा। किसी क्लाउड खाते या बिलिंग की आवश्यकता नहीं है; सब कुछ स्थानीय रूप से चलता है।
node --version)ANTHROPIC_API_KEY के रूप में सेट किया गया (export ANTHROPIC_API_KEY=sk-ant-...)mkdir cca-f-lab && cd cca-f-lab)Anthropic को API कॉल पर उपयोग-आधारित शुल्क लगता है। चरण 6-8 और 10 में claude-sonnet-4-6 का उपयोग किया गया है, जिसकी लागत ~$3/M इनपुट टोकन और ~$15/M आउटपुट टोकन है। इस लैब की कुल लागत आमतौर पर $0.15 से कम होती है। विस्तारित सोच (चरण 7) में आउटपुट दर पर बिल किए गए अतिरिक्त थिंकिंग टोकन का उपयोग होता है।
Claude Code वह CLI है जिसकी CCA-F परीक्षा सबसे सीधे तौर पर जाँच करती है — कॉन्फ़िगरेशन, हुक, स्लैश कमांड और अनुमति मोड सभी यहीं रहते हैं। हम इसे वैश्विक स्तर पर स्थापित करके शुरू करते हैं ताकि बाद के सभी चरण claude को कॉल कर सकें।
स्थापना के बाद, एक त्वरित claude --version यह साबित करता है कि बाइनरी आपके PATH पर है, और claude --print-system-prompt यह पुष्टि करता है कि API key वैध है (यह अंदर ही एक हल्का कॉल करता है)।
# 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 शामिल हो सकते हैं।
यह एक उच्च-आवृत्ति वाला परीक्षा विषय है: कमांड कहाँ रहते हैं, तर्क कैसे पास किए जाते हैं, और वे हुक से कैसे भिन्न होते हैं।
# 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 calculatorहुक Claude Code घटनाओं के जवाब में शेल कमांड चलाते हैं। परीक्षा तीन हुक प्रकारों का परीक्षण करती है: PreToolUse (किसी टूल के चलने से पहले), PostToolUse (बाद में), और Notification (स्थिति परिवर्तनों पर)। हुक .claude/settings.json में परिभाषित किए जाते हैं।
हम एक 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.jsonमॉडल कॉन्टेक्स्ट प्रोटोकॉल (MCP) एक मुख्य परीक्षा डोमेन है। MCP सर्वर एक मानकीकृत JSON-RPC प्रोटोकॉल के माध्यम से LLM क्लाइंट को टूल, संसाधन और प्रॉम्प्ट प्रदान करते हैं। stdio ट्रांसपोर्ट सबसे सरल है — सर्वर stdin से पढ़ता है और stdout को लिखता है।
हम एक न्यूनतम MCP सर्वर बनाएंगे जो एक get_weather टूल को उजागर करता है, फिर Claude Code को उससे कनेक्ट करने के लिए कॉन्फ़िगर करेंगे। यह पूरे MCP जीवनचक्र का अभ्यास करता है जिसकी परीक्षा जाँच करती है: टूल परिभाषा, ट्रांसपोर्ट वायरिंग, टूल इनवोकेशन, और परिणाम हैंडलिंग।
# 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."परीक्षा Messages API टूल-यूज़ फ़्लो का विस्तार से परीक्षण करती है: आप अनुरोध में tools भेजते हैं, मॉडल एक tool_use सामग्री ब्लॉक के साथ प्रतिक्रिया करता है, आप इसे निष्पादित करते हैं और एक tool_result लौटाते हैं, फिर मॉडल अंतिम उत्तर उत्पन्न करता है।
यह चरण सीधे API को कॉल करने के लिए curl का उपयोग करता है — यह परीक्षा-संरेखित सबसे अच्छा तरीका है क्योंकि परीक्षा कच्चे अनुरोध/प्रतिक्रिया प्रारूप का परीक्षण करती है, न कि 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विस्तारित सोच मॉडल को प्रतिक्रिया देने से पहले चरण-दर-चरण तर्क करने के लिए एक 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.प्रॉम्प्ट कैशिंग आपको अनुरोध के कुछ हिस्सों को कैश करने योग्य के रूप में चिह्नित करने देता है। कैश किए गए प्रीफिक्स बाद के कॉलों पर 90% कम लागत वाले होते हैं और उनमें कोई अतिरिक्त लेटेंसी नहीं होती है। परीक्षा cache_control ब्लॉक प्लेसमेंट और कैश-हिट हेडर का परीक्षण करती है।
हम एक ही बड़े सिस्टम प्रॉम्प्ट को दो बार भेजते हैं और दूसरे कॉल पर कैश हिट की पुष्टि करने के लिए प्रतिक्रिया हेडर की जाँच करते हैं।
# 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%) परीक्षा में सबसे अधिक भारित है। सुपरवाइज़र पैटर्न — एक ऑर्केस्ट्रेटर विशेषज्ञ उप-एजेंटों को कार्य सौंपता है, जिनमें से प्रत्येक का अपना सिस्टम प्रॉम्प्ट और टूल सेट होता है — सबसे अधिक परीक्षण किया गया आर्किटेक्चर है।
हम एक स्व-निहित Node.js स्क्रिप्ट बनाएंगे जो एक सुपरवाइज़र को लागू करती है जो दो विशेषज्ञों का समन्वय करता है: एक शोधकर्ता जो फ़ाइलों को पढ़ता और सारांशित करता है, और एक लेखक जो आउटपुट उत्पन्न करता है। सुपरवाइज़र एक कार्य को विघटित करता है, अलग-अलग 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 के व्यावहारिक अभ्यासों पर केंद्रित है। इसमें शामिल नहीं है: