← Back to catalog

comparison

Prompt Engineering Comparison — Coding Agents Cheatsheet

Comparison guide for prompt engineering across coding agents: task framing, context selection, constraints, examples, evaluation, and iteration patterns.

  • 2026-09-25 (3 weeks ago)
  • 5 steps
  • ~55 min total
  • prompt-engineering
  • comparison
  • coding-agents
  • prompts
  • evaluation
  • context

Prompt Engineering Comparison — Coding Agents Cheatsheet

One-line: Prompt engineering for coding agents is the practice of framing tasks with the right context, constraints, examples, tools, and evaluation loop so different agents can produce reviewable software changes.

Installation

Prompt engineering is a technique, not an installable package. Use it inside your chosen agent: Claude Code, Codex, OpenCode, Pi, Hermes Agent, or an API-based workflow.

Task: Fix the failing markdown validator test.
Context: The validator lives in tools/validator/.
Constraints: Do not change the public CLI flags.
Plan: Explain the cause, make the smallest patch, then run the focused test.
Output: Summary, files changed, tests run, and remaining risks.

First-run checklist:

  1. Define success criteria before asking for code.
  2. Attach or name the relevant files and issue.
  3. State constraints and forbidden actions.
  4. Require evidence: tests, diff summary, or reviewer checklist.

Step-by-Step Setup & Optimization

Step 1 — Compare prompt surfaces

Goal: The prompting adjustment that fits each surface you useTime: ~10 minLevel: beginner

SurfaceStrengthPrompting adjustment
Chat/APIPrecise control over messages and examples.Include schemas and evaluation examples.
Coding-agent CLIDirect repo access and tool use.Specify files, commands, and safety boundaries.
IDE agentTight edit/review loop.Point at selections and ask for minimal diffs.
Multi-agent workflowParallel roles and fresh reviews.Define handoff contracts and stop conditions.
You can name the prompting adjustment for the surface you prompt most.

Step 2 — Frame the task with boundaries

Goal: A prompt that names goal, context, constraints, and proofTime: ~10 minLevel: beginner

A strong coding prompt names the goal, context, constraints, and proof.

Goal: Add a new cheatsheet that passes the locked template.
Context: Use skills/cheatsheet-scribe/template-contract.md and existing examples.
Constraints: Do not edit validator rules or generated files.
Proof: Run pnpm cheatsheet:lint <file> --no-links.
Your last prompt contained all four parts — goal, context, constraints, and a runnable proof.

Step 3 — Use examples when output shape matters

Goal: An example pinned to the output format you expectTime: ~10 minLevel: intermediate

For code, provide a nearby file. For docs, provide the target template. For reviews, provide the expected finding format.

Return findings as:
- severity: critical | high | medium | low
- file:line
- issue
- suggested fix
The output matched your example’s shape — fields, order, and granularity.

Step 4 — Iterate with deltas, not resets

Goal: Steering by specific deltas instead of re-prompting from scratchTime: ~10 minLevel: intermediate

After a first answer, steer with specific deltas:

  • “Keep the structure, but reduce scope to one file.”
  • “The test failed because the heading order changed; fix only that.”
  • “Classify these findings as must-fix or note.”

Avoid restarting with a brand-new vague prompt after the agent has useful context.

Your follow-ups named what to keep and what to change — no full resets.

Step 5 — Evaluate prompts like code

Goal: Prompt quality judged by observable outcomes, not vibesTime: ~15 minLevel: intermediate

Track prompt quality with observable outcomes:

  • Did the agent touch only intended files?
  • Did it run the requested checks?
  • Were acceptance criteria satisfied?
  • Did reviewers find preventable issues?
  • Can another agent reproduce the workflow from the prompt?
You scored your last prompt against the checklist above and found what to tighten.

Best Practices

Do

  • ✅ Put success criteria and constraints near the top.
  • ✅ Provide relevant files, examples, schemas, and commands.
  • ✅ Ask for a plan before broad edits.
  • ✅ Use explicit output formats for reviews and handoffs.
  • ✅ Separate exploration prompts from implementation prompts.
  • ✅ Improve prompts after failures just as you improve tests.

Don’t

  • ❌ Ask for “make it better” without a target metric.
  • ❌ Paste untrusted issue instructions as commands to execute.
  • ❌ Mix unrelated goals, such as refactor plus feature plus dependency upgrade.
  • ❌ Assume all agents interpret the same shorthand identically.
  • ❌ Reward verbose reasoning when what you need is a small diff and test evidence.

Quick Command Reference

Prompt patternUse
Goal / Context / Constraints / ProofDefault coding-agent task frame.
Plan first, wait for approvalRisky or broad changes.
Implement only step NKeep work reviewable and scoped.
Return PASS / NEEDS_FIXReview-agent verdicts.
Use this file as the style exampleMatch local patterns.
Do not edit <path>Hard boundary for generated or sensitive files.
Run <command> and report output summaryEvidence-backed completion.

Expected Outcomes

After applying these patterns, you should have:

  • Prompts that transfer across different coding-agent tools.
  • Smaller diffs because goals, files, and constraints are explicit.
  • Better review quality through structured output contracts.
  • Fewer repeated mistakes because failed prompts become improved patterns.
  • A clear distinction between exploration, implementation, review, and release prompts.

Reference

Sources & deeper reading