Reference

Prompt Cheat Sheet

8 patterns that make AI output dramatically better. Copy them, remix them, make them yours.

HalperBot
01

Role Prompting

When: You want expert-level output in a specific domain.

Example

You are a senior backend engineer with 10 years of experience in Python and PostgreSQL. Review this database schema and suggest optimizations for read-heavy workloads.

Pro tip: The more specific the role (years of experience, specialization), the more focused the output.

02

Chain-of-Thought

When: The task requires reasoning, analysis, or multi-step logic.

Example

Analyze whether we should migrate from REST to GraphQL. Think step by step: 1) List our current API pain points, 2) Compare REST vs GraphQL for our use case, 3) Estimate migration effort, 4) Give a final recommendation with confidence level.

Pro tip: Numbered steps force AI to reason through each part instead of jumping to a conclusion.

03

Few-Shot Examples

When: You need output in a specific format or style.

Example

Write product descriptions in this style: Input: "Wireless earbuds, 8hr battery, noise canceling" Output: "Block out the world. 8 hours of pure sound, zero wires, zero distractions." Input: "Laptop stand, aluminum, adjustable height" Output: "Elevate your screen. Elevate your posture. Solid aluminum, adjusts to you." Now write one for: "Mechanical keyboard, tactile switches, RGB backlight"

Pro tip: 2-3 examples is the sweet spot. More than 5 has diminishing returns.

04

Structured Output

When: You need data in a specific format (JSON, table, list).

Example

Analyze these 5 competitor websites and return the results as a JSON array. Each entry should have: "name" (string), "strengths" (array of 3 strings), "weaknesses" (array of 3 strings), "pricing_model" (string), "threat_level" (1-10 integer).

Pro tip: Specify exact field names, types, and counts. AI follows schemas precisely when you define them.

05

Constraints & Guardrails

When: You want AI to avoid common over-engineering or scope creep.

Example

Add form validation to the signup page. Rules: - Do NOT modify any existing components or styles - Do NOT add new dependencies - Validate email format, password (min 8 chars), and name (required) - Show inline error messages below each field - Only touch signup.js and signup.html

Pro tip: "Do NOT" constraints are as important as "Do" instructions. AI loves to "improve" things you didn't ask for.

06

Plan Mode

When: The task is complex and you want to review the approach before AI starts building.

Example

I want to add a dark mode toggle to my website. Before writing any code, outline your plan: which files you'll modify, what CSS approach you'll use, how the toggle state will persist, and any tradeoffs. Wait for my approval before implementing.

Pro tip: Plan mode prevents AI from sprinting in the wrong direction. Review the plan, adjust, then let it build.

07

Context Loading

When: AI needs to understand your existing code or project before making changes.

Example

Read the following files first to understand the project structure: - src/App.js (main component) - src/api/client.js (API layer) - src/styles/theme.css (design tokens) Then add a user profile page that follows the existing patterns, uses the same API client, and matches the current design system.

Pro tip: AI that understands your codebase produces code that fits. Without context, it invents its own conventions.

08

Agent Delegation

When: The task has independent parts that can run in parallel.

Example

I need to improve my portfolio site. Run 3 tasks in parallel: 1. Agent 1: Rewrite the homepage copy to be more compelling and action-oriented 2. Agent 2: Add responsive design to the projects grid (currently breaks on mobile) 3. Agent 3: Create an SEO checklist and fix any issues found When all 3 are done, show me a summary of changes made by each agent.

Pro tip: Each agent gets a clear, scoped task. You review the results — they do the work.