Skip to main content
skill CX Codex

anthropic-prompt-engineer — Claude Code skill: how to install

Builds new prompts from scratch and refines existing templates for Claude models using official Anthropic prompt engineering guidelines.

MIT 233 installs ★ 236 updated 2026-01-14

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add jamesrochabrun/skills --skill anthropic-prompt-engineer -a claude-code
Open on GitHub

What anthropic-prompt-engineer does

This skill guides coding agents through Anthropic's proven prompt design methods. It applies semantic XML tags like <instructions> or <context>, chain-of-thought instructions for complex reasoning, few-shot examples, and response prefilling to steer formatting directly into clean JSON or specific code blocks.

The skill relies on files in its references/ directory, covering core techniques, recurring pitfalls, and Claude 4.x recommendations. Poorly framed prompts waste tokens and trigger hallucinations; this skill ensures your agent injects explicit role assignments, constraints, and edge-case handling before sending prompts to production.

What it helps with

  • build structured data extraction prompts returning strict JSON
  • convert vague one-line prompts into detailed XML-tagged specifications
  • prevent hallucinations and token waste across Claude models
  • add reliable few-shot examples and prefilled response prefixes

Example prompts for the agent

  • Using the anthropic-prompt-engineer skill, create a prompt that extracts contact details from emails into JSON
  • Using the anthropic-prompt-engineer skill, improve this prompt: 'Analyze this code and tell me if there are bugs'
  • Apply prompt engineering principles from anthropic-prompt-engineer to structure a multi-step workflow

How to install anthropic-prompt-engineer

1Skills CLI (Vercel)

npx skills add jamesrochabrun/skills --skill anthropic-prompt-engineer -a claude-code

2Manually: put the files in place

~/.claude/skills/anthropic-prompt-engineer/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/anthropic-prompt-engineer/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about anthropic-prompt-engineer

How to install anthropic-prompt-engineer in Claude Code?

Run npx skills add jamesrochabrun/skills --skill anthropic-prompt-engineer -a claude-code in your terminal.

What does anthropic-prompt-engineer do?

It equips your coding assistant with Anthropic prompt engineering rules to design, evaluate, and fix prompts for Claude models.

What reference docs does this skill provide?

Its references/ folder includes guides for core and advanced techniques, common pitfalls, Claude 4.x best practices, and reusable templates.

Source text

SKILL.md · MIT
---
name: anthropic-prompt-engineer
description: Master Anthropic's prompt engineering techniques to generate new prompts or improve existing ones using best practices for Claude AI models.
---

# Anthropic Prompt Engineer

Master the art and science of prompt engineering with Anthropic's proven techniques. Generate new prompts from scratch or improve existing ones using best practices for Claude AI models (Claude 4.x, Sonnet, Opus, Haiku).

## What This Skill Does

Helps you create and optimize prompts for Claude AI using Anthropic's official techniques:
- **Generate new prompts** - Build effective prompts from requirements
- **Improve existing prompts** - Optimize prompts for better results
- **Apply best practices** - Use proven techniques from Anthropic
- **Avoid common mistakes** - Prevent hallucinations and unclear outputs
- **Optimize for Claude 4.x** - Leverage latest model capabilities
- **Structure complex prompts** - Build multi-step, production-ready prompts

## Why Prompt Engineering Matters

**Without proper prompting:**
- Inconsistent or incorrect outputs
- Hallucinations and made-up information
- Unclear or verbose responses
- Wasted tokens and API calls
- Poor performance on complex tasks
- Difficulty reproducing results

**With engineered prompts:**
- Precise, reliable outputs
- Factual, grounded responses
- Clear, formatted results
- Efficient token usage
- Excellent complex task performance
- Reproducible, production-ready results

## Quick Start

### Generate a New Prompt

```
Using the anthropic-prompt-engineer skill, create a prompt that:
- Extracts structured data from customer emails
- Returns JSON format
- Handles missing information gracefully
- Includes 2 examples
```

### Improve an Existing Prompt

