Agent skill

Spring AI Integration

by rrezartprebreza in rrezartprebreza/spring-boot-skills

A skill your agent uses when integrating LLMs, chat clients, embeddings, RAG pipelines, or AI agents into Spring Boot.

MITAuto-check passedAI & LLM Engineering

Install Spring AI Integration

skills CLI
$ npx skills add rrezartprebreza/spring-boot-skills --skill spring-ai-integration -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install rrezartprebreza/spring-boot-skills spring-ai-integration --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/rrezartprebreza/spring-boot-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/spring-boot-4/spring-ai-integration .claude/skills/spring-ai-integration && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
spring-ai-integration
GitHub stars
301
Token cost
~2.5k tokens
SKILL.md length
300 words
Files
6
Skills in repo
51
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when integrating LLMs, chat clients, embeddings, RAG pipelines, or AI agents into Spring Boot.

  • Integrating LLMs
  • SKILL.md covers Dependencies, ChatClient — Basic Usage, ChatClient Bean Configuration and Prompt Templates (externalized), plus 5 more sections
  • Runs Java scripts from its folder; needs ANTHROPIC_API_KEY and OPENAI_API_KEY
  • AI agents into Spring Boot

What it does

Spring AI Integration is an agent skill from rrezartprebreza/spring-boot-skills. Use when integrating LLMs, chat clients, embeddings, RAG pipelines, or AI agents into Spring Boot. Covers Spring AI 2.0 ChatClient, prompt templates, embeddings, vector stores, and structured output. Use when user mentions Spring AI, LLM, ChatGPT, Claude, RAG, embeddings.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files (for example `agents/openai.yaml`).

It sits in AI & LLM Engineering, covering Backend development, Embeddings and Prompt engineering. It works with Spring Boot and OpenAI. The repository describes itself as: Production-grade Claude Code and Codex skills for Spring Boot developers. The licence is MIT.

When your agent uses it

  • Integrating LLMs
  • AI agents into Spring Boot
  • User mentions Spring AI

Example prompts

  • “/spring-ai-integration”

Requirements

  • A credential in ANTHROPIC_API_KEY
  • A credential in OPENAI_API_KEY

What it can do on your machine

Read from SKILL.md and the folder at commit f0c06a0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Java), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • ANTHROPIC_API_KEY
    • OPENAI_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Spring AI Integration loads about 2.5k tokens when it runs. Until then it costs about 74 tokens; SKILL.md has 300 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~74
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from rrezartprebreza/spring-boot-skills at commit f0c06a0, republished under its MIT licence (© rrezartprebreza). 300 words, ~2,507 tokens.

Download SKILL.mdSave it as .claude/skills/spring-ai-integration/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
spring-ai-integration
description
Use when integrating LLMs, chat clients, embeddings, RAG pipelines, or AI agents into Spring Boot. Covers Spring AI 2.0 ChatClient, prompt templates, embeddings, vector stores, and structured output. Use when user mentions Spring AI, LLM, ChatGPT, Claude, RAG, embeddings.

Spring AI Integration

Dependencies

xml
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-bom</artifactId>
            <version>2.0.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <!-- Choose your model provider — pattern is spring-ai-starter-model-<provider> -->
    <dependency>
        <groupId>org.springframework.ai</groupId>
        <artifactId>spring-ai-starter-model-anthropic</artifactId>
    </dependency>
    <!-- OR -->
    <dependency>
        <groupId>org.springframework.ai</groupId>
        <artifactId>spring-ai-starter-model-openai</artifactId>
    </dependency>

    <!-- For RAG / vector search -->
    <dependency>
        <groupId>org.springframework.ai</groupId>
        <artifactId>spring-ai-starter-vector-store-pgvector</artifactId>
    </dependency>
    <!-- QuestionAnswerAdvisor lives here — 2.0 renamed spring-ai-advisors-vector-store -->
    <dependency>
        <groupId>org.springframework.ai</groupId>
        <artifactId>spring-ai-vector-store-advisor</artifactId>
    </dependency>
</dependencies>

Version pairing matters. Spring Boot 4 requires Spring AI 2.0 (spring-ai-bom 2.0.0); the 1.x line targets Boot 3 only. Starter coordinates follow spring-ai-starter-model-<provider> (e.g. -model-anthropic, -model-openai) and spring-ai-starter-vector-store-<store>. Agents trained on pre-1.0 Spring AI emit spring-ai-<x>-spring-boot-starter — those names resolve to nothing in Maven Central. Also gone in 2.0: spring-ai-starter-model-azure-openai (use the OpenAI starter with an Azure base URL instead).

ChatClient — Basic Usage

