Prompt Arsenal
PremiumCopy-paste prompt templates covering the entire development workflow
Prompt Arsenal
Previous chapters covered MBRY framework and various prompt techniques. This chapter gives you weapons directly-a collection of battle-tested prompt templates, ready to copy and use.
These templates all follow MBRY principles: goal-first, clear structure, scorable. You can copy directly or adjust to your needs.
Project Launch: Architect Prompt
Scenario: You have a product idea, starting from scratch. Unsure what tech stack to use, how to organize code structure.
This prompt has AI play a senior architect to help you plan:
I want to build a [describe your product in 1-2 sentences].
Target users: [who uses this product, in what scenarios]
Core features: [most important 2-3 features, don't be greedy]
Technical constraints: [tech you've already decided, like Next.js, Supabase, existing codebase]
My level: [honestly state your background, like "familiar with frontend, backend so-so"]
As a senior full-stack architect, please help me plan:
1. Tech stack recommendation: prioritize dev speed, cost control, one-person maintainable
2. Project directory structure: provide complete project tree
3. Data model: describe core entities with TypeScript interfaces
4. API design: list main endpoints' paths, methods, and function summaries
5. Development milestones: what's in MVP, V1, V2
6. Potential risks: what pitfalls might occur, how to avoid
Give plan first. After I confirm, then start implementing.This prompt's benefit: AI plans before coding, avoiding jumping into code only to go wrong direction. "Give plan first, after I confirm" is crucial-it constrains AI from outputting code directly.
Firefighting: Debug Prompt
Scenario: Code errored, you've tried several approaches with no luck, getting messier. Need AI to help analyze calmly.
Key for this prompt: have AI analyze first, not code directly:
Enter Debug mode. Rule: analyze causes first, don't code directly.
## Error Message
[paste complete error message including stack trace]
## Related Code
[paste relevant code, not too much not too little]
## Already Tried
[list approaches you've tried, avoid AI giving duplicate suggestions]
- Approach A: xxx, result was xxx
- Approach B: xxx, result was xxx
## Context
[optional: framework versions, runtime environment, other relevant info]
---
Please analyze and answer:
1. Direct cause: what is this error message telling me?
2. Root cause: why did this error trigger?
3. Impact scope: what other features might this affect?
4. Solutions: list 2-3 viable approaches with pros/cons
5. Recommendation: which do you recommend, and why?
After I choose an approach, then give specific code changes.Why "Already Tried"-> Because AI easily suggests things you've already tried. Listing them avoids wasted time.
Why "analyze first, then act"-> Because Debug's most important thing is finding the root cause. Wrong root cause = code changes make it worse.
Code Refactoring Prompt
Scenario: A file is too long and messy, hundreds of lines mashed together, painful to look at. Needs splitting and refactoring.
This prompt emphasizes progressive refactoring and keeping functionality unchanged:
This file needs refactoring. Please help me plan.
## Current State
- File path: [xxx.ts]
- Lines: [xxx lines]
- Main problems: [describe what's messy, like: too many responsibilities, duplicate code, too-deep nesting]
## Refactoring Principles
1. Functionality completely unchanged-behavior after refactoring same as now
2. Progressive changes-each step must work, easy to rollback
3. Keep existing API interfaces unchanged-avoid affecting callers
## Current Code
[paste complete code]
---
Please first give refactoring plan:
1. What new files will be created? Each file's responsibility?
2. How will existing code be split? What goes where?
3. Dependencies between files?
4. Suggested execution order? What first, what later?
5. Any risks to note?
After I confirm the plan, then start refactoring step by step. Each step must ensure code runs.Refactoring's biggest fear is breaking functionality during changes. So this prompt emphasizes "each step must work" and "progressive changes."
Code Review Prompt
Scenario: Finished a feature, want to self-check before going live. Have AI play senior engineer to Review.
Please review the following code. You are a senior engineer with 10 years experience, strict about code quality.
## Review Focus
Security:
- SQL injection, XSS, CSRF risks
- Sensitive info leakage (API Keys, passwords, etc.)
- Permission checks complete
Performance:
- N+1 query problems
- Unnecessary re-renders (React)
- Possible memory leaks
Maintainability:
- Clear naming
- Functions too long
- Duplicate code that could be abstracted
Edge Cases:
- Null handling thorough
- Error handling in place
- Concurrency considered
## Code
[paste code to review]
---
Please output categorized by severity:
🔴 Critical (must fix, otherwise could go wrong)
🟡 Warning (should fix, affects quality or maintainability)
🟢 Suggestion (optional optimization, nice to have)
For each issue, explain:
1. Which line specifically
2. What's the problem
3. Why it's a problem
4. How to fixSome think "10 years experience" descriptions are useless. Testing shows it does affect AI's output strictness. Worth trying.
UI Beautification Prompt
Scenario: Feature works, but interface is ugly. You're not a designer; want AI to help beautify.
Please optimize this component's visual appearance to look more professional.
## Design Specs
- Framework: [React + Tailwind CSS / Vue + UnoCSS / other]
- Style: [modern minimal / vibrant colorful / business formal]
- Reference: [if any, put a screenshot or description of a site you like]
## Optimization Requirements
Interaction States:
- hover / focus / active states should have feedback
- Transition animations natural, not jarring
Visual Hierarchy:
- Primary info prominent, secondary info subtle
- Spacing and alignment comfortable
Responsive:
- Mobile should display and operate normally
Details:
- Border radius, shadows, colors coordinated
- Don't over-design, keep it simple
## Current Code
[paste your component code]
---
Please give the complete optimized code directly, and briefly explain what changes you made.This prompt doesn't need "plan then execute" because UI optimization is more intuitive to see results directly.
Documentation Generation Prompt
Scenario: Code's done, need to add docs. Too tiring to write yourself.
Generate documentation for the following code.
## Doc Type
[choose one: API Reference / Component Usage / README]
## Format Requirements
- Markdown format
- Code examples must be runnable
- Each parameter/prop needs type and description
- Add usage notes if necessary
## Style Requirements
- For [beginners / intermediate developers]
- Language: [Chinese / English]
- Concise but complete, not verbose
## Code
[paste your code]
---
Please generate complete documentation.Documentation is one of the best things for AI to write-it requires accurately describing existing code, not creating new things.
Test Case Generation Prompt
Scenario: Wrote a function, want comprehensive test coverage.
Generate complete test cases for this function.
## Test Framework
[Jest / Vitest / Mocha / other]
## Function Code
[paste function code]
## Test Requirements
Coverage:
- Normal input expected output
- Edge cases (nulls, extremes, special characters, etc.)
- Error input error handling
- If async, test success and failure cases
Test Style:
- Use describe/it organization
- Test descriptions in natural language, clearly stating what's being tested
- Each test verifies only one thing
---
Please generate complete test file code.Good tests cover edge cases-this is what AI excels at: thinking of boundary conditions you didn't.
Requirements Analysis Prompt
Scenario: User gave a vague requirement, you need to convert it to clear feature specs.
Help me analyze this requirement and convert to executable feature specs.
## Original Requirement
[user or boss's exact words, usually vague]
## Product Background
[briefly describe what the product is, who the target users are]
---
Please help me:
1. **Requirements Clarification**: What ambiguities might this requirement have? List your understanding and assumptions
2. **Use Case Breakdown**: Break into specific user stories (As a... I want to... so that...)
3. **Boundary Definition**: What's in scope, what's out of scope
4. **Acceptance Criteria**: How to judge each use case "complete"
5. **Technical Considerations**: What to note when implementing
6. **Questions to Confirm**: What questions need to go back to the requester to confirm
Output as Markdown format.This prompt helps turn vague requirements into clear specs. "Questions to Confirm" is especially important-helps you discover unclear parts in requirements.
Learning Explanation Prompt
Scenario: Encountered code or concept you don't understand, want AI to explain.
Please explain this code as if explaining to a smart programmer unfamiliar with this domain.
## Code
[paste code]
## My Background
[state what you're familiar with, what you're not]
---
Please explain:
1. What is this code doing overall? (summarize in one sentence)
2. Line-by-line/block-by-block explanation of each part's function
3. Why write it this way? Any alternatives?
4. What's clever or what common pitfalls in this code?
5. If I want to write similar code myself, what are the key points?
Use simple language, avoid jargon pileup. If jargon is necessary, explain it.Key to this prompt is "My Background." Tell AI your level so it adjusts explanation depth.
Browser Automation Prompt
Scenario: Want AI to use Playwright MCP to control browser and complete tasks for you.
Goal: I want to go to [website name] [complete what task]
Background:
- Project folder has [related material files, like content.md, images/]
- [any special situation notes]
Method: Use Playwright MCP to control browser
Execution Rules:
- If login needed, use Google login
- If image upload needed, use images from images/ folder
- If payment page encountered, stop and notify me
- If captcha encountered, stop and notify me
- Screenshot and save results when done
Please start executing.This prompt clarifies rules to prevent AI from acting on its own for sensitive operations.
Deep Thinking Prompt
Scenario: Facing complex problem, need AI to analyze deeply rather than give surface answers.
Please deeply analyze the following question.
Don't give surface-level, generic answers. I need:
- Essential insights, not surface listings
- Deep analysis, not breadth coverage
- Unique perspectives, not conventional rehashing
You're allowed to express uncertainty. If unsure about some aspects, you can say "I'm uncertain about this, but possibly..."
Question:
[your question]
---
Please first clarify the question's structure, then analyze layer by layer."You're allowed to express uncertainty" is important. Often AI gives overconfident answers; allowing it to say "uncertain" actually yields more honest analysis.
Code Translation Prompt
Scenario: Need to translate code from one language/framework to another.
Please translate this code from [source language/framework] to [target language/framework].
## Original Code
[paste code]
## Translation Requirements
- Function and behavior must be identical
- Use target language/framework's idiomatic style
- Keep code structure clear
- If original code has issues, fix them too
## Target Environment
- Version: [target language/framework version]
- Other constraints: [if any]
---
Please give complete translated code and explain what adjustments were made during translation.Code translation is AI's strong suit, but note specifying target version to avoid generating outdated syntax.
How to Use These Templates
These templates aren't rigid formulas-they're starting points.
First, copy directly. Replace [bracketed content] with your situation, send to AI.
Second, adjust as needed. Some parts might not apply to your scenario-delete or modify. Some need more detail-add.
Third, save versions you use often. With use you'll develop preferences; save adjusted versions to form your own prompt library.
Fourth, keep optimizing. After each use, review results, think about improvements. Good prompts are iterated.
These templates cover the most common development scenarios. If you have other scenario needs, use MBRY framework to organize your own, or adjust based on techniques learned in earlier chapters.
Next chapter covers common pitfalls in AI coding and how to avoid them.
AI Practice Knowledge Base