CLAUDE LABJP
OPUS48 — Claude Opus 4.8 is generally available, improving on 4.7 across coding, agentic skills, reasoning, and knowledge workAUTO — Claude Code now defaults to auto mode on Bedrock, Vertex AI, and Foundry, and updates Bedrock to Opus 4.8GUARD — Auto mode now blocks tampering with session transcripts and asks before running rm -rf on an unresolved variableIDP — Admins can provision MCP connectors org-wide via their IdP (starting with Okta), granting access on first loginTIMEOUT — Fixed per-server request_timeout_ms being ignored, which timed out long MCP tool calls at the 60s defaultFAST — Fast mode for Opus 4.7 is deprecated and will be removed on July 24; migrate to fast mode for Opus 4.8OPUS48 — Claude Opus 4.8 is generally available, improving on 4.7 across coding, agentic skills, reasoning, and knowledge workAUTO — Claude Code now defaults to auto mode on Bedrock, Vertex AI, and Foundry, and updates Bedrock to Opus 4.8GUARD — Auto mode now blocks tampering with session transcripts and asks before running rm -rf on an unresolved variableIDP — Admins can provision MCP connectors org-wide via their IdP (starting with Okta), granting access on first loginTIMEOUT — Fixed per-server request_timeout_ms being ignored, which timed out long MCP tool calls at the 60s defaultFAST — Fast mode for Opus 4.7 is deprecated and will be removed on July 24; migrate to fast mode for Opus 4.8
Articles/Claude Code
Claude Code/2026-03-22Beginner

Claude Code Custom Slash Commands — Build Your Own Commands to Supercharge Team Workflows

Learn how to create, manage, and share custom slash commands in Claude Code. From the .claude/commands directory to team sharing and practical command examples.

Claude Code187slash commandscustom commandsdeveloper productivity4team development3

What Are Custom Slash Commands in Claude Code?

Claude Code ships with built-in commands like /help and /compact, but you can also create your own custom commands tailored to your specific workflow. Custom slash commands let you package frequently used prompts into reusable one-liners that your entire team can share.

If you've ever found yourself typing the same review checklist, test generation prompt, or deployment checklist over and over, custom commands eliminate that repetition entirely.

How Custom Commands Work

Custom slash commands are simply Markdown files stored in specific directories. Claude Code automatically discovers them and makes them available as slash commands. There are two locations where you can place them.

Project-Level Commands

Create a .claude/commands/ folder at the root of your project and add Markdown files inside it.

my-project/
├── .claude/
│   └── commands/
│       ├── review.md        → invoked as /review
│       ├── test-check.md    → invoked as /test-check
│       └── deploy-prep.md   → invoked as /deploy-prep
├── src/
└── package.json

Commit this folder to your Git repository, and every team member gets the same commands automatically.

Global Commands

Commands placed in ~/.claude/commands/ are available across all projects on your machine.

# Global command location
~/.claude/commands/
├── explain.md invoked as /explain
└── summarize.md invoked as /summarize

A good rule of thumb: put personal productivity commands in the global folder, and project-specific workflows in the project folder.

Creating Your First Custom Command

Let's build a code review command step by step.

Step 1: Create the Directory

# Run from your project root
mkdir -p .claude/commands

Step 2: Write the Command File

Create .claude/commands/review.md:

Review the following code for these criteria:
 
1. **Bugs**: null references, off-by-one errors, type mismatches
2. **Security**: SQL injection, XSS, authentication gaps
3. **Performance**: unnecessary loops, N+1 queries, memory leaks
4. **Readability**: naming conventions, function length, comment quality
5. **Testing**: test coverage, edge case handling
 
Format your findings as:
- 🔴 Critical: Must fix before merging
- 🟡 Warning: Recommended fixes
- 🟢 Suggestion: Nice-to-have improvements
 
Target: $ARGUMENTS

The $ARGUMENTS placeholder is automatically replaced with whatever you type after the command name.

Step 3: Use the Command

In Claude Code, simply type:

# Review a specific file
> /review src/auth/login.ts
 
# Review an entire directory
> /review src/api/

That's it — no more copy-pasting the same review checklist every time.

Practical Command Examples

Here are some battle-tested commands that work well in real-world projects.

Test Generation Command

.claude/commands/gen-test.md:

Generate unit tests for the specified file.
 
