MCPInstall

ai-prompt-engineering

Prompt engineering for production LLMs — structured outputs, evals, RAG, tool workflows, multimodal prompting, and safety. Use when designing, debugging, or shipping prompts.

Installs
226
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/vasilyu1983/ai-agents-public --skill ai-prompt-engineering
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads ai-prompt-engineering automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Prompt Engineering — Operational Skill

Route Elsewhere

  • agent architecture and orchestration -> ai-agents
  • retrieval quality and chunking -> ai-rag
  • model selection and prompt vs RAG vs fine-tune architecture -> ai-architecture-advisor
  • fine-tuning or distilling a model -> ai-llm
  • inference latency and cost optimization -> ai-llm-inference
  • deployment, monitoring, and platform controls -> ai-mlops

Quick Start

  1. Classify the prompt job: structured output, extraction, RAG, tool use, rewrite, classification, or release workflow.
  2. Start from a template or provider-native prompt feature rather than writing from scratch.
  3. Add explicit output and refusal rules.
  4. Add validation: schema checks, citation checks, post-tool checks, and failure handling.
  5. Add evals before calling the prompt production-ready.

Quick Reference

  • Schema design and repair path → core patterns.
  • Repeated evals at production settings → prompt testing.
  • Stable prefix and cache checks → cache layout.

Cross-Model Notes

  • Prefer provider-native structured outputs, registries, evals, and prompt tooling where available.
  • Ask for final answers, checks, or brief justification, not visible chain-of-thought.
  • Treat retrieved context, tool outputs, and user documents as untrusted data.
  • Run only truly independent tool calls in parallel; keep writes and validation serialized.
  • Keep state compact and resilient to context compression.

Pattern Chooser

NeedPatternCore Controls
Machine-parseable outputStructured outputschema, JSON-only response, validation
Deterministic field extractionExtractormissing -> null, no transformation, exact schema
Retrieved factual answeringRAG workflowrelevance check, citation requirement, explicit missing-info behavior
Hidden reasoningPrivate reasoning / native thinkingfinal answer only, no exposed chain-of-thought
Tool useTool or agent plannerplan, tool gating, validation after each call
Text transformationRewrite and constrainmeaning preservation, style and format rules
Classification or routingDecision treemutually exclusive branches, stable output format
Prompt releasePrompt opsversioning, eval gates, rollback path
Choosing prompt vs RAG vs fine-tune vs distillEscalation decisionPrompt → RAG (knowledge gap) → Fine-tune (volume + stable task) → Distill (cost at scale). See references/prompt-vs-finetune.md.

Workflow

  1. Pick the closest pattern.
  2. Load the smallest useful template or reference.
  3. Write the prompt contract:
    • task
    • allowed inputs and tools
    • output schema or format
    • refusal or missing-data behavior
  4. Add validators and adversarial tests.
  5. Verify current provider behavior before making claims about "best" settings or features.

Minimal Prompt Skeletons

Output contract

TASK:
{{one_sentence_task}}

INPUT:
{{input_data}}

RULES:
- Use only INPUT and approved tool outputs.
- Do not invent facts.
- Missing required information -> say what is missing.
- Keep reasoning hidden.
- Follow OUTPUT FORMAT exactly.

OUTPUT FORMAT:
{{schema_or_format_spec}}

Schema design (field order, closed enums with unknown, nullable fields, strict schema mode vs tool calling, discriminated unions, one validator-fed repair retry) is in references/core-patterns.md.

Tool or agent prompt

AVAILABLE TOOLS:
{{tool_names_or_signatures}}

WORKFLOW:
- Make a short plan.
- Call tools only when needed.
- Validate each tool result before using it.
- Run independent reads in parallel only if the environment supports it.

Grounded RAG prompt

RETRIEVED CONTEXT:
{{chunks_with_ids}}

RULES:
- Use only retrieved context for factual claims.
- Cite chunk ids for each claim.
- If evidence is missing, say what is missing.

Production Checklist

  • references/quality-checklists.md for pre-release validation
  • references/production-guidelines.md for rollout, guardrails, and regression policy
  • references/provider-native-prompt-ops.md for current provider tooling
  • references/prompt-security-defense.md for injection, tool abuse, and approval gates

