Title: Claude Code Prompts — LearnCoachAssist

Q: What is Claude Code?
A: Claude Code is Anthropic's official AI-powered CLI tool that helps developers write, edit, debug, and understand code directly in the terminal.

Q: How do you start Claude Code?
A: Run `claude` in your terminal from any project directory to start an interactive session with the AI assistant.

Q: What is the key benefit of working in Claude Code's agentic mode?
A: Claude Code can read files, write code, run tests, and execute shell commands autonomously, completing complex multi-step tasks end-to-end.

Q: How do you give Claude Code access to your entire project?
A: Navigate to your project root before starting Claude Code — it will automatically have context of all files in the working directory.

Q: What prompt should you use to ask Claude to read and understand a file?
A: "Read [filename] and explain what it does" or simply "Read [filename]" before asking questions about its contents.

Q: How do you ask Claude Code to fix a bug?
A: Describe the bug and what you expected: "This function returns null when the user has no orders, but it should return an empty array instead."

Q: What is the best way to ask Claude Code to refactor code?
A: Be specific about the goal: "Refactor this function to use async/await instead of callbacks" or "Extract this logic into a separate helper function."

Q: How do you get Claude Code to write tests?
A: "Write unit tests for [function/file] covering edge cases including null inputs, empty arrays, and boundary values."

Q: What is the /help slash command?
A: Running `/help` inside Claude Code displays available slash commands, keyboard shortcuts, and usage information.

Q: What does the /clear command do?
A: `/clear` resets the conversation context, clearing all prior messages and starting a fresh session.

Q: What is the /compact command?
A: `/compact` compresses the conversation history to save context space while preserving the essential information.

Q: What does /cost show?
A: `/cost` displays the token usage and estimated API cost for the current Claude Code session.

Q: What is the CLAUDE.md file?
A: A markdown file in your project root that Claude Code automatically reads to understand project-specific conventions, setup, and preferences.

Q: What should you put in CLAUDE.md?
A: Project overview, tech stack, coding conventions, common commands, environment setup instructions, and any behavioral preferences for Claude.

Q: How do you ask Claude Code to search for something in your codebase?
A: "Find all places where [function/variable/pattern] is used" or "Search for files containing [keyword]."

Q: What prompt helps Claude Code understand a new codebase?
A: "Explore the project structure and give me an overview of the architecture, key files, and how the main features work."

Q: How do you ask Claude Code to explain a complex function?
A: "Read [file:line_number] and explain what this function does, including its inputs, outputs, and side effects."

Q: What is the best prompt for adding a new feature?
A: Describe the feature clearly with context: "Add a [feature] to [component] that [behavior]. It should work like [example] and follow the existing patterns in [reference file]."

Q: How do you direct Claude Code to follow existing code style?
A: "Match the coding style used in [filename]" or "Follow the same patterns as the existing [controllers/services/models]."

Q: What prompt asks Claude Code to check for security issues?
A: "Review [file or feature] for security vulnerabilities including XSS, SQL injection, and OWASP top 10 issues."

Q: How do you ask Claude Code to optimize performance?
A: "Identify performance bottlenecks in [file/function] and suggest optimizations, focusing on [N+1 queries / memory usage / response time]."

Q: What is the best way to ask Claude to create a new file?
A: "Create [filename] with [specific content/structure]. It should [behavior/purpose] and follow the conventions in [reference file]."

Q: How do you instruct Claude Code not to modify certain files?
A: "Do not modify [filename]. Only change [other file]" or set exclusions in CLAUDE.md.

Q: What prompt gets Claude Code to generate a database migration?
A: "Create a migration to [add/modify/remove] [column/table] with [data type and constraints] following the existing migration conventions."

Q: How do you ask Claude Code to debug a failing test?
A: "This test is failing with [error message]. Read the test and the code it tests, then find and fix the root cause."

Q: What is the /vim shortcut?
A: `/vim` enables Vim keybindings for the Claude Code input, letting you use Vim motions for text editing.