Requirements:
- Match the testing framework already used in this project
- Cover happy-path scenarios for all major use cases
- Include error handling, boundary values, and null/undefined cases
- Mock external dependencies appropriately
- Use descriptive test names that explain what's being tested
 
Place test files under __tests__/ mirroring the source directory structure.
 
Target: $ARGUMENTS

Usage:

> /gen-test src/services/userService.ts
# → generates src/services/__tests__/userService.test.ts

Commit Message Generator

.claude/commands/commit-msg.md:

Analyze the currently staged changes and generate a commit message
following the Conventional Commits format.
 
Rules:
- Type: feat / fix / refactor / docs / test / chore
- Scope: the module or area being changed
- Subject: 50 characters max, imperative mood
- Body: briefly explain why the change was made and its impact
 
First run `git diff --staged` to inspect the changes,
then propose 3 message options.

Refactoring Advisor

.claude/commands/refactor.md:

Analyze the specified code and suggest refactoring improvements.
 
Evaluation criteria:
- DRY: extract duplicated logic
- Single Responsibility: split oversized functions/classes
- Dependency Injection: improve testability
- Type Safety: eliminate `any`, add type guards
- Error Handling: adopt Result/Either patterns where appropriate
 
Show each suggestion with before → after code examples.
Include a priority rating (High / Medium / Low) for each change.
 
Target: $ARGUMENTS

Commands vs. Skills

As of 2026, Claude Code offers two extension mechanisms: custom commands and skills. Here's how they compare.

FeatureCustom CommandsSkills
Location.claude/commands/.claude/skills/
File formatMarkdownMarkdown with SKILL.md
Invocation/command-name/skill-name or automatic
Auto-triggerNoYes (via frontmatter)
File managementNoSupported

Custom commands are ideal for straightforward prompt reuse. Skills are better for complex automations that need auto-triggering or file management capabilities. Importantly, existing .claude/commands/ files continue to work — there's no rush to migrate.

Team Workflow Patterns

Custom commands really shine when shared across a team.

Sharing via Git

# Commit the commands folder
git add .claude/commands/
git commit -m "feat(dx): add team custom slash commands for Claude Code"
git push origin main

After a git pull, every team member has access to the same commands.

Recommended Team Command Structure

.claude/commands/
├── review.md          # Code review
├── pr-description.md  # Auto-generate PR descriptions
├── gen-test.md        # Test generation
├── migration.md       # Database migration scaffolding
├── api-doc.md         # API documentation generation
└── onboarding.md      # Codebase walkthrough for new hires

Onboarding Command Example

Help new team members get up to speed quickly with a dedicated onboarding command.

.claude/commands/onboarding.md:

Give a guided tour of this project for a new team member.
 
Include:
1. Directory structure overview and what each folder does
2. Core tech stack (reference package.json / requirements.txt)
3. How to start the development server
4. How to run tests
5. Environment variable setup (reference .env.example)
6. Key architectural patterns and design decisions
7. Coding conventions (reference linter/formatter configs)
 
If a CLAUDE.md file exists, incorporate its content as well.

Wrapping Up

Custom slash commands in Claude Code are remarkably easy to set up — just create a Markdown file and you're done. For individual productivity, they eliminate repetitive prompting. For teams, committing .claude/commands/ to Git standardizes workflows across the entire engineering organization.

Start small: pick one prompt you find yourself typing repeatedly and turn it into a custom command. You'll notice the improvement immediately.

Once you've got the basics down, explore building custom skills for Claude Code or automating workflows with Claude Code Hooks to take your productivity even further.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

Claude Code2026-03-28
Claude Code Team Development Guide — AI Pair Programming with CLAUDE.md, Git Hooks, and Automated Reviews
Learn how to integrate Claude Code into team development workflows. From sharing project context through CLAUDE.md to automating code reviews with Git Hooks, this guide covers everything you need for effective AI pair programming.
Claude Code2026-05-06
Multi-Agent Skill Architecture with gh skill — Versioning, CI/CD, and Agent-Specific Optimization
A production-grade approach to managing SKILL.md across teams using gh skill. Covers repository structure, semantic versioning, GitHub Actions automation, agent-specific optimization, and monorepo patterns.
Claude Code2026-03-21
Accelerate Frontend Development with Claude Code — A Practical React & Next.js Workflow
Learn how to supercharge your React and Next.js frontend development with Claude Code. From component generation and styling to testing and performance optimization, discover practical workflows you can use today.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →