AI Prompts Library

Curated collection of expert prompts for coding, writing, marketing, image generation, and more

Have a great prompt? Submit it to the library →

Coding

Code Performance Profiler

Optimized for: claude-opus-4-7 • TEXT
Profile this code for performance issues:

[PASTE CODE]

1. Identify the top 3 performance bottlenecks. For each, explain WHY it's slow (Big-O, IO blocking, repeated allocations, etc.).
2. Propose a specific optimization for each.
3. Estimate the speedup (rough order of magnitude).
4. Identify the lowest-hanging fruit - the optimization with best ROI (largest speedup per line of code change).
5. Provide the optimized code only for the top recommendation. Don't refactor everything at once.

If the code is already efficient, say so honestly.

Performance bugs, scaling problems, hot path optimization

Coding

Code Review Expert with Security and Performance Focus

Optimized for: general • TEXT
You are a principal software engineer conducting a thorough code review. You combine deep security expertise with performance engineering knowledge. Review the submitted code with extreme attention to detail.

**Code to Review:**
[PASTE CODE HERE]

**Language/Framework:** [SPECIFY]
**Context:** [WHAT DOES THIS CODE DO AND WHERE DOES IT RUN]

**Review Checklist:**

**Security Analysis (CRITICAL):**
- [ ] SQL Injection: Are all queries parameterized? Any string concatenation in queries?
- [ ] XSS: Is user input sanitized before rendering? Are Content-Security-Policy headers set?
- [ ] CSRF: Are state-changing requests protected with tokens?
- [ ] Authentication: Are passwords hashed with bcrypt/argon2? Are JWTs validated properly?
- [ ] Authorization: Is there proper access control on every endpoint? IDOR vulnerabilities?
- [ ] Input Validation: Are all inputs validated for type, length, format, and range?
- [ ] Secrets: Are API keys, passwords, or tokens hardcoded? Are they in environment variables?
- [ ] Dependencies: Are there known CVEs in the dependency versions used?
- [ ] File Upload: Are file types validated server-side? Is the upload directory outside webroot?
- [ ] Rate Limiting: Are sensitive endpoints rate-limited?

**Performance Analysis:**
- [ ] N+1 Queries: Are there database queries inside loops?
- [ ] Missing Indexes: Are queried columns properly indexed?
- [ ] Memory Leaks: Are event listeners, subscriptions, or intervals cleaned up?
- [ ] Unnecessary Re-renders: Are React components memoized appropriately?
- [ ] Bundle Size: Are large libraries imported when smaller alternatives exist?
- [ ] Caching: Are expensive computations or API calls cached appropriately?
- [ ] Async Operations: Are promises handled correctly? Any unhandled rejections?
- [ ] Algorithm Complexity: Are there O(n^2) or worse operations that could be optimized?

**Code Quality:**
- [ ] Single Responsibility: Does each function/class do one thing well?
- [ ] DRY: Is there duplicated logic that should be extracted?
- [ ] Error Handling: Are errors caught, logged, and handled gracefully?
- [ ] Naming: Are variables and functions named clearly and consistently?
- [ ] Comments: Are complex algorithms explained? Are TODO/FIXME items addressed?

For each finding, provide: Severity (P0-P3), location, explanation, and a concrete fix with code.

Pre-merge code reviews, security audits, performance reviews, and code quality assessments

Coding

SQL Query Optimizer

Optimized for: general • TEXT
You are a database performance expert specializing in SQL query optimization. Analyze the provided query and suggest improvements for maximum performance.

**Query to Optimize:**
```sql
[PASTE YOUR SQL QUERY HERE]
```

**Database:** [PostgreSQL / MySQL / SQL Server / SQLite]
**Table Size:** [Approximate row counts for each table involved]
**Current Execution Time:** [If known]
**Available Indexes:** [List existing indexes, or say 'unknown']

**Optimization Analysis:**

1. **Query Plan Analysis:**
   - Identify sequential scans that should be index scans
   - Detect sort operations that could be avoided with indexes
   - Find hash joins that could be merge joins or nested loops
   - Spot unnecessary subqueries or CTEs

2. **Index Recommendations:**
   - Covering indexes for the most common queries
   - Composite indexes (correct column order for the query pattern)
   - Partial indexes for queries with WHERE filters
   - Expression indexes for computed conditions
   - Include CONCURRENTLY option for production index creation

3. **Query Rewriting:**
   - Replace correlated subqueries with JOINs
   - Convert IN (SELECT ...) to EXISTS where appropriate
   - Use window functions instead of self-joins
   - Replace DISTINCT with GROUP BY when more efficient
   - Optimize pagination (keyset pagination vs OFFSET)
   - Use UNION ALL instead of UNION when duplicates are impossible

4. **Schema Suggestions:**
   - Denormalization opportunities for read-heavy queries
   - Materialized views for complex aggregations
   - Partitioning strategy for large tables
   - Data type optimizations (e.g., INT vs BIGINT, VARCHAR vs TEXT)

5. **Optimized Query:**
   - Provide the rewritten query
   - Include EXPLAIN ANALYZE output comparison notes
   - Estimate the performance improvement

**Output**: The optimized query, required index DDL statements, and a brief explanation of each change and its expected impact.

Database query optimization, performance tuning, index strategy planning

Business

OKR and KPI Dashboard Designer

Optimized for: general • TEXT
You are an operations strategist specializing in goal-setting frameworks. Design OKRs and a KPI dashboard for the described team or organization.

**Organization/Team:** [NAME]
**Time Period:** [Q1/Q2/Q3/Q4 of YEAR]
**Team Size:** [NUMBER]
**Department:** [Engineering / Marketing / Sales / Product / Operations / Executive]
**Strategic Priorities:** [LIST 2-3 PRIORITIES]
**Current Challenges:** [DESCRIBE]

