Creating Custom Commands in Claude Code

April 23, 2026
Anablock
AI Insights & Innovations

Anablock is a technology and AI systems company helping businesses automate workflows, connect tools, improve lead handling, and build smarter digital growth systems. The Anablock team writes about AI implementation, automation, CRM, lead generation, SEO/AEO, and practical ways businesses can use technology to operate better and grow.

Follow Anablock on LinkedIn

Claude 2

Creating Custom Commands in Claude Code

Claude Code comes with built-in commands that you can access by typing a forward slash, but you can also create your own custom commands to automate repetitive tasks you run frequently.

Creating Custom Commands

To create a custom command, you need to set up a specific folder structure in your project:

  1. Find the .claude folder in your project directory
  2. Create a new directory called commands inside it
  3. Create a new markdown file with your desired command name (like audit.md)

The filename becomes your command name - so audit.md creates the /audit command.

Example: Audit Command

Here's a practical example of a custom command that audits project dependencies for vulnerabilities:

Audit the project dependencies for vulnerabilities:

1. Run `npm audit` to identify vulnerable packages
2. Run `npm audit fix` to apply available updates
3. Run the test suite to verify updates didn't break anything

This audit command does three things:

  • Runs npm audit to find vulnerable installed packages
  • Runs npm audit fix to apply updates
  • Runs tests to verify the updates didn't break anything

After creating your command file, you must restart Claude Code for it to recognize the new command.

Commands with Arguments

Custom commands can accept arguments using the $ARGUMENTS placeholder. This makes them much more flexible and reusable.

For example, a write_tests.md command might contain:

Write comprehensive tests for: $ARGUMENTS

Testing conventions:
* Use Vitests with React Testing Library
* Place test files in a __tests__ directory in the same folder as the source file
* Name test files as [filename].test.ts(x)
* Use @/ prefix for imports

Coverage:
* Test happy paths
* Test edge cases
* Test error states

You can then run this command with a file path:

/write_tests the use-auth.ts file in the hooks directory

The arguments don't have to be file paths - they can be any string you want to pass to give Claude context and direction for the task.

Key Benefits

Automation - Turn repetitive workflows into single commands

Consistency - Ensure the same steps are followed every time

Context - Provide Claude with specific instructions and conventions for your project

Flexibility - Use arguments to make commands work with different inputs

Custom commands are particularly useful for project-specific workflows like running test suites, deploying code, or generating boilerplate following your team's conventions.

Written by

Anablock
Anablock

AI Insights & Innovations

Anablock is a technology and AI systems company helping businesses automate workflows, connect tools, improve lead handling, and build smarter digital growth systems. The Anablock team writes about AI implementation, automation, CRM, lead generation, SEO/AEO, and practical ways businesses can use technology to operate better and grow.

Follow Anablock on LinkedIn

Share this article:
View all articles

Related Articles

The Institutions That Move First Will Win: AI and the Future of Institutional Finance featured image
June 16, 2026
The financial services industry is at an AI inflection point. Institutions that act decisively on AI today will build compounding competitive advantages in deal velocity, research quality, and compliance efficiency. Anablock, an official Anthropic implementation partner, explains why Claude is the right foundation — and how to move fast.

Talk to Anablock about building AI around your workflows.

If you are ready to move from research to implementation, we can help map the right AI system around your tools, data, team, and goals.