claude-cli-sdk

Run Claude CLI from Node.js without an API key.

7|4|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/nklisch/skills --skill claude-cli-sdk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: claude-cli-sdk
Source: https://github.com/nklisch/skills/tree/main/.agents/skills/claude-cli-sdk
Command: npx skills add https://github.com/nklisch/skills --skill claude-cli-sdk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers need to invoke Claude's CLI for advanced language tasks, but managing subprocesses, billing, and API keys is cumbersome and error‑prone.

Core Features & Use Cases

  • Wraps the claude binary as an async generator, enabling streaming responses.
  • Provides high‑level helpers like query, collectResult, and createConversation for single‑turn and multi‑turn interactions.
  • Supplies tool permission patterns, settings builders, and plugin scaffolding to customize agent behavior.
  • Ideal for Node.js applications that require AI‑driven code generation, data extraction, or interactive chat without exposing API credentials.

Quick Start

Ask the SDK to query Claude with a prompt, for example “Explain async iterators”, and stream the response.

Frequently Asked Questions about claude-cli-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Claude CLI in Node.js without an API key?

You can run Claude CLI in Node.js without an API key by using this SDK to wrap the claude binary as an async generator. It handles subprocess management and uses Pro/Max billing for authentication.

Can I stream Claude CLI responses asynchronously in a Node.js application?

Yes, you can stream Claude CLI responses asynchronously in Node.js. The SDK wraps the claude binary as an async generator, enabling streaming text generation and interactive conversations.

How do I generate structured JSON output from Claude CLI?

You generate structured JSON output from Claude CLI by using the SDK's high-level helpers like query and collectResult. These functions process prompts and return formatted JSON for data extraction tasks.

Does this SDK support multi-turn conversations and session management?

Yes, the SDK supports multi-turn conversations and session management. It provides a createConversation helper to maintain interactive chat state and tool permission patterns for agent behavior.

What are the limitations of using Claude CLI via an SDK wrapper?

A limitation of using Claude CLI via an SDK wrapper is the dependency on the local claude binary and Pro/Max billing. It is ideal for Node.js but requires managing async generators and subprocess states.

Why manage Claude CLI subprocesses and billing with an SDK?

You manage Claude CLI subprocesses and billing with an SDK to avoid exposing API credentials and to streamline error-prone manual management. The SDK provides settings builders and plugin scaffolding for customization.