Guide · Agent skill
How to use the Prompt Engineering Patterns agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The prompt-engineering-patterns skill gives an AI agent a set of established methods for writing prompts that behave reliably in real applications, such as few-shot examples, step-by-step reasoning, structured JSON output and reusable templates. It is aimed at developers building LLM-powered features and teams that maintain prompt libraries. After this guide you will know how to install the skill, how to ask for it with natural requests, and what it needs before you run its optimization script.
Quick start
- 1Download and unzip. Download the skill ZIP from this page and unzip it so you have a prompt-engineering-patterns folder containing SKILL.md.
- 2Place the folder. Move the folder to ~/.claude/skills/ for personal use, or to .claude/skills/ in a project. Alternatively, upload it under Settings → Capabilities → Skills in the Claude apps.
- 3Make a natural request. Describe the prompt problem in plain words, such as inconsistent labels or unreliable JSON, and include the desired output format.
- 4Review the output. Check the proposed template, examples and system prompt against your own test cases before relying on them.
- 5Prepare the optimizer if needed. Install numpy, provide an LLM client with a complete() method, and read scripts/optimize-prompt.py before running it.
- 6Track the metrics. Compare prompt variants on accuracy, latency, token use and success rate to decide which version to keep.
What does the skill make the agent do?
Agent skills are folders of instructions that an AI agent loads when a task matches them. This one is about prompt writing. When it is active, the agent can design prompt templates, add worked examples (few-shot learning), ask for step-by-step reasoning (chain-of-thought), request structured JSON output, design system prompts, and help diagnose why a prompt gives inconsistent answers.
The skill also ships a sample template library covering classification and extraction prompts, and a Python script, scripts/optimize-prompt.py, that can A/B test prompt variants against a test suite and track accuracy, latency and token use.
- Few-shot learning: choosing and writing input-output examples
- Chain-of-thought: zero-shot and few-shot reasoning prompts
- Structured outputs: JSON mode and Pydantic schema enforcement
- Prompt optimization: iterative refinement and A/B testing
- Template systems and system prompt design
How do you install the skill?
Download the skill ZIP from this page and unzip it. For personal use across projects, place the unzipped folder in ~/.claude/skills/. To limit it to one project, place it in that project's .claude/skills/ folder instead.
If you use the Claude apps, you can upload the skill instead. Open Settings, go to Capabilities, then Skills, and upload the skill there.
- Personal install: ~/.claude/skills/
- Project install: .claude/skills/ inside your project
- Claude apps: Settings → Capabilities → Skills
How do you trigger the skill with a natural request?
You do not need to name the skill. The skill description lists phrases such as "optimize a prompt", "improve prompt performance", "design a prompt template", "write better prompts", "debug prompt issues", "use chain-of-thought" and "few-shot prompting". Asking in those terms, or describing a prompt that works sometimes but not reliably, should bring the skill into play.
What are good example requests?
Requests work best when they include the task, the failure you are seeing, and the output format you need. The examples below show the kind of request the skill is written to handle.
- "Write a prompt that extracts name, date and amount from invoices as JSON, and show me how to validate it with Pydantic."
- "My sentiment prompt gives different labels for the same review. Debug it and suggest fixes."
- "Use few-shot examples to improve this classification prompt, and pick examples that cover edge cases."
- "Design a reusable template with variables for product name and tone, plus a system prompt that limits answers to our support topics."
- "Compare two versions of this prompt against my test cases and report accuracy, latency and token use."
What do you need before using it?
The skill itself is instructions and templates. Running its optimization script requires more. The script at scripts/optimize-prompt.py uses Python 3 with numpy, and expects an LLM client object with a complete() method. The Quick Start example assumes langchain-anthropic, langchain-core and pydantic, plus an Anthropic API key, which is not included.
Using the prompt guidance alone does not require running any script, but the source notes that the skill runs scripts and uses the network.
- Python 3 with numpy (for scripts/optimize-prompt.py)
- An LLM client object with a complete() method for the optimizer
- For the Quick Start: langchain-anthropic, langchain-core, pydantic
- An Anthropic API key (not included)
pip install numpy langchain-anthropic langchain-core pydanticWhat should you check before running the scripts?
The optimization script executes code and calls a model endpoint. Review it before running, and do not run it on untrusted test data or against paid API keys without checking what it does. Start with a small, trusted test suite so you can see the cost and behaviour before scaling up.
Treat any sample code as a starting point. Check model names and client setup against the library you have installed.
- Read scripts/optimize-prompt.py before running it
- Use trusted, representative test data
- Be aware that paid API calls will be made
What tips help you get reliable results?
Start with a simple prompt and add patterns only when a measured problem needs them, since the patterns add overhead. Keep examples close to the real task, because mismatched examples confuse the model. Parameterise prompts instead of hardcoding values, and keep prompts under version control so you can compare them.
- Be specific: vague prompts produce inconsistent results
- Use examples that match the target task
- Validate outputs against a schema and handle malformed responses
- Test on edge cases, not only typical inputs
- Track success rate (valid, parseable outputs) alongside accuracy
What people use it for
- Turning a free-text extraction prompt into one that returns validated JSON for a parser
- Diagnosing why a sentiment classifier gives different labels for similar inputs
- Building a versioned library of classification and extraction templates for a team
- A/B testing two system prompts against a fixed test suite before a release
Frequently asked questions
How do I install the prompt-engineering-patterns skill?
Download the ZIP from this page and unzip it. Put the folder in ~/.claude/skills/ for personal use, or in a project's .claude/skills/ folder. In the Claude apps you can instead upload it under Settings → Capabilities → Skills.
Is the prompt-engineering-patterns skill free?
The source lists the licence as MIT. Calling the model through the Quick Start or optimizer script may incur API costs from your provider, which the skill does not include.
What do I need to run the optimization script?
You need Python 3 with numpy and an LLM client object with a complete() method. The script calls a model endpoint, so you also need access to one, such as an Anthropic API key for the Quick Start example.
Does the skill run code on my computer?
Yes. The source says it runs scripts and uses the network. Read scripts/optimize-prompt.py before running it and avoid untrusted test data.
Why doesn't the agent use the skill when I ask for help with a prompt?
Try wording the request around the phrases in the skill description, such as optimize a prompt, debug prompt issues, or use few-shot prompting. Naming the failure you see, like inconsistent answers, also helps.
How does this compare with just asking for a better prompt?
A plain request can work for a one-off question. This skill adds a structured set of patterns, a template library and an A/B testing script for prompts you need to make reliable and measure over time.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
This skill suits developers and teams building LLM features who need consistent, parseable outputs or a tested, versioned prompt library. If you have a one-off question, a plain prompt is usually enough, and the extra patterns will only add overhead.
Download the skill