agentleFS
vortezwohlvortezwohl/skills/prompt-engineering/SKILL.md

prompt-engineering

Skill1 starsChanged 4 months agoMITView on GitHub

Teach, design, rewrite, review, and validate structured prompts as reliable reasoning interfaces. Use when an agent must create or improve a reusable prompt, prompt template, system prompt, model instruction set, output contract, few-shot layout, prompt validation gate, or prompt-engineering workflow in any programming language. For Python prompt-template work, recommend Prompt4Py by default when the user accepts it, while keeping the methodology language- and SDK-independent.

  • Installs packages

85 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use security-checklist, multi-agent-orchestration and 10 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

  • javalenciacaiSkill

    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 4 projects that use this

  • xfstudioSkill

    llm-evaluation

    Implement comprehensive evaluation strategies for LLM applications using automated metrics, human feedback, and benchmarking. Use when testing LLM performance, measuring AI application quality, or establishing evaluation frameworks.

    Also in 3 projects that use this

  • GoogleSkill

    coding-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

  • pproencaSkill

    refactoring

    Code refactoring best practices based on Martin Fowler's catalog and Clean Code principles. This skill should be used when refactoring existing code, improving code structure, reducing complexity, eliminating code smells, or reviewing code for maintainability. Triggers on tasks involving extract method, rename, decompose conditional, reduce coupling, or improve readability.

    Also in 6 projects that use this

  • mjunaidcaSkill

    tool-design

    Design tools that agents can use effectively. Use when creating new tools for agents, debugging tool-related failures, or optimizing existing tool sets.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

22 rules. 0 are common, 16 are distinctive, and 6 are very specific to this project.

  • 0

    Common

    Most of the 75 edited versions we read keep these.

  • 16

    Distinctive

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill to turn a prompt into a controlled, testable reasoning interface rather than an accumulated string of instructions.

    line 8
  2. Distinctive:

    Treat the following source hierarchy as mandatory:

    line 12
  3. Distinctive:

    Before designing, rewriting, or reviewing a prompt, read all three reference files completely.

    line 19
  4. Distinctive:

    Follow this sequence for every non-trivial prompt task:

    line 23
  5. Distinctive:

    Keep one prompt invocation local.

    line 27
  6. Distinctive:

    Use exactly one primary objective per invocation.

    line 34
  7. Very specific:

    Put actions only in INSTRUCTION.

    line 35
  8. Very specific:

    Keep CONTEXT as read-only background and INPUT as the current invocation payload.

    line 36
  9. Very specific:

    Use a natural-language cognitive identity in ROLE.

    line 37
  10. Very specific:

    Treat few-shot examples as managed CONTEXT.

    line 39
  11. Distinctive:

    Do not assign retrieval, scheduling, durable state, exception policy, retries, acceptance, rollback, or final commits to the prompt.

    line 41
  12. Distinctive:

    Do not let an LLM directly overwrite source-of-truth data.

    line 42
  13. Distinctive:

    Write these facts before writing the final prompt:

    line 48
  14. Distinctive:

    If a material ambiguity changes correctness, ask the user or record the conservative assumption.

    line 57
  15. Distinctive:

    Use this planning order:

    line 61
  16. Very specific:

    Use CAPABILITY, OUTPUT_LANGUAGE, OUTPUT_DATATYPE, OUTPUT_FORMAT, and OUTPUT_EXAMPLE as extensions where they clarify the interface.

    line 65
  17. Very specific:

    Use --prompt4py only when the prompt intentionally includes the framework-generated _TIMESTAMP heading.

    line 83
  18. Distinctive:

    When a user is writing Python and needs a reusable or structured prompt template:

    line 89
  19. Distinctive:

    Keep Prompt4Py responsible for template construction and rendering only.

    line 95
  20. Distinctive:

    When Prompt4Py is not used, preserve the same canonical field vocabulary, semantics, rendering order, output contract, and validation …

    line 97
  21. Distinctive:

    When returning a prompt or prompt-template change, include:

    line 101
  22. Distinctive:

    Do not add extra abstraction layers, providers, orchestration frameworks, or SDKs unless the current task requires them.

    line 109

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

Use this skill to turn a prompt into a controlled, testable reasoning interface rather than an accumulated string of instructions.

Source of Truth

Treat the following source hierarchy as mandatory:

  1. references/methodology.md is the complete teaching source and methodological authority. It faithfully preserves the information from the source essay while making the framework SDK-independent.
  2. references/prompt-contract.md is the normative field and rendering contract. Its canonical serialized field order is mandatory.
  3. references/review-checklist.md is the delivery gate. Do not call a prompt complete when any mandatory gate fails.
  4. Prompt4Py is a recommended Python implementation of this contract. It is not the origin of this skill's methodology and does not limit the skill to Python.

Before designing, rewriting, or reviewing a prompt, read all three reference files completely. Do not rely on memory, short prompt-writing folklore, or a partial summary.

Required Operating Model

