agentleFS
SkillMedevSkillMedev/ai-engineer-toolkit/skills/prompt-engineer/SKILL.md

prompt-engineer

Skill0 starsChanged 38 days agoMITView on GitHub

Turns a vague request into a structured, reliable prompt - role, context, task, format, failure handling, and few-shot examples - that produces consistent output across real inputs. Use when someone asks "why does my prompt give inconsistent results", "write a prompt for this task", "the model keeps breaking my JSON", "how do I stop prompt injection from user input", or is building any LLM feature whose prompt was written ad hoc. Do NOT use for converting a working prompt into a reusable agent skill - use prompt-to-skill instead; do NOT use for measuring whether a prompt change improved quality - use llm-evaluation instead.

74 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use idea-validator, debugger and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • dipaulavsSkill

    idea-validator

    Validates app ideas before building. Analyzes market saturation, competitors, real demand vs stated interest, solo builder feasibility (2-4 weeks timeline), and monetization potential. Use when user asks to validate an idea, evaluate a concept, check if idea is worth building, or before starting a new project.

    Also in 3 projects that use this

  • JohnJBorenSkill

    debugger

    Systematic debugging workflows, root cause analysis, and troubleshooting patterns

    Also in 3 projects that use this

  • VercelSkill

    technical-writer

    Write, review, and edit developer documentation for SDKs, libraries, and frameworks, including sites such as ai-sdk.dev and chat-sdk.dev. Use for getting-started guides, tutorials, API references, conceptual explanations, integration guides, migration guides, troubleshooting, and code examples.

    Also in 3 projects that use this

  • JetBrainsSkill

    webapp-testing

    Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

    Also in 4 projects that use this

  • JetBrainsSkill

    doc-coauthoring

    Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 10 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 65 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer positive instructions ("respond in JSON") over negative ones ("don't use prose") - models follow targets better than prohibitions.

    line 77
  2. Distinctive:

    Run the prompt on the collected real inputs, then apply the standard fixes:

    line 82
  3. Distinctive:

    When a change "seems better," measure it - hand the comparison to llm-evaluation rather than eyeballing three outputs.

    line 90
  4. Distinctive:

    Do not use quality adjectives ("detailed", "creative", "professional") as instructions - they are unfalsifiable and change nothing.

    line 98
  5. Distinctive:

    Do not stuff multiple tasks into one prompt - each added task degrades all of them.

    line 99
  6. Distinctive:

    Do not describe the output format in prose when you can pin it with a literal schema or example.

    line 100
  7. Distinctive:

    Do not leave user-supplied content undelimited - that is the injection surface.

    line 101
  8. Distinctive:

    Do not iterate on imagined inputs.

    line 102
  9. Distinctive:

    Do not bury the critical constraint in the middle - put it last, where recency bias makes it stick.

    line 103
  10. Distinctive:

    Every allowed label or enum value is enumerated.

    line 109

“Common” is measured: kept by at least 6 in 10 of the 65 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Prompt Engineer

Turn a vague request into a prompt that produces consistent, high-quality output on inputs you have not seen yet. The costly mistake this prevents is the adjective prompt: "be detailed and professional" reads like an instruction but constrains nothing, so output quality varies run to run and the author iterates blind. Structure and examples constrain; adjectives decorate.

Operating procedure

Ordering inside the prompt is load-bearing, not stylistic: instructions come before context so the model reads the data already knowing what to do with it, and the most important constraint is restated last because recency makes it stick.

Step 1: Gather inputs

  1. The single objective, stated in one sentence. If it takes two sentences, it is two prompts - split into a chain.
  2. 3-5 real example inputs, including one ugly one. Iterate on real inputs, not imagined ones; label synthetic examples as synthetic.
  3. Who or what consumes the output: a downstream parser wants JSON with a schema; a human wants markdown.
  4. The failure policy: what the model should do when input is missing, ambiguous, or out of scope (default: return "UNKNOWN" rather than guess).

Step 2: Build the four blocks, in this order