```
Using the anthropic-prompt-engineer skill, improve this prompt:

"Analyze this code and tell me if there are bugs"

Make it more effective using Anthropic's best practices.
```

## Core Techniques Summary

### 1. Be Clear and Direct
Provide explicit, unambiguous instructions. Claude 4.x excels with precise direction.

### 2. Use XML Tags for Structure
Organize prompts with semantic tags like `<instructions>`, `<example>`, `<context>`.

### 3. Chain of Thought (CoT)
Ask Claude to think step-by-step for complex reasoning.

### 4. Prefilling
Start Claude's response to guide format and style.

### 5. Few-Shot Examples
Provide 2-5 diverse examples showing the pattern you want.

### 6. Role Assignment
Give Claude a specific role or persona for appropriate context.

## Reference Materials

All techniques, examples, and templates are available in the `references/` directory:

- **core_techniques.md** - Essential techniques with examples
- **advanced_techniques.md** - Advanced methods and optimization
- **common_mistakes.md** - Pitfalls to avoid
- **claude_4_best_practices.md** - Claude 4.x specific guidance
- **prompt_templates.md** - Ready-to-use templates

## Usage Examples

### Example 1: Generate a Data Extraction Prompt

Create a prompt that extracts names, emails, and phone numbers from business cards.

### Example 2: Improve a Vague Prompt

Transform "Write about machine learning" into a structured, effective prompt.

### Example 3: Debug a Failing Prompt

Fix inconsistent outputs by adding structure, examples, and format specification.

## Best Practices Checklist

- [ ] Instructions are clear and specific
- [ ] Output format is explicitly defined
- [ ] Examples align with desired behavior
- [ ] XML tags separate different sections
- [ ] Context is minimal but sufficient
- [ ] Edge cases are addressed
- [ ] Tested on diverse inputs
- [ ] Token usage is optimized

## Key Principles

1. **Empirical Approach** - Test, measure, iterate
2. **Context as Resource** - Every token counts
3. **Clarity Over Cleverness** - Explicit instructions work best
4. **Examples Teach Best** - Show, don't just tell
5. **Structure Helps** - Organization reduces confusion
6. **Iteration Improves** - Refine based on results

## Summary

Master prompt engineering to create:
- Reliable and consistent outputs
- Production-ready prompts
- Token-efficient solutions
- Easy to maintain systems

Apply Anthropic's proven techniques for best results.

---

**Remember:** Good prompts are engineered, not guessed.

© jamesrochabrun · MIT · jamesrochabrun/skills

Similar skills

All skills for AI and ML →

From the same set23

The whole set →
swiftui-animation swiftui-animation guides AI coding agents through building SwiftUI spring animations and Metal shader effects on iOS and macOS. CX Codex +1 572installs book-illustrator book-illustrator guides the creation of children's book artwork for ages 0–12, covering color theory, character design, and composition. Useful for planning spreads and character sheets. CX Codex +1 485installs frontend-designer frontend-designer is a Claude Code skill that sets rules for frontend tasks: WCAG 2.1 AA, mobile-first layouts, CSS tokens, and React, Vue, and Svelte patterns. CX Codex +1 345installs reading-teacher reading-teacher turns a prompt into an interactive HTML reading lesson for children aged 1 to 10, from letter sounds to story comprehension. CX Codex +1 291installs query-expert query-expert is a Claude Code skill for writing, tuning, and debugging SQL and NoSQL queries. It reads EXPLAIN plans and suggests indexes. CX Codex +1 227installs anthropic-architect The anthropic-architect skill reviews project requirements and recommends whether to use Skills, Agents, Prompts, or SDK primitives. Use it to plan an Anthropic-based system. CX Codex +1 219installs openai-prompt-engineer The openai-prompt-engineer skill helps draft and refine prompts for GPT-5 and other language models. Use it to shape instructions, choose a prompting method, and specify the response format. CX Codex +1 211installs releasing-macos-apps The releasing-macos-apps skill guides macOS app releases from version changes and code signing through DMG creation, Apple notarization, and Sparkle updates. CX Codex +1 210installs

Project sponsors

Companies that keep this analytics open