How to turn Claude Code into a domain specific coding agent (blog.langchain.com)

🤖 AI Summary
Aliyan Ishfaq tested how to make Claude Code reliably write code for domain-specific libraries (LangGraph/LangChain) by comparing four setups using Claude 4 Sonnet: vanilla, a docs-access MCPDoc tool, a condensed human-authored guide (Claude.md), and both combined. They built an open-source MCPDoc server exposing list_doc_sources and fetch_docs to serve llms.txt pages, and created a focused Claude.md containing project patterns, sample primitives (create_react_agent, supervisor/swarm patterns), streaming/HITL guidance, common pitfalls, and reference URLs. Using three LangGraph tasks and a rigorous evaluation harness (smoke tests, task-specific tests, plus LLM-as-a-judge subjective rubrics with weighted/penalty scoring), they found Claude.md alone outperformed MCP-only setups; combining Claude.md + MCP produced the best results. MCP alone improved grounding by ~10 percentage points, but raw llms.txt dumps often overloaded context windows and confused the model. Key takeaways for practitioners: prioritize a concise, structured guide (Claude.md/Agents.md) that highlights core concepts, anti-patterns, and debugging steps—it's cheaper (e.g., ~2.5x cost savings on one task) and often more effective than bluntly exposing full docs. Pair that guide with smarter, snippet-based retrieval tooling when deep dives are needed so the agent can call docs on demand without filling context. The practical implication: for enterprise or niche libraries, combine high-quality condensed instructions with targeted doc-access tools and a careful evaluation framework to materially improve generated code quality and cost-efficiency.
Loading comments...
loading comments...