Complete Claude Code Best Practices Guide (Part 2): Custom Commands - Your AI Shortcuts to Productivity

Complete Claude Code Best Practices Guide (Part 2): Custom Commands - Your AI Shortcuts to Productivity

Sep 8, 2025

This is part 2 of a 3-part series on Claude Code best practices that transformed how we build software at Kasava. Part 1 covered documentation structure and organization with CLAUDE.md files and the CLAUDE_FILES_INDEX.

Commands and Agents are a great way to customize Claude Code to not only use the right patterns for code development but also to use the right chain of reasoning and research techniques to ensure that all options are explored and best practices are interrogated and validated.

Let's start with commands because they're the gateway drug to custom agents. In your .claude/commands/ directory, each markdown file becomes a slash command. Here's our most-used commands at Kasava:

The /blog Command That Writes Itself

What This Command Does:

  • ๐Ÿ” Searches your codebase for relevant examples

  • โœ๏ธ Maintains your writing voice and style

  • ๐ŸŽฏ Structures posts with intro, body, and conclusion

  • ๐Ÿ’พ Automatically saves to the blog/ directory

  • ๐ŸŒ Uses web research for additional context

<!-- .claude/commands/blog.md -->
You are a product manager tasked with writing a blog post about a given topic.

The topic for your blog post is:<topic>$ARGUMENTS</topic>

Look through the existing project structure for relevant information.

To gather additional information, use the web research agent.

When writing, follow this structure:
1. Introduction: Hook the reader
2. Main body: 2-4 sections exploring different aspects
3. Conclusion: Summarize and provide call to action

Maintain a conversational and engaging tone. Use examples from the actual
codebase where relevant.
When finished, save to the blog/ directory.

