Parchment
โ† Back to posts

Claude Code: Power Commands

omerโ†’ยทApr 03, 2026ยท18 min readยท9

#ai#claude#web-dev#software

๐Ÿค– Claude Code: The Power User's Playbook

From "it's a smart terminal" to "I have a full AI dev platform in my pocket."


Table of Contents

  1. What Even Is Claude Code?
  2. The Basics: Getting Around
  3. Slash Commands: Your Swiss Army Knife
  4. Inline Bash with !
  5. CLAUDE.md: The Agent's Constitution
  6. Permission Modes & The YOLO Flag
  7. Context Management: Don't Let Your Window Go Stale
  8. Custom Skills & Commands
  9. Hooks: Automation That Runs Itself
  10. Subagents: Delegate Like a CTO
  11. Bundled Power Skills
  12. CLI Flags for Scripting & CI/CD
  13. MCP Servers: Claude Meets the World
  14. Pro Tips & Mental Models

What Even Is Claude Code?

ELI5: Imagine you had a brilliant programmer friend who could see your entire codebase, remember everything about your project, and type 1,000 words per minute โ€” and they lived inside your terminal. That's Claude Code.

Claude Code is a command-line AI agent from Anthropic. It's not just a chatbot in a terminal window โ€” it can read your files, run bash commands, write and edit code, manage git, and orchestrate entire multi-step workflows, all through natural language.

The difference between a casual user and a power user comes down to one thing: knowing what levers to pull. This guide covers all of them.


The Basics: Getting Around

Starting a Session

# Standard interactive session
claude

# Start with a model flag
claude --model opus

# Start with a specific prompt (non-interactive, exits after)
claude -p "What does this codebase do?"

# Pipe content in
cat error.log | claude -p "What caused this crash?"

Keyboard Shortcuts You'll Use Every Day

ShortcutWhat It Does
Ctrl+CInterrupt current response (keeps session alive)
Ctrl+DEnd the session entirely
TabAutocomplete slash commands
โ†‘ / โ†“Navigate prompt history

@-tagging Files

You can pull any file into context mid-conversation:

Tell me what's wrong with @src/auth/login.ts

This is cleaner than pasting code manually and keeps the conversation readable.


Slash Commands: Your Swiss Army Knife

Slash commands are text commands you type inside an active session. Think of them as keyboard shortcuts for your AI session. Hit Tab after typing / to see autocomplete suggestions.

Built-in Session Management

CommandWhat It Does
/helpList every available slash command (including custom ones)
/clearWipe conversation history. Use this constantly.
/compactSummarize the conversation to reclaim context window space
/contextShow current context window usage
/modelSwitch models mid-session (e.g., from Sonnet to Opus)
/permissionsAdjust tool permissions during a live session
/hooksConfigure hooks interactively via a menu
/memoryView and manage Claude's memory
/resumeResume a previous session by ID
/initScan the project and auto-generate a CLAUDE.md file
/debugEnable debug logging and troubleshoot session issues
/exitEnd the session cleanly

Bundled Skill Commands

These ship with Claude Code and are more powerful than regular commands โ€” they can spawn parallel agents and adapt to your codebase:

CommandWhat It Does
/simplifyReviews recently changed files for quality/efficiency, spawns 3 parallel review agents, and applies fixes
/batch <instruction>Breaks a large task into 5โ€“30 units, spawns one agent per unit in isolated git worktrees, each running tests and opening PRs
/loop [interval] <prompt>Runs a prompt on a repeating interval (great for polling deploys)
/claude-apiLoads full Anthropic SDK reference for your language
/debug [description]Reads session debug logs to troubleshoot issues

Example:

/batch migrate src/ from CommonJS to ES Modules
/simplify focus on memory efficiency
/loop 5m check if the staging deploy finished

Inline Bash with !

This is one of the most underused features. In your SKILL.md and custom command files, you can inject live bash output directly into Claude's prompt using the ! prefix inside backticks.

## Context
- Current git status: !`git status`
- Recent changes: !`git diff HEAD`
- Current branch: !`git branch --show-current`
- Open PRs: !`gh pr list`

