PROMPT CATEGORY

Coding & Debugging prompts

Practical coding & debugging prompts tested with useful AI apps.

Code

Find the slow thing before optimising

This is slow: {{describe symptom, e.g. endpoint takes 4s at p95}}. Here's the code and what I know: {{paste code, query plans, timings, data volumes}}. Don't optimise yet. First: …

Code

Design review before you write the service

Review this design before I build it: {{paste design or describe: what it does, data model, endpoints, dependencies, expected scale}}. Attack it in this order: 1. FAILURE MODES — …

Code

Write the SQL, then explain what it will cost

Write the query for this question: {{describe what you need to know}}. Schema: {{paste DDL or table and column list with row counts}} Database: {{engine and version}} Requirement…

Code

Convert a script into something maintainable

This script works but it's about to become important: {{paste script}}. Harden it without over-engineering: 1. Name the failure modes it currently has — what happens on a network …

Code

Write the docs the next engineer needs

Write documentation for the code below, for an engineer who joins in six months. Structure: 1. WHAT AND WHY — what this does and the problem it exists to solve. Include the constr…

Code

Understand an unfamiliar codebase fast

I've just been dropped into this codebase and need to ship a change to {{area}} this week. Given the files below, produce an orientation doc: 1. What this system does, in two sent…

Code

Write the tests that would have caught the bug

Here's a bug that reached production, and the code around it. 1. Write the failing test that reproduces it at the smallest useful level (unit if the logic is pure, integration if …

Code

Security pass on code that touches user data

Security-review the code below. It handles {{describe data and who can reach it}}. Check specifically: 1. AUTHZ — is every object access scoped to the caller's tenant and role, or…

Code

Refactor without changing behaviour

Refactor the code below. The behaviour must not change, including its bugs, unless I approve the change. Process: 1. First, describe the current behaviour precisely, including edg…

Code

Debug the thing that only fails in production

This works locally and fails in production. Symptoms: {{describe, including frequency and pattern}}. Environment differences I know of: {{list}}. Logs: {{paste}}. Work the problem…