Przeskocz do głównej treści
Część 4 z 6
6 min read

Część 4 z 6

Power Tools

Advanced Claude Code commands for batch changes, scheduled monitoring, debugging, and multi-repo work. Power tools for developers who've mastered the basics.

Informacja: Treść dostępna wyłącznie w języku angielskim, aby zachować precyzję terminologii technicznej.

Claude Code, Part 4: Power Tools

Advanced commands for developers who've mastered Parts 1-3. Each one makes a specific kind of work much faster, once you know when to reach for it.


Prerequisites

You should be comfortable with the daily flow (Part 3) before adding these. Power tools are situational: you'll use them weekly, not daily. They're worth knowing but not worth learning before the fundamentals.

Some of these are bundled skills (like /batch, /loop) rather than built-in commands. They work the same way (type /name), but they're prompt-driven rather than hardcoded. Availability may depend on your Claude Code version and plan.


Batch & Parallel Work

/batch: Large-Scale Parallel Changes

Runs large-scale changes in parallel. Decomposes the work into 5 to 30 independent units, spawns one background agent per unit in an isolated git worktree, and opens a pull request for each. Requires a git repository.

/batch Add error handling to all public API endpoints
/batch Update all test files to use the new assertion syntax

Perfect for: Repetitive, parallelizable work. The same change applied to many files independently.

Not for: Changes that need a coherent plan or depend on each other. "Redesign the API layer" needs sequential thinking, not parallel execution. Use the standard plan-mode workflow instead.

Example session:

/batch Add consistent error handling to all API endpoints

Claude Code responds:
  Found 8 endpoints in src/api/.
  Decomposed into 8 independent units.
  Plan ready. Approve to proceed.

You approve.

  Spawning 8 background agents, one per unit, each in its own
  git worktree. Each agent implements its unit, runs tests,
  and opens a PR.

  8 PRs created. Review each before merging.

How it works: /batch breaks the work into 5 to 30 independent units and shows you a plan. Once you approve, it spawns one background agent per unit in an isolated git worktree, and each unit gets its own PR. Requires a git repository.

Important: Always review each PR before merging. Parallel execution means parallel mistakes: one bad pattern replicated across 20 units is worse than one bad file.

/add-dir: Multi-Repo Work

Adds additional working directories to the current session.

/add-dir ../shared-library
/add-dir ../api-gateway

When to use: Your task spans multiple repos or packages. Claude Code needs to see both the main project and a shared library to make consistent changes.


Iteration & Diagnostics

/loop: Scheduled Repetition

Runs a prompt repeatedly while the session stays open. Pass an interval (5m, 30s) or omit it and Claude self-paces between iterations.

/loop 5m /review
/loop 3m Check the deploy status at staging.example.com
/loop run the test suite and report any failures

Perfect for:

  • Polling a deployment: /loop 2m Check if staging is healthy
  • Babysitting a PR: /loop 5m Check CI status on PR #142
  • Monitoring a migration: /loop 1m Query the users table count
  • Re-running another skill on a schedule: /loop 10m /review

Not for: Iterative implement-test-fix cycles. For that, just ask Claude Code directly: "Run the tests. If any fail, fix them and re-run. Repeat until all pass." Claude Code handles iterative work natively.

How to stop: press Esc while the loop is waiting for the next iteration: that clears the pending wakeup so it won't fire again. (In self-paced mode, Claude can also end the loop on its own once the task is done.)

/debug: Session Diagnostics

Enables debug logging for the current session and helps troubleshoot Claude Code issues by reading the debug log.

/debug

When to use: When Claude Code itself misbehaves: skills not loading, MCP servers not connecting, hooks not firing, permissions acting strange. This is a diagnostic tool for Claude Code, not for debugging your application code.

For debugging application bugs, use a direct prompt:

/effort high
"Users are getting 500 errors on the checkout page.
Here's the stack trace: [paste].
Don't fix anything yet. Give me 3 hypotheses, ranked by likelihood."

See Part 3's debugging recipe for the full workflow.


Project Setup

/init: Generate CLAUDE.md

/init

Analyzes your project and generates a starting CLAUDE.md with build commands, test instructions, and conventions Claude discovers. Review and edit: it's a draft, not a finished config. The official guidance for writing effective CLAUDE.md files lives in the memory docs. Set CLAUDE_CODE_NEW_INIT=1 to enable the interactive multi-phase flow that also walks through skills, hooks, and personal memory files.

/install-github-app: Claude Code on GitHub

/install-github-app

Sets up the Claude Code GitHub Actions app for your repository. Once installed, you can mention @claude in PR comments and issues to get Claude Code's analysis directly in GitHub. Walks you through repo selection and configuration.

/doctor: Health Check

/doctor

Checks your installation for issues. Run when commands don't work as expected, skills fail to load, or MCP servers won't connect.


The ! Prefix: Inject Shell Output

Type ! followed by a shell command to run it and feed the output into the conversation as context.

!git status
!npm test
!curl -s https://api.example.com/health

Faster than asking Claude Code to run the command itself when you already know the command and just want the output in context.


Command Categories: Complete Reference

Category Commands When
Session hygiene /clear, /compact, /context Between tasks, when context is full
Code review /diff, /simplify, review prompt Before committing
Planning Shift+Tab, /effort Before complex tasks
Session management /resume, /memory Start of day, CLAUDE.md updates
Iteration /loop Scheduled polling, babysitting
Diagnostics /debug, /doctor When Claude Code misbehaves
Batch work /batch, /add-dir Large-scale or multi-repo changes
Monitoring /cost (a.k.a. /usage, /stats) On demand, not on a schedule
Project setup /init, /install-github-app, /doctor Once per project
Utilities /export (save session), /hooks, !prefix As needed

The One Rule

Reach for a power tool when the work fits it, not before. These are weekly tools, not daily ones: get fluent with the Part 1-3 fundamentals first, then add /batch, /loop, or /add-dir the day a specific job actually calls for it.

Ta lekcja jest częścią Claude Code Field Guide, darmowego dodatku do Claude and the Code. Książka uczy myślenia stojącego za komendami.

Ukończyłeś 4 z 6 lekcji.

Chcesz pełną metodologię?

Field Guide uczy komend. Książka uczy myślenia.