Based on the above context, write a commit message.

Why this is powerful: Claude doesn't just get a static prompt โ€” it gets real-time data baked into its context before it even starts thinking. It's like handing a doctor the lab results before they walk into the exam room.

This works in:

  • Custom skill/command .md files (with ! backtick syntax)
  • Inline during a session by just asking Claude to run a bash command

CLAUDE.md: The Agent's Constitution

The CLAUDE.md file is the single most important thing you can configure. Every session, Claude reads it automatically. Think of it as the standing orders you never have to repeat.

Where Files Live

~/.claude/CLAUDE.md          # Global โ€” applies to every project
<project-root>/CLAUDE.md     # Project-specific
packages/frontend/CLAUDE.md  # Monorepo sub-package (also loaded!)

A Solid CLAUDE.md Template

# My Project

## What This Is
A TypeScript monorepo for a SaaS billing platform. Backend is Express, 
frontend is React + Vite.

## Build & Dev Commands
- Build: `npm run build`
- Dev server: `npm run dev`
- Tests: `npm test`
- Lint: `npm run lint -- --fix`
- Type check: `npx tsc --noEmit`

## Code Conventions
- TypeScript strict mode is ON. Never use `any`.
- No default exports.
- All API responses use the `ApiResult<T>` wrapper type.
- Commit format: `feat/fix/chore(scope): description`

## Things Claude Should Know
- The `src/legacy/` directory is read-only. Do not touch it.
- Environment variables are in `.env.local` (never commit this).
- We use Zod for all runtime validation โ€” prefer it over manual checks.

Pro Tip: Run /init to have Claude scan your project and generate a starter CLAUDE.md automatically. Then own it yourself from there.


Permission Modes & The YOLO Flag

The Four Permission Modes

Claude Code ships with four permission modes you can toggle with Shift+Tab or set at startup:

ModeBehavior
DefaultAsks permission for most file edits and shell commands
AcceptEditsAuto-approves file edits, still asks for shell commands
PlanNo execution โ€” Claude only plans and describes what it would do
AutoAI classifier decides per-action what needs approval
# Set a mode at startup
claude --permission-mode acceptEdits
claude --permission-mode auto

The --dangerously-skip-permissions Flag

The most annoying thing about default Claude Code is the permission prompts. Every. Single. File. You go make coffee, come back, and it's been waiting on "Can I run npm test?" for five minutes.

The solution:

claude --dangerously-skip-permissions

What it does: Skips all permission prompts and lets Claude act autonomously. It's not as scary as it sounds for most local development work. Think of it as Cursor's old "YOLO mode."

When to use it: Personal projects, isolated dev environments, when you trust your own CLAUDE.md constraints.

When NOT to use it: Anything touching production, shared systems, or sensitive credentials.

Safety net: You can still scope what Claude can touch using allowedTools and deny rules in your settings โ€” even without permission prompts.

Fine-Grained Tool Permissions (.claude/settings.json)

{
  "permissions": {
    "allowedTools": [
      "Read",
      "Write(src/**)",
      "Bash(git *)",
      "Bash(npm *)"
    ],
    "deny": [
      "Read(.env*)",
      "Write(production.config.*)",
      "Bash(rm -rf*)",
      "Bash(sudo *)"
    ]
  }
}

Context Management: Don't Let Your Window Go Stale

ELI5 for context: The context window is like a whiteboard. Claude can only see what's written on it right now. Old conversations fill it up. When it gets too full, Claude starts forgetting details โ€” or hallucinating to fill gaps.

The Context Health Scale

UsageStatusAction
0โ€“50%๐ŸŸข FineWork freely
50โ€“70%๐ŸŸก Watch itFinish current task cleanly
70โ€“90%๐ŸŸ  CompressRun /compact
90%+๐Ÿ”ด Critical/clear immediately

The "Document & Clear" Pattern

For long, complex tasks that span multiple sessions:

  1. Before clearing, ask Claude: "Dump your current plan, progress, and any blockers into progress.md"
  2. Run /clear
  3. Start a new session: "Read progress.md and continue where we left off"

