AI coding assistants are good at writing code, but vague prompts produce vague work. Strong prompts define context, expected behavior, constraints, validation and a clear output contract.
The 100 prompts are reusable templates for Claude, GPT and Gemini. Keep the engineering requirements constant while changing the model. Replace bracketed fields with your project details.
They are model-agnostic. Claude, GPT and Gemini differ in style and tool support, but the core pattern stays the same: define success, provide relevant context, constrain changes and require verification.
THE AI CODING PROMPT FORMULA

How to Use These Prompts
- Copy the prompt and replace every bracketed placeholder.
- Paste the smallest relevant amount of code, not your entire repository by default.
- Include exact error messages, expected behavior and actual behavior for debugging.
- Tell the model what it is not allowed to change.
- Ask for tests or a verification step whenever the task can break existing behavior.
- Use the same prompt against Claude, GPT and Gemini if you want to compare coding quality fairly.
For coding agents, prompts become even more useful when paired with good context, explicit tool permissions and evaluation. See our AI agents guide, context engineering guide, AI coding-agent security guide and model routing guide.
Coding & Software Engineering
1. Debug a Python Error
Act as a senior Python engineer. Debug this error: [error]. Context: [code and traceback]. Output: identify the root cause, give the smallest safe fix, return corrected code, and add three regression tests.
2. Review a Codebase
Act as a staff engineer. Review this codebase: [files or repository summary]. Output: rank the ten biggest correctness, security, performance and maintainability issues and give one concrete fix for each.
3. Refactor Without Breaking APIs
Act as a senior software architect. Refactor [code]. Preserve all public APIs and behavior. Output: replacement code, key changes, compatibility risks and tests that prove behavior is preserved.
4. Find a Race Condition
Act as a concurrency specialist. Investigate this suspected race condition: [code and symptoms]. Trace the shared state, interleavings and failure path. Output: root cause, minimal fix and concurrency tests.
5. Fix a Failing Test
Act as a debugging engineer. Fix this failing test: [test and failure]. Determine whether the bug is in the test or implementation. Output: diagnosis, patch and tests for the failure plus one related edge case.
6. Implement a Feature
Act as a senior developer. Implement [feature] in [project]. Context: [architecture]. Constraints: [constraints]. Output: implementation plan, changed files, code, tests and any migration steps.
7. Complete TODOs Safely
Act as a maintainer. Implement these TODOs: [list]. Preserve existing behavior and style. Output: code changes, assumptions, tests and any TODO that should remain because requirements are unclear.
8. Explain Complex Code
Act as a senior engineer teaching a teammate. Explain this code: [code]. Trace input to output, identify side effects and hidden assumptions, then summarize the architecture in plain language.
9. Find the Smallest Fix
Act as a production engineer. Find the smallest safe change for this bug: [bug]. Do not refactor unrelated code. Output: root cause, minimal patch, regression test and why the patch is safe.
10. Generate Production-Ready Code
Act as a senior production engineer. Build [component]. Requirements: [requirements]. Output: implementation with validation, error handling, logging, tests and explicit assumptions. Avoid placeholder logic.
Code Review & Quality
11. Security Code Review
Act as an application security engineer. Review this code: [code]. Find authentication, authorization, injection, secret-handling, input-validation and data-exposure risks. Rank severity and return concrete fixes.
12. Performance Review
Act as a performance engineer. Review [code/system]. Identify CPU, memory, I/O, database and network bottlenecks. Output: likely bottleneck, evidence, fix, tradeoff and how to benchmark it.
13. Maintainability Review
Act as a staff engineer. Review [code] for maintainability. Identify coupling, duplication, unclear boundaries, naming problems and risky abstractions. Rank issues by long-term cost.
14. Find Hidden Bugs
Act as an adversarial code reviewer. Try to break this code: [code]. Explore nulls, empty inputs, concurrency, malformed data, retries, timeouts and boundary cases. Return reproducible failure cases and fixes.
15. Review a Pull Request
Act as a pragmatic senior reviewer. Review this PR: [diff or summary]. Focus only on correctness, security, reliability and regressions. Output: blocking issues, non-blocking issues, questions and approval recommendation.
16. Review Error Handling
Act as a reliability engineer. Review error handling in [code]. Find swallowed exceptions, incorrect retries, ambiguous errors and missing cleanup. Return improved patterns and tests.
17. Review Type Safety
Act as a strongly typed language expert. Review [code] for unsafe types, implicit coercion, nullable paths and weak interfaces. Return specific type improvements without unnecessary complexity.
18. Review API Design
Act as a backend architect. Review this API design: [routes/schema]. Evaluate consistency, resource modeling, status codes, validation, versioning and error contracts.
19. Review Database Access
Act as a database engineer. Review this data-access layer: [code]. Look for N+1 queries, transactions, locking, indexing and connection-management issues. Return fixes and test ideas.
20. Set a Quality Gate
Act as an engineering manager. Define a code-quality checklist for [project]. Include correctness, tests, security, performance, observability and maintainability with pass/fail criteria.
Debugging & Troubleshooting
21. Trace a Stack Trace
Act as a debugging specialist. Analyze this stack trace: [trace]. Trace the call path, identify the first meaningful failure and explain why it occurs. Give the smallest fix and verification steps.
22. Debug a Dependency Conflict
Diagnose this dependency problem: [error]. Context: [package files and versions]. Identify incompatible constraints, explain the resolution and return the safest dependency changes.
23. Debug a Memory Leak
Investigate a suspected memory leak in [system]. Evidence: [metrics/logs]. Identify likely retention paths, propose a minimal diagnostic plan and then suggest fixes.
24. Debug a Timeout
Investigate this timeout: [error]. Map the request path, identify likely slow components and explain whether the issue is compute, I/O, locking or network. Give targeted tests.
25. Debug Intermittent Failure
Act as a production incident engineer. Analyze this intermittent failure: [symptoms]. Build a hypothesis tree, rank likely causes and design the cheapest experiments that would distinguish them.
26. Debug Incorrect Output
The program returns [actual] but should return [expected]. Analyze [code/input]. Identify the exact divergence point and return a corrected implementation with a regression test.
27. Debug a CI Failure
Analyze this CI failure: [logs]. Determine whether it is environment, dependency, test-order, timing or code related. Return the minimal fix and how to prevent recurrence.
28. Debug a Docker Problem
Diagnose this Docker issue: [error]. Context: [Dockerfile, compose and environment]. Check build context, ports, permissions, networking and health checks. Return the exact changes to test.
29. Debug a Deployment
Troubleshoot this deployment failure: [logs]. Compare local and production assumptions, identify missing configuration and give an ordered recovery plan with verification at each step.
30. Create a Debugging Plan
Act as a senior incident responder. Given [symptoms], create a debugging plan that starts with the highest-information, lowest-risk checks. Include evidence to collect and stop conditions.
Refactoring & Modernization
31. Refactor for Readability
Refactor this code for readability: [code]. Preserve behavior and public interfaces. Return the revised code and a concise list of structural changes.
32. Split a Large Function
Break this large function [code] into maintainable units. Keep behavior identical. Explain the new boundaries, names, tests and why each extraction is justified.
33. Remove Duplication
Find and remove meaningful duplication in [codebase]. Do not abstract code merely because it looks similar. Return the refactor and explain the threshold used.
34. Modernize Legacy Code
Modernize [legacy code] for [language/version]. Preserve externally visible behavior. Identify deprecated APIs, safer replacements, migration risks and tests.
35. Refactor for Testability
Refactor [code] so it can be tested without heavy integration setup. Minimize global state and hidden dependencies. Return the new design and example unit tests.
36. Improve Error Messages
Rewrite the error-handling layer in [code] so failures are actionable. Preserve exception semantics where possible. Return improved messages, types and tests.
37. Introduce Interfaces
Evaluate whether [code] needs interfaces or dependency inversion. Add abstractions only where they reduce coupling or improve testing. Explain why each abstraction exists.
38. Migrate to Async
Evaluate and, if justified, migrate [component] from synchronous to async execution. Identify blocking operations, concurrency limits and cancellation issues.
39. Reduce Complexity
Measure the conceptual complexity of [code]. Identify the three changes with the highest readability payoff and lowest regression risk, then implement them.
40. Plan a Large Refactor
Create a staged refactor plan for [system]. Include dependencies, safe intermediate states, tests, rollout steps, rollback strategy and criteria for stopping.
Testing & QA
41. Generate Unit Tests
Write unit tests for [function/class]. Cover normal cases, boundaries, invalid input and important failure paths. Prefer focused tests and avoid testing implementation details.
42. Generate Integration Tests
Design integration tests for [service]. Cover authentication, persistence, external dependencies, retries and failure behavior. State what each test proves.
43. Generate Regression Tests
Given this bug [description and fix], create regression tests that would fail before the fix and pass after it. Include the narrow case and two adjacent edge cases.
44. Property-Based Tests
Identify invariants for [component] and create property-based test ideas. Specify generated inputs, invariant, expected failure handling and what the properties protect.
45. Test a REST API
Create a test plan for [API]. Cover happy paths, validation, auth, idempotency, pagination, rate limits, errors and backwards compatibility.
46. Test a Data Pipeline
Design tests for [pipeline]. Validate schemas, nulls, duplicates, transformations, late data, retries and output quality. Include unit, integration and end-to-end layers.
47. Flaky Test Investigation
Investigate this flaky test: [test/logs]. Identify nondeterminism from timing, shared state, network or ordering. Return a minimal reproduction strategy and durable fix.
48. Test Coverage Review
Review this test suite: [tests]. Identify important behavior that is not covered. Rank missing cases by production risk rather than raw line coverage.
49. Mutation Testing Ideas
For [module], propose high-value mutations that existing tests should catch. Use them to identify weak assertions and suggest stronger tests.
50. Release Test Checklist
Create a pre-release checklist for [application]. Include critical user flows, migrations, rollback, performance, security, observability and smoke tests.
Architecture & System Design
51. Design a Backend
Act as a senior systems architect. Design [backend] for [requirements]. Output: components, data flow, APIs, storage, scaling strategy, failure modes and key tradeoffs.
52. Design a Scalable API
Design an API for [product] handling [traffic]. Cover caching, rate limiting, pagination, idempotency, observability, database strategy and failure handling.
53. Design Event-Driven Architecture
Design an event-driven system for [workflow]. Define producers, consumers, events, delivery guarantees, idempotency, retries, dead letters and monitoring.
54. Design a Job Queue
Design a background job system for [tasks]. Cover scheduling, retries, deduplication, priorities, concurrency, timeouts, dead-letter handling and operational metrics.
55. Design Multi-Tenant SaaS
Design a multi-tenant architecture for [product]. Compare isolation strategies, authorization, data partitioning, noisy-neighbor protection and migration implications.
56. Architecture Tradeoff
Compare three architectures for [problem]. Score them on cost, complexity, latency, reliability, team fit and scalability. Recommend one and explain what would change your choice.
57. Find Architecture Risks
Review this architecture: [diagram or description]. Identify single points of failure, scaling bottlenecks, security boundaries and operational risks. Rank by severity.
58. Design for Failure
Take this system [description] and design its failure strategy. Cover timeouts, retries, backpressure, partial failure, degraded modes and recovery.
59. Design Observability
Define observability for [system]. Specify logs, metrics, traces, alerts, SLOs and the minimum dashboards needed to debug production issues.
60. Migration Architecture
Plan a migration from [old architecture] to [new]. Use incremental cutovers, compatibility layers, data validation and rollback points. Minimize downtime and irreversible steps.
APIs, Databases & DevOps
61. Design an API Contract
Create an API contract for [resource]. Define endpoints, schemas, validation, auth, status codes, pagination, errors and versioning. Keep it internally consistent.
62. Integrate a Third-Party API
Implement [API] integration. Context: [docs and code]. Output: client code, auth handling, retries, timeouts, rate-limit behavior, validation and tests.
63. Design a SQL Schema
Design a relational schema for [requirements]. Explain entities, keys, constraints, indexes and transaction boundaries. Identify likely query patterns.
64. Optimize a SQL Query
Optimize this SQL query: [query]. Context: [schema, row counts, indexes]. Explain the bottleneck, return improved SQL and list indexes to test.
65. Find N+1 Queries
Analyze this ORM code for N+1 or excessive queries: [code]. Show exactly where queries multiply and return a more efficient implementation.
66. Database Migration
Create a safe migration for [schema change]. Include forward migration, backfill strategy, compatibility period, validation and rollback considerations.
67. Redis Strategy
Design a Redis strategy for [use case]. Decide what to cache, TTLs, invalidation, stampede protection, consistency risks and failure behavior.
68. Dockerize an App
Create a production-ready Docker setup for [app]. Include multi-stage build, least-privilege user, health check, environment handling and efficient caching.
69. CI/CD Pipeline
Design a CI/CD pipeline for [project]. Include linting, tests, security checks, build, artifact handling, deployment, rollback and environment promotion.
70. Kubernetes Troubleshooting
Diagnose this Kubernetes issue: [manifest/logs]. Check probes, resources, networking, permissions, scheduling and rollout behavior. Return the smallest safe fix.
71. Threat Model a Feature
Threat-model [feature]. Identify assets, actors, trust boundaries, abuse cases, likely attacks and mitigations. Prioritize realistic risks.
72. Review Secrets Handling
Review how secrets are handled in [code/config]. Find hardcoding, logging, unsafe storage and exposure paths. Return safe replacements and rotation steps.
73. Review Authentication
Audit authentication in [system]. Check credential handling, session/token lifecycle, MFA, expiry, replay risk and brute-force protection.
74. Review Authorization
Audit authorization for [feature]. Map identities to actions and resources. Look for IDOR, privilege escalation and missing ownership checks.
75. Secure an API
Security-review this API: [routes/code]. Cover input validation, auth, authz, rate limiting, injection, sensitive data and abuse cases. Return prioritized remediations.
76. Secure File Uploads
Design a secure file-upload flow for [application]. Cover MIME/type validation, size limits, storage isolation, malware scanning, path safety and download headers.
77. Prevent Prompt Injection
Design defenses against prompt injection for this AI feature: [feature]. Identify untrusted inputs, tool boundaries, data exfiltration risks and safe handling.
78. Add Rate Limiting
Design rate limiting for [API]. Choose scope, algorithm, limits, headers, storage and behavior during bursts. Explain tradeoffs and failure modes.
79. Build Audit Logging
Design audit logging for [system]. Specify security-relevant events, required fields, retention, privacy constraints and how logs can support investigations.
80. Reliability Review
Review [service] for reliability risks. Focus on timeouts, retries, dependency failures, data corruption, idempotency and graceful degradation. Return the top fixes.
81. Design an AI Coding Agent
Act as an AI systems architect. Design an agent for [coding task]. Define goal, tools, context, memory, permissions, validation, stop conditions and human approval.
82. Give an Agent Safe Repo Access
Design permissions for a coding agent working in [repo]. Separate read, write, execution and deployment access. Apply least privilege and require approval for high-impact actions.
83. Build a Self-Testing Coding Agent
Design a coding agent loop that edits code, runs targeted tests, inspects failures and iterates. Include max iterations, failure handling and when to stop.
84. Agent Task Handoff
Create a structured handoff for an AI coding agent. Input state: [state]. Return completed work, evidence, failures, pending actions, constraints and exact next step.
85. Agent Context Strategy
Design context for a coding agent working in [repo]. Specify what should be loaded initially, retrieved on demand, summarized, cached or discarded.
86. Agent Evaluation Harness
Design an evaluation suite for an AI coding agent that handles [tasks]. Include representative cases, success criteria, code quality, tests, tool use, cost and latency.
87. Agent Tool Design
Define narrow tools for a coding agent that needs to [goal]. For each tool specify name, purpose, inputs, validation, outputs, errors and permissions.
88. Agent Security Review
Threat-model this coding agent: [architecture]. Analyze prompt injection, secret exposure, unsafe commands, dependency attacks and excessive permissions. Return mitigations.
89. Agent Model Routing
Design model-routing rules for a coding agent with [models]. Route simple edits, debugging, architecture and validation tasks by cost and capability.
90. Agent Loop Reliability
Review this coding-agent loop: [workflow]. Find infinite loops, premature stopping, repeated tool calls and hidden state problems. Return a safer loop with explicit stop rules.
Claude, GPT & Gemini Prompt Optimization
91. Claude Coding Prompt
You are an expert software engineer. Using the code and requirements below, [task]. Preserve existing behavior unless explicitly asked otherwise. Think through dependencies, implement the smallest safe change, then return code and tests.
92. GPT Coding Prompt
Act as a senior engineer working in an existing production codebase. Task: [task]. Context: [context]. Constraints: [constraints]. First state the implementation plan briefly, then provide the patch and verification steps.
93. Gemini Coding Prompt
Act as a senior full-stack engineer. Solve [task] using the provided project context. Keep the solution maintainable and compatible with [versions]. Return changed code, edge cases and tests.
94. Cross-Model Comparison
Give the same coding solution for Claude, GPT and Gemini from this task: [task]. Use identical assumptions and output requirements so the three responses can be compared fairly.
95. Model-Specific Review
Review this implementation and tell me what a strong Claude, GPT or Gemini coding response should catch: [code]. Separate universal engineering issues from model-specific prompting needs.
96. Improve a Weak Coding Prompt
Rewrite this weak coding prompt: [prompt]. Add role, task, context, constraints, acceptance criteria and output format. Make it work well across Claude, GPT and Gemini.
97. Force Minimal Changes
For this task [task], modify only what is necessary. Do not rewrite unrelated code, rename public APIs or introduce new dependencies unless required. Return a concise diff and regression tests.
98. Force Test-First Work
For [feature/bug], define the failing test first, explain what it proves, then implement the smallest change that makes it pass. Return tests, code and a brief validation summary.
99. Force Explicit Assumptions
Solve [task], but first list any assumptions that materially affect the implementation. If a requirement is ambiguous, choose a safe default and label it clearly.
100. Force Final Verification
Complete [task]. Before returning, verify syntax, types, expected behavior and relevant edge cases. Return the implementation plus a short verification checklist and any remaining uncertainty.
How to Get Better Results From Claude, GPT and Gemini
The best coding prompt is not the longest one. The model needs enough context to make the right change, but irrelevant code can make the task harder. The sweet spot is a clear goal, the relevant files or interfaces, exact constraints and a way to verify success.
- Give the model the current behavior and the expected behavior.
- Include exact versions when dependency behavior matters.
- For repository tasks, provide the relevant file tree and entry points before dumping unrelated files.
- For bugs, include the error, reproduction steps and what you already tried.
- For refactors, explicitly state what must remain compatible.
- For agents, define tool permissions and stop conditions instead of assuming the model will infer safe behavior.

