Skip to content

Claude Code Recommended Prompts Guide

The powerful features of Claude Code largely depend on how to communicate with it effectively. This document compiles efficient prompt templates for various development scenarios, helping developers quickly master the usage techniques of Claude Code.

🚀 Project Initialization

Quick Project Structure Understanding

Please read the project's README.md, package.json and main directories, help me understand this project's architecture and tech stack, but don't write any code for now.

Create Project Configuration File

Please help me create a detailed CLAUDE.md file, including project architecture description, common commands, coding standards and development environment configuration.

Project Environment Configuration

Please check the project's environment configuration, ensure all dependencies are correctly installed, and run initialization scripts. If there are any issues, please tell me how to resolve them.

🎯 Feature Development

New Feature Development Flow

I need to develop [feature description]. Please follow these steps:
1. First read relevant code to understand the existing architecture
2. Create a detailed implementation plan
3. Implement core functionality
4. Write tests
5. Update documentation
Please pause after each step and wait for my confirmation.

Test-Driven Development

I want to implement [feature description]. Please first write test cases based on expected input/output, ensure the tests fail, then implement the feature code to make the tests pass.

API Interface Development

Please help me design and implement [API description] interface, including:
- Route definition
- Request parameter validation
- Business logic implementation
- Response format definition
- Error handling
- API documentation

Component Development

Please help me create a [component name] component, requirements:
- Follow existing component patterns in the project
- Include TypeScript type definitions
- Support [specific feature requirements]
- Write corresponding test files

🔧 Code Debugging & Optimization

Error Diagnosis

I encountered this error: [error message]. Please help me analyze the cause and provide a fix. If you need to check related code, please let me know.

Performance Optimization

Please analyze the performance issues of [file/feature] and provide optimization suggestions. Focus on:
- Execution efficiency
- Memory usage
- Loading speed
- User experience

Code Refactoring

Please refactor [function/class] in [filename], goals:
- Improve code readability
- Reduce duplicate code
- Follow best practices
- Keep functionality unchanged
Please first analyze the existing code, then provide a refactoring plan.

Code Review

Please conduct a code review for [file/feature], focus on checking:
- Code standards
- Security issues
- Performance issues
- Best practices
- Potential bugs

Test Case Writing

Please write comprehensive test cases for [function/class/component], including:
- Normal case testing
- Boundary condition testing
- Error case testing
- Mock dependencies

Test Fixing

Several tests are failing, please analyze the failure reasons and fix them. The test command is: [test command]

Test Coverage Improvement

Please analyze the current test coverage and add test cases for parts with insufficient coverage.

📱 Frontend Development

UI Component Implementation

Please implement a UI component based on this design: [upload design]
Requirements:
- Responsive design
- Support dark mode
- Accessibility support
- Follow design specifications

Style Adjustments

Please optimize the styles for [component/page] to achieve the following effects:
- [specific style requirements]
- Maintain consistency with overall design
- Ensure proper display on different devices

State Management

Please implement state management for [feature], including:
- State structure design
- Action definition
- Reducer implementation
- Async operation handling

⚡ Backend Development

Database Design

Please design database table structure for [feature], including:
- Table structure definition
- Index design
- Relationship constraints
- Migration scripts

Middleware Development

Please implement a [middleware name] middleware with features including:
- [specific feature requirements]
- Error handling
- Logging
- Performance monitoring

Service Integration

Please help me integrate [third-party service], including:
- SDK configuration
- API call wrapper
- Error handling
- Unit tests

📚 Documentation Writing

API Documentation Generation

Please generate API documentation for the project, including:
- Interface list
- Request parameter description
- Response format examples
- Error code description

Code Comments

Please add detailed code comments for [file/function], including:
- Feature description
- Parameter description
- Return value description
- Usage examples

README Updates

Please update the project's README.md file, ensure it includes:
- Project introduction
- Installation instructions
- Usage methods
- Contribution guidelines

🔄 Git Workflow

Code Commit

Please review the current changes, write appropriate commit messages and commit the code. The commit message should follow the project's commit conventions.

Create PR

Please create a Pull Request, including:
- Clear title and description
- Summary of changes
- Test plan
- Related issue links

Branch Management

Please help me create a new feature branch [branch name] and switch to that branch to start development.

🏗️ Project Management

Task Breakdown

I need to implement [large feature description]. Please help me break it down into multiple small tasks, each task including:
- Task description
- Estimated hours
- Dependencies
- Acceptance criteria

Project Planning

Please help me create a project development plan, including:
- Feature module division
- Development priorities
- Time arrangement
- Risk assessment

Technology Selection

For [project requirements], please help me analyze technology selection, compare the pros and cons of different solutions, and recommend the most suitable tech stack.

🔍 Code Analysis

Dependency Analysis

Please analyze the project's dependency relationships, check:
- Are there redundant dependencies
- Are there security vulnerabilities
- Do versions need updates
- Are there alternative solutions

Architecture Analysis

Please analyze the project's overall architecture, evaluate:
- Are module responsibilities clear
- Is coupling reasonable
- How is extensibility
- What improvement opportunities exist

Code Statistics

Please provide statistics on the project's code, including:
- Lines of code
- Number of files
- Tech stack distribution
- Test coverage

🛠️ Environment Configuration

Development Environment Setup

Please help me configure the development environment, including:
- Install necessary dependencies
- Configure environment variables
- Set up development tools
- Verify environment is working properly

CI/CD Configuration

Please configure CI/CD process for the project, including:
- Automated testing
- Code quality checks
- Automated deployment
- Notification mechanisms

Docker Configuration

Please create Docker configuration for the project, including:
- Dockerfile
- docker-compose.yml
- Environment variable configuration
- Deployment instructions

💡 Advanced Techniques

Batch Processing

Please execute [operation] on all [file type] files in the project, ensuring:
- Operation consistency
- No breaking of existing functionality
- Compliance with project standards

Automation Scripts

Please create an automation script for [task description], the script should:
- Support command line arguments
- Include error handling
- Provide detailed logging
- Be easy to maintain

Code Generation

Please generate corresponding code files based on [configuration/template], including:
- [specific file types]
- Follow project conventions
- Include necessary comments
- Pass basic tests

📋 Usage Recommendations

Prompt Writing Principles

  • Be Specific: Describe requirements in detail, avoid vague expressions
  • Step by Step: Break complex tasks into multiple steps
  • Set Boundaries: Clearly state what to do and what not to do
  • Include Context: Provide necessary background information
  • Verify and Confirm: Require confirmation for important steps before continuing

Common Modifiers

  • "Please first analyze...": Require Claude to understand before acting
  • "Don't ... for now": Set clear boundaries
  • "Please pause after each step": Control execution pace
  • "Follow existing project...": Maintain consistency
  • "If you need... please let me know": Proactive communication

Efficiency Tips

  • Use @ to reference files: @src/components/Button.tsx
  • Utilize extended thinking: Press Shift+TAB twice to enter PLAN mode
  • Clean context properly: Use /clear and /compact
  • Create custom commands: In .claude/commands/ directory
  • Batch operations: Handle multiple similar tasks at once

💡 Tip:

These prompt templates can be adjusted according to specific project requirements. It's recommended to bookmark this document as a daily development reference and gradually master efficient communication with Claude Code.

By using these carefully designed prompts, you'll be able to better leverage Claude Code's powerful features and significantly improve development efficiency and code quality.

Claude Relay Service - Self-hosted Claude API relay service, secure and efficient