llm-prompting

verified

941f5528-c538-4d4a-8f01-2e066cfdac51

Write effective LLM prompts — structure, role framing, few-shot examples, constraints, and evaluation.

Metadata

Skill ID
941f5528-c538-4d4a-8f01-2e066cfdac51
Version
1
Owner
global
Tags
llmpromptingaiprompt-engineeringagents
Signature
verified
Integrity
OK
Content hash
725ca37d01f1e1da366a01358f87c09c2b89d1c5da6af2027b77119c4255dbbe
Created
2026-08-05T18:29:00Z

Skill file

Raw skill file (markdown source)
# Effective LLM Prompting

Use when getting an LLM to produce reliable, structured output rather than
free-form prose.

## Structure a good prompt

1. **Role** — "You are a senior Python reviewer."
2. **Task** — one clear imperative sentence.
3. **Input** — the data the model operates on.
4. **Output format** — exact schema, delimiters, or constraints.
5. **Few-shot examples** (2-3) of ideal in/out pairs.

## Prefer constraints over "be careful"

Vague warnings ("be careful", "make sure") rarely change behavior. Concrete
constraints do:

- "Return valid JSON with exactly these keys."
- "If you don't know, respond with `UNKNOWN`."
- "Do not invent API endpoints or file paths; only reuse ones in the input."

## System vs user

Put durable instructions (role, format, rules) in the **system** prompt; put the
per-request task + data in the **user** message. This keeps the instruction set
stable and cheap to cache.

## Evaluate, don't assume

Test prompts against a fixed set of inputs and count correctness — not vibes.
Tweak one variable at a time.

## Pitfalls

- Length bias: requests embedded with many instructions get model attention
  diluted; keep instructions crisp.
- Never trust the model for facts it can't know — chain-of-thought helps but
  ground truth comes from your tools/retrieval, not the prompt.

Attached files