Q: How do you ask Claude to explain an error message?
A: Paste the full error: "I'm getting this error: [paste error]. What does it mean and how do I fix it?"

Q: What prompt makes Claude Code run commands safely?
A: "Run [command] and tell me the output. If there are any errors, explain what went wrong before attempting a fix."

Q: How do you ask Claude Code to create an API endpoint?
A: "Create a [GET/POST/PUT/DELETE] endpoint at [path] that [behavior]. It should validate [inputs] and return [response format]."

Q: What is the best prompt for code review?
A: "Review [file] for code quality, potential bugs, readability issues, and adherence to best practices. Suggest specific improvements."

Q: How do you get Claude Code to document code?
A: "Add documentation to [file] explaining the purpose of each function, its parameters, return values, and any important behavior."

Q: What prompt helps Claude handle a large refactor?
A: Break it into steps: "First read [files], then plan the refactor, explain the approach, and only start changing code after I approve the plan."

Q: How do you ask Claude Code to handle a merge conflict?
A: "I have a merge conflict in [file]. Read the conflict markers and resolve it by [keeping feature/applying both changes/choosing the correct version]."

Q: What is the best prompt for generating boilerplate?
A: "Generate a [component/class/module] boilerplate for [purpose] following the same structure as [existing example file]."

Q: How do you stop Claude Code mid-task?
A: Press `Escape` or `Ctrl+C` to interrupt the current operation and return to the prompt.

Q: What prompt makes Claude Code ask clarifying questions first?
A: "Before writing any code, ask me the questions you need answered to implement [feature] correctly."

Q: How do you ask Claude Code to generate seed data?
A: "Create a seeder for [model] with [N] realistic sample records covering [edge cases / varied scenarios]."

Q: What is a good prompt for improving error messages?
A: "Review the error messages in [file] and improve them to be more descriptive, actionable, and user-friendly."

Q: How do you ask Claude Code to add logging?
A: "Add structured logging to [file/function] that logs [events] with appropriate log levels (debug/info/warn/error)."

Q: What prompt asks Claude to explain its plan before acting?
A: "Before making any changes, explain exactly what you plan to do and why, then wait for my confirmation."

Q: How do you use Claude Code to write a regex?
A: "Write a regex that matches [pattern description] and test it against these examples: [valid examples] vs [invalid examples]."

Q: What is the best prompt for environment setup?
A: "Read the project structure and tell me exactly what commands I need to run to set up this project locally from scratch."

Q: How do you ask Claude Code to suggest a data structure?
A: "I need to store [data type] with [operations needed]. What data structure would be most efficient and why?"

Q: What prompt helps with CI/CD configuration?
A: "Create a [GitHub Actions / GitLab CI] workflow that runs [tests/builds/deploys] on [trigger events] for this [framework] project."

Q: How do you ask Claude Code to handle pagination?
A: "Add cursor-based pagination to the [endpoint] returning [per_page] items per page with a next_cursor for subsequent requests."

Q: What prompt generates API documentation?
A: "Generate OpenAPI/Swagger documentation for the [endpoint or file], including request/response schemas and example payloads."

Q: How do you ask Claude to prioritize security in code?
A: "Implement [feature] with security as the top priority. Validate all inputs, sanitize outputs, and explain any security decisions made."

Q: What is the best way to ask about tradeoffs?
A: "What are the tradeoffs between [approach A] and [approach B] for [use case]? Which would you recommend and why?"

Q: How do you ask Claude Code to write idiomatic code?
A: "Rewrite this in idiomatic [Python/Go/TypeScript] following language best practices and community conventions."

Q: What prompt gets Claude to generate a Dockerfile?
A: "Create a Dockerfile for this [language/framework] app that is optimized for production with a multi-stage build."

Q: How do you ask Claude Code to add type safety?
A: "Add TypeScript types / type hints to [file], ensuring all function signatures, return types, and variable declarations are typed."

Q: What prompt tests Claude Code's understanding?
A: "In your own words, explain how [feature/system] works based on the code. Then identify any gaps or potential issues."

