Advanced Claude Code: Tips, tricks, and custom commands to maximize your productivity

After my previous article about agent-centric programming, I’ve been researching more advanced techniques for using Claude Code really productively. As a programmer with 30 years of experience, I’ve seen many promising tools that ultimately didn’t deliver on their promises. But Claude Code, when used correctly, is becoming a real game-changer.

Beyond the basics: The difference between playing and working seriously

One thing is using Claude Code for experiments or personal projects, and another very different thing is integrating it into a professional workflow. For serious projects, you need a different approach:

The importance of curated context

In real projects, it’s not enough to give Claude the task and wait. You have to curate the context like an obsessive librarian. This means:

  • Documenting established patterns: Not just what to do, but how your team does it
  • Including architectural decisions: Why you chose X over Y
  • Providing examples of existing code: So it maintains consistency

The CLAUDE.md file is your best friend

This is not optional if you want to be productive. In each project (and important subdirectory), you should have a CLAUDE.md that documents:

# Instructions for Claude

## Important commands
- `npm run dev` - development server
- `npm run test` - run tests
- `npm run lint` - check code

## Project patterns
- We use strict TypeScript
- All components go in `src/components/`
- Tests next to the file they test

## Things you should NOT do
- Don't modify config files without asking
- Don't use `any` in TypeScript
- Don't commit directly to main

Professional tip: Use # as a prefix in your prompts and Claude will automatically add those instructions to CLAUDE.md.

Commands and shortcuts that change the game

The basics you should know:

  • Plan mode (Shift+Tab): Makes Claude more methodical and complete complex tasks better
  • Verbose mode (Ctrl+R): To see exactly what context Claude is using
  • Bash mode (! as prefix): Executes commands and adds output to context
  • Escape: Interrupt. Double escape to go back in the conversation

Advanced thought commands:

  • think - For problems that require more consideration
  • think harder - When you need deeper analysis
  • ultrathink - Assigns up to 31,999 thinking tokens. Use it for complex debugging or architectural design

Custom commands: The next level

This is where things get interesting. You can create custom commands by saving them in .claude/commands/.

Examples of useful commands:

For database migrations:

# /create-migration
Create a new migration following our patterns:
1. File in migrations/ with timestamp
2. Use transactions
3. Include rollback
4. Document changes in CHANGELOG.md

For code analysis:

# /analyze-function
Analyze function line by line:
1. Cyclomatic complexity
2. Possible optimizations
3. Performance issues
4. Uncovered edge cases

For project setup:

# /project-setup
Complete initial setup:
1. Standard directory structure
2. Linting configuration
3. Test setup
4. Basic npm scripts
5. Appropriate .gitignore

Multi-Mind Analysis: Collaboration between “specialists”

A fascinating technique I’ve discovered is using commands like /multi-mind that make Claude simulate multiple specialists working on a problem:

/multi-mind "Should we implement GraphQL in our existing REST API?"

Claude will automatically assign 4-6 experts (software architect, performance specialist, DX engineer, etc.) and each will contribute their perspective. It’s surprisingly effective at avoiding blind spots.

Advanced workflows

Multiple instances in parallel

Something that changed my way of working: running multiple instances of Claude Code simultaneously:

  • Frontend + Backend: One instance works on the UI with mocked data, another on the API
  • Features + Tests: One develops functionality, another writes tests
  • Refactor + Documentation: One cleans up code, another updates docs

Trick: Use Git worktrees so each instance works on its own copy of the repo without interference.

The power of unified logs

One of the most powerful techniques I’ve learned:

# Redirect everything to unified log
npm run dev > dev.log 2>&1 &
npm run api > dev.log 2>&1 &

Now Claude can read dev.log and see exactly what’s happening in real time. It’s automatic debugging.

Using multiple models together

This is more advanced, but incredibly effective:

  1. O3-pro for planning: Use models like O3 in Cursor for design and architectural analysis
  2. Claude Code for implementation: Takes the detailed plan and executes it
  3. Feedback loop: Claude reads the result, reports problems, O3 adjusts the plan

It’s expensive, but for complex problems it’s an unbeatable combination.

Environment variables and advanced configuration

I’ve discovered some undocumented environment variables that improve the experience:

# My function to launch optimized Claude Code
function cc-pro() {
    local env_vars=(
        "ENABLE_BACKGROUND_TASKS=true"
        "FORCE_AUTO_BACKGROUND_TASKS=true"
        "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=true"
        "CLAUDE_CODE_ENABLE_UNIFIED_READ_TOOL=true"
    )

    local args=()
    if [[ "$1" == "-y" ]]; then
        args+=("--dangerously-skip-permissions")
    elif [[ "$1" == "-r" ]]; then
        args+=("--resume")
    fi

    env "${env_vars[@]}" claude "${args[@]}"
}

Warning: These variables can change without notice. Use them at your own risk.

Common mistakes and how to avoid them

The danger of unchecked “vibe-coding”

I’ve seen people leave Claude running for hours without supervision. Don’t do this in production projects. The code it generates starts well but degrades over time and can create serious technical debt.

Compacting: The double-edged sword

The /compact function reduces noise but can also remove important context. Better strategy:

  • Divide large tasks into small sessions
  • Use intermediate documents to maintain context
  • Compact only at natural stopping points

Security with MCP and external context

Careful with prompt injection. If Claude reads GitHub issues or external content, it can be manipulated. Always review what context you’re injecting.

Use cases beyond code

Claude Code is not just for programming:

  • Research and documentation: Give it technical documentation and it creates executive summaries
  • Code archaeology: In large codebases, find where X functionality is implemented
  • Debugging: It’s exceptionally good at finding complex bugs
  • Refactoring: Especially useful for modernizing legacy code

My current workflow

Here’s how I use Claude Code in my day-to-day:

  1. Morning: Review issues and create detailed plans with ultrathink
  2. Development: Claude Code + Cursor, multiple instances for parallel tasks
  3. Testing: One instance dedicated to writing and maintaining tests
  4. Docs: At the end of the day, Claude documents everything implemented

Metrics that surprise me

Since I’ve been using Claude Code systematically:

  • 30% less time debugging
  • 50% faster prototyping
  • 80% less time writing tests (without sacrificing quality)

The future of development

Are we seeing the future of software development? I think so, but with important nuances:

  • It doesn’t replace the programmer, but radically changes the role
  • Architecture becomes more important than individual code
  • “Management” skills are as important as technical ones

Final recommendations

If you want to get serious with Claude Code:

  1. Invest time in setup: CLAUDE.md, custom commands, unified logs
  2. Start with non-critical projects: Learn the patterns before applying them in production
  3. Document everything: Every session, every pattern that works, every useful command
  4. Use Git religiously: It’s your only safety net
  5. Experiment with multiple models: The O3 + Claude Code combination is powerful

Resources to go deeper

Claude Code is changing how we program. The question is not whether you should learn it, but how quickly you can integrate it into your workflow.

What techniques are you using? I’d love to know your tricks and custom commands.


Did you find this article useful? The previous one about agent-centric programming covers the basic fundamentals.