java
@Service
@RequiredArgsConstructor
public class DocumentSummaryService {

    private final ChatClient chatClient;

    public String summarize(String conversationId, String content) {
        return chatClient.prompt()
            .advisors(a -> a.param(ChatMemory.CONVERSATION_ID, conversationId))
            .user(u -> u.text("Summarize the following document in 3 bullet points:\n\n{content}")
                .param("content", content))
            .call()
            .content();
    }

    // With system prompt
    public String analyzeFinancial(String conversationId, String document, String language) {
        return chatClient.prompt()
            .advisors(a -> a.param(ChatMemory.CONVERSATION_ID, conversationId))
            .system("You are a financial analyst. Respond in {language}.")
            .system(s -> s.param("language", language))
            .user(document)
            .call()
            .content();
    }
}

Every call using the configured memory advisor must provide a user- or session-scoped ChatMemory.CONVERSATION_ID. Never use one shared conversation ID for all users.

ChatClient Bean Configuration

java
@Configuration
public class AiConfig {

    @Bean
    public ChatMemory chatMemory() {
        // InMemoryChatMemory is long gone. Use MessageWindowChatMemory —
        // it caps history to a sliding window and defaults to an in-memory repository.
        return MessageWindowChatMemory.builder()
            .maxMessages(20)
            .build();
    }

    @Bean
    public ChatClient chatClient(ChatClient.Builder builder, ChatMemory chatMemory) {
        return builder
            .defaultSystem("You are a helpful assistant for an e-commerce platform.")
            .defaultAdvisors(
                MessageChatMemoryAdvisor.builder(chatMemory).build(), // builder, not new(...)
                new SimpleLoggerAdvisor() // logs prompts/responses
            )
            .build();
    }
}
java
// 2.0: the conversation id is REQUIRED on every call that goes through a memory advisor.
// ChatMemory.DEFAULT_CONVERSATION_ID is removed — omitting the param throws IllegalArgumentException.
public String chat(String sessionId, String message) {
    return chatClient.prompt()
        .user(message)
        .advisors(a -> a.param(ChatMemory.CONVERSATION_ID, sessionId))
        .call()
        .content();
}

Prompt Templates (externalized)

java
// src/main/resources/prompts/analyze-order.st
// Analyze this order and identify any anomalies:
// Customer: {customer}
// Items: {items}
// Total: {total}
// Flag any unusual patterns.

@Service
public class OrderAnalysisService {

    @Value("classpath:prompts/analyze-order.st")
    private Resource promptTemplate;

    public String analyzeOrder(String conversationId, Order order) {
        return chatClient.prompt()
            .advisors(a -> a.param(ChatMemory.CONVERSATION_ID, conversationId))
            .user(u -> u.text(promptTemplate)
                .param("customer", order.getCustomerEmail())
                .param("items", order.getItems().toString())
                .param("total", order.getTotal()))
            .call()
            .content();
    }
}

Structured Output

java
// Define the target record
public record OrderClassification(
    String category,
    String priority,
    List<String> tags,
    boolean requiresManualReview
) {}

@Service
public class OrderClassifier {

    public OrderClassification classify(String orderDescription) {
        return chatClient.prompt()
            .user("Classify this order: " + orderDescription)
            .call()
            .entity(OrderClassification.class); // Spring AI handles JSON parsing
    }
}

RAG Pipeline

java
@Configuration
public class RagConfig {

    // No manual VectorStore bean — the spring-ai-starter-vector-store-pgvector
    // starter auto-configures one. Just inject it. (The old `new PgVectorStore(...)`
    // constructor is removed; if you must build one, use PgVectorStore.builder(...).)

    @Bean
    public ChatClient ragChatClient(ChatClient.Builder builder, VectorStore vectorStore) {
        return builder
            .defaultAdvisors(
                QuestionAnswerAdvisor.builder(vectorStore)
                    .searchRequest(SearchRequest.builder().topK(5).build()) // builder, not defaults().withTopK()
                    .build()
            )
            .build();
    }
}

@Service
@RequiredArgsConstructor
public class KnowledgeService {

    private final VectorStore vectorStore;
    private final ChatClient ragChatClient;

    // Ingest documents
    public void ingest(List<String> documents) {
        List<Document> docs = documents.stream()
            .map(content -> new Document(content))
            .toList();
        vectorStore.add(docs);
    }

    // Query with RAG
    public String ask(String question) {
        return ragChatClient.prompt()
            .user(question)
            .call()
            .content();
    }
}

Streaming Responses

java
@GetMapping(value = "/stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<String> stream(@RequestParam String prompt) {
    return chatClient.prompt()
        .user(prompt)
        .stream()
        .content();
}

application.yml

