przeprogramowani

Agent SDK Examples — Development skill for Claude Code

Development community

Example SDK snippets for programmatic agent usage.

How to install Agent SDK Examples

This entry records only its repository, not the path inside it, so there is no exact command to give. Open przeprogramowani/agent-sdk-examples and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Agent SDK Examples does

Example SDK snippets for programmatic agent usage.

Alternatives in Development

  • Anthropic Cookbook — Official examples and guides from Anthropic 36.3k ★
  • Example Plugin — Reference implementation for plugin developers 14k ★
  • Claude How To — by luongnv89 — Example-driven guide to mastering Claude Code through progressive tutorials with copy-paste tem 8.5k ★

README

agent-sdk-examples

Runnable, minimal examples of programmatic agent usage. Each example is a small, self-contained TypeScript script you can run with a single `npm` command — no boilerplate, just the SDK feature it demonstrates.

Examples are run with [`tsx`](https://github.com/privatenumber/tsx), so there is no build step.

Setup

npm install
cp .env.example .env   # then fill in your keys

Every example loads `.env` at startup (via `dotenv`), so put your keys there:

ANTHROPIC_API_KEY=sk-ant-...    # anthropic/* examples (optional — see below)
OPENROUTER_API_KEY=sk-or-v1-... # ai-sdk/* examples (required)

`.env` is gitignored; `.env.example` is the committed template.

The **Claude Agent SDK** (`anthropic/*`) also runs through the locally installed `claude` CLI and reuses its Claude Code login, so `ANTHROPIC_API_KEY` is optional if that CLI is already authenticated. The **Vercel AI SDK** examples (`ai-sdk/*`) have no implicit auth and always need `OPENROUTER_API_KEY`.

Anthropic — Claude Agent SDK

Examples live in [`anthropic/`](./anthropic) and revolve around a small code-review agent. The sample diffs they review are in [`data/`](./data) — by default the scripts read `data/sample-1.md`; pass another sample as an argument, or pipe a real diff via stdin:

npm run anthropic:review              # uses data/sample-1.md
npm run anthropic:review -- sample-2  # uses data/sample-2.md
git diff | npm run anthropic:review   # review your working tree
Script File What it shows
npm run anthropic:review `review.ts` A focused review agent that returns structured JSON output enforced by a JSON Schema.
npm run anthropic:session `review-with-session.ts` Session resume — review once, then ask a follow-up that reuses the prior context without re-sending the diff.
npm run anthropic:skill [`skill-auto