ROLE: You are a senior <domain> expert.
TASK: <imperative, one goal - placed before the context it operates on>
FORMAT: Respond as <literal JSON schema / markdown table / bullets>.
RULES:
- If <field> is missing, return "UNKNOWN" rather than guessing.
- Keep reasoning internal; output only the final result.
CONTEXT:
<facts, constraints, audience - and any user-supplied content, delimited>
<restate the single most important constraint here, last>

Instructions before context: a model that reads the task first processes the context purposefully; a model that reads three pages of context first has already formed its own idea of the job. Pin the output format with a literal schema or example, never a description of one.

Step 3: Replace adjectives with examples

Examples beat adjectives every time. Add 1-3 few-shot examples whenever the output shape is non-obvious, choosing examples that mark the decision boundaries - the near-misses, not the easy cases.

Bad - adjectives, no shape, no failure policy:

Analyze this customer review and tell me the sentiment. Be accurate,
thorough, and professional. Don't get it wrong.

Review: "Shipping was fast but the box was crushed."

Why it fails: "accurate, thorough, professional" constrains nothing measurable; the output shape is unpinned so one run returns a paragraph and the next a single word; no labels are enumerated, so the model may invent "MOSTLY NEGATIVE"; mixed-signal reviews - the actual hard case - get whichever reading the sampling favors that run.

Good - enumerated labels, boundary-marking examples, pinned shape:

Classify sentiment as POSITIVE, NEGATIVE, or NEUTRAL. Use only these
three labels. A review mixing praise and a product/delivery defect is
NEGATIVE.

Input: "Shipping was fast but the box was crushed."
Output: NEGATIVE

Input: "Exactly what I expected."
Output: NEUTRAL

Input: <review>${userText}</review>
Output:

The examples do the work the adjectives could not: the first one settles the mixed-signal boundary by demonstration.

Step 4: Harden the boundaries

  • Delimit user-supplied content with XML-style tags (<review>...</review>) so injected instructions inside the data cannot blur into your instructions.
  • For classification, enumerate the exact allowed labels and forbid new ones.
  • Prefer positive instructions ("respond in JSON") over negative ones ("don't use prose") - models follow targets better than prohibitions.
  • Specify the failure mode explicitly; an unspecified failure mode means the model improvises one per run.

Step 5: Iterate against real inputs and known edge cases

Run the prompt on the collected real inputs, then apply the standard fixes:

  • Long context: place the question both before and after the documents.
  • Inconsistent JSON: lower temperature, validate against a schema, retry once on parse failure.
  • Hallucinated facts: instruct "only use the provided context; cite the sentence."
  • Refusals on benign tasks: add a one-line justification of legitimate intent.
  • Format drift over long conversations: restate the format in the latest turn; do not rely on the model remembering it.

When a change "seems better," measure it - hand the comparison to llm-evaluation rather than eyeballing three outputs.

Deliverable

Produce a prompt file containing: the one-sentence objective, the four blocks in the Step 2 order, 1-3 boundary-marking few-shot examples, delimited slots for user content, an explicit failure-mode rule, and a note listing the real inputs it was iterated against.

Do NOT

  • Do not use quality adjectives ("detailed", "creative", "professional") as instructions - they are unfalsifiable and change nothing; encode the desired property as a rule or an example.
  • Do not stuff multiple tasks into one prompt - each added task degrades all of them; split into a chain.
  • Do not describe the output format in prose when you can pin it with a literal schema or example.
  • Do not leave user-supplied content undelimited - that is the injection surface.
  • Do not iterate on imagined inputs; the prompt will overfit to inputs no one sends.
  • Do not bury the critical constraint in the middle - put it last, where recency bias makes it stick.

Quality bar

  • The objective is one sentence and the prompt serves only it.
  • Output shape is pinned by a literal schema or example; a parser or reader gets the same shape every run.
  • Every allowed label or enum value is enumerated; new ones are forbidden.
  • User content sits inside delimiters; the failure mode is specified.
  • Few-shot examples mark decision boundaries, not easy wins.
  • Any claimed improvement is backed by a run on real inputs, not a single good sample.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.