Home

Create Custom Slash Commands

Tired of typing the same detailed prompts over and over? Custom slash commands let you save complex instructions as reusable shortcuts. Like creating keyboard shortcuts for your most frequent tasks, slash commands turn lengthy prompts into simple commands like /stock-report Apple that generate comprehensive reports instantly.

The best part? We use Claude to write the detailed prompt and create the Skill. Yes, Claude is very good at prompting…itself.

Key Concepts

What You’ll Need

Step 1: Create a Project Folder

Windows (WSL):

Mac:

Step 2: Start Claude Code

Windows (WSL):

Mac:

Claude Code starts and displays a welcome message.

Step 3: Ask Claude to Create a Slash Command

Instead of manually creating files, let Claude do the work. Type this prompt:

Create a slash command called stock-report that generates 
reports on recent developments of a company identified by name or ticker symbol.
Include:
- Product or service news 
- Management team news 
- Recent financial reports 
- Analyst reports 

When asked, grant Claude permission to create the file. Claude will create a detailed prompt and save it as stock-report.md to the .claude/commands/ folder.

Note: We use Markdown format throughout: in prompts, reports, and slash commands. Markdown is AI-friendly and can be easily edited as plain text files.

Step 4: Review the Command

Use any text editor to open the stock-report.md file from the .claude/commands/ folder. That’s the prompt for the slash command.

If you have VS Code installed (recommended):

Review the prompt and make changes to the instructions if you want.

Note: Claude is incredibly good at writing prompts. You can see that its prompt is structured well using markdown format and clearly written. Learn to write prompts like this. It sometimes even includes instructions to ask for clarification if the identifier is ambiguous.

Step 5: Test the Command

First quit the current Claude Code session by pressing Ctrl+C twice. Then restart Claude so the new slash command is loaded:

  claude

Now test your new command with a real stock ticker:

/stock-report Apple

Claude searches the web and generates a comprehensive report about Apple Inc. This may take 1-2 minutes.

Step 6: Review the Generated Report

Claude creates a report in the command line. Review the output:

Step 7: Save report to file

Let’s modify the slash command to automatically save reports as markdown files. Append this to the slash command markdown file manually.

Step 8: Rerun Command

Claude generates the report and saves it as an markdown file named something like Apple_2025-12-13.md. Click the file in VS Code to view it.

Step 9: Modify the Command through Claude

You can ask Claude to edit the slash commands:

Revise the stock-report slash command to save the report as a html file.

Claude updates the command file. You can verify from the editor.

Step 10: Test the Updated Command

Claude creates a file named something like Apple_2025-12-13.html. Click on this file from File Explorer on Windows or Mac to open it in your default browser.

Step 11: Reuse slash command (Optional)

The $ARGUMENTS keyword in your slash command acts as a placeholder. When you type /stock-report AAPL, Claude replaces $ARGUMENTS with AAPL before executing the prompt.

Try another ticker:

/stock-report TSLA

The same command structure now researches Tesla instead.

Step 12: Try Another Slash Command (Optional)

If you completed the Writing Research Paper tutorial, you should have a /research-paper command. Test it on a fresh topic.

First, clear Claude’s memory to start fresh:

/clear

Then run the research paper command:

/research-paper AI in schools

Two key differences:

Next Steps

Now that you understand slash commands, create more custom commands for your workflows:

Troubleshooting

Workflow Overview


Created by Steven Ge on December 13, 2025.