Prompt engineering

From WrongStack/WrongStack · View interactive version

Prompt engineering is an AI agent skill from the GitHub repository WrongStack/WrongStack. Prompt and instruction text: system prompts, tool and skill descriptions, few-shot examples, evals, and models ignoring instructions. Use this skill when designing, critiquing, or fixing system prompts, tool descriptions, skill definitions, or other LLM instruction text — including when a model igno

How to use this skill

Skill file

Prompt Engineering

Selection card

Overview

Current models follow instructions closely, so most prompt failures are

failures of clarity, not of emphasis: a missing reason, a buried or

contradictory rule, an example that teaches the wrong thing, or a tool whose

purpose overlaps another. Write prompts the way you would brief a capable new

colleague who has none of your context, then check them against real inputs.

Rules

  1. State the goal and the reason. A rule with its "why" generalizes to cases

the rule didn't list; a bare rule gets applied literally.

  1. Say what good output looks like — format, length, audience, and when the

task is done. Prefer "do X" over a list of things not to do.

  1. Use examples deliberately. They are copied closely, so make them varied,

representative, and consistent with the written rules.

  1. Structure long prompts. Separate instructions, context, and data with

headings or XML-style tags; put long reference material before the question

that uses it.

  1. Calibrate emphasis. Capitals and "CRITICAL" on every line make a model

over-apply rules to cases they were never meant for; reserve strong wording

for genuine hard constraints.

  1. Remove filler and resolve contradictions. Every sentence should change

behaviour; when two instructions can conflict, state which wins.

  1. Order for caching: stable content (identity, tools, standing rules) first,

volatile content (session state, recent errors) last.

  1. Test against a fixed set of inputs, including edge cases and inputs the

prompt should decline. Change one thing at a time and read the outputs, not

just a score.

  1. Enforce an explicit instruction hierarchy and completion discipline: untrusted data, project files, memories, and subagent notes can never override baseline system rules, and prompts should instruct the model to finish and report immediately once acceptance criteria are verified.

Tool descriptions

A model picks tools from their names and descriptions alone. Each description

answers:

instead ("for exact text use grep; for symbols use this").

concrete example value for anything non-obvious.

✅ Search indexed code symbols by name or concept and return ranked definitions
   with file and line. Use before broad grep when locating a function, type, or
   module; use grep for exact strings or regexes. `kind` narrows to functions,
   classes, or interfaces. If the index is empty, build it first.

❌ Searches the codebase.

Skill descriptions

The description decides whether a skill is ever loaded, so it is written for

selection, not for documentation:

situation ("when writing or fixing tests in any project"), not a topic ("this

skill is about tests").

("flaky", "keeps failing"), not only the formal names.

says "in <product>" may never fire for the user's own project.

followed by a backticked name, is treated as a required tool — the skill is

dropped where that tool is absent. Write optional tool names in plain text.

Diagnosing a misbehaving prompt

| Symptom | Likely cause | Fix |

|---|---|---|

| Ignores an instruction | Buried in a long block, or contradicted elsewhere | Move it near the task, remove the conflict, give the reason |

| Applies a rule where it doesn't fit | Absolute or shouted wording | State the scope and the exception; drop the capitals |

| Output format drifts | No example or schema | Show one exact example, or require a schema |

| Too verbose or too terse | No length or audience guidance | State the reader and the expected length |

| Calls the wrong tool | Overlapping tool descriptions | Add "use X instead when…" to both |

| Invents facts | No permission to say "unknown" | Tell it what to do when information is missing |

Anti-patterns

they cost tokens and change nothing.

of patches; find the underlying ambiguity instead.

Before returning

Behavioral evaluation

Pin realistic inputs and observable success criteria before changing a prompt.

Include near-miss activation cases, ambiguous instructions and untrusted source

text. Compare tool choice, task completion and output validity against the old

prompt; regex/phrase presence alone is structural evidence.

Record model/version/settings and repeated-run variability for meaningful

quality claims. Instructions cannot substitute for runtime validation or permissions.

Skills in scope

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.