Prompt Engineering General Techniques Cheatsheet - Role/Structure/Constraints/CoT
General prompt-engineering templates organized by pattern — role, structure, CoT, self-verification. Copy a template, fill the variables, and ship.
Role Anchoring 5
You are a senior {domain} expert (10+ yrs); answer professionally but clearly: {q}Domain+years anchor expertise
As a {role}, complete per {spec}: {task}Force adherence to a spec
Identity={role}; Goal={goal}; Constraints={c}. Start: {input}Identity+goal+constraint triad
From a {role} view, give 3 differing opinions with reasoningForce multi-angle, avoid bias
Assume you are a {job} in {scene}; give full steps for {problem}Scenario-based roleplay
Structured Output 5
Output JSON with fields name/desc/tags. JSON only, no prose. Text: {t}Field names + no prose → parseable
Compare A vs B in a Markdown table: perf/usability/ecosystem/costPredefined dims, paste-ready
Output as ## heading / ### sub / - bullets. Topic: {t}Fixed hierarchy, paste-ready
Strictly follow this JSON Schema, no prose: {schema}Schema constrains field types
Break the req into a checklist: task/priority/effort. Req: {r}Req → executable list
Constraints & Few-shot 5
Ex1: X→Y; Ex2: A→B. New: {input}Few-shot sets the format
Length ≤200 words; pro tone; no lists; in ChineseExplicit beats "be concise"
Use only the provided material; no outside knowledgeAnti-hallucination boundary
Conclusion first, ≤3 reasons, then one counterexampleFixed answer skeleton
No apologies/small talk unless needed; answer directlyCut redundant openers
CoT & Verification 5
Think step by step, then give the final answerChain of Thought boosts reasoning
List all assumptions, then derive, then flag uncertaintyExplicit assumptions cut errors
After answering, self-check 3 possible errors and fixSelf-verification loop
If info is insufficient, say what is missing — do not guessHonest boundary, no fabrication
Argue against your conclusion, then synthesizeAdversarial robustness
Pitfalls 5
Swap vague for specific ("a few" → "3 points")Specific is controllable
Split long tasks, then ask step by stepToo much at once gets messy
Ask for cited rationale on important outputTraceable lowers risk
Run the same prompt a few times for stabilityReduce random variance
Save winning prompts as reusable templatesBuild an asset
Tips
- The core of prompt engineering is translating vague intent into instructions the model executes reliably — role, structure, constraints, and CoT cover most scenarios.
- Few-shot sets format better than long descriptions; explicit constraints (length/tone/prohibitions) beat "be concise" — models respond more to concrete numbers and negations.
- Chain of Thought lifts reasoning quality but costs tokens; add a self-verification loop on important output to cut hallucination and misjudgment.
- Bank verified prompts as reusable templates — steadier and faster than writing ad hoc each time.
Official References
Commands are compiled from the official docs below. Click to verify the latest usage.
Maintained by LaoHand
Publicly updated on Aug 23, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact UsEdit this page on GitHub
Edit the source file directly and open a PR to improve this cheatsheet.