Frequently Asked Questions
What are the best AI coding prompts?
The strongest coding prompts define the task, provide relevant context, state constraints, specify acceptance criteria and require verification. The exact prompt should match the engineering job.
What is the best prompt for Claude coding?
Give Claude the relevant codebase context, the exact task, compatibility constraints and tests. Ask for focused changes rather than broad rewrites.
What are the best GPT coding prompts?
GPT works well with explicit task requirements, relevant context, expected behavior, constraints and a clear output contract that includes code and verification.
What are the best Gemini coding prompts?
Gemini coding prompts should clearly state the task, project context, versions, interfaces and expected output. Asking for tests and edge cases improves reliability.
How do I get AI to review my code?
Paste the relevant code and ask the model to review correctness, security, performance and maintainability. Tell it to rank findings and give concrete fixes rather than generic advice.
How do I prompt AI to debug code?
Provide the exact error, reproduction steps, expected behavior, actual behavior and relevant code. Ask for root cause, smallest safe fix and regression tests.
How do I make AI write production-ready code?
Specify validation, error handling, logging, security, tests, compatibility and failure behavior. Do not rely on the phrase 'production-ready' without defining what it means.
Should I use the same prompt for Claude, GPT and Gemini?
The engineering requirements can stay the same, which makes comparisons fair. You can then make small model-specific changes based on how each model handles context, tools and output.
What should I include in an AI coding prompt?
Include goal, context, constraints, expected behavior, relevant files or interfaces, version information and how success should be validated.
How do AI coding-agent prompts differ from normal coding prompts?
Agent prompts must also define tool permissions, context retrieval, iteration behavior, stop conditions, failure handling and approval requirements because the system can take actions.
Can AI coding prompts replace tests?
No. A prompt can ask for tests and improve the model's discipline, but automated tests remain the real verification layer.
How do I make AI stop changing unrelated code?
State explicitly that unrelated files, public APIs and behavior must remain unchanged and ask for a minimal diff with a list of modified files.
Recommended Blogs
- What Is an AI Agent? Beginner Guide With Examples (2026)
- Model Routing for AI Coding Agents: How to Cut Costs Without Losing Quality
- Replit's AI Model Routing Is Here: How Intelligent Routing Cuts Costs (2026)
- How to Secure AI Coding Agents in 2026: Permissions, Sandboxing, MCP & Secrets
- Pydantic AI: Build Type-Safe AI Agents Guide (2026)
- How to Use LangGraph for Multi-Agent Systems (2026)
- What Is Context Engineering? Complete Guide (2026)
Resources & Community
Join our community of 70,000+ AI enthusiasts and learn to build powerful AI applications. Whether you're a beginner or an experienced developer, Build Fast with AI helps you understand and implement AI in your projects.
- Website - buildfastwithai.com
- LinkedIn - Build Fast with AI
- Instagram - @buildfastwithai
- Founder Twitter - @satvikps
- Twitter - @BuildFastWithAI
Agentic AI Launchpad 2026
A structured 6-week cohort program that takes you from AI basics to building and deploying real-world agentic AI systems. Includes live sessions, expert mentorship, project reviews and a builder community network.
Ready to go from learning to building? Join the next cohort: Agentic AI Launchpad 2026
Free AI Resources
Access free tools, workshops and micro-learning to keep building.
- AI Workshops - Free resources, upcoming events and past recordings
- Unrot - Learn AI in 5 minutes a day


