agentleFS
HaiTrieu0902HaiTrieu0902/agent-skills-kit/skills/prompt-engineering/SKILL.md

prompt-engineering

Skill0 starsChanged 8 months agoMITView on GitHub

Principles for designing reliable prompts for LLM-backed features — structured output, few-shot, reasoning, and eval-driven iteration. Use when building, debugging, or hardening any feature that calls an LLM.

63 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use security-checklist, nextjs-app-router and 5 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.
  • atuljha23Skill

    security-checklist

    OWASP-style quick reference — authn/authz, injection, secrets, sessions, crypto, dependencies. Use during code review and before committing security-sensitive changes.

    Also in 3 projects that use this

  • desilokesh1Skill

    nextjs-app-router

    Next.js App Router best practices, Server Components, Server Actions, routing patterns, and data fetching strategies. Use when building Next.js applications with the App Router.

    Also in 3 projects that use this

  • qodex-aiSkill

    multi-agent-orchestration

    Design and coordinate multi-agent systems where specialized agents work together to solve complex problems. Covers agent communication, task delegation, workflow orchestration, and result aggregation. Use when building coordinated agent teams, complex workflows, or systems requiring specialized expertise across domains.

    Also in 3 projects that use this

  • mrgoonieSkill

    context-engineering

    Master context engineering for AI agent systems. Use when designing agent architectures, debugging context failures, optimizing token usage, implementing memory systems, building multi-agent coordination, evaluating agent performance, or developing LLM-powered pipelines. Covers context fundamentals, degradation patterns, optimization techniques (compaction, masking, caching), compression strategies, memory architectures, multi-agent patterns, LLM-as-Judge evaluation, tool design, and project development.

    Also in 7 projects that use this

  • dylantarreSkill

    performance-optimization

    Use when animation runs slow, janky, or causes frame drops

    Also in 4 projects that use this

  • ArogyaReddySkill

    changelog-generator

    Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 56 edited versions we read keep these.

  • 3

    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 the provider's native tool-calling / JSON mode over "respond in JSON" in plain text.

    line 40
  2. Distinctive:

    Keep one responsibility per call — chain calls instead of one mega-prompt.

    line 41
  3. Distinctive:

    Prompt injection: treat retrieved/user content as untrusted data, never as instructions.

    line 45

“Common” is measured: kept by at least 6 in 10 of the 56 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 Engineering

Designing prompts as a deliberate, testable interface — not trial and error.

Overview

A prompt is the contract between your app and the model. Treat it like code: make it explicit, version it, and validate it against examples. Most "model problems" are under-specified prompts.

Core Principles

PrincipleWhat it means
Be specificState the task, format, audience, and constraints. Ambiguity is filled by the model's priors, not yours.
Show, don't only tellA few worked examples (few-shot) beat long descriptions for format/tone.
Separate rolesSystem prompt = durable behavior and constraints. User turn = the specific request.
Constrain the outputDemand a schema (JSON / tool call) when the result is consumed by code.
Give an outTell the model what to do when it can't answer ("reply UNKNOWN") to suppress hallucination.

Choosing a Technique

SituationTechnique
Output parsed by codeStructured output — JSON schema or tool/function calling, validated on receipt
Format/tone is hard to describeFew-shot — 2–5 representative examples
Multi-step reasoning / mathReasoning — ask the model to think step by step (or use a reasoning model)
Long, varied inputsContext discipline — put instructions first, data last; label sections with delimiters
Classification / extractionEnumerate the allowed labels/fields explicitly

Structured Output

  • Define the exact schema; reject and retry on validation failure rather than parsing prose.
  • Prefer the provider's native tool-calling / JSON mode over "respond in JSON" in plain text.
  • Keep one responsibility per call — chain calls instead of one mega-prompt.

Reliability & Safety

  • Prompt injection: treat retrieved/user content as untrusted data, never as instructions. Keep system instructions separate and don't let tool output silently override them.
  • Determinism: set temperature low (0) for extraction/classification; higher only for ideation.
  • Don't bury the lede: the most important instruction goes first and, for long contexts, is repeated at the end.

Eval-Driven Iteration

  1. Collect 10–50 real input/output examples (a golden set).
  2. Change the prompt.
  3. Re-run the set and compare — never judge a prompt change from one example.

(See the llm-evaluation skill for the full loop.)

Anti-Patterns

❌✅
Tweaking against a single exampleIterate against a golden set
"Respond in JSON" in free textNative structured output + validation
One giant prompt doing five thingsDecompose into chained, single-purpose calls
Trusting retrieved text as instructionsQuarantine untrusted content as data
Vague role ("be helpful")Concrete behavior, constraints, and failure mode

A good prompt is specific, constrained, and measured against examples.

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.