Context Engineering

Prompt quality depends on the whole input pipeline, not just instruction wording.

  • prioritize the highest-signal context first
  • compress history and tool output aggressively
  • separate instructions, user data, and retrieved context with clear delimiters
  • adapt context size to task complexity instead of dumping everything into the window

Route deep retrieval or memory design work to ai-rag or ai-context-layer.

Cache-Aware Prompt Layout

Provider prompt caches match on an exact prefix, so order every request from most stable to least stable:

  1. Tool definitions, then system policy, then long reference documents and few-shot examples, then conversation history, then the current request.
  2. Put volatile values (timestamps, user IDs, request IDs, per-request flags) after the last cache breakpoint, never in tool descriptions or the system prompt.
  3. Any upstream change invalidates everything after it: editing or reordering tools, system text or examples, swapping an image, or changing the thinking setting.
  4. Verify with the cache-read token counts the API returns on repeated calls, not by assumption. When clearing or compacting mid-session pays for the cache rewrite is an ai-context-layer decision.

Core Principles

  • Define the contract before optimizing style.
  • Make determinism explicit with schemas, constrained decoding, and post-generation validation.
  • Treat prompt length and output caps as latency and cost controls.
  • Use evals plus regression gates instead of intuition.
  • Security means instruction-data separation, output validation, and tool-risk controls.

Do / Avoid

Do

  • keep prompts modular and versioned
  • centralize shared policies and schemas
  • block releases on prompt regressions
  • use provider-native prompt ops where they simplify maintenance

Avoid

  • prompt sprawl with many near-duplicates
  • brittle multi-step chains without validation
  • mixing product copy, policy, and control logic in one long prompt
  • asking for visible chain-of-thought

Prompt Change Attribution Gate

Prefer one independent prompt variable at a time: instruction, context, examples, schema, tool contract, or policy. When compatibility requires coupled edits, predeclare an atomic bundle, such as schema plus schema instructions or a tool definition plus its usage examples, and compare the complete bundle with the prior complete contract. Hold the model ID, inference settings, unrelated tool fixtures, and dated eval set constant; record the rendered prompt fingerprint and raw outputs. Judge syntax and schema compliance separately from semantic task success and refusal behavior. Promote only when the target slice improves within its regression budget. Label unrelated simultaneous runtime, provider, or model changes as confounders and re-baseline.

Known Traps

  • Designing a prompt contract around one specific frontier model as if its availability is guaranteed. Provider-side safety incidents, export-control actions, or capacity constraints can suspend or fall back a model family with no notice; a production prompt contract must already specify what happens when the primary model is unavailable, not just what happens when it refuses.
  • Attributing a refusal-rate or format-compliance regression to "the prompt got worse" without first checking whether the provider shipped a safety-classifier or model update in the same window.
  • Treating the prompt text itself as the whole system while validators, retrieval shaping, and tool-output checks remain undefined.
  • Mixing instructions, retrieved context, and user data without strong delimiters, then misdiagnosing injection or policy failures as "model quality" issues.
  • Shipping prompt changes without a regression set for the exact schema, citations, refusal behavior, and edge cases that matter.
  • Creating many slightly different prompts for the same job instead of maintaining one reusable pattern with explicit variants.
  • Asking for verbose exposed reasoning when the real requirement is a correct answer plus a narrow audit trail.

Navigation

Core references

  • references/core-patterns.md
  • references/best-practices-core.md
  • references/production-guidelines.md
  • references/quality-checklists.md
  • references/provider-native-prompt-ops.md
  • references/prompt-security-defense.md
  • references/domain-specific-patterns.md

