prompt-engineering
Skill33 starsChanged 22 days agoMITView on GitHub
Use when writing or improving prompts for a language model. Covers instruction structure, examples, reasoning elicitation, output formatting, and systematically diagnosing why a prompt fails. Trigger on "improve this prompt", "the model ignores my instructions", "prompt works sometimes and fails randomly". Do not use for guaranteeing schema-valid JSON — see the structured-output skill; for measuring prompt quality, see the llm-evaluation skill.
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 70 edited versions we read keep these.
2
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
- Distinctive: line 14
Write prompts that produce the right output reliably, and diagnose the ones that do not.
- Distinctive: line 55
Put the instructions before the data for short inputs, and after for long ones — models attend more reliably to the end of a long context.
“Common” is measured: kept by at least 6 in 10 of the 70 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.
Files
Prompt Engineering
Purpose
Write prompts that produce the right output reliably, and diagnose the ones that do not. Prompt engineering is an empirical discipline: the model's actual behavior, measured, beats any theory about what should work.
When to Use
- Writing a prompt for a production feature.
- A prompt that works most of the time and fails unpredictably.
- Reducing token cost or latency without losing quality.
- Migrating a prompt between models.
Capabilities
- Instruction design: role, task, constraints, and output contract.
- Few-shot examples, and selecting the ones that teach the boundary.
- Reasoning elicitation for tasks that need it.
- Output formatting and structured extraction.
- Failure diagnosis and systematic iteration.
Inputs
- The task, and what a correct output looks like.
- Real failure cases from the current prompt.
- Constraints: latency, cost, and the model available.
Outputs
- A prompt with an explicit output contract.
- An evaluation set of inputs with expected outputs.
- A measured success rate, before and after.
Workflow
- Define correct before writing the prompt — Twenty real inputs and their correct outputs. Without this, "improving" a prompt is a matter of opinion and you will optimize for the last example you looked at.
- State the task, the constraints, and the output shape — Be specific about what to do, what not to do, and exactly what format the answer takes.
- Add examples that teach the boundary — Two or three examples covering the ambiguous cases, not the obvious ones. An example of the hard case is worth ten of the easy one.
- Elicit reasoning only where it helps — For multi-step reasoning, ask the model to work through it before answering. For classification and extraction, it adds latency and cost without improving accuracy.
- Measure, change one thing, measure again — On the evaluation set. A change that improves one example and silently breaks three others is a regression that feels like progress.
- Handle the failure mode — Decide what happens when the model returns something unparseable, refuses, or hallucinates a field. That path will be taken.
Best Practices
- Specificity beats politeness. "Return exactly one of: approve, reject, escalate" outperforms "please try to categorize this appropriately".
- Put the instructions before the data for short inputs, and after for long ones — models attend more reliably to the end of a long context.
- Negative instructions are weakly followed. "Do not include a preamble" works less well than "Begin your response with the JSON object."
- Structured output (a JSON schema, a tool call) is far more reliable than asking for JSON in prose and hoping. Use the API's native mechanism.
- Long, elaborate prompts accumulate contradictions. When a prompt exceeds a page, look for instructions that conflict — the model is following one of them.
- Prompt improvements do not transfer across models. Re-measure after any model change; a prompt tuned for one is not tuned for another.
Examples
A prompt with an explicit contract and a boundary example:
You classify customer support messages for routing.
Categories (choose exactly one):
- billing — charges, invoices, refunds, payment methods
- technical — errors, outages, broken functionality, integration problems
- account — login, permissions, plan changes, cancellation
- other — anything not clearly covered above
Rules:
- If a message spans two categories, choose the one the customer needs
resolved first to be unblocked.
- If the message is too vague to classify with confidence, return "other"
with confidence below 0.5. Do not guess.
Respond with JSON only, matching this schema:
{"category": "billing|technical|account|other", "confidence": 0.0-1.0, "reason": "<one sentence>"}
Examples:
Message: "I was charged twice for March and I can't log in to check."
{"category": "account", "confidence": 0.8, "reason": "The double charge matters, but they cannot access the account to act on it, so access is the blocker."}
Message: "hey"
{"category": "other", "confidence": 0.2, "reason": "No classifiable content."}The first example is the one that earns its place: it teaches the tie-break rule in a way the prose alone does not.
Diagnosing a failing prompt systematically:
Symptom: the classifier returns "billing" for technical messages ~15% of the time.
Hypotheses, tested one at a time against the 40-case evaluation set:
H1: The category definitions overlap.
Test: read them. "billing" says "payment methods"; several technical
messages are about a broken payment *integration*.
Result: CONFIRMED. Baseline 85% -> 94% after clarifying that integration
failures are technical regardless of subject matter.
H2: Reasoning would help.
Test: add "Think step by step before answering."
Result: no accuracy change, +340ms latency, +180 tokens. REVERTED.
H3: More examples would help.
Test: 6 examples instead of 2.
Result: 94% -> 96%. Kept. Diminishing returns past 6 (tested 10: 96%).
Final: 96%, at lower cost than the baseline.Notes
- The measurement set is the entire discipline. A prompt engineer without an evaluation set is guessing with extra confidence.
- "Think step by step" is not free and is not universally helpful. It reliably improves multi-step arithmetic and logic; it reliably does nothing for classification. Measure rather than assume.
- Prompt injection is a real vulnerability when user content enters a prompt. Never let user text be interpreted as instructions — delimit it clearly and treat the model's output as untrusted.
Other versions79 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 79
- trycompai/comp★ 2.1ksame name
- niki914/zafiro★ 319same name
- CodeAlive-AI/ai-driven-development★ 167same name
- grandamenium/cortextos★ 101same name
- nahid-sparktales/agent-dispatcher★ 59same name
- geekatron/jerry★ 37same name
- Bbar0n234/learnflow-ai★ 35same name
- sabahattink/antigravity-fullstack-hq★ 30same name
- VoDaiLocz/kilo-kit-mcp★ 28same name
- jshearin01/agent-skills★ 16same name
69 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use security-checklist, coding-principles and 6 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.
atuljha23Skillsecurity-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
GoogleSkillcoding-principles
Enforces engineering, architecture, public API, and code quality standards distilled from human reviewer feedback across A2UI pull requests. Use when authoring new code, refactoring, addressing review feedback, or reviewing PR diffs. Don't use for release publishing or spec blueprint generation without code or PR changes.
Also in 3 projects that use this
javalenciacaiSkillmulti-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
LangChainSkillweb-research
Use this skill for requests related to web research; it provides a structured approach to conducting comprehensive web research
Also in 4 projects that use this
harrissohail6Skilldatabase-design
Database schema design and SQL best practices. Use when designing tables, writing queries, or optimizing database performance.
Also in 4 projects that use this
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 4 projects that use this
In this repository137 other files it gives its agents.
- agent-instructionsSkill
- agent-memorySkill
- hooksSkill
- plugin-developmentSkill
- skill-authoringSkill
- skill-reviewSkill
- slash-commandsSkill
- subagentsSkill
- agent-designSkill
- context-engineeringSkill
- fine-tuningSkill
- llm-cost-optimizationSkill
- llm-evaluationSkill
- llm-integrationSkill
- mcp-serverSkill
- ml-pipelineSkill
- model-selectionSkill
- ragSkill
- structured-outputSkill
- api-designSkill
- background-jobsSkill
- cachingSkill
- djangoSkill
- event-driven-architectureSkill
- fastapiSkill
- graphqlSkill
- microservicesSkill
- nestjsSkill
- realtime-websocketsSkill
- spring-bootSkill
- competitive-analysisSkill
- lead-researchSkill
- product-analysisSkill
- resumeSkill
- user-researchSkill
- database-performanceSkill
- data-modelingSkill
- data-qualitySkill
- pandasSkill
- postgresSkill
- sparkSkill
- brand-guidelinesSkill
- generative-artSkill
- themingSkill
- ui-reviewSkill
- visual-designSkill
- architecture-decisionsSkill
- bug-fix-protocolSkill
- cli-developmentSkill
- code-reviewSkill
- debuggingSkill
- design-patternsSkill
- domain-modelingSkill
- git-workflowSkill
- legacy-modernizationSkill
- refactoringSkill
- repository-explorationSkill
- simple-designSkill
- system-designSkill
- aws-cdkSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