yaml
spring:
  ai:
    anthropic:
      api-key: ${ANTHROPIC_API_KEY}
      chat:
        # 2.0 flattened the properties — the old chat.options.* nesting is dead
        model: ${ANTHROPIC_MODEL}
        max-tokens: 2048
        temperature: 0.7   # 2.0 removed the 0.7 default — set it explicitly if you rely on it
    # OR for OpenAI:
    openai:
      api-key: ${OPENAI_API_KEY}
      chat:
        model: ${OPENAI_MODEL}
    vectorstore:
      pgvector:
        initialize-schema: true
        dimensions: 1536

Gotchas

  • Agent uses Spring AI 1.x (spring-ai-bom 1.0.x) on Spring Boot 4 — 1.x targets Boot 3 only; Boot 4 requires Spring AI 2.0
  • Agent uses pre-1.0 artifact names (spring-ai-anthropic-spring-boot-starter) — the pattern is spring-ai-starter-model-anthropic
  • Agent configures spring.ai.anthropic.chat.options.model — 2.0 flattened properties; drop the .options segment (spring.ai.anthropic.chat.model)
  • Agent passes built options to .options(...) — 2.0 takes the builder: .options(AnthropicChatOptions.builder().maxTokens(2048)), no .build()
  • Agent writes new MessageChatMemoryAdvisor(new InMemoryChatMemory()) — both long removed; use MessageChatMemoryAdvisor.builder(chatMemory) + MessageWindowChatMemory
  • Agent omits the conversation id on a memory-advisor call — mandatory in 2.0 (ChatMemory.DEFAULT_CONVERSATION_ID removed); pass a.param(ChatMemory.CONVERSATION_ID, ...) or get IllegalArgumentException
  • Agent uses PromptChatMemoryAdvisor — removed in 2.0; use MessageChatMemoryAdvisor
  • Agent adds spring-ai-advisors-vector-store for QuestionAnswerAdvisor — renamed to spring-ai-vector-store-advisor in 2.0
  • Agent writes SearchRequest.defaults().withTopK(n) — use SearchRequest.builder().topK(n).build()
  • Agent hardcodes API keys — always use environment variables / ${...}
  • Agent hardcodes provider model IDs - configure them externally because model catalogs change
  • Agent builds prompts with string concatenation — use .param() template variables
  • Agent puts prompts inline in code — externalize to src/main/resources/prompts/
  • Agent ignores structured output — use .entity(MyClass.class) instead of parsing manually
  • Agent uses .entity(List.class) for a list — generics erase; pass new ParameterizedTypeReference<List<X>>() {}
  • Agent skips error handling for API calls — wrap in try/catch, handle NonTransientAiException (don't retry) vs TransientAiException (retry)
  • Agent uses wrong model string — verify model names against provider docs

© rrezartprebreza, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files in skills/spring-boot-4/spring-ai-integration of rrezartprebreza/spring-boot-skills.

  • SKILL.md
  • agents/openai.yaml
  • examples/bad-ai-service.java
  • examples/good-ai-service.java
  • templates/AiServiceTemplate.java
  • templates/analyze-order.st

Open the folder on GitHubat commit f0c06a0

Compare with similar skills

Spring AI Integration next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Spring AI Integration compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Spring AI Integration this skillrrezartprebreza/spring-boot-skills301—~2.5kAutomated safety check: PassMIT
AI SDK Developmenttrypostit/trypost6911 repos~3.5kAutomated safety check: PassMIT
Sap AI Coresecondsky/sap-skills462—~3.3kAutomated safety check: PassGPL-3.0
AWS SDK Java V2 Bedrockgiuseppe-trisciuoglio/developer-kit357—~3.2kAutomated safety check: NotesMIT
Chroma Vector DatabaseOrchestra-Research/AI-Research-SKILLs13k7 repos~2.3kAutomated safety check: PassMIT
LangchainOrchestra-Research/AI-Research-SKILLs13k2 repos~3.2kAutomated safety check: PassMIT

Similar skills

  • AI SDK Development

    trypostit/trypost

    TRIGGER when working with ai-sdk which is Laravel official first-party AI SDK.

    691 GitHub starsUsed in 1 repo~3.5k tokens
    AI & LLM EngineeringAuto-check passed
  • Sap AI Core

    secondsky/sap-skills

    Guides development with SAP AI Core and SAP AI Launchpad for enterprise AI/ML workloads on SAP BTP.

    462 GitHub stars~3.3k tokensUpdated 5 days ago
    AI & LLM EngineeringAuto-check passed
  • AWS SDK Java V2 Bedrock

    giuseppe-trisciuoglio/developer-kit

    Provides Amazon Bedrock patterns using AWS SDK for Java 2.x.

    357 GitHub stars~3.2k tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check: notes
  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 7 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Langchain

    Orchestra-Research/AI-Research-SKILLs

    Framework for building LLM-powered applications with agents, chains, and RAG.

    13k GitHub starsUsed in 2 repos~3.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Qianwenai Wiki

    chujianyun/skills

    千问AI平台(Qianwen AI Platform / DashScope)官方文档离线知识库,用于检索并回答模型选择、API Key、OpenAI 兼容接口、DashScope SDK、文本与多模态生成、图像/视频/语音、Realtime API、Embedding、Reranking、Function Calling、MCP、批量调用、计费、Token Plan、API/SDK/CLI…

    742 GitHub stars~717 tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed

More from rrezartprebreza/spring-boot-skills

All 51 skills in this repo
  • AI Observability

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and completion logging.

    301 GitHub stars~1.6k tokensUpdated 19 days ago
    Auto-check passed
  • API Versioning

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when versioning Spring MVC or WebFlux APIs in Spring Boot 3 / Spring Framework 6.

    301 GitHub stars~516 tokensUpdated 19 days ago
    Auto-check passed
  • API Versioning

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when versioning Spring MVC or WebFlux APIs in Spring Boot 4 / Spring Framework 7.

    301 GitHub stars~643 tokensUpdated 19 days ago
    Auto-check passed
  • Container Native Deployment

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when packaging a Spring Boot 3 application as an OCI image or GraalVM native executable.

    301 GitHub stars~781 tokensUpdated 19 days ago
    Auto-check passed
  • Container Native Deployment

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when packaging Spring Boot 4 as an OCI image, JVM container, AOT application, or GraalVM native executable.

    301 GitHub stars~706 tokensUpdated 19 days ago
    Auto-check passed
  • Domain Driven Design

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 3 application, or when DDD is explicitly requested.

    301 GitHub stars~2.1k tokensUpdated 19 days ago
    Auto-check passed

Questions about Spring AI Integration

What does Spring AI Integration do?

A skill your agent uses when integrating LLMs, chat clients, embeddings, RAG pipelines, or AI agents into Spring Boot. Spring AI Integration is an agent skill from rrezartprebreza/spring-boot-skills. Use when integrating LLMs, chat clients, embeddings, RAG pipelines, or AI agents into Spring Boot.

When should I use Spring AI Integration?

Spring AI Integration fits situations like: integrating LLMs; AI agents into Spring Boot; user mentions Spring AI.

How do I install Spring AI Integration in Claude Code?

Run `npx skills add rrezartprebreza/spring-boot-skills --skill spring-ai-integration -a claude-code`. Or copy the skill folder (skills/spring-boot-4/spring-ai-integration in rrezartprebreza/spring-boot-skills) into .claude/skills/spring-ai-integration in your project. Claude Code loads it when a task matches its description.

How do I install Spring AI Integration in Codex?

Run `npx skills add rrezartprebreza/spring-boot-skills --skill spring-ai-integration -a codex`. Or copy the skill folder (skills/spring-boot-4/spring-ai-integration in rrezartprebreza/spring-boot-skills) into .agents/skills/spring-ai-integration in your project. Codex loads it when a task matches its description.

Can I use Spring AI Integration in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rrezartprebreza/spring-boot-skills --skill spring-ai-integration -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/spring-ai-integration, .gemini/skills/spring-ai-integration, .github/skills/spring-ai-integration and .opencode/skills/spring-ai-integration in your project.

What does Spring AI Integration need to run?

Going by SKILL.md and its folder, Spring AI Integration needs Java for the scripts in its folder and credentials named ANTHROPIC_API_KEY and OPENAI_API_KEY. Our summary lists: A credential in ANTHROPIC_API_KEY; A credential in OPENAI_API_KEY.

Does Spring AI Integration access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Spring AI Integration safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Spring AI Integration use?

Spring AI Integration is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Spring AI Integration use?

About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Spring AI Integration?

Skills that share tags, products or a category with Spring AI Integration: AI SDK Development (trypostit/trypost, 691 stars), Sap AI Core (secondsky/sap-skills, 462 stars), AWS SDK Java V2 Bedrock (giuseppe-trisciuoglio/developer-kit, 357 stars) and Chroma Vector Database (Orchestra-Research/AI-Research-SKILLs, 13k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Spring AI Integration?

rrezartprebreza (a GitHub user) maintains it in rrezartprebreza/spring-boot-skills, which has 301 GitHub stars. The repository holds 51 skills in this directory. The repository was last updated on September 21, 2026.

Source: rrezartprebreza/spring-boot-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.