Stacking Claude Skills to Create Complex Workflows

John Lindquist
InstructorJohn Lindquist

Social Share Links

Tweet

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:

  1. Run the timestamp skill.
  2. Capture the output (the correctly formatted timestamp).
  3. Run the compress skill, 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:

  1. Analyzes index.ts and writes a new summary file (e.g., index-ts-summary.md).
  2. Executes the timestamp skill to get the current timestamp.
  3. Executes the compress skill, using the tar command to archive index-ts-summary.md into 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.

[00:00] One skill can fire off another skill, so we're going to create a clod skills compress and skill.md. Give this the front matter with the name of compress and just accept this and we'll tweak it. And one side note I haven't mentioned so far is that the name should all be lowercase and dashed to match the directory name here. So in the skills directory all of the skills will be lowercased or dashcased and then this name needs to match that. Now it's okay if this is uppercased, we did that in the previous one, but we'll go ahead and lowercase it just to completely follow the spec.

[00:38] It will lowercase it automatically if you forget. But back to compress, cursor suggested pretty much what I wanted, just tarring up a request from the user, but the key here is we're going to mention that we want a timestamp. And as long as we have timestamp at least just here in the name, if we get rid of all of this, and I'm even going to get rid of this, and all of this, the tar command should be enough to handle it. And for tar the first path will be the path to the output file and this is the path to the input file. And we're just using placeholders inside of these angle brackets, which is a fairly common convention inside of markdown files when working with AI prompts.

[01:17] They don't have any special meaning other than hinting to the AI of what's going on. So we'll say in our project root, in the compressions directory, create a timestamp and then a dash and then the file name based on the user's request is the first path and then the second path will be whatever files were created as a result of the user's request. So if we fire this off I'll say clod please compress a summary of the and then I'll find a file We'll use index.ts again. Once I hit enter, we're going to allow the skill compress which we just created. I'm going to press 2 so we can always run it.

[01:54] The skill will kick off. Now it's running the bash command and you can see that the bash command ran without requesting any permissions because we listed it in our allowed tools here with bash tar. But unfortunately it looks like timestamp here is not going to be enough since this isn't the actual time, it just tried to guess at a time of the day. So I am going to drop in a requirements section and I'll say you must use the timestamp skill to create the timestamp. It'll exit out so this reloads, clear, start it over, press up, hit enter.

[02:27] Now it runs a compressed skill without asking for permission. Now the timestamp skill is running so bash runs to get the timestamp, and this is the correct time. And now we have a compressed file of that summary in compressions with the timestamp-indexSummary.tar.gz which follows exactly our pattern here, and it contains the index.ts file. And I can see how my initial prompt was ambiguous. If I look back at compress a summary of this, it misunderstood and compressed this and then wrote a summary.

[03:02] So give it one more shot and improve my initial prompt with please create a summary of index.ts and then compress it or compress the summary. Fire this off. So now it's creating a summary. And I should have even said create a file of the summary, which it's not doing. Maybe it'll write it out this time.

[03:23] So that's still my user error. So now it's writing a file which it can compress, and this is what it didn't do last time. And then compressing that file. So here's the summary and here's the compressed version of that summary. And you can see how these skills can stack on top of each other.

[03:40] So you could imagine taking this even further where you could have an upload result where the upload told it to compress and then the compress used the timestamp so that the timestamp skill can be its own thing which can be shared across other skills but the higher level skills such as upload could reference a skill which references a skill and you end up creating entire workflows with specific instructions that you want your agent to follow.