惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
M
MIT News - Artificial intelligence
D
Docker
S
SegmentFault 最新的问题
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
C
Check Point Blog
GbyAI
GbyAI
美团技术团队
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
5 AI Prompts That Get You Production-Ready Code Every Tim...
Musfique Has · 2026-05-19 · via DEV Community

If you've ever typed "write me a REST API" into
ChatGPT and got back something you had to completely
rewrite — this post is for you.

The problem isn't the AI. It's the prompt.

After testing 200+ prompts across Claude, ChatGPT,
and Gemini, I found one framework that consistently
produces production-ready code: CRTSE.

What is CRTSE?

Every great AI prompt has 5 parts:

  • C — Context: What project/situation you're in
  • R — Role: What expert the AI should act as
  • T — Task: Exactly what you want done
  • S — Standards: Quality constraints and requirements
  • E — Example: A complete ready-to-use prompt

Here are 5 prompts built with this framework
that I use every week:


Prompt 1 — REST API Endpoint Generator

The problem it solves: You need a complete,
production-ready API endpoint but don't want to
write all the boilerplate from scratch.

Copy this prompt:

You are a senior Node.js backend engineer with
10+ years of experience. Create a complete POST
/api/users endpoint in TypeScript using Express +
Zod validation + Prisma ORM + JWT auth middleware.
Return full code for routes/users.ts and
middleware/auth.ts. Handle duplicate email (409),
invalid input (400), and server errors (500).
Include JSDoc comments. No external dependencies
beyond Express, Zod, Prisma, and jsonwebtoken.

Why it works: The role assignment ("senior
Node.js backend engineer") activates the model's
most relevant knowledge. The standards section
("no external dependencies") prevents bloated
output. The error handling specification forces
production-level thinking.

Result: Full working code in one shot. No
rewriting needed.


Prompt 2 — Memory Leak Detector

The problem it solves: Your Node.js service
memory grows over time and you can't find why.

Copy this prompt:

You are a Node.js memory profiling expert
specializing in V8 heap analysis and garbage
collection. Review this code: [paste your code].
Identify: 1) All memory leak sources with exact
line references, 2) Why V8 GC cannot collect
them, 3) Fixed version of each leaky function
with before/after comparison, 4) Exact commands
to profile with --inspect and take heap snapshots,
5) How to set up memory monitoring alerts in
production.

Why it works: Asking for "exact line references"
forces precision. Asking for "before/after
comparison" ensures you get actionable fixes,
not just analysis.

Result: I used this last week and found 3
event listener leaks in 2 minutes that I had
been chasing for hours.


Prompt 3 — SQL Query Performance Debugger

The problem it solves: Your database queries
are running slowly in production and you don't
know why.

Copy this prompt:

You are a PostgreSQL performance engineer.
Here is my slow query and EXPLAIN ANALYZE
output: [paste query + EXPLAIN output].
Provide: 1) Identified bottlenecks (seq scans,
missing indexes, bad joins), 2) CREATE INDEX
statements to add, 3) Optimized query rewrite,
4) Expected performance improvement percentage,
5) Any schema changes recommended. Target
sub-100ms execution time.

Why it works: Giving the AI the EXPLAIN
ANALYZE output is the key. It stops the AI
from guessing and forces it to analyze your
actual query plan.

Result: Cut a 4-second query down to 60ms
using the indexes this prompt recommended.


Prompt 4 — Security Vulnerability Auditor

The problem it solves: You want a security
review of your backend before pushing to
production.

Copy this prompt:

You are an application security engineer with
OWASP expertise. Security audit this code:
[paste code]. For each vulnerability: 1) OWASP
Top 10 category, 2) Severity rating
(Critical/High/Medium/Low), 3) Exact vulnerable
line with explanation, 4) Fixed code snippet.
End with a security hardening checklist.
Priority order: SQL injection, auth bypass,
sensitive data exposure, broken access control.

Why it works: The OWASP category requirement
forces structured output. The severity rating
tells you what to fix first. The priority order
at the end means critical issues always surface
first.

Result: Found a JWT verification bypass in
my code that would have been a critical
production vulnerability.


Prompt 5 — Code Refactoring Planner

The problem it solves: You inherited legacy
code and need a clear refactoring plan without
breaking everything.

Copy this prompt:

You are a software architect who applies SOLID
principles and clean code practices. Analyze
this code for code smells: [paste code]. For
each smell: 1) Formal name (e.g. Long Method,
God Class), 2) SOLID principle violated,
3) Refactored version using the appropriate
design pattern, 4) Risk level of refactoring
(High/Medium/Low). Prioritize smells that will
cause the most maintenance pain in 6 months.

Why it works: Asking for "formal names"
gives you vocabulary to discuss with your team.
The "6 months" framing forces the AI to think
about long-term maintainability, not just
cosmetic fixes.

Result: Turned a 400-line God Class into
4 focused services with clear responsibilities.


The Pattern Behind All 5 Prompts

Look at what every prompt above has in common:

Specific expert role — not just "you are
an expert" but "you are a PostgreSQL performance
engineer"

Numbered output format — forces structured,
scannable responses

Quality constraints — sub-100ms target,
OWASP categories, severity ratings

Edge case handling — duplicate emails,
server errors, null inputs

Actionable deliverable — not analysis,
but working code or specific commands

This is the CRTSE framework and it works across
Claude, ChatGPT, Gemini, and GitHub Copilot.


Want All 50?

I packaged 50 of these prompts into a PDF
covering 5 categories:

→ Code Generation (10 prompts)
→ Debugging (10 prompts)
→ Code Review (10 prompts)
→ Documentation (10 prompts)
→ Refactoring (10 prompts)

Each prompt follows the full CRTSE framework
with a complete copy-paste ready example.

Get the full pack here → Ai Prompts for Developers


What's the best AI prompt you've used for
coding? Drop it in the comments — I read
every one. 👇