๐ Debugging Prompts
22 prompts to diagnose, fix, and understand bugs โ from simple errors to complex race conditions and memory leaks.
Debug โข Error Analysis
Root Cause Analyzer โ Any Error
Diagnoses any error message, explains the root cause in plain English, provides a fix, and prevents future recurrence.
You are a senior software engineer at a top tech company. I have a bug in my code. Perform a complete root cause analysis.
ERROR MESSAGE:
[PASTE EXACT ERROR MESSAGE]
CONTEXT:
Language/Framework: [LANGUAGE & FRAMEWORK]
What I was trying to do: [WHAT YOU EXPECTED TO HAPPEN]
What happened instead: [WHAT ACTUALLY HAPPENED]
When did this start occurring: [ALWAYS / AFTER A SPECIFIC CHANGE]
ANALYSIS STEPS:
1. DIAGNOSE: Identify the exact line and root cause. Name the bug type (null pointer, type mismatch, async timing, etc.)
2. EXPLAIN: Explain why this happens in plain English โ like I'm a junior dev who wants to understand, not just fix it
3. FIX: Provide the complete corrected code (the full function, not just the changed line)
4. TEST: How can I verify this fix works before shipping?
5. PREVENT: What coding pattern or test would have caught this before it reached production?
My code:
```[LANGUAGE]
[PASTE YOUR CODE]
```
[ERROR MESSAGE][LANGUAGE/FRAMEWORK][CODE]
Best with: GPT-4o, Claude 3.5 Sonnet
Debug โข Performance
Performance Profiler & Optimizer
Analyzes code for performance bottlenecks, identifies the most impactful optimization opportunities, and provides refactored code with before/after complexity analysis.
Act as a performance engineering specialist. Analyze my code for performance issues and optimize it.
PERFORMANCE CONTEXT:
Current behavior: [DESCRIBE CURRENT PERFORMANCE โ e.g., takes 3 seconds to load, crashes with 10K records]
Target behavior: [WHAT GOOD LOOKS LIKE โ e.g., under 200ms, handles 1M records]
Data scale: [CURRENT SCALE] โ [EXPECTED SCALE IN 12 MONTHS]
Environment: [WHERE THIS RUNS โ browser / server / mobile / edge]
ANALYSIS FRAMEWORK:
1. BOTTLENECK IDENTIFICATION: Identify every performance issue in order of impact (most โ least)
2. COMPLEXITY ANALYSIS: What is the current Big-O for time and space? What should it be?
3. DATABASE/NETWORK ISSUES: Identify any N+1 queries, unnecessary API calls, or missing indexes
4. MEMORY ISSUES: Flag any memory leaks, excessive allocations, or inefficient data structures
5. OPTIMIZED VERSION: Provide the fully refactored, optimized code
6. IMPACT ESTIMATE: For each optimization, estimate the % performance improvement
7. FURTHER OPTIMIZATIONS: What would require architectural changes (caching, DB, infrastructure) for another 10x improvement?
Code to optimize:
```[LANGUAGE]
[PASTE YOUR CODE]
```
[CURRENT PERFORMANCE][TARGET][DATA SCALE][CODE]
Best with: Claude 3.5 Sonnet, GPT-4o
๐๏ธ Code Review Prompts
18 prompts for security audits, best practices review, refactoring suggestions, and PR review assistance.
Code Review โข Security
Security Vulnerability Audit
Performs a comprehensive security audit covering OWASP Top 10, common vulnerabilities for your tech stack, and provides remediation code.
You are a senior application security engineer (OWASP-certified). Perform a comprehensive security audit of my code.
SECURITY AUDIT SCOPE:
Language/Framework: [TECH STACK]
Application type: [WEB APP / API / CLI / MOBILE]
Sensitivity: [HANDLES PAYMENTS / PII / HEALTHCARE / GENERAL DATA]
AUDIT CHECKLIST โ Check for every item:
INJECTION VULNERABILITIES:
โก SQL injection (parameterized queries, ORM escaping)
โก Command injection
โก XSS (cross-site scripting) โ reflected, stored, DOM-based
โก Template injection
โก LDAP/NoSQL injection if applicable
AUTHENTICATION & AUTHORIZATION:
โก Insecure password handling (hashing algorithm, salting)
โก Session management issues
โก JWT vulnerabilities (algorithm confusion, weak secrets)
โก Missing authorization checks (IDOR, privilege escalation)
โก Hardcoded credentials or API keys
DATA EXPOSURE:
โก Sensitive data in logs
โก Unencrypted sensitive data at rest or in transit
โก Verbose error messages exposing system info
โก Secrets in environment variables exposed to frontend
OTHER:
โก CSRF protection
โก Rate limiting / brute force protection
โก Dependency vulnerabilities (flag old or vulnerable imports)
โก Insecure direct object references
FOR EACH VULNERABILITY FOUND:
- Severity: Critical / High / Medium / Low / Info
- Location: File and line number
- Explanation: Why this is dangerous
- Remediation: Exact fix with corrected code
Code to audit:
```[LANGUAGE]
[PASTE CODE]
```
[TECH STACK][APPLICATION TYPE][DATA SENSITIVITY][CODE]
Best with: Claude 3.5 Sonnet (more thorough security analysis)
๐ SQL & Database Prompts
13 prompts for writing complex SQL queries, optimizing slow queries, designing schemas, and working with databases.
SQL โข Query Building
Complex SQL Query Builder
Translates plain English data requirements into optimized, production-ready SQL with clear explanation of the query logic.
You are a senior database engineer. Write an optimized SQL query for the following requirement.
DATABASE CONTEXT:
Database type: [PostgreSQL / MySQL / SQLite / BigQuery / Snowflake / etc.]
Scale: [APPROXIMATE ROW COUNTS FOR MAIN TABLES]
REQUIREMENT:
I need to query data that: [DESCRIBE WHAT DATA YOU NEED IN PLAIN ENGLISH]
TABLE SCHEMAS:
[Paste your CREATE TABLE statements or describe your tables and columns]
QUERY REQUIREMENTS:
- Filter by: [YOUR FILTERS]
- Group by: [GROUPING IF NEEDED]
- Order by: [SORT ORDER]
- Return: [WHAT COLUMNS YOU WANT]
- Performance constraint: [MUST RUN IN UNDER X SECONDS / HANDLE X ROWS]
DELIVERABLES:
1. THE QUERY: Complete, runnable SQL with clear formatting
2. EXPLANATION: Walk through what each clause does in plain English
3. INDEXES: What indexes would make this query faster? Provide the CREATE INDEX statements
4. PERFORMANCE NOTES: Expected complexity and potential bottlenecks at scale
5. EDGE CASES: What happens if tables are empty? Any NULLs to handle?
[DATABASE TYPE][TABLE SCHEMAS][DATA REQUIREMENT]
Best with: GPT-4o, Claude 3.5
๐ API Design Prompts
12 prompts for designing RESTful APIs, GraphQL schemas, authentication systems, and API documentation.
API โข REST Design
Complete REST API Design Document
Creates a full REST API specification with endpoints, request/response schemas, error codes, authentication, and rate limiting โ production-ready documentation.
Act as a senior API architect. Design a complete, production-ready REST API for: [API PURPOSE]
CONTEXT:
What this API does: [DESCRIBE THE SYSTEM]
Who will consume it: [INTERNAL / MOBILE APP / THIRD PARTY / PUBLIC]
Expected scale: [REQUESTS PER SECOND]
Authentication type: [JWT / API KEY / OAuth 2.0 / etc.]
API DESIGN DOCUMENT:
BASE URL & VERSIONING:
Convention: https://api.[domain].com/v1/
AUTHENTICATION:
How to authenticate all requests (with example headers)
ENDPOINTS (for each endpoint):
[METHOD] /resource/{id}
- Description: What this endpoint does
- Path parameters: {description of each}
- Query parameters: name, type, required/optional, description
- Request body (POST/PUT): JSON schema with example
- Response 200: JSON schema with complete example
- Error responses: 400, 401, 403, 404, 422, 500 (with example error format)
STANDARD ERROR FORMAT:
Define the consistent error response structure used across all endpoints
RATE LIMITING:
Limits, headers returned, and 429 response format
PAGINATION:
Standard pagination approach (cursor/offset) with example
DESIGN for this system: [YOUR SYSTEM DESCRIPTION]
Core resources needed: [LIST YOUR MAIN ENTITIES]
[API PURPOSE][SYSTEM DESCRIPTION][CORE RESOURCES]
Best with: Claude 3.5 Sonnet, GPT-4o
Showing 5 of 120+ coding prompts.
Build Custom Coding Prompts Free โ