Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Prompt Improvement Skill

A Claude Code skill that analyzes prompts and produces improved versions based on Anthropic's official prompt engineering best practices.

What It Does

The /improve-prompt skill systematically evaluates prompts against 10 key techniques from Anthropic's documentation:

  1. XML Tags - Structure complex prompts with clear boundaries
  2. Variables - Template placeholders for reusable prompts
  3. Role/Persona - Expertise framing for better responses
  4. Examples - Input/output demonstrations (multishot prompting)
  5. Chain of Thought - Step-by-step reasoning for complex tasks
  6. Clarity - Replace vague language with specific terms
  7. Output Format - Explicit response structure
  8. Constraints - Boundaries and exclusions
  9. Context - Background information and audience
  10. Task Decomposition - Breaking complex tasks into chains

For each technique, the skill determines whether it's present, needed, and how to apply it appropriately.

Installation

Quick Install (Personal Use)

Copy the skill to your Claude Code skills directory:

# Clone the repository
git clone https://github.com/christabone/claude-prompt-improvement.git
cd claude-prompt-improvement

# Install to personal skills directory
mkdir -p ~/.claude/skills
cp -r skills/improve-prompt ~/.claude/skills/

Project Install (Team Use)

Add to your project's .claude/skills/ directory:

# From your project root
mkdir -p .claude/skills
cp -r /path/to/claude-prompt-improvement/skills/improve-prompt .claude/skills/

Project skills are automatically shared with team members via git.

Verify Installation

Start Claude Code and ask:

What skills are available?

You should see improve-prompt listed.

Usage

The skill activates automatically when you ask Claude to improve, optimize, or review a prompt. Examples:

Can you improve this prompt for me?

Review this prompt and make it better: [your prompt]

Optimize this prompt using best practices: [your prompt]

Or reference a file:

Improve the prompt in prompts/my-prompt.txt

What You Get

The skill produces two output files:

  1. improved_prompt.md - The rewritten prompt with all improvements
  2. improvement_summary.md - Detailed explanation of what changed and why

Example

Before:

Hey Claude! So I've been working on this Python function and I think it needs
some work but I'm not totally sure what's wrong with it. It's supposed to get
user data from our API and do some stuff with it. Could you take a look?

After:

<role>
You are a senior Python developer performing a code review. Focus on practical,
actionable feedback rather than stylistic nitpicks.
</role>

<instructions>
Review the following Python function that fetches and processes user data from
a REST API. Provide feedback in these specific areas:

1. **Bugs**: Identify any logic errors, edge cases, or runtime errors
2. **Error Handling**: Evaluate how the function handles API failures
3. **Best Practices**: Check adherence to Python conventions
4. **Performance**: Note any inefficiencies
</instructions>

<code>
{{code}}
</code>

<output_format>
## Summary
## Bugs Found
## Error Handling Issues
## Best Practice Violations
## Performance Suggestions
## Recommended Priority
</output_format>

Updating Anthropic Documentation

The skill references Anthropic's prompt engineering documentation, which may change over time. Use the fetcher scripts to check for and incorporate updates.

Setup (One-Time)

cd fetcher

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Install Playwright browser
playwright install chromium

Check for Documentation Changes

cd fetcher
source venv/bin/activate

# Check for changes (doesn't modify anything)
python fetch_docs.py --check

Output shows which pages changed:

Checking 10 pages...

  overview... unchanged
  be-clear-and-direct... unchanged
  chain-of-thought... CHANGED
  extended-thinking-tips... NEW

==================================================
SUMMARY
==================================================
  Unchanged: 8
  CHANGED:   1
  NEW:       1
==================================================

*** 2 change(s) detected! Check diff_log.md for details. ***

Fetch and Save Updates

# Fetch all pages and save changes
python fetch_docs.py

# Or force re-fetch everything
python fetch_docs.py --force

Updated content is saved to:

  • data/processed/*.md - Cleaned markdown versions
  • data/manifest.json - Hashes and timestamps for change detection
  • diff_log.md - Human-readable changelog

After Updating

If documentation changed significantly:

  1. Review diff_log.md for what changed
  2. Compare old vs new in data/processed/
  3. Update skills/improve-prompt/CHECKLIST.md if techniques changed
  4. Update skills/improve-prompt/reference/techniques.md if needed
  5. Re-install the skill: cp -r skills/improve-prompt ~/.claude/skills/

Adding New Documentation Pages

Edit fetcher/urls.txt to add or remove pages:

# Comments start with #
https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview
https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/new-page

Repository Structure

claude-prompt-improvement/
├── skills/
│   └── improve-prompt/
│       ├── SKILL.md              # Main skill instructions
│       ├── CHECKLIST.md          # 10-technique evaluation checklist
│       ├── reference/
│       │   └── techniques.md     # Condensed technique reference
│       └── scripts/
│           └── checks/
│               ├── xml_tags.py   # Detect XML tag patterns
│               └── variables.py  # Detect template variables
├── fetcher/
│   ├── fetch_docs.py             # Documentation fetcher script
│   ├── urls.txt                  # URLs to monitor
│   └── requirements.txt          # Python dependencies
├── data/
│   ├── processed/                # Cleaned markdown docs
│   └── manifest.json             # Content hashes for change detection
├── test/                         # Example prompts and outputs
└── diff_log.md                   # Documentation change history

How It Works

  1. Automated Detection - Python scripts detect XML tags and template variables
  2. Manual Judgment - Claude evaluates all 10 techniques using CHECKLIST.md criteria
  3. Visible Reasoning - Claude outputs thinking process for transparency
  4. Actionable Output - Produces improved prompt file, not just suggestions

The skill follows Anthropic's guidance that some checks (XML tags, variables) can be pattern-matched, while others (role, examples, clarity) require nuanced judgment.

License

MIT

Contributing

  1. Fork the repository
  2. Make changes
  3. Run the skill on test prompts to verify
  4. Submit a pull request

About

A series of scripts, skills, and instructions used for improving Claude Code's prompts.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages