Skip to content

20 Real-World CLI Scenarios

You have a deadline in two days, a codebase you barely understand, and a feature request that touches twelve files across three services. You could spend the first day just reading code. Or you could open a terminal, type claude, and start shipping.

These 20 lessons are built from real development workflows — the kind where things break, requirements change, and “it works on my machine” is never good enough. Each one gives you a repeatable process you can use starting today.

  • A complete CLI-first development workflow from project scaffolding through production deployment
  • Copy-paste prompts for every phase of the development lifecycle
  • Debugging, testing, and refactoring patterns that work on real codebases, not toy examples
  • Automation techniques that let Claude Code handle the repetitive work while you make the decisions

Start here. These four lessons take you from an empty directory to production-ready code.

Project Initialization

Bootstrap full-stack projects in minutes. Configure CLAUDE.md, set up tooling, and generate project scaffolding from a single terminal session. Start Building

Codebase Analysis

Onboard to a 500K-line monorepo without reading every file. Use sub-agents to map architecture, trace data flows, and find the code that matters. Explore Codebases

Feature Planning

Turn vague product requirements into detailed implementation plans using Plan Mode and extended thinking. Get the architecture right before writing a line of code. Plan Features

Implementation

Go from plan to working code. Learn the explore-plan-implement-commit cycle that keeps Claude on track across multi-file changes. Write Code

Daily Development: The Workflows You’ll Use Every Day

Section titled “Daily Development: The Workflows You’ll Use Every Day”

These are the bread-and-butter patterns. The workflows you reach for at 10 AM and again at 4 PM.

Debugging

Pipe error logs directly into Claude, trace execution paths across services, and fix bugs in minutes that used to take hours. Includes headless mode for automated error triage. Fix Bugs

Testing

Generate test suites that match your existing patterns. Use the red-green-refactor loop with Claude running tests after every change. Coverage gaps become obvious. Write Tests

Refactoring

Rename across 200 files. Migrate from callbacks to async/await. Extract shared modules. Fan out with headless mode for large-scale changes that land cleanly. Refactor Code

Documentation

Generate JSDoc, OpenAPI specs, and architecture docs from your actual codebase. Set up hooks that keep docs in sync with every file edit. Document Code

Backend Development: APIs, Databases, and Infrastructure

Section titled “Backend Development: APIs, Databases, and Infrastructure”

Server-side workflows where Claude Code’s CLI-native approach really shines.

API Development

Scaffold REST and GraphQL endpoints with validation, auth middleware, and error handling. Test with curl without leaving Claude’s session. Build APIs

Database Work

Design schemas, generate migrations, write complex queries, and seed test data. Use headless mode to audit query performance across your entire codebase. Work with Data

Deployment

Dockerize applications, configure CI/CD pipelines, and automate production deployments — all from the terminal. Deploy Apps

Monitoring

Set up structured logging, health checks, and alerting. Pipe production logs into Claude for real-time anomaly detection. Monitor Systems

Advanced: Architecture, Security, and Scale

Section titled “Advanced: Architecture, Security, and Scale”

For the senior engineers who want to push Claude Code to its limits.

Security Audit

Scan for vulnerabilities, audit dependencies, and generate security reports. Use sub-agents to review code from multiple security perspectives simultaneously. Secure Code

Performance

Profile bottlenecks, optimize database queries, and benchmark changes. Claude reads flame graphs and heap snapshots so you can focus on the fix. Optimize Performance

Migrations

Handle zero-downtime database migrations, framework upgrades, and API version transitions. Fan out across files for large-scale transformations. Migrate Systems

Integrations

Connect MCP servers, configure skills, and build custom sub-agents. Extend Claude Code to fit your team’s exact workflow. Integrate Services

Stop doing things twice. These lessons turn manual workflows into repeatable automation.

Task Automation

Build hooks for auto-formatting, headless scripts for batch operations, and custom skills that encode your team’s workflows. Automate Tasks

CI/CD Pipelines

Run Claude Code in GitHub Actions for automated code review, test generation, and PR creation. Headless mode makes it scriptable. Configure Pipelines

Containerization

Generate Dockerfiles, compose configurations, and Kubernetes manifests. Debug container issues by piping logs directly into Claude. Containerize Apps

System Architecture

Use extended thinking for architectural decisions. Have Claude interview you about requirements, then generate implementation specs. Design Systems

Start with Project Initialization to get comfortable with the basics: launching sessions, writing prompts, and understanding how Claude reads and modifies your code. Then move through Codebase Analysis, Feature Planning, and Implementation in order. By the end of those four, you will have a workflow that covers most daily development tasks.

Jump to the lesson that matches your current bottleneck. Most experienced users find the biggest wins in Refactoring (fan-out patterns for large changes), Testing (automated coverage gap detection), and Automation (hooks and headless mode).

Focus on CI/CD Pipelines and Security Audit for org-wide impact. The headless mode patterns in those lessons let you embed Claude Code into existing team workflows without requiring everyone to change how they work.