Class ShellSkills
FileSystemSkills to an LLM using shell commands.
WARNING: Shell execution is inherently unsafe. Commands run directly in the host process environment without any sandboxing, containerization, or privilege restriction. A misbehaving or prompt-injected LLM can execute arbitrary commands on the machine running your application. Only use this in controlled environments where you fully trust the input.
This corresponds to the Filesystem-based agents integration approach from the Agent Skills specification.
Only a run_shell_command tool is registered. The LLM reads SKILL.md files
and other resources directly via shell commands using the absolute paths provided in the
formatAvailableSkills() via <location>.
Typical usage with an AI Service:
ShellSkills skills = ShellSkills.from(FileSystemSkillLoader.loadSkills(skillsDir));
MyAiService service = AiServices.builder(MyAiService.class)
.chatModel(chatModel)
.systemMessage("You have access to the following skills:\n" + skills.formatAvailableSkills()
+ "\nWhen the user's request relates to one of these skills, read its SKILL.md before proceeding.")
.toolProvider(skills.toolProvider())
.build();
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ShellSkills.Builderbuilder()Returns an XML-formatted string listing all configured skills with their names, descriptions, and absolute file-system paths to theirSKILL.mdfiles.static ShellSkillsfrom(FileSystemSkill... skills) Creates aShellSkillsinstance with default configuration from the given skills.static ShellSkillsfrom(Collection<? extends FileSystemSkill> skills) Creates aShellSkillsinstance with default configuration from the given collection of skills.Returns theToolProviderthat exposes therun_shell_commandtool to the LLM.
-
Constructor Details
-
ShellSkills
-
-
Method Details
-
toolProvider
Returns theToolProviderthat exposes therun_shell_commandtool to the LLM. Pass this toAiServices.builder(...).toolProvider(...). -
formatAvailableSkills
Returns an XML-formatted string listing all configured skills with their names, descriptions, and absolute file-system paths to theirSKILL.mdfiles.Include this in the system message so the LLM knows which skills are available and where to find their instructions via
run_shell_command.Example output:
<available_skills> <skill> <name>docx</name> <description>Edit and review Word documents using tracked changes</description> <location>/path/to/skills/docx/SKILL.md</location> </skill> </available_skills> -
from
Creates aShellSkillsinstance with default configuration from the given collection of skills. -
from
Creates aShellSkillsinstance with default configuration from the given skills. -
builder
-