Code Analysis & Review
Full Code Review
Review this {{language}} code and provide:
1. Bugs or logical errors
2. Performance bottlenecks
3. Security vulnerabilities
4. Violations of SOLID/cle...
Review this {{language}} code and provide:
1. Bugs or logical errors
2. Performance bottlenecks
3. Security vulnerabilities
4. Violations of SOLID/clean code principles
5. Suggested improvements with code examples
Code:
{{code}}
Code Analysis & Review
Quick Sanity Check
Give me a quick sanity check on this code:
- Any obvious bugs?
- Does the logic match the intent?
- Any red flags?
Code:
{{code}}...
Give me a quick sanity check on this code:
- Any obvious bugs?
- Does the logic match the intent?
- Any red flags?
Code:
{{code}}
Code Analysis & Review
PR Review Simulation
Act as a senior backend engineer doing a pull request review.
Be direct, opinionated, and concise. Flag anything you'd block the PR for.
Context: {{p...
Act as a senior backend engineer doing a pull request review.
Be direct, opinionated, and concise. Flag anything you'd block the PR for.
Context: {{pr_description}}
Code diff:
{{diff}}
Code Analysis & Review
Complexity Analysis
Analyze the complexity of this code:
Language: {{language}}
Code:
{{code}}
Provide:
1. Time complexity (Big O) per function
2. Space complexity
3. W...
Analyze the complexity of this code:
Language: {{language}}
Code:
{{code}}
Provide:
1. Time complexity (Big O) per function
2. Space complexity
3. Which parts are hardest to understand and why
4. Suggestions to reduce complexity
Code Analysis & Review
Dead Code Detection
Review this codebase/module for dead code:
Language: {{language}}
Code:
{{code}}
Identify:
- Unused functions, variables, imports
- Unreachable code...
Review this codebase/module for dead code:
Language: {{language}}
Code:
{{code}}
Identify:
- Unused functions, variables, imports
- Unreachable code paths
- Deprecated patterns still in use
- Safe removal order
Code Analysis & Review
Dependency Coupling Analysis
Analyze the coupling in this module:
Code:
{{code}}
Identify:
- Tight coupling between components
- Hidden dependencies
- Circular dependencies
- Su...
Analyze the coupling in this module:
Code:
{{code}}
Identify:
- Tight coupling between components
- Hidden dependencies
- Circular dependencies
- Suggested decoupling strategies
---
Debugging & Error Fixing
Error Diagnosis
I'm getting this error in my {{language}} app:
Error:
{{error_message}}
Stack trace:
{{stack_trace}}
Relevant code:
{{code}}
Explain what's causin...
I'm getting this error in my {{language}} app:
Error:
{{error_message}}
Stack trace:
{{stack_trace}}
Relevant code:
{{code}}
Explain what's causing this and how to fix it.
Debugging & Error Fixing
Bug Hunt
This function isn't behaving as expected.
Expected behavior: {{expected}}
Actual behavior: {{actual}}
Code:
{{code}}
Find the bug and explain why i...
This function isn't behaving as expected.
Expected behavior: {{expected}}
Actual behavior: {{actual}}
Code:
{{code}}
Find the bug and explain why it happens.
Debugging & Error Fixing
Intermittent Bug (Flaky Issue)
I have a bug that doesn't happen consistently.
Symptoms: {{symptoms}}
Frequency: {{frequency}}
Environment: {{environment}}
Code:
{{code}}
List lik...
I have a bug that doesn't happen consistently.
Symptoms: {{symptoms}}
Frequency: {{frequency}}
Environment: {{environment}}
Code:
{{code}}
List likely causes ranked by probability.
Debugging & Error Fixing
Memory Leak Investigation
I suspect a memory leak in this {{language}} service.
Symptoms: {{symptoms}}
Memory growth pattern: {{pattern}}
Relevant code:
{{code}}
Identify lik...
I suspect a memory leak in this {{language}} service.
Symptoms: {{symptoms}}
Memory growth pattern: {{pattern}}
Relevant code:
{{code}}
Identify likely sources and suggest how to confirm and fix each.
Debugging & Error Fixing
Regression Analysis
This code worked before but broke after a recent change.
What changed: {{change_description}}
Before behavior: {{before}}
After behavior: {{after}}
...
This code worked before but broke after a recent change.
What changed: {{change_description}}
Before behavior: {{before}}
After behavior: {{after}}
Old code:
{{old_code}}
New code:
{{new_code}}
What regression was introduced and how to fix it?
Debugging & Error Fixing
Environment-Specific Bug
This bug only happens in {{environment}} (not locally).
Error: {{error}}
Local config: {{local_config}}
{{environment}} config: {{env_config}}
What ...
This bug only happens in {{environment}} (not locally).
Error: {{error}}
Local config: {{local_config}}
{{environment}} config: {{env_config}}
What environment-specific factors could cause this?
---
API Design
REST API Design
Design a RESTful API for the following feature:
Feature: {{feature_description}}
Entities involved: {{entities}}
Business rules: {{rules}}
Provide:
...
Design a RESTful API for the following feature:
Feature: {{feature_description}}
Entities involved: {{entities}}
Business rules: {{rules}}
Provide:
- Endpoint list (method + path + description)
- Request/response body examples (JSON)
- HTTP status codes to use per case
- Any design decisions and why
API Design
API Endpoint Review
Review this API endpoint design:
{{api_spec}}
Check for:
1. REST conventions compliance
2. Naming consistency
3. Missing edge case handling
4. Secur...
Review this API endpoint design:
{{api_spec}}
Check for:
1. REST conventions compliance
2. Naming consistency
3. Missing edge case handling
4. Security concerns (auth, validation, rate limiting)
5. Versioning strategy
API Design
API Contract (OpenAPI snippet)
Write an OpenAPI 3.0 snippet for this endpoint:
Method: {{method}}
Path: {{path}}
Description: {{description}}
Request body: {{request_body}}
Possibl...
Write an OpenAPI 3.0 snippet for this endpoint:
Method: {{method}}
Path: {{path}}
Description: {{description}}
Request body: {{request_body}}
Possible responses: {{responses}}
API Design
API Pagination Design
Design a pagination strategy for this API endpoint:
Endpoint: {{endpoint}}
Dataset size: {{size}}
Sort requirements: {{sort}}
Client type: {{web | mo...
Design a pagination strategy for this API endpoint:
Endpoint: {{endpoint}}
Dataset size: {{size}}
Sort requirements: {{sort}}
Client type: {{web | mobile | third-party}}
Compare: offset-based vs cursor-based vs keyset pagination.
Recommend the best fit and show request/response examples.
API Design
API Versioning Strategy
Design a versioning strategy for this API:
Current state: {{current_version_and_clients}}
Planned breaking changes: {{changes}}
Client migration time...
Design a versioning strategy for this API:
Current state: {{current_version_and_clients}}
Planned breaking changes: {{changes}}
Client migration timeline: {{timeline}}
Compare: URL versioning, header versioning, content negotiation.
Recommend approach and provide migration plan.
API Design
GraphQL Schema Design
Design a GraphQL schema for:
Domain: {{domain}}
Main entities: {{entities}}
Key operations: {{queries_and_mutations}}
Auth requirements: {{auth}}
Pr...
Design a GraphQL schema for:
Domain: {{domain}}
Main entities: {{entities}}
Key operations: {{queries_and_mutations}}
Auth requirements: {{auth}}
Provide: type definitions, queries, mutations, subscriptions (if needed), and resolver strategy.
API Design
Webhook Design
Design a webhook system for:
Events to emit: {{events}}
Consumers: {{consumers}}
Reliability requirements: {{sla}}
Provide: payload structure, deliv...
Design a webhook system for:
Events to emit: {{events}}
Consumers: {{consumers}}
Reliability requirements: {{sla}}
Provide: payload structure, delivery guarantees, retry strategy, security (signature verification), and consumer registration flow.
---
Database & Query Optimization
Query Review
Analyze this {{db_type}} query:
{{query}}
Table schemas:
{{schemas}}
Current execution time: {{exec_time}}
Expected load: {{load}}
Provide:
1. Wha...
Analyze this {{db_type}} query:
{{query}}
Table schemas:
{{schemas}}
Current execution time: {{exec_time}}
Expected load: {{load}}
Provide:
1. What's slow and why
2. Index recommendations
3. Rewritten optimized query
Database & Query Optimization
Schema Design
Design a database schema for:
Use case: {{use_case}}
Entities: {{entities}}
Key relationships: {{relationships}}
Scale expectations: {{scale}}
Provi...
Design a database schema for:
Use case: {{use_case}}
Entities: {{entities}}
Key relationships: {{relationships}}
Scale expectations: {{scale}}
Provide table definitions, indexes, and explain key design decisions.
Database & Query Optimization
N+1 Query Detection
Review this code for N+1 query problems:
ORM/DB used: {{orm}}
Code:
{{code}}
Identify N+1 issues and rewrite using eager loading or batching....
Review this code for N+1 query problems:
ORM/DB used: {{orm}}
Code:
{{code}}
Identify N+1 issues and rewrite using eager loading or batching.
Database & Query Optimization
Database Sharding Strategy
Design a sharding strategy for:
Database: {{db_type}}
Current size: {{size}}
Growth rate: {{growth}}
Query patterns: {{patterns}}
Hotspot risks: {{ho...
Design a sharding strategy for:
Database: {{db_type}}
Current size: {{size}}
Growth rate: {{growth}}
Query patterns: {{patterns}}
Hotspot risks: {{hotspots}}
Recommend sharding key, strategy (range/hash/directory), and cross-shard query handling.
Database & Query Optimization
Data Archival Strategy
Design a data archival strategy for:
Table/collection: {{table}}
Current size: {{size}}
Retention policy: {{policy}}
Access frequency of old data: {{...
Design a data archival strategy for:
Table/collection: {{table}}
Current size: {{size}}
Retention policy: {{policy}}
Access frequency of old data: {{access_pattern}}
Provide: archival criteria, storage target, archival process, and restore procedure.
Database & Query Optimization
Transaction Design
Review or design the transaction boundaries for this operation:
Operation: {{operation}}
Entities involved: {{entities}}
Failure scenarios: {{failure...
Review or design the transaction boundaries for this operation:
Operation: {{operation}}
Entities involved: {{entities}}
Failure scenarios: {{failure_scenarios}}
DB used: {{db_type}}
Check: atomicity, isolation level needed, deadlock risks, and rollback strategy.
Database & Query Optimization
Read Replica Strategy
I want to offload read traffic using read replicas.
Current setup: {{current_setup}}
Read/write ratio: {{ratio}}
Consistency requirements: {{consiste...
I want to offload read traffic using read replicas.
Current setup: {{current_setup}}
Read/write ratio: {{ratio}}
Consistency requirements: {{consistency}}
Which queries to route to replicas? What replication lag risks exist? How to handle lag-sensitive reads?
---
Security Audit
Security Review
Perform a security audit on this {{language}} code:
{{code}}
Check for:
1. Injection vulnerabilities (SQL, NoSQL, command)
2. Authentication/authori...
Perform a security audit on this {{language}} code:
{{code}}
Check for:
1. Injection vulnerabilities (SQL, NoSQL, command)
2. Authentication/authorization flaws
3. Sensitive data exposure
4. Insecure dependencies or configs
5. Input validation gaps
Rate each issue: Critical / High / Medium / Low
Security Audit
Auth Flow Review
Review this authentication/authorization flow:
{{auth_flow_description_or_code}}
Check for:
- Token handling issues
- Session management flaws
- Pri...
Review this authentication/authorization flow:
{{auth_flow_description_or_code}}
Check for:
- Token handling issues
- Session management flaws
- Privilege escalation risks
- Missing security headers
Security Audit
Dependency Check Guidance
I'm using these dependencies in my {{language}} project:
{{dependencies_list}}
Which ones are known to have security issues?
What should I upgrade o...
I'm using these dependencies in my {{language}} project:
{{dependencies_list}}
Which ones are known to have security issues?
What should I upgrade or replace?
Security Audit
OWASP Top 10 Checklist
Evaluate this {{language}} application against the OWASP Top 10:
Application description: {{description}}
Key features: {{features}}
Tech stack: {{st...
Evaluate this {{language}} application against the OWASP Top 10:
Application description: {{description}}
Key features: {{features}}
Tech stack: {{stack}}
Code samples (if relevant):
{{code}}
Go through each OWASP category and flag risks specific to this app.
Security Audit
JWT Implementation Review
Review this JWT implementation:
Code:
{{code}}
Check for:
- Algorithm confusion attacks (alg:none)
- Key strength and storage
- Claims validation (e...
Review this JWT implementation:
Code:
{{code}}
Check for:
- Algorithm confusion attacks (alg:none)
- Key strength and storage
- Claims validation (exp, iss, aud)
- Token revocation strategy
- Refresh token rotation
Security Audit
RBAC / Permission System Design
Design a Role-Based Access Control system for:
Application: {{application}}
User types: {{user_types}}
Resources: {{resources}}
Actions per resource:...
Design a Role-Based Access Control system for:
Application: {{application}}
User types: {{user_types}}
Resources: {{resources}}
Actions per resource: {{actions}}
Special rules: {{special_rules}}
Provide: role definitions, permission matrix, implementation approach, and enforcement strategy.
Security Audit
Secrets Management Review
Review how this application manages secrets:
{{code_or_config}}
Check for:
- Hardcoded credentials
- Insecure secret storage
- Secret rotation strat...
Review how this application manages secrets:
{{code_or_config}}
Check for:
- Hardcoded credentials
- Insecure secret storage
- Secret rotation strategy
- Least privilege violations
- Logging of sensitive values
---
Refactoring
Refactor for Readability
Refactor this code to be more readable and maintainable.
Don't change the behavior — only improve structure and clarity.
Language: {{language}}
Code:...
Refactor this code to be more readable and maintainable.
Don't change the behavior — only improve structure and clarity.
Language: {{language}}
Code:
{{code}}
After refactoring, briefly explain the key changes.
Refactoring
Refactor to Design Pattern
Refactor this code to use the {{pattern_name}} design pattern.
Current code:
{{code}}
Show before and after, and explain why this pattern fits here....
Refactor this code to use the {{pattern_name}} design pattern.
Current code:
{{code}}
Show before and after, and explain why this pattern fits here.
Refactoring
Break Down God Class / Function
This class/function is doing too much. Break it down.
Language: {{language}}
Code:
{{code}}
Apply Single Responsibility Principle. Show the new stru...
This class/function is doing too much. Break it down.
Language: {{language}}
Code:
{{code}}
Apply Single Responsibility Principle. Show the new structure.
Refactoring
Remove Magic Numbers / Strings
Refactor this code to eliminate magic numbers and magic strings.
Language: {{language}}
Code:
{{code}}
Replace with named constants, enums, or confi...
Refactor this code to eliminate magic numbers and magic strings.
Language: {{language}}
Code:
{{code}}
Replace with named constants, enums, or config. Explain each change.
Refactoring
Improve Error Handling
Refactor the error handling in this code:
Language: {{language}}
Code:
{{code}}
Issues with current approach: {{current_issues}}
Implement: proper ...
Refactor the error handling in this code:
Language: {{language}}
Code:
{{code}}
Issues with current approach: {{current_issues}}
Implement: proper exception hierarchy, meaningful error messages, appropriate error propagation, and logging at the right level.
Refactoring
Extract Reusable Service / Module
Extract the reusable parts from this code into a shared service or module:
Language: {{language}}
Code:
{{code}}
Target: {{what_to_extract}}
Show t...
Extract the reusable parts from this code into a shared service or module:
Language: {{language}}
Code:
{{code}}
Target: {{what_to_extract}}
Show the extracted module interface and updated calling code.
---
Testing
Generate Unit Tests
Write unit tests for this function:
Language/Framework: {{language}} + {{test_framework}}
Code:
{{code}}
Cover:
- Happy path
- Edge cases
- Error/ex...
Write unit tests for this function:
Language/Framework: {{language}} + {{test_framework}}
Code:
{{code}}
Cover:
- Happy path
- Edge cases
- Error/exception cases
- Boundary values
Testing
Test Coverage Gap Analysis
Here is a function and its existing tests.
Function:
{{function_code}}
Existing tests:
{{test_code}}
What cases are NOT covered? Write the missing ...
Here is a function and its existing tests.
Function:
{{function_code}}
Existing tests:
{{test_code}}
What cases are NOT covered? Write the missing tests.
Testing
Integration Test Design
Design integration tests for this API endpoint:
Endpoint: {{method}} {{path}}
Business logic: {{logic}}
Dependencies: {{dependencies}}
Provide test ...
Design integration tests for this API endpoint:
Endpoint: {{method}} {{path}}
Business logic: {{logic}}
Dependencies: {{dependencies}}
Provide test scenarios and pseudocode or actual test code using {{test_framework}}.
Testing
Load & Stress Test Plan
Design a load test plan for:
Endpoint/feature: {{endpoint}}
Expected normal load: {{normal_rps}}
Peak load target: {{peak_rps}}
SLA: {{response_time_...
Design a load test plan for:
Endpoint/feature: {{endpoint}}
Expected normal load: {{normal_rps}}
Peak load target: {{peak_rps}}
SLA: {{response_time_sla}}
Tool: {{k6 | locust | jmeter | artillery}}
Provide: test scenarios, ramp-up strategy, metrics to track, and pass/fail criteria.
Testing
Contract Testing Design
Design consumer-driven contract tests for this API:
Provider: {{provider_service}}
Consumer: {{consumer_service}}
API contract:
{{api_spec}}
Use Pac...
Design consumer-driven contract tests for this API:
Provider: {{provider_service}}
Consumer: {{consumer_service}}
API contract:
{{api_spec}}
Use Pact or equivalent. Provide: consumer test, provider verification test, and CI integration notes.
Testing
Mock & Stub Strategy
Design a mocking strategy for these dependencies in my tests:
Language/Framework: {{language}} + {{test_framework}}
Dependencies to mock: {{dependenc...
Design a mocking strategy for these dependencies in my tests:
Language/Framework: {{language}} + {{test_framework}}
Dependencies to mock: {{dependencies}}
Code under test:
{{code}}
Show: how to mock each dependency, what to verify vs what to stub, and common pitfalls.
Testing
Test Data Factory Design
Design a test data factory for:
Entity: {{entity}}
ORM/DB: {{orm}}
Variations needed: {{variations}}
Provide a factory/fixture pattern that makes te...
Design a test data factory for:
Entity: {{entity}}
ORM/DB: {{orm}}
Variations needed: {{variations}}
Provide a factory/fixture pattern that makes tests readable and avoids data duplication.
---
Architecture & System Design
System Design Review
Review this system architecture:
{{architecture_description_or_diagram}}
Evaluate:
1. Scalability
2. Single points of failure
3. Data consistency
4....
Review this system architecture:
{{architecture_description_or_diagram}}
Evaluate:
1. Scalability
2. Single points of failure
3. Data consistency
4. Latency concerns
5. Security posture
Suggest improvements with tradeoffs explained.
Architecture & System Design
Technology Choice Evaluation
I need to choose between these options for {{use_case}}:
Option A: {{option_a}}
Option B: {{option_b}}
My constraints:
- Team size: {{team_size}}
- ...
I need to choose between these options for {{use_case}}:
Option A: {{option_a}}
Option B: {{option_b}}
My constraints:
- Team size: {{team_size}}
- Scale expectation: {{scale}}
- Budget: {{budget}}
- Existing stack: {{stack}}
Give a structured comparison and a recommendation.
Architecture & System Design
Microservices Boundary Design
I'm splitting this monolith into microservices.
Domain: {{domain}}
Current modules: {{modules}}
Team structure: {{teams}}
Suggest service boundaries...
I'm splitting this monolith into microservices.
Domain: {{domain}}
Current modules: {{modules}}
Team structure: {{teams}}
Suggest service boundaries using DDD principles.
Highlight potential issues with each boundary choice.
Architecture & System Design
Capacity Planning
Help me with capacity planning for:
Service: {{service}}
Current metrics: {{current_load}} rps, {{avg_latency}} latency, {{cpu_mem}} resource usage
G...
Help me with capacity planning for:
Service: {{service}}
Current metrics: {{current_load}} rps, {{avg_latency}} latency, {{cpu_mem}} resource usage
Growth expectation: {{growth_rate}} over {{timeframe}}
SLA: {{sla}}
Estimate: compute, storage, and bandwidth needs. Identify when to scale and what to scale first.
Architecture & System Design
Domain Model Design (DDD)
Help me design a domain model using DDD for:
Domain: {{domain}}
Core business rules: {{rules}}
Key workflows: {{workflows}}
Identify: aggregates, en...
Help me design a domain model using DDD for:
Domain: {{domain}}
Core business rules: {{rules}}
Key workflows: {{workflows}}
Identify: aggregates, entities, value objects, domain events, bounded contexts, and aggregate boundaries.
Architecture & System Design
CQRS Design
Design a CQRS pattern for this feature:
Feature: {{feature}}
Current approach: {{current}}
Read patterns: {{read_patterns}}
Write patterns: {{write_p...
Design a CQRS pattern for this feature:
Feature: {{feature}}
Current approach: {{current}}
Read patterns: {{read_patterns}}
Write patterns: {{write_patterns}}
Consistency requirement: {{consistency}}
Show: command side, query side, event flow, and synchronization strategy.
Architecture & System Design
Event Sourcing Design
Design an event sourcing implementation for:
Aggregate: {{aggregate}}
Events: {{events}}
Projections needed: {{projections}}
Storage: {{event_store}}...
Design an event sourcing implementation for:
Aggregate: {{aggregate}}
Events: {{events}}
Projections needed: {{projections}}
Storage: {{event_store}}
Provide: event schema, aggregate logic, projection rebuilding strategy, and snapshot approach.
---
Documentation
Generate Code Documentation
Write documentation for this code:
Language: {{language}}
Code:
{{code}}
Format: {{docstring | JSDoc | Swagger | plain markdown}}
Include: purpose,...
Write documentation for this code:
Language: {{language}}
Code:
{{code}}
Format: {{docstring | JSDoc | Swagger | plain markdown}}
Include: purpose, parameters, return values, exceptions, usage example.
Documentation
README Generation
Write a README.md for this project:
Project name: {{name}}
What it does: {{description}}
Tech stack: {{stack}}
How to run it: {{setup_steps}}
Key env...
Write a README.md for this project:
Project name: {{name}}
What it does: {{description}}
Tech stack: {{stack}}
How to run it: {{setup_steps}}
Key environment variables: {{env_vars}}
Make it clear for a developer joining the project cold.
Documentation
ADR (Architecture Decision Record)
Write an ADR (Architecture Decision Record) for this decision:
Decision: {{decision}}
Context: {{context}}
Options considered: {{options}}
Chosen opt...
Write an ADR (Architecture Decision Record) for this decision:
Decision: {{decision}}
Context: {{context}}
Options considered: {{options}}
Chosen option: {{choice}}
Reason: {{rationale}}
Format it as a standard ADR document.
Documentation
Runbook Generation
Write an operational runbook for:
Service: {{service}}
Scenario: {{scenario}} (e.g. deployment, rollback, DB failover)
Steps: {{steps}}
Dependencies:...
Write an operational runbook for:
Service: {{service}}
Scenario: {{scenario}} (e.g. deployment, rollback, DB failover)
Steps: {{steps}}
Dependencies: {{dependencies}}
Include: prerequisites, step-by-step procedure, verification steps, rollback procedure, and escalation path.
Documentation
API Changelog Entry
Write a CHANGELOG entry for this API change:
Version: {{version}}
Breaking changes: {{breaking_changes}}
New features: {{new_features}}
Bug fixes: {{...
Write a CHANGELOG entry for this API change:
Version: {{version}}
Breaking changes: {{breaking_changes}}
New features: {{new_features}}
Bug fixes: {{bug_fixes}}
Deprecations: {{deprecations}}
Format: Keep a Changelog standard. Include migration notes for breaking changes.
Documentation
Technical Design Document (TDD)
Write a Technical Design Document for:
Feature: {{feature}}
Problem it solves: {{problem}}
Proposed approach: {{approach}}
Alternatives considered: {...
Write a Technical Design Document for:
Feature: {{feature}}
Problem it solves: {{problem}}
Proposed approach: {{approach}}
Alternatives considered: {{alternatives}}
Impact on existing systems: {{impact}}
Open questions: {{open_questions}}
Format as a complete TDD ready for team review.
---
Performance Optimization
Backend Performance Audit
Audit this code for performance issues:
Language: {{language}}
Code:
{{code}}
Expected load: {{rps}} requests/sec
Identify bottlenecks and suggest o...
Audit this code for performance issues:
Language: {{language}}
Code:
{{code}}
Expected load: {{rps}} requests/sec
Identify bottlenecks and suggest optimizations with expected impact.
Performance Optimization
Caching Strategy
Design a caching strategy for this use case:
Endpoint/feature: {{feature}}
Data characteristics: {{data_description}}
Cache options available: {{redi...
Design a caching strategy for this use case:
Endpoint/feature: {{feature}}
Data characteristics: {{data_description}}
Cache options available: {{redis | memcached | in-memory | CDN}}
Acceptable staleness: {{ttl_expectation}}
Provide cache key design, TTL recommendation, and invalidation strategy.
Performance Optimization
Async / Queue Strategy
This operation is too slow to do synchronously:
Operation: {{operation_description}}
Current approach: {{current}}
Tech stack: {{stack}}
Redesign us...
This operation is too slow to do synchronously:
Operation: {{operation_description}}
Current approach: {{current}}
Tech stack: {{stack}}
Redesign using async processing / message queues.
Show the new flow and handle failure scenarios.
Performance Optimization
Horizontal vs Vertical Scaling Decision
Help me decide between horizontal and vertical scaling for:
Service: {{service}}
Current bottleneck: {{bottleneck}}
Traffic pattern: {{traffic_patter...
Help me decide between horizontal and vertical scaling for:
Service: {{service}}
Current bottleneck: {{bottleneck}}
Traffic pattern: {{traffic_pattern}}
Stateful or stateless: {{state}}
Cloud provider: {{cloud}}
Provide recommendation with cost and complexity tradeoffs.
Performance Optimization
Connection Pool Tuning
Help me tune the database connection pool for:
Language/ORM: {{language_orm}}
DB type: {{db_type}}
Service instance count: {{instances}}
Avg query du...
Help me tune the database connection pool for:
Language/ORM: {{language_orm}}
DB type: {{db_type}}
Service instance count: {{instances}}
Avg query duration: {{query_duration}}
Peak concurrency: {{concurrency}}
Current config: {{config}}
Recommend: pool size, timeout settings, and overflow strategy.
---
Code Generation
Boilerplate Generator
Generate production-ready boilerplate for:
Type: {{REST API | CRUD service | background job | event handler}}
Language/Framework: {{language_framewor...
Generate production-ready boilerplate for:
Type: {{REST API | CRUD service | background job | event handler}}
Language/Framework: {{language_framework}}
Features needed: {{features}}
Follow these conventions: {{conventions}}
Code Generation
Data Model / Entity
Generate a data model for:
Entity: {{entity_name}}
Fields: {{fields}}
Validations: {{validations}}
Language/ORM: {{language_orm}}
Include: model def...
Generate a data model for:
Entity: {{entity_name}}
Fields: {{fields}}
Validations: {{validations}}
Language/ORM: {{language_orm}}
Include: model definition, validation rules, and basic CRUD methods.
Code Generation
Migration Script
Generate a database migration script for:
DB type: {{db_type}}
Change: {{change_description}}
Current schema: {{current_schema}}
Include: up migrati...
Generate a database migration script for:
DB type: {{db_type}}
Change: {{change_description}}
Current schema: {{current_schema}}
Include: up migration, down migration (rollback), and safety checks.
Code Generation
CLI Tool Generation
Generate a CLI tool for:
Purpose: {{purpose}}
Language: {{language}}
Commands needed: {{commands}}
Input/output: {{io}}
Include: argument parsing, h...
Generate a CLI tool for:
Purpose: {{purpose}}
Language: {{language}}
Commands needed: {{commands}}
Input/output: {{io}}
Include: argument parsing, help text, error handling, and usage examples.
Code Generation
Middleware / Interceptor
Generate a {{middleware | interceptor | filter}} for:
Framework: {{framework}}
Purpose: {{purpose}}
Logic: {{logic}}
Should apply to: {{routes_or_end...
Generate a {{middleware | interceptor | filter}} for:
Framework: {{framework}}
Purpose: {{purpose}}
Logic: {{logic}}
Should apply to: {{routes_or_endpoints}}
Include: implementation, registration, and test example.
Code Generation
Config / Settings Module
Generate a configuration module for:
Language/Framework: {{language_framework}}
Environments: {{environments}}
Config values: {{config_keys}}
Validat...
Generate a configuration module for:
Language/Framework: {{language_framework}}
Environments: {{environments}}
Config values: {{config_keys}}
Validation: {{validation_rules}}
Include: loading from env vars, validation on startup, and typed config object.
---
DevOps & Deployment
Dockerfile Review
Review this Dockerfile:
{{dockerfile}}
App type: {{app_type}}
Environment: {{production | staging}}
Check for:
1. Security issues (running as root,...
Review this Dockerfile:
{{dockerfile}}
App type: {{app_type}}
Environment: {{production | staging}}
Check for:
1. Security issues (running as root, exposed secrets)
2. Image size optimization
3. Layer caching efficiency
4. Missing best practices
DevOps & Deployment
CI/CD Pipeline Design
Design a CI/CD pipeline for:
Project type: {{project_type}}
Stack: {{stack}}
Target platform: {{platform}}
Current pain points: {{pain_points}}
Prov...
Design a CI/CD pipeline for:
Project type: {{project_type}}
Stack: {{stack}}
Target platform: {{platform}}
Current pain points: {{pain_points}}
Provide stages, tools recommendation, and a sample config file.
DevOps & Deployment
Environment Variable Audit
Review how this app handles environment variables and configuration:
{{code_or_config}}
Check for:
- Hardcoded secrets
- Missing validation on start...
Review how this app handles environment variables and configuration:
{{code_or_config}}
Check for:
- Hardcoded secrets
- Missing validation on startup
- Insecure defaults
- Proper separation of environments
DevOps & Deployment
Kubernetes Manifest Review
Review these Kubernetes manifests:
{{manifests}}
App: {{app_description}}
Check for:
1. Resource limits and requests
2. Liveness/readiness probes
3...
Review these Kubernetes manifests:
{{manifests}}
App: {{app_description}}
Check for:
1. Resource limits and requests
2. Liveness/readiness probes
3. Security context (non-root, read-only FS)
4. Secret management
5. Horizontal scaling config
6. Namespace and RBAC setup
DevOps & Deployment
Zero-Downtime Deployment Strategy
Design a zero-downtime deployment strategy for:
App type: {{app_type}}
Current deployment method: {{current}}
DB migration situation: {{db_migrations...
Design a zero-downtime deployment strategy for:
App type: {{app_type}}
Current deployment method: {{current}}
DB migration situation: {{db_migrations}}
Session/state handling: {{state}}
Recommend: blue-green, canary, or rolling — and provide the implementation steps.
DevOps & Deployment
Infrastructure as Code Review
Review this IaC configuration:
Tool: {{terraform | pulumi | cloudformation | cdk}}
Code:
{{iac_code}}
Check for:
- Security misconfigurations
- Hard...
Review this IaC configuration:
Tool: {{terraform | pulumi | cloudformation | cdk}}
Code:
{{iac_code}}
Check for:
- Security misconfigurations
- Hardcoded values that should be variables
- Missing tagging/naming conventions
- Drift risks
- Cost optimization opportunities
DevOps & Deployment
Rollback Plan Design
Design a rollback plan for this deployment:
Service: {{service}}
Change being deployed: {{change}}
DB migrations included: {{migrations}}
Dependencie...
Design a rollback plan for this deployment:
Service: {{service}}
Change being deployed: {{change}}
DB migrations included: {{migrations}}
Dependencies affected: {{dependencies}}
Provide: rollback triggers, step-by-step rollback procedure, data safety considerations, and communication plan.
---
Tech Lead / Architect Prompts
Technical Debt Assessment
Assess the technical debt in this codebase description:
{{codebase_description}}
Team size: {{team_size}}
Age of codebase: {{age}}
Known pain points:...
Assess the technical debt in this codebase description:
{{codebase_description}}
Team size: {{team_size}}
Age of codebase: {{age}}
Known pain points: {{pain_points}}
Provide:
1. Debt classification (design debt, code debt, test debt, infra debt)
2. Priority matrix (impact vs effort)
3. Recommended remediation roadmap
Tech Lead / Architect Prompts
Engineering Standards Document
Write an engineering standards document for a backend team working with {{stack}}.
Cover:
- Code style and formatting
- Git workflow (branching, comm...
Write an engineering standards document for a backend team working with {{stack}}.
Cover:
- Code style and formatting
- Git workflow (branching, commit messages, PR process)
- API design conventions
- Testing requirements
- Security baseline
- Performance expectations
- Documentation requirements
Team context: {{team_context}}
Tech Lead / Architect Prompts
Technical Interview Problem Design
Design a technical interview problem for a {{seniority_level}} backend engineer.
Skills to assess: {{skills}}
Time limit: {{duration}}
Stack: {{stack...
Design a technical interview problem for a {{seniority_level}} backend engineer.
Skills to assess: {{skills}}
Time limit: {{duration}}
Stack: {{stack}}
Include:
- Problem statement
- Sample input/output
- Evaluation rubric
- Follow-up questions for each seniority level
- Red flags to watch for
Tech Lead / Architect Prompts
RFC (Request for Comments)
Write an RFC for this proposed change:
Title: {{title}}
Problem: {{problem}}
Proposed solution: {{solution}}
Alternatives considered: {{alternatives}...
Write an RFC for this proposed change:
Title: {{title}}
Problem: {{problem}}
Proposed solution: {{solution}}
Alternatives considered: {{alternatives}}
Impact: {{impact}}
Rollout plan: {{rollout}}
Make it structured and ready for team review.
Tech Lead / Architect Prompts
Post-Mortem Write-up
Write a blameless post-mortem for this incident:
Incident summary: {{summary}}
Timeline: {{timeline}}
Root cause: {{root_cause}}
Impact: {{impact}}
...
Write a blameless post-mortem for this incident:
Incident summary: {{summary}}
Timeline: {{timeline}}
Root cause: {{root_cause}}
Impact: {{impact}}
Include: detection, response, resolution, lessons learned, and action items.
Tech Lead / Architect Prompts
Sprint / Iteration Planning Advice
Help me plan this sprint:
Team size: {{team_size}}
Sprint duration: {{duration}}
Velocity (last sprint): {{velocity}}
Backlog items to consider:
{{ba...
Help me plan this sprint:
Team size: {{team_size}}
Sprint duration: {{duration}}
Velocity (last sprint): {{velocity}}
Backlog items to consider:
{{backlog}}
Priorities: {{priorities}}
Known risks: {{risks}}
Recommend: what to commit, what to defer, risk mitigations, and team capacity considerations.
Tech Lead / Architect Prompts
Team Onboarding Plan
Create a 30/60/90 day onboarding plan for a new {{role}} joining the team.
Team context: {{team_context}}
Stack: {{stack}}
Key systems: {{systems}}
C...
Create a 30/60/90 day onboarding plan for a new {{role}} joining the team.
Team context: {{team_context}}
Stack: {{stack}}
Key systems: {{systems}}
Current team processes: {{processes}}
Tailor milestones to help them become productive without overwhelming them.
---
Git & Version Control
Commit Message Writing
Write a proper commit message for this change:
Change description: {{change}}
Files modified: {{files}}
Type: {{feat | fix | refactor | chore | docs ...
Write a proper commit message for this change:
Change description: {{change}}
Files modified: {{files}}
Type: {{feat | fix | refactor | chore | docs | test | perf}}
Follow Conventional Commits format. Be specific and clear.
Git & Version Control
Branch Strategy Design
Design a Git branching strategy for:
Team size: {{team_size}}
Release cadence: {{release_cadence}}
Environments: {{environments}}
Current pain points...
Design a Git branching strategy for:
Team size: {{team_size}}
Release cadence: {{release_cadence}}
Environments: {{environments}}
Current pain points: {{pain_points}}
Compare: Gitflow, trunk-based, GitHub Flow.
Recommend one and show the branch structure and merge rules.
Git & Version Control
Merge Conflict Resolution
Help me resolve this merge conflict:
Base branch: {{base_branch}}
Feature branch: {{feature_branch}}
Conflicting file: {{filename}}
Conflict:
{{conf...
Help me resolve this merge conflict:
Base branch: {{base_branch}}
Feature branch: {{feature_branch}}
Conflicting file: {{filename}}
Conflict:
{{conflict_block}}
Context: {{context_of_both_changes}}
Which version is correct, or how should they be merged?
Git & Version Control
Git History Cleanup
I need to clean up my Git history before merging.
Current history:
{{git_log}}
Goal: {{squash | reorder | rewrite messages | split commits}}
Provid...
I need to clean up my Git history before merging.
Current history:
{{git_log}}
Goal: {{squash | reorder | rewrite messages | split commits}}
Provide the exact git commands to achieve this safely.
Git & Version Control
Revert Strategy
I need to revert this change in production:
Commit(s) to revert: {{commits}}
How many other commits happened after it: {{commits_after}}
Is the chang...
I need to revert this change in production:
Commit(s) to revert: {{commits}}
How many other commits happened after it: {{commits_after}}
Is the change in the DB too: {{db_impact}}
Provide the safest revert approach with git commands and any DB rollback steps.
---
Code Understanding & Onboarding
Explain Unfamiliar Code
Explain this code to me as if I'm seeing this codebase for the first time:
Language: {{language}}
Code:
{{code}}
Explain:
1. What it does (plain Eng...
Explain this code to me as if I'm seeing this codebase for the first time:
Language: {{language}}
Code:
{{code}}
Explain:
1. What it does (plain English)
2. Why it's structured this way
3. Key dependencies and what they do
4. Any non-obvious patterns or tricks used
Code Understanding & Onboarding
Map a Codebase / Module
Help me understand the structure of this module:
Language/Framework: {{language}}
Directory structure:
{{directory_tree}}
Key files:
{{key_files_con...
Help me understand the structure of this module:
Language/Framework: {{language}}
Directory structure:
{{directory_tree}}
Key files:
{{key_files_content}}
Provide: a mental map of how the pieces connect, entry points, data flow, and where to look for specific concerns.
Code Understanding & Onboarding
Trace a Request / Data Flow
Trace the complete lifecycle of this request/event:
Entry point: {{entry_point}}
Expected behavior: {{expected}}
Relevant code paths:
{{code}}
Show ...
Trace the complete lifecycle of this request/event:
Entry point: {{entry_point}}
Expected behavior: {{expected}}
Relevant code paths:
{{code}}
Show step-by-step what happens from request to response, including DB calls, external services, and transformations.
Code Understanding & Onboarding
Explain Design Decision
Why is this code written this way? Explain the likely design rationale:
Language: {{language}}
Code:
{{code}}
What problem is this solving? What alt...
Why is this code written this way? Explain the likely design rationale:
Language: {{language}}
Code:
{{code}}
What problem is this solving? What alternatives were likely rejected and why?
Code Understanding & Onboarding
Generate a Glossary
Generate a glossary for this domain/codebase:
Domain: {{domain}}
Key terms found in code/docs:
{{terms}}
For each term, provide: definition, how it'...
Generate a glossary for this domain/codebase:
Domain: {{domain}}
Key terms found in code/docs:
{{terms}}
For each term, provide: definition, how it's used in code, and any synonyms or aliases used.
---
Logging & Observability
Logging Strategy Design
Design a structured logging strategy for:
Service: {{service}}
Language/Framework: {{language_framework}}
Log aggregation tool: {{tool}} (e.g. ELK, D...
Design a structured logging strategy for:
Service: {{service}}
Language/Framework: {{language_framework}}
Log aggregation tool: {{tool}} (e.g. ELK, Datadog, CloudWatch)
Define: log levels usage, required fields in every log, sensitive data masking, correlation ID propagation, and what NOT to log.
Logging & Observability
Logging Review
Review the logging in this code:
{{code}}
Check for:
- Missing logs at critical points
- Over-logging (noise)
- Logging sensitive data (PII, tokens,...
Review the logging in this code:
{{code}}
Check for:
- Missing logs at critical points
- Over-logging (noise)
- Logging sensitive data (PII, tokens, passwords)
- Inconsistent log format
- Wrong log level usage
- Missing correlation/request IDs
Logging & Observability
Metrics & Alerting Design
Design metrics and alerting for:
Service: {{service}}
Key operations: {{operations}}
SLA: {{sla}}
Monitoring tool: {{prometheus | datadog | cloudwatc...
Design metrics and alerting for:
Service: {{service}}
Key operations: {{operations}}
SLA: {{sla}}
Monitoring tool: {{prometheus | datadog | cloudwatch | grafana}}
Define: key metrics (RED: Rate, Errors, Duration), alert thresholds, and runbook links per alert.
Logging & Observability
Distributed Tracing Setup
Design distributed tracing for:
Services involved: {{services}}
Communication: {{rest | grpc | events}}
Tracing tool: {{jaeger | zipkin | datadog | o...
Design distributed tracing for:
Services involved: {{services}}
Communication: {{rest | grpc | events}}
Tracing tool: {{jaeger | zipkin | datadog | opentelemetry}}
Provide: instrumentation approach, span naming convention, what to tag, and sampling strategy.
Logging & Observability
Observability Gap Analysis
Analyze this service for observability gaps:
Service description: {{description}}
Current logging: {{logging}}
Current metrics: {{metrics}}
Current a...
Analyze this service for observability gaps:
Service description: {{description}}
Current logging: {{logging}}
Current metrics: {{metrics}}
Current alerts: {{alerts}}
What would make it hard to debug a production incident? What's missing?
---
Resilience & Rate Limiting
Circuit Breaker Design
Design a circuit breaker for this integration:
Calling service: {{caller}}
Downstream service: {{target}}
Expected failure modes: {{failures}}
Langua...
Design a circuit breaker for this integration:
Calling service: {{caller}}
Downstream service: {{target}}
Expected failure modes: {{failures}}
Language/Framework: {{language_framework}}
Provide: thresholds, states (closed/open/half-open), fallback behavior, and monitoring.
Resilience & Rate Limiting
Retry Strategy Design
Design a retry strategy for:
Operation: {{operation}}
Failure types: {{failure_types}}
Idempotency: {{idempotent: yes | no}}
Max acceptable delay: {{...
Design a retry strategy for:
Operation: {{operation}}
Failure types: {{failure_types}}
Idempotency: {{idempotent: yes | no}}
Max acceptable delay: {{max_delay}}
Provide: retry count, backoff algorithm (fixed/exponential/jitter), dead letter handling, and logging approach.
Resilience & Rate Limiting
Rate Limiter Design
Design a rate limiting system for:
Endpoint/service: {{endpoint}}
Limit type: {{per-user | per-IP | per-API-key | global}}
Limits: {{limit}} requests...
Design a rate limiting system for:
Endpoint/service: {{endpoint}}
Limit type: {{per-user | per-IP | per-API-key | global}}
Limits: {{limit}} requests per {{window}}
Storage: {{redis | in-memory | db}}
Provide: algorithm (token bucket / sliding window / fixed window), implementation approach, headers to return, and response on limit exceeded.
Resilience & Rate Limiting
Bulkhead Pattern Design
Design a bulkhead pattern for this service:
Service: {{service}}
Critical operations: {{critical_ops}}
Non-critical operations: {{non_critical_ops}}
...
Design a bulkhead pattern for this service:
Service: {{service}}
Critical operations: {{critical_ops}}
Non-critical operations: {{non_critical_ops}}
Risk: {{risk_description}}
Show how to isolate thread pools / connection pools to prevent cascade failure.
Resilience & Rate Limiting
Timeout Strategy
Design a timeout strategy for:
Operation: {{operation}}
Downstream dependencies: {{dependencies}}
P99 latency of each dependency: {{latencies}}
User-...
Design a timeout strategy for:
Operation: {{operation}}
Downstream dependencies: {{dependencies}}
P99 latency of each dependency: {{latencies}}
User-facing SLA: {{sla}}
Recommend timeouts at each layer, what to do on timeout, and how to propagate cancellation.
---
Data Validation & Sanitization
Input Validation Design
Design input validation for this API endpoint:
Endpoint: {{method}} {{path}}
Request body/params:
{{schema}}
For each field, define:
- Type and form...
Design input validation for this API endpoint:
Endpoint: {{method}} {{path}}
Request body/params:
{{schema}}
For each field, define:
- Type and format constraints
- Required vs optional
- Business rule validations
- Error messages to return
Data Validation & Sanitization
Validation Code Review
Review the input validation in this code:
Language: {{language}}
Code:
{{code}}
Check for:
- Missing validations
- Validation bypass risks
- Inconsi...
Review the input validation in this code:
Language: {{language}}
Code:
{{code}}
Check for:
- Missing validations
- Validation bypass risks
- Inconsistent error responses
- Validation placed at wrong layer
- Missing sanitization before storage or output
Data Validation & Sanitization
Data Sanitization Strategy
Design a sanitization strategy for user-generated content in:
Feature: {{feature}}
Data types: {{data_types}}
Storage: {{storage}}
Output contexts: {...
Design a sanitization strategy for user-generated content in:
Feature: {{feature}}
Data types: {{data_types}}
Storage: {{storage}}
Output contexts: {{html | sql | shell | json}}
Define: where to sanitize (input vs output), libraries to use, and any allow/deny lists.
Data Validation & Sanitization
File Upload Validation
Design validation and security checks for file uploads in:
Feature: {{feature}}
Allowed file types: {{types}}
Max size: {{max_size}}
Storage: {{local...
Design validation and security checks for file uploads in:
Feature: {{feature}}
Allowed file types: {{types}}
Max size: {{max_size}}
Storage: {{local | s3 | gcs}}
Provide: validation checks (MIME type, extension, content inspection), malware scan approach, and secure storage path design.
---
Event-Driven & Messaging
Event Schema Design
Design event schemas for:
Domain events: {{events}}
Format: {{json | avro | protobuf}}
Consumers: {{consumers}}
For each event: define payload, vers...
Design event schemas for:
Domain events: {{events}}
Format: {{json | avro | protobuf}}
Consumers: {{consumers}}
For each event: define payload, versioning strategy, and mandatory envelope fields (event_id, timestamp, correlation_id, version).
Event-Driven & Messaging
Message Queue Design
Design a message queue architecture for:
Use case: {{use_case}}
Producer: {{producer}}
Consumers: {{consumers}}
Message broker options: {{kafka | rab...
Design a message queue architecture for:
Use case: {{use_case}}
Producer: {{producer}}
Consumers: {{consumers}}
Message broker options: {{kafka | rabbitmq | sqs | redis_streams}}
Provide: topic/queue design, consumer group strategy, dead letter queue, ordering requirements, and idempotency handling.
Event-Driven & Messaging
Saga Pattern Design
Design a Saga for this distributed transaction:
Business process: {{process}}
Services involved: {{services}}
Steps: {{steps}}
Use: {{choreography |...
Design a Saga for this distributed transaction:
Business process: {{process}}
Services involved: {{services}}
Steps: {{steps}}
Use: {{choreography | orchestration}} pattern.
Show: happy path, compensation logic for each failure point, and state tracking.
Event-Driven & Messaging
Outbox Pattern Design
Design an Outbox pattern implementation for:
Service: {{service}}
Events to publish: {{events}}
DB: {{db_type}}
Message broker: {{broker}}
Provide: ...
Design an Outbox pattern implementation for:
Service: {{service}}
Events to publish: {{events}}
DB: {{db_type}}
Message broker: {{broker}}
Provide: outbox table schema, write logic, outbox processor design, and at-least-once delivery guarantee.
Event-Driven & Messaging
Consumer Idempotency
Design idempotent message consumption for:
Consumer service: {{service}}
Message type: {{message_type}}
Processing logic: {{logic}}
Duplicate risk: {...
Design idempotent message consumption for:
Consumer service: {{service}}
Message type: {{message_type}}
Processing logic: {{logic}}
Duplicate risk: {{risk}}
Provide: idempotency key strategy, deduplication store, and what to do on duplicate detection.
---
AI-Assisted Planning
User Story Breakdown
Break down this feature into user stories and tasks:
Feature: {{feature}}
Target users: {{users}}
Business value: {{value}}
Tech stack: {{stack}}
Fo...
Break down this feature into user stories and tasks:
Feature: {{feature}}
Target users: {{users}}
Business value: {{value}}
Tech stack: {{stack}}
Format each story as:
- As a {{user}}, I want {{action}} so that {{benefit}}
- Acceptance criteria
- Technical tasks
- Story points estimate
AI-Assisted Planning
PRD → Technical Tasks
Convert this Product Requirements Document into technical tasks:
PRD:
{{prd}}
For each requirement:
- Identify backend, frontend, DB, and infra work...
Convert this Product Requirements Document into technical tasks:
PRD:
{{prd}}
For each requirement:
- Identify backend, frontend, DB, and infra work
- Flag dependencies between tasks
- Highlight technical risks or open questions
AI-Assisted Planning
Estimation Breakdown
Help me estimate this technical task:
Task: {{task}}
Stack: {{stack}}
Team experience with this area: {{experience}}
Known unknowns: {{unknowns}}
Pr...
Help me estimate this technical task:
Task: {{task}}
Stack: {{stack}}
Team experience with this area: {{experience}}
Known unknowns: {{unknowns}}
Provide: optimistic, realistic, pessimistic estimates with assumptions, risk factors, and suggested spike tasks if uncertainty is high.
AI-Assisted Planning
Technical Spike Definition
Define a time-boxed technical spike for:
Question to answer: {{question}}
Why it's needed: {{reason}}
Time box: {{hours}}
Define: scope, out-of-scop...
Define a time-boxed technical spike for:
Question to answer: {{question}}
Why it's needed: {{reason}}
Time box: {{hours}}
Define: scope, out-of-scope, expected output, success criteria, and how findings will be documented.
AI-Assisted Planning
Feature Flag Strategy
Design a feature flag strategy for rolling out:
Feature: {{feature}}
Risk level: {{risk}}
Target rollout: {{rollout_plan}} (e.g. 5% → 25% → 100%)
Fla...
Design a feature flag strategy for rolling out:
Feature: {{feature}}
Risk level: {{risk}}
Target rollout: {{rollout_plan}} (e.g. 5% → 25% → 100%)
Flag tool: {{launchdarkly | unleash | custom}}
Provide: flag naming, targeting rules, kill switch design, cleanup plan, and metrics to watch during rollout.
---
Dependency & Upgrade Management
Library Upgrade Plan
Plan an upgrade for:
Library: {{library}}
Current version: {{current}}
Target version: {{target}}
Breaking changes in changelog: {{breaking_changes}}...
Plan an upgrade for:
Library: {{library}}
Current version: {{current}}
Target version: {{target}}
Breaking changes in changelog: {{breaking_changes}}
Provide: impact assessment, migration steps, testing checklist, and rollback plan.
Dependency & Upgrade Management
Language/Runtime Upgrade
Plan an upgrade from {{current_version}} to {{target_version}} of {{language_or_runtime}}:
Current stack: {{stack}}
Known breaking changes: {{changes...
Plan an upgrade from {{current_version}} to {{target_version}} of {{language_or_runtime}}:
Current stack: {{stack}}
Known breaking changes: {{changes}}
Test coverage: {{coverage}}
Provide: pre-upgrade checklist, migration steps, compatibility risks, and recommended testing approach.
Dependency & Upgrade Management
Dependency Audit
Audit the dependencies in this project:
Package file:
{{package_file}}
Identify:
- Outdated dependencies (major versions behind)
- Abandoned librari...
Audit the dependencies in this project:
Package file:
{{package_file}}
Identify:
- Outdated dependencies (major versions behind)
- Abandoned libraries (no recent updates/maintenance)
- Duplicated functionality
- Overly heavy libraries for simple needs
- Recommended alternatives
Dependency & Upgrade Management
Vendor Lock-in Assessment
Assess vendor lock-in risk in this architecture:
Current services used: {{services}}
Usage depth: {{usage_description}}
For each vendor: lock-in lev...
Assess vendor lock-in risk in this architecture:
Current services used: {{services}}
Usage depth: {{usage_description}}
For each vendor: lock-in level (Low/Medium/High), switching cost, and mitigation strategy (abstraction layer, alternative options).
---
Incident Response (Live)
Live Incident Diagnosis
LIVE INCIDENT — help me diagnose this:
Service affected: {{service}}
Symptoms: {{symptoms}}
Error rate: {{error_rate}}
Started at: {{time}}
Recent de...
LIVE INCIDENT — help me diagnose this:
Service affected: {{service}}
Symptoms: {{symptoms}}
Error rate: {{error_rate}}
Started at: {{time}}
Recent deployments: {{deployments}}
Recent config changes: {{config_changes}}
What are the most likely causes? Give me a prioritized list and first steps to investigate each.
Incident Response (Live)
Blast Radius Assessment
Assess the blast radius of this incident:
Failing component: {{component}}
Downstream services: {{downstream}}
Upstream callers: {{upstream}}
Data im...
Assess the blast radius of this incident:
Failing component: {{component}}
Downstream services: {{downstream}}
Upstream callers: {{upstream}}
Data impact: {{data_impact}}
What is affected, what is not, and what might degrade next?
Incident Response (Live)
Hotfix Code Review (Urgent)
URGENT — review this hotfix before deploying to production:
Problem it's fixing: {{problem}}
Hotfix code:
{{code}}
Focus on:
1. Does it actually fix...
URGENT — review this hotfix before deploying to production:
Problem it's fixing: {{problem}}
Hotfix code:
{{code}}
Focus on:
1. Does it actually fix the problem?
2. Any new risks introduced?
3. Is it safe to deploy without full test cycle?
4. Any immediate side effects to watch for?
Incident Response (Live)
Customer-Facing Incident Communication
Write a customer-facing status page update for:
Incident: {{incident}}
Current status: {{investigating | identified | monitoring | resolved}}
Impact:...
Write a customer-facing status page update for:
Incident: {{incident}}
Current status: {{investigating | identified | monitoring | resolved}}
Impact: {{impact}}
What we're doing: {{action}}
ETA (if known): {{eta}}
Keep it: honest, non-technical, calm, and avoid blame. Follow status.io style.
---
Concurrency & Race Conditions
Race Condition Detection
Review this code for race conditions:
Language: {{language}}
Concurrent context: {{threads | goroutines | async | workers}}
Code:
{{code}}
Identify:...
Review this code for race conditions:
Language: {{language}}
Concurrent context: {{threads | goroutines | async | workers}}
Code:
{{code}}
Identify: shared mutable state, missing synchronization, TOCTOU issues, and deadlock risks.
Concurrency & Race Conditions
Locking Strategy Design
Design a locking strategy for:
Operation: {{operation}}
Shared resource: {{resource}}
Concurrency level: {{concurrency}}
DB/Cache: {{db}}
Compare: o...
Design a locking strategy for:
Operation: {{operation}}
Shared resource: {{resource}}
Concurrency level: {{concurrency}}
DB/Cache: {{db}}
Compare: optimistic locking, pessimistic locking, distributed lock.
Recommend one and show implementation.
Concurrency & Race Conditions
Async/Concurrency Code Review
Review this concurrent/async code:
Language: {{language}}
Code:
{{code}}
Check for:
- Unhandled promise rejections / goroutine panics
- Goroutine/th...
Review this concurrent/async code:
Language: {{language}}
Code:
{{code}}
Check for:
- Unhandled promise rejections / goroutine panics
- Goroutine/thread leaks
- Improper error propagation in async chains
- Blocking calls in async context
- Starvation risks
Concurrency & Race Conditions
Distributed Lock Design
Design a distributed lock for:
Operation: {{operation}}
Lock store: {{redis | zookeeper | db}}
Lock duration: {{duration}}
Failure scenarios: {{lock_...
Design a distributed lock for:
Operation: {{operation}}
Lock store: {{redis | zookeeper | db}}
Lock duration: {{duration}}
Failure scenarios: {{lock_holder_crashes | network_partition}}
Provide: lock acquisition, release, TTL strategy, and fencing token approach.
---
Multi-Tenancy & SaaS Patterns
Multi-Tenancy Model Design
Design a multi-tenancy model for:
Product type: {{product}}
Scale: {{tenants}} tenants, {{users_per_tenant}} users avg
Isolation requirements: {{data...
Design a multi-tenancy model for:
Product type: {{product}}
Scale: {{tenants}} tenants, {{users_per_tenant}} users avg
Isolation requirements: {{data | compute | both}}
Compare: shared DB/schema, shared DB/separate schema, separate DB per tenant.
Recommend based on requirements and provide migration path.
Multi-Tenancy & SaaS Patterns
Tenant Isolation Review
Review this code for tenant isolation issues:
Multi-tenancy model: {{model}}
Code:
{{code}}
Check for:
- Missing tenant_id filters in queries
- Cros...
Review this code for tenant isolation issues:
Multi-tenancy model: {{model}}
Code:
{{code}}
Check for:
- Missing tenant_id filters in queries
- Cross-tenant data leakage risks
- Insecure tenant resolution (from header/token/URL)
- Missing tenant validation in background jobs
Multi-Tenancy & SaaS Patterns
Subscription & Billing Integration Design
Design a subscription/billing integration for:
Product: {{product}}
Plans: {{plans}}
Billing provider: {{stripe | paddle | chargebee}}
Metering: {{us...
Design a subscription/billing integration for:
Product: {{product}}
Plans: {{plans}}
Billing provider: {{stripe | paddle | chargebee}}
Metering: {{usage_based: yes | no}}
Provide: plan enforcement strategy, webhook handling (payment events), upgrade/downgrade logic, and failed payment handling.
Multi-Tenancy & SaaS Patterns
Per-Tenant Feature Flags
Design a per-tenant feature flag system for:
Product: {{product}}
Feature types: {{beta | paid_tier | experimental}}
Storage: {{db | redis | launchda...
Design a per-tenant feature flag system for:
Product: {{product}}
Feature types: {{beta | paid_tier | experimental}}
Storage: {{db | redis | launchdarkly}}
Admin interface needed: {{yes | no}}
Provide: data model, evaluation logic, caching strategy, and override rules.
---
Knowledge Transfer & Handoff
Service Handoff Document
Write a knowledge transfer document for this service:
Service: {{service}}
What it does: {{description}}
Tech stack: {{stack}}
Key dependencies: {{de...
Write a knowledge transfer document for this service:
Service: {{service}}
What it does: {{description}}
Tech stack: {{stack}}
Key dependencies: {{dependencies}}
Known gotchas: {{gotchas}}
On-call runbook: {{runbook}}
Audience: engineer who has never worked on this service.
Knowledge Transfer & Handoff
Code Walkthrough Prep
Prepare a structured code walkthrough for:
Module/service: {{module}}
Audience: {{audience}} (junior | new joiner | external team)
Duration: {{durati...
Prepare a structured code walkthrough for:
Module/service: {{module}}
Audience: {{audience}} (junior | new joiner | external team)
Duration: {{duration}}
Provide: what to cover in what order, key concepts to explain first, diagrams to prepare, and questions to anticipate.
Knowledge Transfer & Handoff
Bus Factor Analysis
Analyze the bus factor risk in this team/codebase:
Team: {{team}}
Systems: {{systems}}
Knowledge distribution:
{{knowledge_map}}
Identify: high-risk...
Analyze the bus factor risk in this team/codebase:
Team: {{team}}
Systems: {{systems}}
Knowledge distribution:
{{knowledge_map}}
Identify: high-risk single points of knowledge, recommended documentation or pairing to mitigate.
---
## 💡 Usage Tips
**Tip 1 — Be specific with placeholders**
The more specific your `{{context}}`, the better the output. Vague inputs = vague outputs.
**Tip 2 — Chain prompts**
Use "Code Review" → "Refactor" → "Generate Tests" as a pipeline for any new feature.
**Tip 3 — Add constraints**
Append to any prompt: *"We use {{framework}}, follow {{convention}}, target {{environment}}."*
**Tip 4 — Control output verbosity**
Add `"Be concise."` or `"Show only code, no explanation."` to save tokens.
**Tip 5 — Use role framing**
Prepend: *"Act as a senior backend engineer with 10+ years experience."* — consistently improves quality.
**Tip 6 — Incident prompts are time-sensitive**
For Section 22, prepend real data immediately. Don't spend time on formatting under pressure.
**Tip 7 — Combine prompts**
Example: 22.1 (Live Diagnosis) → 23.1 (Race Condition Check) → 22.3 (Hotfix Review) is a full incident pipeline.
SQL Queries
Write a Query from Scratch
Write a SQL query for:
DB type: {{mysql | postgresql | sqlite | mssql | oracle}}
Goal: {{goal}}
Tables involved: {{tables}}
Schemas:
{{schemas}}...
Write a SQL query for:
DB type: {{mysql | postgresql | sqlite | mssql | oracle}}
Goal: {{goal}}
Tables involved: {{tables}}
Schemas:
{{schemas}}
Sample data (optional):
{{sample_data}}
Provide the query and explain each part.
SQL Queries
Optimize a Slow Query
Optimize this slow SQL query:
DB type: {{db_type}}
Query:
{{query}}
Schema:
{{schema}}
Current execution time: {{exec_time}}...
Optimize this slow SQL query:
DB type: {{db_type}}
Query:
{{query}}
Schema:
{{schema}}
Current execution time: {{exec_time}}
EXPLAIN / EXPLAIN ANALYZE output:
{{explain_output}}
Identify what's slow and provide an optimized version with explanation.
SQL Queries
Rewrite Query Using Joins
Rewrite this query to use proper JOINs instead of subqueries or multiple queries:
DB type: {{db_type}}
Current query:
{{query}}...
Rewrite this query to use proper JOINs instead of subqueries or multiple queries:
DB type: {{db_type}}
Current query:
{{query}}
Schema:
{{schema}}
Goal: improve readability and performance.
SQL Queries
Aggregation & Grouping Query
Write an aggregation query for:
DB type: {{db_type}}
Goal: {{goal}} (e.g. total sales per region per month, top 10 products by revenue)
Tables:
{{tables_and_schemas}}...
Write an aggregation query for:
DB type: {{db_type}}
Goal: {{goal}} (e.g. total sales per region per month, top 10 products by revenue)
Tables:
{{tables_and_schemas}}
Filters: {{filters}}
Output columns: {{output}}
Use: GROUP BY, HAVING, window functions if appropriate.
SQL Queries
Window Functions
Write a query using window functions for:
DB type: {{db_type}}
Goal: {{goal}} (e.g. running total, rank per group, lag/lead comparison, moving average)...
Write a query using window functions for:
DB type: {{db_type}}
Goal: {{goal}} (e.g. running total, rank per group, lag/lead comparison, moving average)
Table:
{{schema}}
Sample data:
{{sample_data}}
Show the query and explain which window function is used and why.
SQL Queries
CTE (Common Table Expression) Design
Rewrite or write this query using CTEs for readability:
DB type: {{db_type}}
Goal: {{goal}}
Current query (if any):
{{query}}...
Rewrite or write this query using CTEs for readability:
DB type: {{db_type}}
Goal: {{goal}}
Current query (if any):
{{query}}
Schema:
{{schema}}
Break into logical named steps using WITH clauses.
SQL Queries
Pagination Query
Write an efficient pagination query for:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Sort by: {{sort_column}}...
Write an efficient pagination query for:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Sort by: {{sort_column}}
Page size: {{page_size}}
Compare offset-based vs keyset/cursor-based pagination.
Provide both versions and explain when to use each.
SQL Queries
Full-Text Search Query
Write a full-text search query for:
DB type: {{db_type}}
Table: {{table}}
Searchable columns: {{columns}}
Search input: {{search_term}}...
Write a full-text search query for:
DB type: {{db_type}}
Table: {{table}}
Searchable columns: {{columns}}
Search input: {{search_term}}
Use native FTS features. Include: index setup, ranking by relevance, partial match handling.
SQL Queries
Upsert (Insert or Update)
Write an upsert query for:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Conflict key: {{conflict_column}}...
Write an upsert query for:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Conflict key: {{conflict_column}}
On conflict action: {{update_columns | ignore}}
Handle: concurrency safety and return the affected row.
SQL Queries
Bulk Insert / Batch Operations
Write a bulk insert query for:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Batch size: {{batch_size}}...
Write a bulk insert query for:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Batch size: {{batch_size}}
Data source: {{array | file | another_table}}
Include: conflict handling, transaction wrapping, and performance tips for large datasets.
SQL Queries
Recursive Query (Hierarchical Data)
Write a recursive query for:
DB type: {{db_type}}
Goal: {{goal}} (e.g. org chart traversal, category tree, bill of materials)...
Write a recursive query for:
DB type: {{db_type}}
Goal: {{goal}} (e.g. org chart traversal, category tree, bill of materials)
Table:
{{schema}}
Starting node: {{start}}
Direction: {{top-down | bottom-up}}
Use recursive CTE. Show query and explain the base + recursive case.
SQL Queries
Soft Delete Query Patterns
Write query patterns for a soft delete implementation:
DB type: {{db_type}}
Table: {{table}}
Soft delete column: {{deleted_at | is_deleted}}...
Write query patterns for a soft delete implementation:
DB type: {{db_type}}
Table: {{table}}
Soft delete column: {{deleted_at | is_deleted}}
Provide:
1. Soft delete statement
2. Restore statement
3. SELECT that excludes deleted rows
4. Index recommendation for performance
5. Purge old deleted records query
SQL Queries
Date & Time Query Patterns
Write date/time queries for:
DB type: {{db_type}}
Table: {{table}}
Goal: {{goal}} (e.g. records in last 30 days, group by week, find gaps in date series)...
Write date/time queries for:
DB type: {{db_type}}
Table: {{table}}
Goal: {{goal}} (e.g. records in last 30 days, group by week, find gaps in date series, timezone conversion)
Date column: {{column}}
Timezone: {{timezone}}
Provide query with explanation of date functions used.
SQL Queries
Query Explain Plan Analysis
Analyze this query execution plan:
DB type: {{db_type}}
Query:
{{query}}
EXPLAIN output:
{{explain_output}}...
Analyze this query execution plan:
DB type: {{db_type}}
Query:
{{query}}
EXPLAIN output:
{{explain_output}}
Identify:
1. Sequential scans that should use indexes
2. Nested loop problems
3. Sort operations on large datasets
4. Missing index opportunities
5. Estimated vs actual row count mismatches
Suggest concrete fixes.
SQL Queries
Index Design for a Query
Design optimal indexes for this query:
DB type: {{db_type}}
Query:
{{query}}
Table schema:
{{schema}}...
Design optimal indexes for this query:
DB type: {{db_type}}
Query:
{{query}}
Table schema:
{{schema}}
Current indexes:
{{existing_indexes}}
Recommend: which indexes to add, composite index column order, partial indexes if applicable, and indexes to drop.
SQL Queries
Stored Procedure / Function
Write a stored procedure or function for:
DB type: {{db_type}}
Goal: {{goal}}
Input parameters: {{params}}
Return: {{return_type}}...
Write a stored procedure or function for:
DB type: {{db_type}}
Goal: {{goal}}
Input parameters: {{params}}
Return: {{return_type}}
Business logic:
{{logic}}
Include: error handling, transaction management, and usage example.
SQL Queries
Data Migration Query
Write a data migration query for:
DB type: {{db_type}}
Migration goal: {{goal}} (e.g. backfill a new column, normalize a table, merge two tables)...
Write a data migration query for:
DB type: {{db_type}}
Migration goal: {{goal}} (e.g. backfill a new column, normalize a table, merge two tables)
Source table/schema:
{{source}}
Target table/schema:
{{target}}
Row count estimate: {{rows}}
Provide: migration query, validation query to verify results, and safe rollback query.
SQL Queries
Cross-Table Report Query
Write a report query that joins multiple tables:
DB type: {{db_type}}
Report goal: {{goal}}
Tables and schemas:
{{schemas}}...
Write a report query that joins multiple tables:
DB type: {{db_type}}
Report goal: {{goal}}
Tables and schemas:
{{schemas}}
Filters: {{filters}}
Output columns: {{output}}
Sort: {{sort}}
Optimize for readability. Use CTEs if the logic is complex.
SQL Queries
Detect Duplicate Records
Write a query to detect and optionally deduplicate records in:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}...
Write a query to detect and optionally deduplicate records in:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Duplicate definition: {{columns_that_define_a_duplicate}}
Provide:
1. Query to find duplicates
2. Query to keep only one record per group (specify which: first/last/by ID)
3. Safe deletion query
SQL Queries
JSON Column Query
Write a query to work with JSON data stored in a column:
DB type: {{db_type}}
Table: {{table}}
JSON column: {{column}}...
Write a query to work with JSON data stored in a column:
DB type: {{db_type}}
Table: {{table}}
JSON column: {{column}}
Goal: {{extract_field | filter_by_value | aggregate | update_nested | index_json_field}}
Use native JSON operators/functions. Include indexing recommendations if filtering.
SQL Queries
Pivot / Crosstab Query
Write a pivot (crosstab) query to transform rows into columns:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}...
Write a pivot (crosstab) query to transform rows into columns:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Row key: {{row_identifier}}
Pivot column (values become column headers): {{pivot_column}}
Value column: {{value_column}}
Aggregation: {{sum | count | avg | max}}
Sample input and expected output:
{{sample}}
Use native PIVOT syntax or CASE-based approach depending on the DB.
SQL Queries
Gap Detection Query
Find gaps or missing values in a sequence or time series:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}...
Find gaps or missing values in a sequence or time series:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Sequence/date column: {{column}}
Expected interval: {{interval}} (e.g. daily, every ID, every hour)
Return: missing values with context (what's before and after each gap).
SQL Queries
Query Refactoring (Simplification)
Refactor this SQL query to be simpler and more maintainable:
DB type: {{db_type}}
Current query:
{{query}}...
Refactor this SQL query to be simpler and more maintainable:
DB type: {{db_type}}
Current query:
{{query}}
Issues: {{too_nested | redundant_subqueries | repeated_logic | hard_to_read}}
Rewrite using CTEs, cleaner joins, or window functions where appropriate.
Don't change the result — only improve the structure.
SQL Queries
Deadlock Investigation Query
Help me investigate a deadlock in my DB:
DB type: {{db_type}}
Transactions involved:
Transaction A:
{{query_a}}...
Help me investigate a deadlock in my DB:
DB type: {{db_type}}
Transactions involved:
Transaction A:
{{query_a}}
Transaction B:
{{query_b}}
Tables affected: {{tables}}
Explain: why the deadlock occurs, which lock order causes it, and how to rewrite the queries to avoid it.
SQL Queries
Permissions & Row-Level Security
Design row-level security for:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Access rule: {{rule}}...
Design row-level security for:
DB type: {{db_type}}
Table: {{table}}
Schema: {{schema}}
Access rule: {{rule}} (e.g. users can only see their own tenant's rows)
User identifier available: {{session_variable | jwt_claim | app_param}}
Provide: RLS policy definition, enabling command, and test queries to verify it works.
SQL Queries
Explain a SQL Query
Explain this SQL query in plain English:
{{query}}
Schema context:
{{schema}}...
Explain this SQL query in plain English:
{{query}}
Schema context:
{{schema}}
Include:
1. What it returns step by step
2. How each JOIN works
3. What the WHERE/HAVING/GROUP BY does
4. Any non-obvious behavior or edge cases
SQL Queries
Write a JOIN Query
Write a SQL query that joins these tables:
DB type: {{db_type}}
Tables and their relationships:
{{tables_and_relationships}}...
Write a SQL query that joins these tables:
DB type: {{db_type}}
Tables and their relationships:
{{tables_and_relationships}}
Schema:
{{schema}}
What to return: {{columns_needed}}
Filter conditions: {{conditions}}
Join type needed: {{inner | left | right | full | cross}}
Explain the join logic used.
SQL Queries
Subquery vs CTE vs JOIN — Best Approach
I need to write a query for this use case:
DB type: {{db_type}}
Schema:
{{schema}}
Requirement: {{requirement}}...
I need to write a query for this use case:
DB type: {{db_type}}
Schema:
{{schema}}
Requirement: {{requirement}}
Compare approaches: subquery vs CTE vs JOIN.
Show all three versions and recommend the best one for readability and performance.
SQL Queries
Trigger Design
Write a SQL trigger for:
DB type: {{db_type}}
Table: {{table}}
Event: {{INSERT | UPDATE | DELETE}} — {{BEFORE | AFTER}}...
Write a SQL trigger for:
DB type: {{db_type}}
Table: {{table}}
Event: {{INSERT | UPDATE | DELETE}} — {{BEFORE | AFTER}}
Purpose: {{purpose}} (e.g. audit log, enforce constraint, sync table)
Provide trigger code and explain any risks (performance, cascades, recursion).
SQL Queries
SQL Injection Prevention Review
Review this SQL code for injection vulnerabilities:
Language/DB: {{language}} + {{db_type}}
Code:
{{code}}...
Review this SQL code for injection vulnerabilities:
Language/DB: {{language}} + {{db_type}}
Code:
{{code}}
Identify:
- String concatenation in queries
- Unparameterized inputs
- Dynamic ORDER BY / table names risks
- ORM misuse that bypasses protection
Rewrite using parameterized queries / prepared statements.
SQL Queries
Reporting Query (Complex Business Report)
Write a SQL query for this business report:
DB type: {{db_type}}
Schema:
{{schema}}
Report: {{report_name}}
Metrics needed: {{metrics}}...
Write a SQL query for this business report:
DB type: {{db_type}}
Schema:
{{schema}}
Report: {{report_name}}
Metrics needed: {{metrics}}
Dimensions: {{dimensions}} (group by fields)
Filters: {{filters}}
Date range: {{date_range}}
Sorting: {{sort}}
Optimize for readability — use CTEs, add comments per section.
SQL Queries
Compare Two Result Sets
Write a SQL query to compare two result sets and find differences:
DB type: {{db_type}}
Table/query A: {{source_a}}
Table/query B: {{source_b}}...
Write a SQL query to compare two result sets and find differences:
DB type: {{db_type}}
Table/query A: {{source_a}}
Table/query B: {{source_b}}
Key to join on: {{key}}
Find:
- Rows in A but not in B
- Rows in B but not in A
- Rows in both but with different values in: {{columns_to_compare}}
SQL Queries
Materialized View / Summary Table Design
Design a materialized view or summary table for:
DB type: {{db_type}}
Source tables:
{{schema}}
Report/query it should accelerate: {{query}}...
Design a materialized view or summary table for:
DB type: {{db_type}}
Source tables:
{{schema}}
Report/query it should accelerate: {{query}}
Refresh strategy: {{on_commit | scheduled | manual}}
Provide: CREATE MATERIALIZED VIEW statement (or equivalent), refresh job, and index recommendations.
SQL Queries
Hierarchical / Tree Data Query
Query hierarchical data stored in:
DB type: {{db_type}}
Structure: {{adjacency_list | nested_set | closure_table | ltree}}
Schema:
{{schema}}...
Query hierarchical data stored in:
DB type: {{db_type}}
Structure: {{adjacency_list | nested_set | closure_table | ltree}}
Schema:
{{schema}}
Goal: {{fetch_tree | find_ancestors | find_descendants | calculate_depth | move_subtree}}
Starting node: {{node}}
Provide the query and explain the approach.