Use the Claude Code SDK to Build Your Own AI-Powered Development Tools
The same engine that powers Claude Code's CLI is available as an SDK you can use in your own programs. If the CLI doesn't do exactly what you need, build something that does.
import { Claude } from "@anthropic-ai/claude-code";
const claude = new Claude();
const result = await claude.message("Fix all failing tests in this project");
This lets you build custom development tools that go beyond what the CLI offers — tools that fit your team's specific workflows, integrate with your systems, and automate multi-step processes.
Practical things you can build:
// Automated PR reviewer that posts comments on GitHub
const diff = await fetchPRDiff(prNumber);
const review = await claude.message(
`Review this diff for bugs and security issues:\n${diff}`
);
await postGitHubComment(prNumber, review);
// Nightly code quality scanner
const issues = await claude.message(
"Scan for code quality issues, unused imports, and dead code"
);
await createJiraTicket("Code quality issues", issues);
// Custom migration helper
const schema = await fetchDatabaseSchema();
const migration = await claude.message(
`Generate a migration to add soft deletes to all models: ${schema}`
);
await writeFile("migrations/add_soft_deletes.sql", migration);
The SDK gives you programmatic access to everything Claude Code can do:
- Read and edit files in the project
- Run shell commands and process the output
- Search the codebase with grep and glob
- Use MCP tools you've configured
- Stream responses for real-time progress
Combine it with your existing tools:
# Build a Slack bot that fixes bugs from messages
# Build a monitoring integration that auto-fixes known issues
# Build a code review bot that runs on every PR
# Build a migration generator triggered by schema changes
The SDK uses the same conversation model as the CLI — you can have multi-turn conversations, provide context, and build complex multi-step agents.
Claude Code the CLI solves common problems. The SDK lets you solve your problems — build the AI-powered tools your team actually needs.
via Claude Code
Log in to leave a comment.
When Claude writes error messages, button labels, validation text, or onboarding flows, it defaults to generic developer-speak. Add a "Users" section to your CLAUDE.md describing who your actual users are — their technical level, industry jargon, and what they care about — so Claude writes copy that makes sense to THEM, not to developers.
Use the --agent flag with custom markdown files in .claude/agents/ to launch purpose-built Claude sessions with restricted tools and scoped system prompts.
Every project has traps — the billing module that silently fails if you forget to queue the job, the legacy table with column names that don't match the model, the config value that must be set before tests run. Document these gotchas in your CLAUDE.md so Claude avoids the same mistakes your team spent days debugging.