Q: How do you ask Claude to generate fixtures for testing?
A: "Create test fixtures for [model/feature] that cover: a typical case, an edge case with empty values, and a case with maximum data."

Q: What is the best prompt for async code conversion?
A: "Convert this synchronous [function/module] to async/await, handling errors properly and preserving all existing behavior."

Q: How do you ask Claude Code to add caching?
A: "Add caching to [function/endpoint] with a [N minute] TTL, using [Redis/in-memory/HTTP cache headers] and cache invalidation for [events]."

Q: What prompt improves a database query?
A: "This query is slow: [paste query]. Analyze it and rewrite it to be more efficient. Suggest any indexes that should be added."

Q: How do you ask Claude Code to implement rate limiting?
A: "Add rate limiting to [endpoint] allowing [N] requests per [time window] per [user/IP], returning a 429 with retry-after header when exceeded."

Q: What prompt asks Claude to review architecture?
A: "Review the current architecture of [system/feature] and identify any design issues, scalability concerns, or improvements to consider."

Q: How do you ask Claude Code to write a CLI tool?
A: "Create a CLI tool in [language] that [behavior]. It should accept [flags/arguments] and output [format]."

Q: What is the best prompt for generating a README?
A: "Generate a README for this project including: overview, features, prerequisites, installation steps, usage examples, and contributing guide."

Q: How do you ask Claude to handle authentication?
A: "Implement [JWT/session/OAuth] authentication for [framework], including login, logout, token refresh, and protected route middleware."

Q: What prompt makes Claude Code write defensive code?
A: "Implement [feature] defensively: validate all inputs at boundaries, handle all error cases explicitly, and never trust external data."

Q: How do you ask Claude Code to implement webhooks?
A: "Create a webhook handler for [service] that validates the signature, processes [event types], and responds within 5 seconds."

Q: What prompt asks Claude to suggest variable names?
A: "Suggest more descriptive names for these variables: [list]. The names should clearly express intent without abbreviation."

Q: How do you use Claude Code to untangle spaghetti code?
A: "This function is too complex. Break it into smaller, single-responsibility functions, keeping the public interface the same."

Q: What is the best prompt for implementing search?
A: "Add full-text search to [model/endpoint] that searches [fields], ranks results by relevance, and supports [filters/pagination]."

Q: How do you ask Claude Code to add feature flags?
A: "Add a feature flag for [feature] using [library/config], defaulting to disabled, so it can be enabled per user/environment."

Q: What prompt makes Claude generate a changelog entry?
A: "Based on the changes in [files], generate a changelog entry in [Keep a Changelog / conventional format] for version [X.X.X]."

Q: How do you ask Claude Code to implement retry logic?
A: "Add exponential backoff retry logic to [API call/operation] with [max N retries], jitter, and logging of each attempt."

Q: What is the best way to ask Claude Code to trace a bug?
A: "Walk me through how data flows from [input] to [output] in this code, and identify where [bug symptom] could originate."

Q: How do you ask Claude to generate mock data?
A: "Generate [N] realistic mock records for [entity] in [JSON/SQL/CSV] format, varying the fields to cover different scenarios."

Q: What prompt asks Claude Code to create environment configs?
A: "Create [.env.example / config files] for this project with all required environment variables documented with descriptions and examples."

Q: How do you ask Claude to implement soft deletes?
A: "Add soft delete functionality to [model] so records are marked deleted_at rather than removed, and all queries exclude soft-deleted records."

Q: What is the best prompt for adding observability?
A: "Add metrics, tracing, and structured logging to [service/endpoint] so we can monitor request rates, latency, and error rates."

Q: How do you ask Claude Code to generate a data pipeline?
A: "Create a data pipeline that [reads from source], [transforms data], and [writes to destination], handling errors and partial failures."

Q: What prompt asks Claude to explain a dependency?
A: "Explain what [library/package] does, why it's used in this project, and what would need to change if we removed it."

