spring-ai-community

Claude Agent SDK Java Tutorial — Git skill for Claude Code

Git community

No longer maintained — active development moved to https://github.com/markpollack/claude-agent-sdk-java-tutorial.

How to install Claude Agent SDK Java Tutorial

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

What Claude Agent SDK Java Tutorial does

No longer maintained — active development moved to https://github.com/markpollack/claude-agent-sdk-java-tutorial.

Alternatives in Git

  • Skill Development Guide — Community Examples 81.1k ★
  • Worktree Parallel Init — Create multiple git worktrees for parallel development: $ARGUMENTS 23.4k ★
  • Superclaude — by SuperClaude-Org - A versatile configuration framework that enhances Claude Code with specialized commands 21.7k ★

README

[!IMPORTANT] **This repository is no longer maintained.**

Active development has moved to [markpollack/claude-agent-sdk-java-tutorial](https://github.com/markpollack/claude-agent-sdk-java-tutorial). Current documentation is available at [lab.pollack.ai](https://lab.pollack.ai/projects/claude-agent-sdk).

This repository remains available for historical Spring AI Community releases. Its Apache 2.0 license and historical contents are unchanged. Please submit new issues and pull requests to the active repository.

Claude Agent SDK Java Tutorial

Progressive tutorial modules for learning the Claude Agent SDK Java.

Overview

This repository contains 23 standalone tutorial modules, each teaching one concept in ~50-100 lines of focused code. Each module is a complete, runnable console application.

Prerequisites

  • Java 21+
  • Maven 3.8+
  • Claude Code CLI installed and authenticated (claude --version)

Three API Styles

The Java SDK provides three ways to interact with Claude:

1. One-Shot API (`Query`) - Simplest

// One-liner for quick answers
String answer = Query.text("What is 2+2?");
System.out.println(answer);  // "4"

// Full result with metadata
QueryResult result = Query.execute("Explain Java");
System.out.println("Cost: $" + result.metadata().cost().calculateTotal());

2. Blocking API (`ClaudeSyncClient`) - Multi-turn & Hooks

try (ClaudeSyncClient client = ClaudeClient.sync()
        .workingDirectory(Path.of("."))
        .build()) {

    String response1 = client.connectText("What is the capital of France?");
    System.out.println(response1);

    // Follow-up in same context
    String response2 = client.queryText("What's its population?");
    System.out.println(response2);  // Claude remembers we were talking about Paris
}

3. Reactive API (`ClaudeAsyncClient`) - Non-blocking

ClaudeAsyncClient client = ClaudeClient.async()
    .workingDirectory(Path.of("."))
    .build();

// Mult