agentleFS
NikoxkxNikoxkx/Agent-Skills/skills/ai-ml/prompt-engineer/SKILL.md

prompt-engineer

Skill2 starsChanged 6 months agoApache-2.0View on GitHub

Designs, tests, and iterates on LLM prompts for accuracy, reliability, and performance. Use when crafting system prompts, few-shot examples, chain-of-thought prompts, or output format instructions.

45 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use secure-code-guardian, fullstack-guardian 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.
  • JeffallanSkill

    secure-code-guardian

    Use when implementing authentication/authorization, securing user input, or preventing OWASP Top 10 vulnerabilities — including custom security implementations such as hashing passwords with bcrypt/argon2, sanitizing SQL queries with parameterized statements, configuring CORS/CSP headers, validating input with Zod, and setting up JWT tokens. Invoke for authentication, authorization, input validation, encryption, OWASP Top 10 prevention, secure session management, and security hardening. For pre-built OAuth/SSO integrations or standalone security audits, consider a more specialized skill.

    Also in 3 projects that use this

  • JeffallanSkill

    fullstack-guardian

    Builds security-focused full-stack web applications by implementing integrated frontend and backend components with layered security at every level. Covers the complete stack from database to UI, enforcing auth, input validation, output encoding, and parameterized queries across all layers. Use when implementing features across frontend and backend, building REST APIs with corresponding UI, connecting frontend components to backend endpoints, creating end-to-end data flows from database to UI, or implementing CRUD operations with UI forms. Distinct from frontend-only, backend-only, or API-only skills in that it simultaneously addresses all three perspectives—Frontend, Backend, and Security—within a single implementation workflow. Invoke for full-stack feature work, web app development, authenticated API routes with views, microservices, real-time features, monorepo architecture, or technology selection decisions.

    Also in 3 projects that use this

  • AutumnsGroveSkill

    api-designer

    Design and document RESTful and GraphQL APIs with OpenAPI/Swagger specifications, authentication patterns, versioning strategies, and best practices. Use for: (1) Creating API specifications, (2) Designing REST endpoints, (3) GraphQL schema design, (4) API authentication and authorization, (5) API versioning strategies, (6) Documentation generation

    Also in 5 projects that use this

  • +9 more from Jeffallan

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 40 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use model response_format: {type: "json_object"} (OpenAI) or equivalent.

    line 57
  2. Distinctive:

    Create a small golden set (10-30 examples) with expected outputs.

    line 67
  3. Distinctive:

    Model refuses or hallucinates: Add explicit "If you cannot answer from the provided context, say 'I don't have enough information'."

    line 85
  4. Distinctive:

    Output not parseable: Always validate + retry loop with the error message fed back to the model.

    line 86
  5. Distinctive:

    Run the prompt on the golden set — success rate meets the target (e.g., >90% on key fields).

    line 91
  6. Distinctive:

    Test with adversarial or edge-case inputs — model behaves as specified.

    line 92

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

Overview

Designs, tests, and iterates high-quality LLM prompts. Covers prompt anatomy (role, context, instructions, examples, output format), few-shot example selection and ordering, chain-of-thought triggering, structured output (JSON mode, Pydantic, grammar), prompt injection defenses, systematic evaluation, and 10 reusable prompt patterns that have proven effective across many tasks.

When to Use This Skill

  • Building or improving system prompts for agents, chatbots, or tools.
  • The user wants reliable, structured output from an LLM.
  • Debugging inconsistent or low-quality LLM responses.
  • Creating few-shot examples or chain-of-thought prompts.

Prerequisites

  • Access to one or more LLMs (via API or local).
  • A clear task definition and success criteria.
  • Evaluation data (even 10-20 examples is useful to start).

Steps

  1. Define the task precisely:
    • What is the input?
    • What is the desired output (format, content, constraints)?
    • What are the failure modes to avoid?
  2. Prompt anatomy (use this structure):
    • Role / persona.
    • Context / background.
    • Task instructions (clear, numbered, imperative).
    • Constraints and rules.
    • Few-shot examples (2-6 high-quality ones).
    • Output format (JSON schema, bullet list, specific template).
    • Reasoning encouragement ("Think step by step").
  3. Few-shot best practices:
    • Choose diverse, representative, high-quality examples.
    • Order matters — put the most similar or most important first.
    • Include both positive and "edge" examples when helpful.
  4. Chain-of-Thought (CoT):
    • "Let's think step by step."
    • Or more specific: "First identify X, then Y, then produce Z."
    • For complex reasoning, use "ReAct" style (Thought → Action → Observation).
  5. Structured output:
    • Use model response_format: {type: "json_object"} (OpenAI) or equivalent.
    • Provide a Pydantic model or JSON Schema in the prompt.
    • Validate the output in code and retry with error feedback if invalid.
  6. Defense against prompt injection:
    • Clearly separate instructions from user content (e.g., XML tags, "User input starts here:").
    • Instruct the model to ignore instructions inside user content.
    • Validate and sanitize output.
  7. Evaluation & iteration:
    • Create a small golden set (10-30 examples) with expected outputs.
    • Score outputs (exact match, fuzzy, LLM-as-judge).
    • A/B test prompt variants.
    • Track regression when changing models or prompts.
  8. Output:
    • The full system prompt + user template.
    • 3-6 few-shot examples.
    • Evaluation script or rubric.
    • Notes on which model(s) it works best with.
    • Version history of the prompt.

Examples

10 reusable prompt patterns (Classification, Extraction, Summarization, Reasoning, Tool Use, Critique, etc.) with full prompts and example inputs/outputs are included, plus a complete worked example for "Extract structured customer feedback from free-text reviews" with JSON schema, CoT, and evaluation.

Edge Cases & Error Handling

  • Model refuses or hallucinates: Add explicit "If you cannot answer from the provided context, say 'I don't have enough information'."
  • Output not parseable: Always validate + retry loop with the error message fed back to the model.
  • Context length: Summarize or chunk long context; use RAG when appropriate.

Verification

  1. Run the prompt on the golden set — success rate meets the target (e.g., >90% on key fields).
  2. Test with adversarial or edge-case inputs — model behaves as specified.
  3. Structured output is always valid JSON that passes Pydantic validation.
  4. Changing the model (within the same family) still produces good results (or you have noted model-specific tuning).
  5. Success: The prompt is reliable enough to use in production or as part of an agent, with known limitations documented.

References

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.