Q: How do you ask Claude Code to implement pagination with filters?
A: "Add filtering and sorting to [endpoint] so users can filter by [fields], sort by [columns], and paginate results with [limit/offset or cursor]."

Q: What is a good prompt for asking Claude to write SQL?
A: "Write a SQL query that [returns/aggregates/joins] [data description], optimized for [read performance / correctness / clarity]."

Q: How do you ask Claude Code to create a state machine?
A: "Implement a state machine for [entity] with states [list] and transitions [list], enforcing valid transitions and logging state changes."

Q: What prompt makes Claude explain its approach?
A: "Before implementing, explain your approach, the key decisions you'll make, and any alternatives you considered."

Q: How do you ask Claude Code to add validation?
A: "Add input validation to [endpoint/form] ensuring [field constraints]. Return descriptive validation errors for each invalid field."

Q: What prompt generates integration tests?
A: "Write integration tests for [feature] that test the full request/response cycle including database interactions and edge cases."

Q: How do you ask Claude Code to implement event sourcing?
A: "Refactor [feature] to use event sourcing: store domain events, rebuild state from events, and add event projections for queries."

Q: What is the best prompt for upgrading a dependency?
A: "I need to upgrade [package] from [version A] to [version B]. Read the changelog and migrate any breaking API changes in this codebase."

Q: How do you ask Claude Code to add background jobs?
A: "Create a background job that [behavior] triggered by [event], with retry logic, error handling, and progress logging."

Q: How do you ask Claude Code to implement file uploads?
A: "Add file upload support for [endpoint] accepting [file types] up to [size], storing in [S3/local disk], and validating file contents."

Q: What prompt asks Claude to write a deployment checklist?
A: "Generate a pre-deployment checklist for this project covering: environment variables, database migrations, cache warming, and health checks."

Q: How do you ask Claude Code to implement search autocomplete?
A: "Add autocomplete to [search field] that queries [endpoint] on keypress with [debounce ms] delay, displaying top [N] results."

Q: What prompt makes Claude Code write accessible HTML?
A: "Ensure [component/page] meets WCAG 2.1 AA standards: proper ARIA labels, keyboard navigation, color contrast, and screen reader support."

Q: How do you ask Claude to generate GraphQL types?
A: "Generate GraphQL schema types for [entities] with queries for [list/find], mutations for [create/update/delete], and proper resolver hints."

Q: What is the best prompt for extracting a service?
A: "Extract [logic] from [controller/class] into a dedicated service class, following the single responsibility principle and dependency injection pattern."

Q: How do you ask Claude Code to add monitoring alerts?
A: "Define alerting rules for [service] that trigger when [error rate / latency / queue depth] exceeds [threshold] for [duration]."

Q: How do you ask Claude Code to create a design doc?
A: "Write a technical design document for [feature] covering: requirements, proposed solution, alternative approaches, risks, and success metrics."

Q: What prompt generates a database schema from requirements?
A: "Design a normalized database schema for [feature/application] with tables, columns, data types, constraints, and foreign key relationships."

Q: How do you ask Claude Code to refactor a monolith?
A: "Identify bounded contexts in this codebase and propose how to extract [module] into an independently deployable service with a clear API boundary."

Q: What is the best prompt for improving test coverage?
A: "Analyze [file/module] and identify untested code paths. Write tests for the most critical gaps, prioritizing error handling and edge cases."

Q: How do you use Claude Code to learn from a codebase?
A: "Explain the design patterns used in this codebase, why they were chosen, and how they interact with each other."

Q: What prompt asks Claude to suggest technical debt fixes?
A: "Identify the top 5 pieces of technical debt in [file/module] ranked by impact and effort, and suggest a remediation plan for each."

Q: How do you ask Claude Code to implement a health check endpoint?
A: "Add a /health endpoint that checks [database connectivity / external service availability / disk space] and returns status 200 OK or 503 with details."

Q: What prompt asks Claude Code to review a pull request?
A: "Review the changes in [files] as if doing a code review: check for bugs, security issues, missing tests, and adherence to the project's coding standards."