This gives Claude durable external "memory" that survives context resets.

Anti-pattern: Relying on auto-compaction. It doesn't always preserve what matters. Own your context resets manually.


Custom Skills & Commands

Skills are reusable prompts that become slash commands. The newer .claude/skills/ format is preferred โ€” it supports automatic invocation by Claude, not just manual invocation.

Directory Structure

.claude/
โ”œโ”€โ”€ skills/
โ”‚   โ””โ”€โ”€ review-pr/
โ”‚       โ””โ”€โ”€ SKILL.md       # /review-pr command
โ”œโ”€โ”€ commands/              # Legacy format (still works)
โ”‚   โ””โ”€โ”€ catchup.md         # /catchup command
โ””โ”€โ”€ settings.json

Creating a Skill

Create .claude/skills/review-pr/SKILL.md:

---
name: review-pr
description: Fetch and review a pull request for logic errors, security 
             issues, and missing error handling. Use when asked to review 
             a PR or check a pull request.
allowed-tools: Bash(gh pr diff:*), Bash(gh pr view:*)
---

Fetch the PR diff for $ARGUMENTS using `gh pr diff`.

Review for:
1. Logic errors and edge cases
2. Security vulnerabilities (injection, auth bypasses, exposed secrets)
3. Missing error handling
4. Violations of rules in CLAUDE.md

Do NOT comment on style, naming conventions, or subjective preferences.
Flag only high-signal issues with clear explanations.

Use it with:

/review-pr 142

A Minimal Personal Command Set Worth Having

# ~/.claude/skills/catchup/SKILL.md
# Reads all changed files since branching from main

# ~/.claude/skills/pr/SKILL.md  
# Stages, commits, and opens a PR with a clean message

# ~/.claude/skills/security/SKILL.md
# Reviews current diff for security vulnerabilities

Skill Scoping

LocationApplies To
~/.claude/skills/All your projects (personal)
.claude/skills/This project only
Enterprise managed settingsAll users in org

When names conflict, priority is: Enterprise > Personal > Project.


Hooks: Automation That Runs Itself

Hooks are shell commands that fire automatically at specific points in Claude's lifecycle. Think of them as "if this, then that" rules baked into your Claude session.

Hook Events

EventWhen It Fires
UserPromptSubmitImmediately when you submit a prompt
PreToolUseBefore Claude runs any tool (read, write, bash)
PostToolUseAfter a tool completes
NotificationWhen Claude sends a notification
StopWhen Claude finishes responding

Configuring Hooks (.claude/settings.json)

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write(*.py)",
        "hooks": [
          {
            "type": "command",
            "command": "python -m black $file && python -m mypy $file"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Bash(rm *)",
        "hooks": [
          {
            "type": "command",
            "command": "echo 'Deletion detected โ€” logging to audit.log' >> audit.log"
          }
        ]
      }
    ]
  }
}

Use /hooks in an active session to configure these interactively via a menu instead of editing JSON manually. Much easier when starting out.

Practical Hook Ideas

  • Auto-format: Run Prettier/Black after every file write
  • Type-check: Run tsc --noEmit after TypeScript edits
  • Audit log: Log every bash command Claude runs to a file
  • Notifications: Ping Slack or play a sound when Claude finishes a long task

Subagents: Delegate Like a CTO

Subagents are specialized AI agents that Claude can delegate tasks to. They run with their own context, tools, and instructions โ€” keeping your main session's context clean.

Creating a Subagent

Create .claude/agents/code-reviewer/AGENT.md:

---
name: code-reviewer
description: Expert code reviewer. Use proactively after code changes.
tools: Read, Grep, Glob, Bash
model: sonnet
---

You are a senior code reviewer. When reviewing code:
- Check for security vulnerabilities (SQL injection, XSS, etc.)
- Verify error handling is complete
- Flag any hardcoded secrets or credentials
- Suggest performance improvements
- Check for proper input validation

Invoke with:

# Natural language โ€” Claude delegates automatically
"Review my latest changes"

# Direct invocation in session
@code-reviewer check my latest changes

# CLI flag
claude --agent code-reviewer

When to Use Subagents (and When Not To)

Good uses:

  • Security auditing (isolated, focused)
  • Test writing (separate concern from implementation)
  • Documentation generation

Watch out for: If you make a PythonTests subagent, the main Claude can no longer reason holistically about test behavior. Sometimes hiding context creates problems. Use subagents for genuinely separable concerns.


Bundled Power Skills (Deep Dive)

/batch โ€” Parallel Codebase Refactoring

The crown jewel for large refactors. Give it an instruction and it:

  1. Researches your codebase
  2. Decomposes the work into 5โ€“30 independent units
  3. Shows you a plan for approval
  4. Spawns one agent per unit in isolated git worktrees
  5. Each agent runs tests and opens its own PR
/batch migrate all API handlers from callbacks to async/await
/batch add input validation to every public endpoint in src/routes/
/batch replace all `console.log` calls with the structured logger

โš ๏ธ Requires a git repository. Large jobs can use significant token budget โ€” start with a smaller scope to test.

/simplify โ€” Post-Feature Cleanup

Run this after shipping a feature to clean up your work. It spawns three parallel review agents (code reuse, quality, efficiency), aggregates their findings, and applies fixes.

/simplify
/simplify focus on memory efficiency
/simplify focus on reducing bundle size

/loop โ€” Babysit a Deploy

/loop 5m check if the CI pipeline finished and tell me the result
/loop 2m tail the last 20 lines of deploy.log and flag any errors

CLI Flags for Scripting & CI/CD

The -p Flag (Print Mode)

The -p flag makes Claude non-interactive โ€” it processes the prompt and exits. This is the key to integrating Claude Code into scripts and pipelines:

# Simple one-shot query
claude -p "summarize this file" < README.md

# Git diff review in CI
git diff main | claude -p "review for security issues and output JSON" \
  --output-format json

# Pipe error logs for triage
cat error.log | claude -p "what caused this crash and how do I fix it?"

# Cap spending on expensive tasks
claude -p "refactor the API layer" --max-budget-usd 5.00

# Limit turns for automated workflows
claude -p "fix the failing test" --max-turns 5

# Use a specific model
claude -p "analyze this" --model claude-opus-4-5-20251001

Other Useful Flags

FlagWhat It Does
--model <name>Set the model for the session
--permission-mode <mode>Set permission mode at startup
--dangerously-skip-permissionsSkip all permission prompts
--output-format jsonMachine-readable output for scripting
--max-budget-usd <amount>Cap API spend for a task
--max-turns <n>Limit agentic turns (useful in CI)
--agent <name>Start session using a named subagent
--debugEnable verbose debug logging
--mcp-config <file>Load a specific MCP config (great for CI)
--strict-mcp-configOnly load specified MCP servers, ignore others
--from-pr <number>Resume a session linked to a GitHub PR

Installing the GitHub App

/install-github-app

After running this once, Claude will automatically review your PRs. Given that AI-assisted development tends to increase PR volume, this is genuinely useful as a first-pass reviewer.


MCP Servers: Claude Meets the World

MCP (Model Context Protocol) servers give Claude access to external tools and services โ€” Figma, GitHub, databases, internal APIs, whatever you need.

Adding MCP Servers

# Add a server globally (available in all projects)
claude mcp add github -s user -- npx @modelcontextprotocol/server-github

# Add a server scoped to the current project only
claude mcp add figma -s project -- npx @modelcontextprotocol/server-figma

# Add with custom JSON config
claude mcp add-json custom-server '{
  "command": "node",
  "args": ["./my-mcp-server.js"],
  "env": { "API_KEY": "your-key" }
}'

# List all configured servers
claude mcp list

# Remove a server
claude mcp remove github

Using MCP in CI (.mcp.json)

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      }
    }
  }
}

Use --strict-mcp-config in CI to ensure only the servers in your config file load โ€” no surprises.


Pro Tips & Mental Models

