While individual AI agent skills are powerful, their true potential is unlocked when they can be combined to perform more complex, multi-step tasks. One skill might need the output of another to complete its work, creating a dependency chain.
This lesson demonstrates how to build modular, composable skills that can call each other. We will create a compress skill that needs a timestamped filename, and we will instruct it to use a separate timestamp skill to get that information.
The Initial compress Skill
First, we define our compress skill. Its goal is to take files resulting from a user's request and archive them into a .tar.gz file. The desired filename format includes a timestamp, which we initially define as a placeholder.
When we first run this, the AI doesn't know about our separate timestamp skill. It simply tries to fill in the <timestamp> placeholder itself, resulting in an incorrect or guessed value.
Explicitly Defining a Dependency
To solve this, we can explicitly tell the compress skill that it has a dependency. By adding a ## Requirements section to its SKILL.md, we can instruct the agent to use another skill first.
With this simple instruction, the agent's behavior changes completely. It now understands the workflow:
- Run the
timestampskill. - Capture the output (the correctly formatted timestamp).
- Run the
compressskill, substituting the output from the first step into its command.
Running the Workflow
With the dependency defined, we can now make a more complex request that requires creating a file and then compressing it.
The agent correctly follows the multi-step process:
- Analyzes
index.tsand writes a new summary file (e.g.,index-ts-summary.md). - Executes the
timestampskill to get the current timestamp. - Executes the
compressskill, using thetarcommand to archiveindex-ts-summary.mdinto a file with the correct timestamped name.
This pattern of creating small, single-purpose skills and composing them through explicit requirements allows you to build sophisticated, reliable, and reusable workflows for your AI agent.
