Senior developers value brevity, clarity, and production‑ready code. This pack gives you ready‑to‑paste prompts that make AI act like a seasoned engineer: concise solutions, minimal boilerplate, and pragmatic trade‑offs. Copy a prompt, replace the placeholders, and feed it to your LLM. Use the “Copy” buttons to grab the exact text without manual selection.
Write a single-file Express.js endpoint that:
- Listens on [PORT]
- Handles POST /[RESOURCE] with JSON body
- Validates fields [FIELD1], [FIELD2] using Joi
- Returns 201 with the created object or 400 with errors
Include only necessary imports and export the app. No extra comments.
When you need a quick API stub without scaffolding a whole project.
Generate a functional React component named [ComponentName] that:
- Accepts props {title:string, onClick:()=>void}
- Uses Tailwind for styling (simple button)
- Returns a button with the title and onClick wired
- Export default the component. No extra wrappers.
Perfect for UI tickets that require a single, styled component.
Write a Python script that reads a CSV at "[INPUT_PATH]" and prints the top 5 rows as JSON.
- Use pandas for reading
- No argparse, just hard‑code the path variable
- Output should be pretty‑printed.
Great for quick data‑exploration tasks.
Create a pre‑commit hook script that:
- Runs "npm run lint"
- Blocks commit if lint exits non‑zero
- Prints a concise red error message
Place the script in .git/hooks/pre-commit and make it executable.
Use when you need a safety net without adding heavy CI.
Write a PostgreSQL upsert statement for table "[TABLE]" with columns (id, name, value).
- Insert values ([ID], '[NAME]', [VALUE])
- On conflict (id) do update set name = EXCLUDED.name, value = EXCLUDED.value
- Return the inserted/updated row.
When you need an atomic insert‑or‑update in a single line.
Review the following Python module and list any imports that are never used. Return a JSON array of import names.
Run after copy‑pasting a file to clean up bloat.
Given this JS loop:
for(let i=0;i<arr.length;i++){ if(arr[i]===target){return i;}}
Suggest a more idiomatic, O(n) alternative using built‑in methods. Return only the new code.
When you suspect a loop can be replaced by Array.prototype.findIndex.
Analyze the following TypeScript function and point out any implicit any, unsafe casts, or missing return types. Respond with a minimal patch diff.
Use before merging to enforce strict typing.
Inspect this Express middleware code and tell if it correctly sets:
- Content‑Security‑Policy
- X‑Frame‑Options
- Referrer‑Policy
List missing or mis‑configured headers in a bullet list.
Quick security sanity check for new services.
Given the CSS snippet below, rewrite it to achieve the same visual result with lower specificity (avoid !important). Return only the revised CSS.
When your stylesheet gets tangled and you need a cleaner cascade.
Provide a minimal Java program that triggers the following exception stack trace:
[PASTE_TRACE]
Include only the class and method needed to reproduce it.
Helps isolate the bug in a sandbox.
Given this Node.js server code, identify patterns that could cause a memory leak (e.g., event listeners, global caches). Return a JSON with file line numbers and suggestions.
Run after noticing growing RSS.
Explain why the regex /[A-Z]+[0-9]?/g fails to match "ABC123" as intended. Provide a corrected version and a one‑line test case in JavaScript.
When regexes bite you unexpectedly.
Spot the bug in this async function:
async function fetchAll(urls){ return urls.map(u=>fetch(u).then(r=>r.json())); }
Explain why it returns an array of promises and give the corrected implementation.
Common mistake when mixing map with async.
Given this Dockerfile excerpt, suggest the minimal change to fix the "permission denied" error on line 7 without altering the base image.
Quick fix for CI pipeline breaks.
For a product catalog with filters, pagination, and occasional bulk updates, list pros and cons of REST vs GraphQL. Output a table with columns: Aspect, REST, GraphQL.
Use during early design meetings.
Provide a naming guideline for microservices in a polyglot environment. Include examples for auth, billing, and notification services.
Helps keep repo names consistent.
Sketch a three‑stage GitHub Actions workflow for a Node library:
1. Lint & test on push
2. Build on PR merge
3. Publish to npm on tag
Show only the yaml steps, no comments.
When you want a lean CI without extra plugins.
Outline a zero‑downtime migration plan from MySQL 5.7 to 8.0 for a table with 10M rows. Include steps, risk mitigations, and a rollback checklist.
For production upgrades that can’t afford downtime.
Define a simple cache‑key scheme for user profile data that expires after 5 minutes or on profile update. Provide pseudo‑code for get/set and invalidation.
When you need fast, consistent caching with minimal churn.
List five logging conventions for a Go service (e.g., structured JSON, log levels). Include a short code snippet showing a log entry for an error with request ID.
Standardize observability across services.
Write a rollout plan for a new “dark mode” flag using LaunchDarkly:
- Percentage ramp‑up steps
- Monitoring metrics
- Rollback trigger
Present as a bullet list.
When you need a controlled release.
Draft a versioning policy for a public JSON API. Include URL versioning vs header versioning, deprecation timeline, and client communication template.
Helps keep external developers happy.
Compare S3 Standard, S3 Infrequent Access, and Glacier for storing log files that are queried weekly for 90 days then archived. Provide a table with cost per GB and retrieval latency.
When budgeting storage tiers.
Explain when to prefer edge (CDN) HTML rendering over origin server rendering for a marketing site. List three criteria and give a concise recommendation.
Guides performance decisions.