Specialized references

  • references/extended-thinking-and-reasoning-models.md — provider-neutral rules for reasoning models: lookup step for sampling and effort controls, outcome-first prompting, fallback models, cost checks
  • references/prompt-vs-finetune.md — Prompt → RAG → Fine-tune → Distill escalation decision ladder
  • references/rag-patterns.md
  • references/agent-patterns.md
  • references/extraction-patterns.md
  • references/reasoning-patterns.md
  • references/multimodal-prompt-patterns.md
  • references/generative-media-prompt-patterns.md — Prompting generative image/video models (text-to-image persona, character-consistency edits, image-to-video, lip-sync): the shot-spec anatomy, model-pluggable dialects, copy-paste templates G1–G7
  • references/prompt-testing-ci-cd.md
  • references/additional-patterns.md
  • references/information-theory-applied.md — Information-theory applied recipes for prompts: redundancy diet, MI few-shot selection, KL drift gate.

Scripts

ScriptPurpose
scripts/prompt_regression_runner.pyRun a JSONL prompt regression suite (variant_id, prompt, actual, golden_substrings, schema). Groups results by variant. Validates pre-collected outputs only; a record without actual, without any assertion, or with an empty golden substring is rejected (exit 2) instead of passing vacuously. The schema check supports only type (including lists such as ["string","null"]), properties, required, additionalProperties: false, enum, const, items, minLength/maxLength, minimum/maximum and anyOf; any other keyword is rejected (exit 2), never ignored. For repeated runs, add one record per run with a shared case_id: the runner reports per-case pass rates and gates each case on --min-pass-rate (default 1.0) and on any failed must_pass run. Tests: scripts/test_prompt_regression_runner.py.

Templates and data

  • assets/quick/template-quick.md
  • assets/standard/template-standard.md
  • assets/standard/template-agent.md
  • assets/standard/template-rag.md
  • assets/standard/template-cot.md
  • assets/standard/template-json-extractor.md
  • assets/eval/prompt-eval-template.md
  • data/sources.json

Related Skills

  • ai-agents
  • ai-rag
  • ai-llm
  • ai-mlops
  • dev-api-design
  • software-backend

Learnings Loop

When prior decisions or pitfalls are relevant, consult learnings.consolidated.md if present; use learnings.md only for needed history or as the available fallback. Otherwise skip both.

After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.

FAQ

What does the ai-prompt-engineering skill do?

Prompt engineering for production LLMs — structured outputs, evals, RAG, tool workflows, multimodal prompting, and safety. Use when designing, debugging, or shipping prompts.

How do I install ai-prompt-engineering?

Run npx skills add https://github.com/vasilyu1983/ai-agents-public --skill ai-prompt-engineering in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/ai-prompt-engineering/ (personal) or .claude/skills/ai-prompt-engineering/ (project).

Which AI agents can use ai-prompt-engineering?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is ai-prompt-engineering safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains ai-prompt-engineering?

It is published by vasilyu1983 in vasilyu1983/ai-agents-public. It has 226 recorded installs.

More from vasilyu1983/ai-agents-public

View all →

software-architecture-design

vasilyu1983/ai-agents-public

Designs runtime topology in a chosen solution. Use when choosing monolith vs services, cells, consistency, ADRs. Not for cross-system design (software-solution-architecture).

product-management

vasilyu1983/ai-agents-public

Guides founder-PM discovery, roadmaps, prioritization, and PMF measurement. Use when planning product strategy, metrics, or roadmaps.

AI & Agents914 installs

document-xlsx

vasilyu1983/ai-agents-public

Builds Excel charts, pivots, validation, exports, Office Scripts/Graph automation, and workbook audits. Use when automating workbooks; for plain edits prefer official xlsx skill.

Data & Databases875 installs

software-ui-ux-design

vasilyu1983/ai-agents-public

Designs and audits UI/UX systems with usability and accessibility requirements. Use when shaping flows, design systems, interaction patterns, or WCAG-aware product behavior.

Frontend & Design731 installs

document-pdf

vasilyu1983/ai-agents-public

Handles PDF/UA accessibility, real redaction, metadata scrubbing, signing, and extraction. Use when redacting or signing PDFs; for plain create/merge prefer the official pdf skill.

Docs & Writing689 installs

qa-testing-playwright

vasilyu1983/ai-agents-public

Builds and debugs Playwright E2E suites. Use when authoring browser tests, fixing flakes, or hardening Playwright CI and locator strategy.

Testing & QA665 installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs