Yar Malik
HomeFree CourseResourcesStartupsPortfolioPartnershipsAbout
Join the community
Build a 1-Person AI Business with Claude/AI Automations

Course 04 · Lesson 2 of 8

Custom Slash Commands

Every workflow you run more than once is a candidate for a slash command

A slash command is a shortcut. Instead of typing a 20-line prompt every Monday morning you type /weekly-content and Claude runs the full workflow automatically.

This is the simplest form of automation and the most immediately useful.

How Slash Commands Work

A slash command is a markdown file saved in your ~/.claude/commands/ folder. The filename becomes the command name.

A file called ~/.claude/commands/weekly-content.md becomes available as /weekly-content. A file called ~/.claude/commands/morning-brief.md becomes /morning-brief. A file called ~/.claude/commands/project-kickoff.md becomes /project-kickoff.

When you type the slash command in Claude Code it loads the contents of that file as your prompt and runs it.

The Commands Folder

To create your commands folder if it does not already exist, open a terminal on Mac or Linux and run:

mkdir -p ~/.claude/commands

On Windows run:

mkdir %USERPROFILE%\.claude\commands

Or simply ask Claude Code:

  • Create the commands folder at ~/.claude/commands/ if it does not exist.
  • Create a test file called hello.md inside it that says "Say hello and tell me what project I am in."

A Simple Example

Here is a command file called review.md:

# Code Review

Review every file in the current project.

Check for:

  1. Any functions longer than 50 lines — suggest how to split them
  2. Any hardcoded values that should be constants
  3. Any error handling that is missing or too broad
  4. Any console.log or debug statements that should be removed

Give me a numbered list of every issue found.

For each issue: file name, line number, what is wrong, how to fix it.

Start with the highest severity issues

Save that file. Type /review in Claude Code. Claude runs the full review automatically.

What to Put in a Slash Command

The best slash commands follow a fixed structure every time covering the same steps, same format, and same output. They handle tasks that take a long time to prompt manually where any workflow over 5 lines of instructions qualifies. And they use information from your project files because slash commands automatically have access to your project context and CLAUDE.md.

You can also make slash commands that take an argument, which is a variable piece of input you add after the command name. Claude Code supports this with $ARGUMENTS:

# Topic Research

Research the following topic thoroughly: $ARGUMENTS

Use the fetch MCP to find 3 authoritative sources.

For each source: URL, key claim, and how it applies to our audience.

Then give me 5 specific angles we could take on this topic for our content.

When you type /topic-research AI landing page conversion, Claude replaces $ARGUMENTS with "AI landing page conversion" and runs the full research workflow.

Building Your First Slash Command

Step 1: Pick a workflow you repeat

Look at your Claude Code history. What prompt have you typed multiple times in a similar form? Start there.

Step 2: Write the command file

Structure it the same way you structure a good prompt covering what the goal is, what steps to follow, what the output should look like, and any quality checks to run.

Step 3: Save it

Save to ~/.claude/commands/[command-name].md where the command name has no spaces and uses hyphens instead.

Step 4: Test it

In Claude Code type a forward slash and your command should appear in the autocomplete list. Select it and let it run.

Your Action Right Now

Create your first slash command from the workflow you identified at the start of this course, the one you do regularly with similar prompts.

Write the command file. Save it to ~/.claude/commands/. Test it.

In the next lesson we go deeper with hooks that run automatically without you typing anything.

PreviousAI Automation: Start HereNext lessonHooks: Automations That Run Themselves

Do it with other builders

Post your homework. Get unstuck.

Every course ends with homework. Post yours in Claude Codex Mastery, the community this course comes from, and get feedback from Yar and 400+ people building the same way.

Join the community · $29/mo
AI Automations
  1. 1.AI Automation: Start Here
  2. 2.Custom Slash Commands
  3. 3.Hooks: Automations That Run Themselves
  4. 4.Morning Brief: Know What Matters First
  5. 5.Content Batch Automation
  6. 6.Automation Stack: Build System That Runs Itself
  7. 7.Course Summary: Automations
  8. 8.Homework: Automations

Yar Malik

AI operator, educator, and founder building businesses around automation, media, and monetizable skills.

HomeAboutFree CourseBlogsPartnershipsCommunity

© 2026 Yar Malik. All rights reserved.