Spring AI Recipe: Reusing Agent Behavior with SkillsJars
In a previous recipe, we explored how Agent Skills provide procedural memory — guiding how an agent behaves.
We defined those skills manually using Markdown.
But what if you could reuse skills created by others?
What if adding behavior to your agent was as simple as adding a dependency?
That’s exactly what SkillsJars provide.
NOTE: This recipe has been updated since it’s original publication to reflect changes in Spring AI 2.0.0.
What are SkillsJars?
SkillsJars are packaged skills distributed as JAR files (an initiative by James Ward).
They allow you to:
- reuse prebuilt agent behaviors
- share domain knowledge across applications
- add capabilities without writing SKILL.md files
Each SkillsJar contains one or more skills, typically located under /META-INF/skills.
Adding dependencies
Start with a basic Spring AI application (such as the chat loop from earlier recipes).
Add Spring AI Agent Utils:
implementation 'org.springaicommunity:spring-ai-agent-utils:0.7.0'Next, browse available SkillsJars to find one or more that suits your needs.
For this example, we’ll use a skill that enables PDF creation:
implementation 'com.skillsjars:anthropics__skills__pdf:2026_02_25-3d59511'Configuring skill discovery
Tell Spring AI where to find the skills:
agent.skills.paths=classpath:/META-INF/skillsWiring skills into ChatClient
@Value("${agent.skills.paths}")
List<Resource> skillPaths;
@Bean
ChatClientBuilderCustomizer skillsTools() {
return builder -> builder
.defaultToolCallbacks(
SkillsTool.builder()
.addSkillsResources(skillPaths)
.build());
}This makes all skills from the JAR available to the agent.
Adding required tools
Even though skills define behavior, they still rely on tools to execute actions.
In this case, the PDF skill requires:
- filesystem access
- shell execution
@Bean
ChatClientBuilderCustomizer addFileSystemAndShellTools() {
return builder -> builder
.defaultTools(
ShellTools.builder().build(),
FileSystemTools.builder().build());
}Trying it out
Run the application and ask:
> Create a story about an otter and write it to a .pdf file at /path/to/otter-story.pdfThe agent will:
- Generate the story
- Follow the skill’s instructions
- Use tools to write the PDF
Why this matters
Without SkillsJars:
- you write skills manually
- you duplicate effort across projects
With SkillsJars:
- behavior is reusable
- knowledge is shareable
- setup becomes declarative
A mental model
Think of agent construction as layers:
- Tools → what the agent can do
- Skills → how the agent behaves
- SkillsJars → how behavior is distributed and reused
Takeaway
SkillsJars bring a new level of modularity to agent design.
They let you assemble intelligent behavior the same way you assemble Spring applications — through dependencies.
Find the source code for this and other recipes at https://github.com/habuma/spring-ai-recipes.