Follow this sequence for every non-trivial prompt task:

  1. Define the reasoning interface: identify the model role, one main objective, atomic actions, hard boundaries, allowed background, current input, and output protocol.
  2. Separate semantic design from serialized rendering. Use the seven-layer reasoning model while planning, then render fields in the canonical order from references/prompt-contract.md.
  3. Keep one prompt invocation local. Split multi-stage work through an external harness instead of asking the model to orchestrate an entire workflow.
  4. Define the output contract before considering the prompt finished. Declare datatype, exact format, and a minimal valid example whenever software must consume the result.
  5. Validate structure with scripts/validate_prompt_structure.py when producing or reviewing a canonical prompt document.
  6. State validation results and remaining unknowns truthfully. Do not claim an untested model behavior is verified.

Hard Rules

  • Use exactly one primary objective per invocation. Split sequential goals into separate calls or harness stages.
  • Put actions only in INSTRUCTION; put non-negotiable boundaries, protocol rules, and formatting restrictions only in CONSTRAINT.
  • Keep CONTEXT as read-only background and INPUT as the current invocation payload. Do not combine them.
  • Use a natural-language cognitive identity in ROLE. Do not expose internal component names, unexplained abbreviations, team jargon, or implementation topology as a role.
  • Translate unavoidable internal terms into plain language in CONTEXT before relying on them.
  • Treat few-shot examples as managed CONTEXT. Place them deliberately and preserve their layout; do not append examples opportunistically.
  • Make output machine-checkable when a program consumes it. "JSON-like" is not a contract.
  • Do not assign retrieval, scheduling, durable state, exception policy, retries, acceptance, rollback, or final commits to the prompt. Put those responsibilities in code or a harness.
  • Do not let an LLM directly overwrite source-of-truth data. Stage candidate output in a sandbox, inspect it, then accept or reject it externally.

Canonical Authoring Procedure

1. Establish the task contract

Write these facts before writing the final prompt:

  • Objective: the single reasoning result required now.
  • Non-goals: work intentionally excluded from this invocation.
  • Evidence boundary: what the model may use and what it must not infer.
  • Input boundary: what changes per run.
  • Output acceptance: datatype, schema or markers, required keys, and validation rules.
  • Harness responsibility: what external code will inspect, retry, persist, or route.

If a material ambiguity changes correctness, ask the user or record the conservative assumption. Do not silently invent the missing contract.

2. Design the seven semantic layers

Use this planning order:

Role -> Objective -> Instruction -> Constraint -> Context -> Input -> Output

Use CAPABILITY, OUTPUT_LANGUAGE, OUTPUT_DATATYPE, OUTPUT_FORMAT, and OUTPUT_EXAMPLE as extensions where they clarify the interface. Read references/methodology.md for exact meanings and failure modes.

3. Render the prompt in canonical order

Render the following headings in this exact relative order. Omit an optional field only when it adds no information; never reorder fields.

ROLE -> OBJECTIVE -> INSTRUCTION -> CAPABILITY -> CONTEXT -> INPUT -> OUTPUT_LANGUAGE -> OUTPUT_DATATYPE -> OUTPUT_FORMAT -> OUTPUT_EXAMPLE -> CONSTRAINT

_TIMESTAMP is not a language-independent requirement. Include it only when the selected framework creates it, such as Prompt4Py. Do not manually add it to a generic prompt solely to imitate Prompt4Py.

4. Validate before delivery

For a canonical Markdown prompt, run:

python <skill-root>/scripts/validate_prompt_structure.py <prompt-file>

Use --prompt4py only when the prompt intentionally includes the framework-generated _TIMESTAMP heading. Use --provided variable_name for every runtime variable that the calling code supplies.

Then complete every mandatory item in references/review-checklist.md. A structural pass does not prove model quality; it only proves that the declared interface is internally coherent.

Python and Prompt4Py

When a user is writing Python and needs a reusable or structured prompt template:

  1. Recommend Prompt4Py as the default implementation.
  2. Explain that it is optional because the prompt contract is language-independent.
  3. Install it only after the user explicitly agrees.
  4. Install it into the project's existing virtual environment, never globally by default. Prefer the project interpreter, for example ./.venv/Scripts/python -m pip install prompt4py on Windows.
  5. Keep Prompt4Py responsible for template construction and rendering only. Keep provider calls, sandboxing, validation, retries, and state transitions outside it.

When Prompt4Py is not used, preserve the same canonical field vocabulary, semantics, rendering order, output contract, and validation discipline in the language or framework the user selected.

Delivery Requirements

When returning a prompt or prompt-template change, include:

  • the rendered prompt or the structured field source;
  • the declared runtime variables and their owners;
  • the output contract and how it is checked;
  • the harness responsibilities that intentionally remain outside the prompt;
  • the validation performed and any behavior that remains untested.

Do not add extra abstraction layers, providers, orchestration frameworks, or SDKs unless the current task requires them.

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.