s-soroosh

Claude Code JS — Git skill for Claude Code

Git community intermediate

GitHub Repo stars Claude Code SDK for Javascript & Typescript JS/TS SDK.

How to install Claude Code JS

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

What Claude Code JS does

A JavaScript SDK for integrating with Claude Code, Anthropic's official CLI tool for Claude.

Alternatives in Git

  • Analysis Claude Code — GitHub Repo stars Complete reverse engineering research and analysis of Claude Code v1.0.33 Reverse engineerin 35k ★
  • n8n MCP — GitHub Repo stars MCP for Claude Desktop/Code to build n8n workflows n8n workflow integration 15.5k ★
  • Claude Relay Service — GitHub Repo stars Self-built Claude code mirror service supporting multi-account switching Relay service 9.9k ★

README

Claude Code JS

A JavaScript SDK for integrating with Claude Code, Anthropic's official CLI tool for Claude.

Overview

This project provides a JavaScript/TypeScript SDK that allows developers to programmatically interact with Claude Code, enabling AI-powered software engineering capabilities in their applications.

Installation

npm install claude-code-js

or with yarn:

yarn add claude-code-js

Quick Start

Basic Setup

import { ClaudeCode } from 'claude-code-js';

// Initialize the SDK
const claude = new ClaudeCode({
  apiKey: process.env.CLAUDE_API_KEY, // Optional: if already logged in
  model: 'claude-3-sonnet', // Optional: specify model
  workingDirectory: './my-project', // Optional: set working directory
  verbose: false, // Optional: enable verbose logging
  oauth: { // Optional: OAuth credentials for token refresh
      accessToken: "ACCESS_TOKENID",
      refreshToken: "REFRESH_TOKEN",
      expiresAt: EXPIRES_AT_VALUE
  }
});

Example Usage

Single Chat with Claude

// Send a chat message to Claude with a prompt
const response = await claude.chat({
  prompt: 'Explain this error: TypeError: Cannot read property of undefined',
  systemPrompt: 'You are a helpful coding assistant', // Optional
  appendSystemPrompt: 'Keep explanations concise' // Optional
});

if (response.success) {
  console.log('Result:', response.message.result);
  console.log('Session ID:', response.message.session_id);
  console.log('Cost:', response.message.cost_usd);
} else {
  console.error('Error:', response.error.message);
}

Sessions for Multi-turn Conversations

// Create a new session for ongoing conversations
const session = claude.newSession();

// Start the conversation
const firstMessage = await session.prompt({
  prompt: 'What is 2 + 2?',
  systemPrompt: 'You are expert at math. Always return a single line of text in format: equation = result'
});

...