AI Prompt Templates
Crafting effective prompts is critical to successful AI-assisted development. Use these templates as starting points for common programming tasks.

Why Prompt Templates Matter
While AI coding assistants are powerful, their output is only as good as the input they receive. Well-structured prompts provide crucial context, constraints, and clarity to guide the AI toward generating exactly what you need.
These templates are designed based on real-world interactions with AI coding assistants and represent patterns that consistently lead to high-quality results. Each template can be customized for your specific use case.
Remember to include relevant details about your tech stack, existing patterns, and specific requirements when using these templates.

Template Categories
Development
Templates for building new features, components, and functionality
Maintenance
Templates for refactoring, optimizing, and improving existing code
Troubleshooting
Templates for diagnosing and solving bugs and technical issues
Architecture
Templates for designing systems, APIs, and technical infrastructure
Featured Templates
Feature ImplementationDevelopment
Template Pattern
I need to implement a [FEATURE] that [DESCRIBE FUNCTIONALITY]. The feature should support [REQUIREMENTS]. The existing codebase uses [TECH STACK/PATTERNS]. Please help me implement this feature with the following considerations: - [CONSIDERATION 1] - [CONSIDERATION 2] - [CONSIDERATION 3]
Example
I need to implement a user authentication system that supports both email/password and social login. The feature should support password reset, email verification, and account lockout after failed attempts. The existing codebase uses React frontend with Node.js/Express backend and MongoDB. Please help me implement this feature with the following considerations: - Security best practices for storing passwords and managing sessions - Clear separation of concerns between auth logic and UI - Extensibility for adding more authentication providers later
Tips for this template:
- Be as specific as possible about your requirements
- Include information about your tech stack and constraints
- Provide examples of similar code if available
Code RefactoringMaintenance
Template Pattern
I need to refactor [CODE/COMPONENT] because [REASON]. Current issues include: - [ISSUE 1] - [ISSUE 2] - [ISSUE 3] Here's the current implementation: ``` [PASTE CODE HERE] ``` Please refactor this code to improve [GOALS] while maintaining the same functionality.
Example
I need to refactor our API client module because it has become difficult to maintain and test. Current issues include: - Too many responsibilities in a single class - Hard-coded configuration values - No error handling strategy - Poor test coverage Here's the current implementation: ``` class ApiClient { constructor() { this.baseUrl = 'https://api.example.com'; this.apiKey = 'hardcoded-api-key'; } async fetchUsers() { const response = await fetch(`${this.baseUrl}/users`); return response.json(); } // Many more methods with similar patterns... } ``` Please refactor this code to improve modularity, testability, and error handling while maintaining the same functionality.
Tips for this template:
- Be as specific as possible about your requirements
- Include information about your tech stack and constraints
- Provide examples of similar code if available
Debugging IssueTroubleshooting
Template Pattern
I'm experiencing the following issue: [DESCRIBE THE PROBLEM] Expected behavior: [WHAT SHOULD HAPPEN] Actual behavior: [WHAT'S HAPPENING INSTEAD] Here's the relevant code: ``` [PASTE CODE HERE] ``` Error message (if any): ``` [ERROR MESSAGE] ``` I've already tried: - [ATTEMPT 1] - [ATTEMPT 2] Any ideas what might be causing this and how to fix it?
Example
I'm experiencing the following issue: My React component is re-rendering infinitely when I update state in a useEffect hook Expected behavior: The component should render once, fetch data, update state and render again with the data Actual behavior: The component keeps re-rendering indefinitely, causing API spam and browser lag Here's the relevant code: ```jsx function UserProfile({ userId }) { const [user, setUser] = useState(null); useEffect(() => { async function fetchUser() { const userData = await api.getUser(userId); setUser(userData); } fetchUser(); }); if (!user) return <Loading />; return <div>{user.name}</div>; } ``` Error message (if any): No explicit error, but browser devtools shows constant re-rendering I've already tried: - Adding error handling to the API call - Checking if the API response changes Any ideas what might be causing this and how to fix it?
Tips for this template:
- Be as specific as possible about your requirements
- Include information about your tech stack and constraints
- Provide examples of similar code if available

Get the Full Templates Collection
Download our complete library of 25+ prompt templates for AI-assisted development.