**Generate:**

1. **OKRs (3-5 Objectives):**
   For each Objective:
   - Objective statement (qualitative, inspiring, achievable in the quarter)
   - 3-4 Key Results (quantitative, measurable, specific)
   - Key Result scoring criteria (0.0 to 1.0 scale)
   - Current baseline for each Key Result
   - Target value (stretch goal at 0.7 score)
   - Initiatives: 2-3 specific projects that drive the Key Results

2. **KPI Dashboard Design:**
   - Leading indicators (predict future outcomes)
   - Lagging indicators (measure past results)
   - For each KPI:
     - Name and definition (exact formula)
     - Data source
     - Measurement frequency
     - Target value with red/yellow/green thresholds
     - Trend direction (increasing is good vs. decreasing is good)
     - Dashboard visualization type (number, gauge, line chart, bar chart)

3. **Dashboard Layout:**
   - Top-level summary row (3-4 headline metrics)
   - Trend section (week-over-week, month-over-month comparisons)
   - Detail section (breakdowns by segment, team, or channel)
   - Alert section (KPIs that need attention)

4. **Review Cadence:**
   - Weekly: Which metrics to review, by whom
   - Monthly: Deeper analysis topics
   - Quarterly: OKR scoring and next quarter planning

5. **Anti-Patterns to Avoid:**
   - Vanity metrics that feel good but do not drive decisions
   - Too many OKRs (focus is key)
   - Key Results that are actually tasks
   - Gaming risks for each KPI

**Output**: Complete OKR document, KPI definitions with formulas, and dashboard wireframe description.

Quarterly planning, team goal-setting, executive dashboards, performance management

Coding

Performance Optimization Checklist

Optimized for: general • TEXT
Optimize [WEB APP/API/DATABASE] performance:

**Frontend Optimization**:
- [ ] Minify CSS/JS/HTML
- [ ] Compress images (WebP, lazy loading)
- [ ] Use CDN for static assets
- [ ] Implement code splitting
- [ ] Add browser caching headers
- [ ] Reduce HTTP requests
- [ ] Optimize fonts (font-display: swap)

**Backend Optimization**:
- [ ] Database query optimization
- [ ] Add database indexes
- [ ] Implement caching (Redis/Memcached)
- [ ] Use connection pooling
- [ ] Add rate limiting
- [ ] Optimize API responses (pagination, partial)
- [ ] Enable gzip compression

**Database Optimization**:
- [ ] Analyze slow queries (EXPLAIN)
- [ ] Add composite indexes
- [ ] Denormalize where beneficial
- [ ] Implement query caching
- [ ] Optimize table structure
- [ ] Regular VACUUM/ANALYZE

**Monitoring**:
- [ ] Set up APM (New Relic, DataDog)
- [ ] Track Core Web Vitals
- [ ] Monitor error rates
- [ ] Set performance budgets

Performance audits, optimization sprints, speed improvements

Coding

Expert Code Reviewer with Security Focus

Optimized for: general • TEXT
You are an expert code reviewer with deep knowledge of security, performance, and best practices across multiple programming languages.

Your task is to review the following code and provide:
1. **Security Analysis**: Identify any security vulnerabilities (SQL injection, XSS, CSRF, authentication issues, etc.)
2. **Performance Review**: Highlight performance bottlenecks and suggest optimizations
3. **Code Quality**: Assess readability, maintainability, and adherence to best practices
4. **Bug Detection**: Point out logical errors, edge cases, and potential runtime issues
5. **Recommendations**: Provide specific, actionable improvements with code examples

For each issue found, specify:
- Severity (Critical, High, Medium, Low)
- Location (file, line number if available)
- Detailed explanation of the problem
- Concrete solution with improved code

Code to review:
[PASTE YOUR CODE HERE]

Pre-deployment code review, security audits, code quality assessment

Coding

SQL Query Optimizer & Performance Tuner

Optimized for: gpt-4o • TEXT
Analyze and optimize the following SQL query for maximum performance.

**Current Query:**
```sql
[PASTE YOUR SQL QUERY HERE]
```

**Database Context:**
- Database System: [MySQL/PostgreSQL/SQL Server/Oracle]
- Table row counts: [TABLE1: X rows, TABLE2: Y rows]
- Current indexes: [LIST EXISTING INDEXES]
- Query execution time: [CURRENT TIME]
- Use case: [DESCRIPTION OF WHAT QUERY DOES]

**Performance Requirements:**
- Target execution time: [GOAL]
- Frequency: [How often this query runs]
- Data freshness needs: [Real-time/Near real-time/Can be cached]

**Please provide:**

1. **Performance Analysis**
   - Identify performance bottlenecks
   - Explain current query execution plan
   - Point out inefficient operations (full table scans, cartesian products, etc.)

2. **Optimized Query**
   - Rewritten query with improvements
   - Inline comments explaining changes
   - Alternative approaches if multiple solutions exist

3. **Indexing Strategy**
   - Recommended indexes to create
   - Explain which clauses each index helps
   - Consider trade-offs (write performance, storage)

4. **Additional Optimizations**
   - Partitioning recommendations
   - Caching opportunities
   - Database configuration tweaks
   - Query refactoring into multiple queries if beneficial

5. **Expected Performance Gain**
   - Estimated improvement
   - Explain why these changes help

6. **Monitoring & Maintenance**
   - What metrics to track
   - When to revisit the optimization

Database performance tuning, slow query optimization, scaling data-heavy applications

Want Custom Prompts?

Get personalized AI prompts tailored to your specific needs and workflow.

Contact Us