prompt-refiner-claude

2
0
Source

Refine prompts for Claude models (Opus, Sonnet, Haiku) using Anthropic's best practices. Use when preparing complex tasks for Claude.

Install

mkdir -p .claude/skills/prompt-refiner-claude && curl -L -o skill.zip "https://mcp.directory/api/skills/download/3904" && unzip -o skill.zip -d .claude/skills/prompt-refiner-claude && rm skill.zip

Installs to .claude/skills/prompt-refiner-claude

About this skill

Claude Prompt Refiner

Refine prompts to get better results from Claude models by applying Anthropic's recommended patterns.

When to Use

Invoke this skill when you have a task for Claude that:

  • Involves multiple steps or files
  • Requires specific output formatting
  • Needs careful reasoning or analysis
  • Would benefit from structured context

Refinement Process

Step 1: Analyze the Draft Prompt

Review the user's prompt for:

  • Clear outcome definition
  • Sufficient context
  • Explicit constraints
  • Success criteria

Ask clarifying questions if any of these are missing.

Step 2: Apply Claude-Specific Patterns

Structure with XML tags: Claude responds exceptionally well to XML-style tags for organizing complex prompts:

  • <context> - Background information, codebase state, environment
  • <task> - The specific action to take
  • <requirements> - Must-have criteria
  • <constraints> - Limitations and boundaries
  • <examples> - Sample inputs/outputs if helpful
  • <output_format> - How to structure the response

Ordering matters:

  1. Context first (what exists)
  2. Task second (what to do)
  3. Requirements third (how to do it)
  4. Examples last (clarifying edge cases)

Step 3: Enhance for Reasoning

For complex tasks, add thinking prompts:

  • "Think through the approach before implementing"
  • "Consider these edge cases: ..."
  • "Explain your reasoning for key decisions"

Step 4: Output the Refined Prompt

Present the improved prompt with:

  • Clear section headers
  • XML tags where beneficial
  • Specific, measurable criteria
  • An explanation of what changed and why

Example Transformations

Example 1: Vague Task

Before:

Add caching to the API

After:

<context>
The /api/products endpoint currently queries the database on every request.
Average response time is 200ms. We use Redis for other caching in the app.
</context>

<task>
Add Redis caching to the /api/products endpoint to reduce database load.
</task>

<requirements>
- Cache TTL of 5 minutes
- Cache invalidation when products are updated
- Graceful fallback to database if Redis is unavailable
- Add cache hit/miss metrics logging
</requirements>

<constraints>
- Don't change the response format
- Must pass existing integration tests
- Use our existing Redis connection from src/lib/redis.ts
</constraints>

Example 2: Code Review Request

Before:

Review this PR

After:

<context>
This PR adds user authentication to our Next.js application.
Our stack: Next.js 14, TypeScript, Prisma, PostgreSQL.
Security is critical - this handles user sessions and passwords.
</context>

<task>
Review the changes in this PR for security issues, code quality, and adherence to our patterns.
</task>

<requirements>
Focus on:
1. Security vulnerabilities (auth bypass, injection, etc.)
2. Error handling and edge cases
3. TypeScript type safety
4. Test coverage for critical paths
</requirements>

<output_format>
Organize your review as:
## Critical Issues (must fix before merge)
## Recommendations (should consider)
## Minor Suggestions (nice to have)
## What Looks Good (positive feedback)
</output_format>

Example 3: Feature Implementation

Before:

Add dark mode

After:

<context>
React application using Tailwind CSS for styling.
Currently only has light mode. Design tokens are in tailwind.config.js.
User preference should persist across sessions.
</context>

<task>
Implement dark mode toggle with system preference detection and persistence.
</task>

<requirements>
- Toggle component in the header
- Detect system preference on first visit
- Persist user choice in localStorage
- Smooth transition between modes
- Update all existing components to support both modes
</requirements>

<constraints>
- Use Tailwind's built-in dark mode support
- Don't add new dependencies
- Ensure WCAG AA contrast ratios in both modes
</constraints>

<examples>
Current light mode colors:
- Background: bg-white
- Text: text-gray-900
- Primary: text-blue-600

Expected dark mode equivalents:
- Background: dark:bg-gray-900
- Text: dark:text-gray-100
- Primary: dark:text-blue-400
</examples>

Tips for Best Results

  1. Be specific about scope - "the auth module" → "src/auth/session.ts"
  2. Include file paths when relevant
  3. Reference existing patterns - "follow the pattern in UserService.ts"
  4. State what NOT to do - constraints prevent unwanted changes
  5. Define done - what does success look like?

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

641968

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

590705

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

339397

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318395

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

450339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.