In Claude Code, both Skills and Slash Commands allow you to extend the AI's capabilities, but they serve distinct purposes. It can be confusing to know when to use one over the other. This lesson clarifies the fundamental difference between them and demonstrates the ideal use case for each.
You'll learn that Slash Commands are for tasks you want to invoke manually and directly from the command line—acting as convenient shortcuts. In contrast, Skills are tools you provide for the AI agent to discover and use dynamically as part of a larger, more complex plan.
/compress slash command directly from an existing compress skill./compress command to see how it provides a direct, user-driven way to perform a specific action.compress skill at the appropriate step in its plan, without any direct command from the user.This lesson clarifies the difference between Claude Code's Slash Commands and Skills. Slash Commands are designed for direct, manual invocation by the user, serving as shortcuts for repetitive tasks. Skills, on the other hand, are tools provided to the AI agent, which it can discover and use dynamically as part of a larger, multi-step plan. The video demonstrates this by first creating a /compress slash command from an existing compress skill and running it manually. Then, the slash command is removed, and the AI is given a complex task to find, sort, and compress files. In this scenario, the AI autonomously invokes the compress skill at the correct moment, showcasing how skills empower the agent to solve problems without direct user intervention for each step.
Based on the following skill @.claude/skills/compress/SKILL.md Please create a slash command for my local project.
1. Find all of the JSON files in our project
2. Sort them by size
3. Compress the three largest files into a single bundle.
claude
/compress bundle @index.ts
The following is the compress.md file generated for the /compress Slash Command. Note its structure is nearly identical to a SKILL.md file, defining allowed tools, arguments, and instructions for execution.
---
allowed-tools: Skill(timestamp), Bash(bun run scripts/compress.ts:*)
argument-hint: <output-name> <files-to-compress...>
description: Compress files with timestamp prefix to compressions directory
---
# Compress Files
You must compress the specified files using the following steps:
1. **Generate timestamp**: Use the timestamp skill to create a timestamp in the format YYYY-MM-DD-HH-MM-SS
2. **Compress files**: Use the compression script to create a tarball with the timestamp prefix
## Requirements
- The output filename must include the timestamp prefix: `<timestamp>-<output-name>.tar.gz`
- Files are output to `compressions/<timestamp>-<output-name>.tar.gz`
- Use the compression script at `scripts/compress.ts`
## Arguments
- `$1`: Output name (without timestamp prefix or .tar.gz extension)
- Remaining arguments (`$2`, `$3`, etc.): Files and directories to compress
## Usage Pattern
```bash
bun run scripts/compress.ts <timestamp>-$1.tar.gz <remaining-files>
```
## Example
If the user runs: `/compress my-project src/ package.json README.md`
And the timestamp is: `2025-10-24-15-30-45`
Then execute:
```bash
bun run scripts/compress.ts 2025-10-24-15-30-45-my-project.tar.gz src/ package.json README.md
```
This creates: `compressions/2025-10-24-15-30-45-my-project.tar.gz`
[00:00] I'm going to go to the slash commands doc page, select copy page, then paste that into clod, then tell it based on the following skill, reference our compress skill, please create a slash command for my local project. We'll let this run, and now we have a slash command called compress which can use my timestamp skill and also uses my same compress script from bun and all I have to do to run it is exit this session so my commands will be loaded. So we'll start a new one. I'll say slash compress, hit tab, then it prompts for the arguments. We'll say the output name is bundle, and the input is our index.ts file.
[00:45] Then once I hit enter we're going to get a very similar behavior to our skill. In fact, the exact same behavior. So you'll see we'll get that in our compressions directory, a timestamp, with the name of bundle, and everything worked perfectly. So the question is how is a slash command different from a skill. The difference is in scenarios where you have plans, and I'll go ahead and delete our slash command.
[01:10] So just throw away this commands directory, make sure I update my hook so that it's not blocking all the bash commands, then I'll fire up a plan, which I'll paste in, to tell it to find JSON files, sort them by size, and then compress the three largest files. So the skill will come into effect much later on in the plan, based on when the agent thinks it's necessary. So far in all of the lessons we've been using skills as if they're commands, just to save on time, but the difference for you is to think, is this something I want to invoke manually as a slash command, or is this something that's going to come up later as my agent is figuring out how to solve this problem, so that I give it the tools necessary to figure it out. Say for example, if instead of compress the three largest files I told it to upload the files to a server and make sure it fits within a size constraint, The agent could figure out it needed to compress them. So even using the word compress in here is just for educational purposes, whereas skills are things that will be dynamically invoked by the agent in the future based on the scenario where the agent decides to use it.
[02:15] So we'll go ahead and let this plan run. It found 90 JSON files. We'll sort them by size. And now it's loading up the compress skill and the timestamp skill so it was able to create the file in our compressions directory with a proper timestamp and follow all of the instructions. And again, it's critical to remember that the context from the skills were not loaded until they were requested.
[02:40] So it knew nothing about how it was going to compress it until the compressed skill was loaded. It just knew that it should bring in that skill once that scenario was necessary. But in general, the best way to separate them is a slash command is invoked by the user, and a skill is invoked by an agent, and it has the benefit of lazy loading context.