๐Ÿง  Mental Models First

The context window is a whiteboard, not a notepad. Claude can only reason about what's currently on it. Old context doesn't help โ€” it just crowds out space for new thinking. Clear aggressively.

Claude is your team lead, not your employee. Give it the outcome you want, not a step-by-step script. "Make the auth flow robust" beats "edit line 42 of auth.ts." The more autonomous leeway you grant it, the more leverage you get.

CLAUDE.md is the difference between a junior and senior Claude. A fresh session with no CLAUDE.md is Claude operating blind. A rich CLAUDE.md is Claude knowing your whole codebase convention set before it writes a single character.


๐Ÿ”ฅ Quick Power Tips

  • /clear early, /clear often. Every new task or context switch deserves a fresh start. Don't drag old conversation crud into new work.

  • Queue tasks, go touch grass. Claude Code can queue up a lot of work. Set it going on a long task (especially with --dangerously-skip-permissions in a safe environment), go do something else, and check back. It's surprisingly good at staying on task.

  • Use Opus for planning, Sonnet for execution. Opus is better at architectural reasoning and multi-step planning. Sonnet is faster and cheaper for the actual implementation grind. Switch mid-session with /model.

  • The "Document & Clear" trick for long tasks:

    "Dump your current plan, progress notes, and blockers into progress.md"
    /clear
    "Read progress.md and continue from where we left off"
    
  • Let Claude build its own CLAUDE.md hooks. Ask Claude: "Look at this project and set up some default hooks, custom commands, and a CLAUDE.md." It's remarkably good at bootstrapping its own configuration.

  • Monorepos: use nested CLAUDE.md files. A CLAUDE.md in packages/payments/ is auto-loaded when you're working in that directory. Each sub-package can have its own context.

  • -p mode is perfect for git hooks:

    # .git/hooks/pre-commit
    git diff --cached | claude -p "check for hardcoded secrets or API keys" \
      --max-turns 1

โš ๏ธ Common Mistakes to Avoid

MistakeBetter Approach
Never clearing context/clear at every new task
Relying on auto-compactionManual "Document & Clear" for complex work
Overly complex slash commandsKeep commands simple; let CLAUDE.md and natural language carry the weight
No deny rules with skip-permissionsAlways set explicit deny rules in settings.json for destructive ops
One giant CLAUDE.md for everythingUse nested CLAUDE.md files in monorepos
Using subagents for everythingReserve subagents for genuinely separable, isolated concerns

Quick Reference Cheatsheet

# โ”€โ”€ LAUNCH โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
claude                                    # Interactive session
claude --model opus                       # Start with Opus
claude --permission-mode acceptEdits      # Auto-accept file edits
claude --dangerously-skip-permissions     # Full YOLO mode
claude -p "prompt"                        # Non-interactive (exits after)
cat file | claude -p "review this"        # Pipe input

# โ”€โ”€ SESSION COMMANDS โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
/clear          # Wipe history
/compact        # Summarize conversation
/context        # Check context usage %
/model opus     # Switch model mid-session
/hooks          # Configure hooks interactively
/init           # Generate CLAUDE.md for this project
/debug          # Enable debug logging
/resume <id>    # Resume a previous session

# โ”€โ”€ BUNDLED SKILLS โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
/simplify                          # Cleanup recently changed files
/simplify focus on performance     # Focused cleanup
/batch migrate src/ from X to Y    # Parallel large-scale refactor
/loop 5m check deploy status       # Repeating poll task
/debug describe the issue here     # Troubleshoot session

# โ”€โ”€ FILE STRUCTURES โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
~/.claude/CLAUDE.md                # Global project memory
.claude/settings.json              # Permissions + hooks config
.claude/skills/<name>/SKILL.md     # Custom slash command
.claude/agents/<name>/AGENT.md     # Custom subagent
.mcp.json                          # MCP server config (project)

# โ”€โ”€ MCP โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
claude mcp add <name> -- <command>
claude mcp list
claude mcp remove <name>

For the most current features and docs, always check: code.claude.com/docs

Related posts