---
This is your LinkedIn profile:
<linkedin>[Your or your colleague's linkedin profile.]</linkedin>
---

<example_post>[Example posts for tone and style follow...]<

Now when I type /blog How we reduced our embedding costs by 90%, Claude doesn't just write generic content - it pulls real examples from our codebase, maintains my writing voice, and saves it in the right place.

The /issues Command That Manages GitHub

What This Command Does:

  • ๐Ÿ†• Creates new issues with proper labels

  • ๐Ÿ” Searches for duplicate issues before creating

  • ๐Ÿ”— Links related issues together

  • ๐Ÿ“‹ Generates issue templates

  • ๐Ÿ“Š Creates issue reports

  • ๐Ÿท๏ธ Uses consistent label taxonomy

<!-- .claude/commands/issues.md -->
You are a GitHub issues manager for the Kasava project.
  
Task: $ARGUMENTS
  
Available operations:
- Create new issues with proper labels and assignees
- Search existing issues for duplicates
- Link related issues
- Create issue templates
- Generate issue reports
  
Always check for duplicates before creating new issues.Use our label taxonomy:
- bug: Something isn't working
- enhancement: New feature or request
- documentation: Improvements or additions to documentation
- performance: Performance improvements
- tech-debt: Code refactoring or cleanup

Format issues with:
  
1. Clear, searchable ttles
2. Reproduction steps (for bugs)
3. Expected vs actual behavior
4. Environment details
5. Related PR/issue links

The /think Command for Complex Problem-Solving

This one's special. Sometimes you need Claude to really think through a problem:
What This Command Does:

  • ๐Ÿง  Restates problems for clarity

  • ๐Ÿ”ฌ Breaks down complex components

  • ๐Ÿ“š Researches existing codebase patterns

  • ๐Ÿ’ก Proposes multiple solution approaches

  • โš–๏ธ Evaluates trade-offs systematically

  • ๐ŸŽฏ Recommends best approach with justification

  • ๐Ÿ“ Creates step-by-step implementation plans

<!-- .claude/commands/think.md -->
Approach this problem methodically:
1. Understand: Restate the problem in your own words
2. Analyze: Break down the components
3. Research: Look through the codebase for similar patterns
4. Design: Propose 2-3 different approaches
5. Evaluate: Compare trade-offs of each approach
6. Recommend: Choose the best approach with justification
7. Plan: Create step-by-step implementation plan
   
Problem: $ARGUMENTS

Take your time. Think through edge cases. Consider performance implications.
Reference existing code patterns where applicable

The structured thinking process consistently produces better solutions than just asking Claude to solve something.

The /style Command for Consistent Code

What This Command Does:

  • ๐Ÿ” Analyzes existing code patterns

  • ๐Ÿ“ Documents naming conventions

  • ๐Ÿ—๏ธ Captures code organization structure

  • ๐Ÿ’ฌ Identifies commenting practices

  • โš ๏ธ Documents error handling patterns

  • ๐Ÿงช Recognizes testing approaches

  • ๐Ÿ“„ Generates comprehensive STYLE_GUIDE.md

<!-- .claude/commands/style.md -->
You are tasked with creating a comprehensive style guide for writing code
that future AI prompts should follow.
  
Carefully examine the code in the following directory:
  
<relevant_directory>$ARGUMENTS</relevant_directory>
  
Analyze the code patterns, design choices, and conventions used throughout
the project. Pay attention to:

- Naming conventions (variables, functions, classes)
- Code organization and structure
- Commenting and documentation practices
- Indentation and formatting
- Error handling and logging
- Use of design patterns or architectural styles
- Testing approaches (if visible in the code)
  
Create a document called STYLE_GUIDE.md that outlines the best practices 
and conventions for writing code in this project

The /update Command for Maintenance

What This Command Does:

  • ๐Ÿ“… Checks file freshness (>7 days old)

  • ๐Ÿค– Creates subagents for parallel updates

  • ๐Ÿ”„ Compares and updates outdated info

  • ๐ŸŽจ Maintains original formatting

  • โœ… Updates CLAUDE_FILES_INDEX.md timestamps

  • ๐Ÿ”ง Keeps documentation synchronized


<!-- .claude/commands/update.md -->

You are tasked with updating all existing CLAUDE.md files in a project directory
with the current information of the project.

Look at the CLAUDE_FILES_INDEX.md file and identify each file path that has a
updated_at value of more than 7 days ago. Create a subagent for each file.

For each subagent:
  - Analyze the content of the corresponding CLAUDE.md file
  - Compare the existing information with the updated project information
  - Identify any outdated, incorrect, or missing information
  - Update the file content with current project information
  - Maintain the original structure and formatting
  
After all subagents have completed their updates, 
update the relevant files in CLAUDE_FILES_INDEX.md with the current

This keeps your CLAUDE.md files fresh and accurate as your project evolves.

The /visualize Command for Architecture Diagrams

What This Command Does:

  • ๐Ÿ“Š Creates flowcharts for code flow

  • ๐Ÿ—ƒ๏ธ Generates database ERD diagrams

  • ๐Ÿ›๏ธ Visualizes system architecture

  • ๐Ÿ”„ Maps API interaction sequences

  • ๐Ÿงฉ Shows class and module relationships

  • ๐ŸŒ Diagrams network infrastructure

  • ๐Ÿ“ Supports Mermaid, PlantUML, and Graphviz

<!-- .claude/commands/visualize.md -->
Analyzes code and architecture to generate explanatory diagrams.
  
<architecture_location>
  $ARGUMENTS
</architecture_location>
  
**Default Output Location**: `/docs/diagrams/` directory
  
This command transforms complex code, logic, and system architectures
into clear, visual diagrams. 

Generates:
- Code flow visualization (flowcharts)
- Database schema visualization (ERDs)
- System architecture diagrams
- API interaction sequences
- Class and module relationships
- Network and infrastructure diagrams
  
Output formats: Mermaid (default), PlantUML, Graphviz DOT

Full disclosure -- I found this one on Github and I would credit but I forgot to star their repo...

The /work Command for Issue Management

What This Command Does:

  • ๐Ÿ”Œ Connects to GitHub via MCP server

  • ๐Ÿ“‹ Lists and prioritizes open issues

  • ๐ŸŽฏ Selects issues to work on

  • ๐ŸŒฟ Creates feature branches

  • ๐Ÿ’ป Writes clear, tested code

  • ๐Ÿ“š Updates documentation

  • ๐Ÿ’พ Commits with descriptive messages

  • ๐Ÿš€ Creates pull requests

  • ๐Ÿงน Cleans up workspace

<!-- .claude/commands/work.md -->
You are an AI assistant tasked with managing and working on GitHub issues.

1. Connect to the preconfigured MCP server for Github
2. List all open issues on the repository (or work on specific issue if provided)
3. Select one to work on (oldest or highest priority)
4. Create a new branch for your changes
5. Work on the issue with clear, tested code
6. Update documentation as needed
7. Commit changes with descriptive messages
8. Push branch and create pull request
9. Clean up workspace when done

Your goal is to look for open issues, select one to work on, and
create a pull request when the work is

This command turns Claude into an autonomous contributor who can pick up GitHub issues and work on them end-to-end.

The /upgrade Command with Agent Delegation

What This Command Does:

  • ๐ŸŽฏ Analyzes upgrade requirements

  • ๐Ÿค– Delegates to specialized agents:

    • Cloudflare โ†’ cloudflare-backend-architect

    • Mastra โ†’ mastra-workflow-architect

    • Search โ†’ vector-search-architect

    • Frontend โ†’ nextjs-frontend-expert

    • Extension โ†’ browser-extension-developer

    • ๐Ÿ“‹ Reviews specialist recommendations

    • ๐Ÿงช Implements with testing

    • ๐Ÿ“ Updates documentation

<!-- .claude/commands/upgrade.md -->
Analyze the requested upgrade and delegate to the appropriate specialist:

Task: $ARGUMENTS

If this involves:
  - Cloudflare services โ†’ Use cloudflare-backend-architect agent
  - Mastra workflows โ†’ Use mastra-workflow-architect agent
  - Search/embeddings โ†’ Use vector-search-architect agent
  - Frontend React โ†’ Use nextjs-frontend-expert agent
  - Chrome extension โ†’ Use browser-extension-developer agent
    
Approach:
  1. Identify the domain
  2. Engage the specialist agent
  3. Review their recommendations
  4. Implement with proper testing
  5. Update relevant CLAUDE.md files

Command Design Principles

1. Make Them Specific

Bad: /help - too vague

Good: /debug-api - clear purpose

2. Use $ARGUMENTS Effectively

Commands can take arguments. Use them to make your commands flexible:

<!-- .claude/commands/test.md -->
Run tests for the specified component or feature:
<target>$ARGUMENTS</target>
If no target specified, run all tests.If target is a file path, 
run tests for that file.If target is a feature name, run related test suites

โ€”โ€”โ€”

Pro Tips from the Trenches

  1. Start with your biggest pain point - What do you ask Claude to do repeatedly? That's your first command.

  2. Include examples in your commands - Show Claude exactly what good output looks like

  3. Document your commands - Keep a list of available commands in your main CLAUDE.md

The Bottom Line

Custom commands transformed Claude from a general assistant into a specialized toolkit. Each command is a shortcut to productivity, armed with your team's specific context and practices.
Start small. Create one command for something you do repeatedly. Watch as your productivity multiplies.
The real magic isn't in having AI write code - it's in having AI that writes code the way your team writes code, following your processes, and understanding your context.

Next Up

In Part 3, we'll dive deep into specialized agents - the secret weapons that turned Claude from a coding assistant into a full team member. Spoiler: our `cloudflare-backend-architect` agent writes better Workers code than most humans.

โ€”โ€”โ€”

This is part 2 of a 3-part series on Claude Code best practices. Next up: Specialized agents - your domain experts that bring deep knowledge to complex problems.

This is part 2 of a 3-part series on Claude Code best practices that transformed how we build software at Kasava. Part 1 covered documentation structure and organization with CLAUDE.md files and the CLAUDE_FILES_INDEX.

Commands and Agents are a great way to customize Claude Code to not only use the right patterns for code development but also to use the right chain of reasoning and research techniques to ensure that all options are explored and best practices are interrogated and validated.

Let's start with commands because they're the gateway drug to custom agents. In your .claude/commands/ directory, each markdown file becomes a slash command. Here's our most-used commands at Kasava:

The /blog Command That Writes Itself

What This Command Does:

  • ๐Ÿ” Searches your codebase for relevant examples

  • โœ๏ธ Maintains your writing voice and style

  • ๐ŸŽฏ Structures posts with intro, body, and conclusion

  • ๐Ÿ’พ Automatically saves to the blog/ directory

  • ๐ŸŒ Uses web research for additional context

<!-- .claude/commands/blog.md -->
You are a product manager tasked with writing a blog post about a given topic.

The topic for your blog post is:<topic>$ARGUMENTS</topic>

Look through the existing project structure for relevant information.

To gather additional information, use the web research agent.

When writing, follow this structure:
1. Introduction: Hook the reader
2. Main body: 2-4 sections exploring different aspects
3. Conclusion: Summarize and provide call to action

Maintain a conversational and engaging tone. Use examples from the actual
codebase where relevant.
When finished, save to the blog/ directory.

---
This is your LinkedIn profile:
<linkedin>[Your or your colleague's linkedin profile.]</linkedin>
---

<example_post>[Example posts for tone and style follow...]<

Now when I type /blog How we reduced our embedding costs by 90%, Claude doesn't just write generic content - it pulls real examples from our codebase, maintains my writing voice, and saves it in the right place.

The /issues Command That Manages GitHub

What This Command Does:

  • ๐Ÿ†• Creates new issues with proper labels

  • ๐Ÿ” Searches for duplicate issues before creating

  • ๐Ÿ”— Links related issues together

  • ๐Ÿ“‹ Generates issue templates

  • ๐Ÿ“Š Creates issue reports

  • ๐Ÿท๏ธ Uses consistent label taxonomy

<!-- .claude/commands/issues.md -->
You are a GitHub issues manager for the Kasava project.
  
Task: $ARGUMENTS
  
Available operations:
- Create new issues with proper labels and assignees
- Search existing issues for duplicates
- Link related issues
- Create issue templates
- Generate issue reports
  
Always check for duplicates before creating new issues.Use our label taxonomy:
- bug: Something isn't working
- enhancement: New feature or request
- documentation: Improvements or additions to documentation
- performance: Performance improvements
- tech-debt: Code refactoring or cleanup

Format issues with:
  
1. Clear, searchable ttles
2. Reproduction steps (for bugs)
3. Expected vs actual behavior
4. Environment details
5. Related PR/issue links

The /think Command for Complex Problem-Solving

This one's special. Sometimes you need Claude to really think through a problem:
What This Command Does:

  • ๐Ÿง  Restates problems for clarity

  • ๐Ÿ”ฌ Breaks down complex components

  • ๐Ÿ“š Researches existing codebase patterns

  • ๐Ÿ’ก Proposes multiple solution approaches

  • โš–๏ธ Evaluates trade-offs systematically

  • ๐ŸŽฏ Recommends best approach with justification

  • ๐Ÿ“ Creates step-by-step implementation plans

<!-- .claude/commands/think.md -->
Approach this problem methodically:
1. Understand: Restate the problem in your own words
2. Analyze: Break down the components
3. Research: Look through the codebase for similar patterns
4. Design: Propose 2-3 different approaches
5. Evaluate: Compare trade-offs of each approach
6. Recommend: Choose the best approach with justification
7. Plan: Create step-by-step implementation plan
   
Problem: $ARGUMENTS

Take your time. Think through edge cases. Consider performance implications.
Reference existing code patterns where applicable

The structured thinking process consistently produces better solutions than just asking Claude to solve something.

The /style Command for Consistent Code

What This Command Does:

  • ๐Ÿ” Analyzes existing code patterns

  • ๐Ÿ“ Documents naming conventions

  • ๐Ÿ—๏ธ Captures code organization structure

  • ๐Ÿ’ฌ Identifies commenting practices

  • โš ๏ธ Documents error handling patterns

  • ๐Ÿงช Recognizes testing approaches

  • ๐Ÿ“„ Generates comprehensive STYLE_GUIDE.md

<!-- .claude/commands/style.md -->
You are tasked with creating a comprehensive style guide for writing code
that future AI prompts should follow.
  
Carefully examine the code in the following directory:
  
<relevant_directory>$ARGUMENTS</relevant_directory>
  
Analyze the code patterns, design choices, and conventions used throughout
the project. Pay attention to:

- Naming conventions (variables, functions, classes)
- Code organization and structure
- Commenting and documentation practices
- Indentation and formatting
- Error handling and logging
- Use of design patterns or architectural styles
- Testing approaches (if visible in the code)
  
Create a document called STYLE_GUIDE.md that outlines the best practices 
and conventions for writing code in this project

The /update Command for Maintenance

What This Command Does:

  • ๐Ÿ“… Checks file freshness (>7 days old)

  • ๐Ÿค– Creates subagents for parallel updates

  • ๐Ÿ”„ Compares and updates outdated info

  • ๐ŸŽจ Maintains original formatting

  • โœ… Updates CLAUDE_FILES_INDEX.md timestamps

  • ๐Ÿ”ง Keeps documentation synchronized


<!-- .claude/commands/update.md -->

You are tasked with updating all existing CLAUDE.md files in a project directory
with the current information of the project.

Look at the CLAUDE_FILES_INDEX.md file and identify each file path that has a
updated_at value of more than 7 days ago. Create a subagent for each file.

For each subagent:
  - Analyze the content of the corresponding CLAUDE.md file
  - Compare the existing information with the updated project information
  - Identify any outdated, incorrect, or missing information
  - Update the file content with current project information
  - Maintain the original structure and formatting
  
After all subagents have completed their updates, 
update the relevant files in CLAUDE_FILES_INDEX.md with the current

This keeps your CLAUDE.md files fresh and accurate as your project evolves.

The /visualize Command for Architecture Diagrams

What This Command Does:

  • ๐Ÿ“Š Creates flowcharts for code flow

  • ๐Ÿ—ƒ๏ธ Generates database ERD diagrams

  • ๐Ÿ›๏ธ Visualizes system architecture

  • ๐Ÿ”„ Maps API interaction sequences

  • ๐Ÿงฉ Shows class and module relationships

  • ๐ŸŒ Diagrams network infrastructure

  • ๐Ÿ“ Supports Mermaid, PlantUML, and Graphviz

<!-- .claude/commands/visualize.md -->
Analyzes code and architecture to generate explanatory diagrams.
  
<architecture_location>
  $ARGUMENTS
</architecture_location>
  
**Default Output Location**: `/docs/diagrams/` directory
  
This command transforms complex code, logic, and system architectures
into clear, visual diagrams. 

Generates:
- Code flow visualization (flowcharts)
- Database schema visualization (ERDs)
- System architecture diagrams
- API interaction sequences
- Class and module relationships
- Network and infrastructure diagrams
  
Output formats: Mermaid (default), PlantUML, Graphviz DOT

Full disclosure -- I found this one on Github and I would credit but I forgot to star their repo...

The /work Command for Issue Management

What This Command Does:

  • ๐Ÿ”Œ Connects to GitHub via MCP server

  • ๐Ÿ“‹ Lists and prioritizes open issues

  • ๐ŸŽฏ Selects issues to work on

  • ๐ŸŒฟ Creates feature branches

  • ๐Ÿ’ป Writes clear, tested code

  • ๐Ÿ“š Updates documentation

  • ๐Ÿ’พ Commits with descriptive messages

  • ๐Ÿš€ Creates pull requests

  • ๐Ÿงน Cleans up workspace

<!-- .claude/commands/work.md -->
You are an AI assistant tasked with managing and working on GitHub issues.

1. Connect to the preconfigured MCP server for Github
2. List all open issues on the repository (or work on specific issue if provided)
3. Select one to work on (oldest or highest priority)
4. Create a new branch for your changes
5. Work on the issue with clear, tested code
6. Update documentation as needed
7. Commit changes with descriptive messages
8. Push branch and create pull request
9. Clean up workspace when done

Your goal is to look for open issues, select one to work on, and
create a pull request when the work is

This command turns Claude into an autonomous contributor who can pick up GitHub issues and work on them end-to-end.

The /upgrade Command with Agent Delegation

What This Command Does:

  • ๐ŸŽฏ Analyzes upgrade requirements

  • ๐Ÿค– Delegates to specialized agents:

    • Cloudflare โ†’ cloudflare-backend-architect

    • Mastra โ†’ mastra-workflow-architect

    • Search โ†’ vector-search-architect

    • Frontend โ†’ nextjs-frontend-expert

    • Extension โ†’ browser-extension-developer

    • ๐Ÿ“‹ Reviews specialist recommendations

    • ๐Ÿงช Implements with testing

    • ๐Ÿ“ Updates documentation

<!-- .claude/commands/upgrade.md -->
Analyze the requested upgrade and delegate to the appropriate specialist:

Task: $ARGUMENTS

If this involves:
  - Cloudflare services โ†’ Use cloudflare-backend-architect agent
  - Mastra workflows โ†’ Use mastra-workflow-architect agent
  - Search/embeddings โ†’ Use vector-search-architect agent
  - Frontend React โ†’ Use nextjs-frontend-expert agent
  - Chrome extension โ†’ Use browser-extension-developer agent
    
Approach:
  1. Identify the domain
  2. Engage the specialist agent
  3. Review their recommendations
  4. Implement with proper testing
  5. Update relevant CLAUDE.md files

Command Design Principles

1. Make Them Specific

Bad: /help - too vague

Good: /debug-api - clear purpose

2. Use $ARGUMENTS Effectively

Commands can take arguments. Use them to make your commands flexible:

<!-- .claude/commands/test.md -->
Run tests for the specified component or feature:
<target>$ARGUMENTS</target>
If no target specified, run all tests.If target is a file path, 
run tests for that file.If target is a feature name, run related test suites

โ€”โ€”โ€”

Pro Tips from the Trenches

  1. Start with your biggest pain point - What do you ask Claude to do repeatedly? That's your first command.

  2. Include examples in your commands - Show Claude exactly what good output looks like

  3. Document your commands - Keep a list of available commands in your main CLAUDE.md

The Bottom Line

Custom commands transformed Claude from a general assistant into a specialized toolkit. Each command is a shortcut to productivity, armed with your team's specific context and practices.
Start small. Create one command for something you do repeatedly. Watch as your productivity multiplies.
The real magic isn't in having AI write code - it's in having AI that writes code the way your team writes code, following your processes, and understanding your context.

Next Up

In Part 3, we'll dive deep into specialized agents - the secret weapons that turned Claude from a coding assistant into a full team member. Spoiler: our `cloudflare-backend-architect` agent writes better Workers code than most humans.

โ€”โ€”โ€”

This is part 2 of a 3-part series on Claude Code best practices. Next up: Specialized agents - your domain experts that bring deep knowledge to complex problems.

Kasava

No Spam. Just Product updates.

Kasava. All right reserved. ยฉ 2025

Kasava

No Spam. Just Product updates.

Kasava. All right reserved. ยฉ 2025

Kasava

No Spam. Just Product updates.

Kasava. All right reserved. ยฉ 2025

Kasava

No Spam. Just Product updates.

Kasava. All right reserved. ยฉ 2025