Course lesson
Stacking Claude Skills to Create Complex Workflows
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.
- Duration
- 4 min
- Access
- Free
- Transcript
- Needs source
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.
---
name: compress
description: Compress the resulting files of a user's request
allowed-tools: [Write, Bash(tar:*)]
---
## Usage
```bash
tar -czvf <project-root>/compressions/<timestamp>-<file-name-based-on-the-user-request>.tar.gz <files-from-user-request>
```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.
---
name: compress
description: Compress the resulting files of a user's request
allowed-tools: [Write, Bash(tar:*)]
---
## Requirements
You must use the timestamp skill to create the timestamp.
## Usage
```bash
tar -czvf <project-root>/compressions/<timestamp>-<file-name-based-on-the-user-request>.tar.gz <files-from-user-request>
```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.
claude "Please create a summary of @index.ts and then compress the summary."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.