agentleFS
adriaalcalaadriaalcala/claude-code-setup/skills/prompt-engineer/SKILL.md

prompt-engineer

Skill0 starsChanged 49 days agoMITView on GitHub

Create and optimize LLM prompts for specific tasks. Covers prompt patterns, few-shot learning, chain-of-thought, output formatting. Test prompts locally with Ollama before cloud APIs. Trigger on 'prompt', 'improve prompt', 'optimize prompt', 'write prompt', 'prompt engineering'.

74 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use idea-validator, debugger and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • dipaulavsSkill

    idea-validator

    Validates app ideas before building. Analyzes market saturation, competitors, real demand vs stated interest, solo builder feasibility (2-4 weeks timeline), and monetization potential. Use when user asks to validate an idea, evaluate a concept, check if idea is worth building, or before starting a new project.

    Also in 3 projects that use this

  • JohnJBorenSkill

    debugger

    Systematic debugging workflows, root cause analysis, and troubleshooting patterns

    Also in 3 projects that use this

  • VercelSkill

    technical-writer

    Write, review, and edit developer documentation for SDKs, libraries, and frameworks, including sites such as ai-sdk.dev and chat-sdk.dev. Use for getting-started guides, tutorials, API references, conceptual explanations, integration guides, migration guides, troubleshooting, and code examples.

    Also in 3 projects that use this

  • JetBrainsSkill

    webapp-testing

    Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

    Also in 4 projects that use this

  • JetBrainsSkill

    doc-coauthoring

    Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. 0 are common, 14 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 65 edited versions we read keep these.

  • 14

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Generation: Create new content (code, text, ideas)

    line 18
  2. Distinctive:

    Test before sending to cloud APIs:

    line 209
  3. Distinctive:

    Create 5-10 representative test cases:

    line 224
  4. Distinctive:

    Add more context/examples

    line 255
  5. Distinctive:

    Add constraints ("exactly 3 items", "under 50 words")

    line 257
  6. Distinctive:

    Add example with exact formatting

    line 261
  7. Distinctive:

    Add more context to prompt

    line 264
  8. Distinctive:

    Use different approach (e.g., few-shot instead of zero-shot)

    line 271
  9. Distinctive:

    Test initial prompt → 60% success

    line 275
  10. Distinctive:

    Add 2-3 examples showing input/output

    line 284
  11. Distinctive:

    Keep prompts in git (prompts/ directory)

    line 322
  12. Distinctive:

    Test results per version

    line 324
  13. Distinctive:

    No examples: Always include 1-2 examples for clarity

    line 365
  14. Distinctive:

    Always test with Ollama first:

    line 373

“Common” is measured: kept by at least 6 in 10 of the 65 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Prompt Engineer Skill

Overview

Design, test, and optimize prompts for language models. Includes patterns for classification, generation, reasoning, and code tasks.

Phase 1: UNDERSTAND

Task Type

Identify what you need the model to do:

  • Classification: Categorize input into predefined classes
  • Extraction: Pull specific information from text
  • Summarization: Condense longer text
  • Generation: Create new content (code, text, ideas)
  • Translation: Convert between languages
  • Reasoning: Multi-step logical thinking (math, planning)
  • Code: Generate, debug, or explain code
  • Chat: Conversation/dialogue

Model Characteristics

  • Model name: Which LLM (GPT-4, Claude, qwen3-coder, llama3)?
  • Context size: How much input can fit?
  • Speed requirement: Real-time vs batch processing?
  • Cost: API cost per token?
  • Capability level: Is model strong enough for task?

Input/Output Specification

  • Input format: Structured data, free text, code, images?
  • Input size: Typical length?
  • Output format: JSON, markdown, plain text?
  • Output length: Short (sentence), medium (paragraph), long (multi-page)?
  • Quality criteria: Accuracy, creativity, speed?

Success Criteria

Define how you'll measure success:

  • Accuracy: Must match expected answer X% of the time
  • Relevance: Output must address the question
  • Format: Must be JSON/markdown/code
  • Tone: Professional, casual, technical?
  • Length: Exactly N words, under N tokens?

Phase 2: CRAFT

Prompt Structure

[ROLE] (optional)
You are an [expert/assistant/etc] who [core responsibility].

[CONTEXT]
[Background information needed for task]
[Constraints and requirements]

[TASK]
[Specific instruction]
[What to do with input]

[FORMAT]
Respond in [format]: [example or template]

[EXAMPLE] (optional but recommended)
Input: [example input]
Output: [example output]

[INPUT]
[The actual user input/data]

Best Practices

Be Specific

  • Bad: "Write code"
  • Good: "Write a Python function that validates email addresses. Use regex and return True/False"

Use Role/Persona

  • Gives model context and bias toward that perspective
  • "You are a security expert auditing code for vulnerabilities"
  • "You are a technical writer explaining concepts simply"

Provide Context

  • Explain why task matters
  • Give domain knowledge if specialized
  • "Context: We're building a real-time chat system. Message latency <100ms is critical."

Give Examples

  • Few-shot learning: 1-3 examples help enormously
  • Format: Input → Output pairs
  • Shows both content AND format expectations

Specify Format Explicitly

  • "Return as JSON with keys: title, summary, tags"
  • "Return as a valid Python function"
  • "Return as markdown with ## headings"

Use Delimiters

  • Separate sections with clear markers: ===, ---, or triple backticks
  • Helps model understand structure

Constraint Specification

  • "Do not exceed 100 words"
  • "Return only the code, no explanation"
  • "Ignore previous examples, use only this context"

Chain of Thought

  • For reasoning tasks, ask model to explain thinking
  • "Let's think step by step:"
  • "First, [step 1]. Then, [step 2]. Finally, [step 3]."

Common Prompt Patterns

Classification

You are a content moderation assistant. Classify the following message.

Categories:
- SPAM: Advertising, promotional content
- OFFENSIVE: Hateful, discriminatory language
- NORMAL: Regular conversation
- QUESTION: User asking for help

Message: "{input}"

Respond only with the category name.

Extraction

Extract the following information from the text below:
- Names (people, companies)
- Dates
- Financial amounts
- Action items

Text:
"{input}"

Return as JSON:
{
  "names": [],
  "dates": [],
  "amounts": [],
  "actions": []
}

Summarization

Summarize the following article in 2-3 sentences, focusing on key findings.

Article:
"{input}"

Summary:

Code Generation

Generate a Python function with the following requirements:
- Name: calculate_fibonacci
- Input: integer n (0 <= n <= 100)
- Output: nth Fibonacci number
- Should use memoization for performance

Include docstring and type hints.

Reasoning (Chain of Thought)

Solve this math problem step by step.

Problem: A train leaves Station A at 10 AM going 60 mph.
Another train leaves Station B (50 miles away) at 10:30 AM going 75 mph toward A.
When do they meet?

Let's think step by step:
1. [Define variables]
2. [Set up equation]
3. [Solve]

Answer:

Code Review

You are a senior code reviewer. Review the following code for:
- Logic errors
- Performance issues
- Security vulnerabilities
- Code style problems

Code:
{code}

For each issue, provide:
1. Line number
2. Severity (HIGH/MEDIUM/LOW)
3. Description
4. Suggested fix

Phase 3: TEST

Local Testing with Ollama

Test before sending to cloud APIs:

# Test with qwen3-coder (good for code/reasoning)
ollama run qwen3-coder << 'EOF'
[YOUR FULL PROMPT HERE]
EOF

# Or with llama3 for general tasks
ollama run llama3 << 'EOF'
[YOUR FULL PROMPT HERE]
EOF

Test Dataset

Create 5-10 representative test cases:

Test Case 1:
  Input: [example input]
  Expected: [what good output looks like]
  Actual: [model output]
  Pass: ✓/✗

Test Case 2:
  ...

Evaluation Criteria

For each test case, check:

  • ✓ Format correct? (JSON valid? Markdown? Code syntactically correct?)
  • ✓ Content accurate? (Does answer match expectation?)
  • ✓ Complete? (No truncation, all required fields?)
  • ✓ Relevant? (Addresses the question?)
  • ✓ Length appropriate? (Not too long/short?)
  • ✓ Tone right? (Professional/casual/technical as needed?)

Success Rate

  • < 70%: Major revision needed
  • 70-85%: Fine-tune details
  • 85%+: Ready to deploy

Phase 4: OPTIMIZE

If Success Rate Too Low

Unclear task?

  • Add more context/examples
  • Be more specific about expectations
  • Add constraints ("exactly 3 items", "under 50 words")

Wrong format?

  • Show explicit output format/template
  • Add example with exact formatting

Missing information?

  • Add more context to prompt
  • Provide background knowledge
  • Link to reference materials

Model capability gap?

  • Try stronger model (qwen3-coder, llama3:70b)
  • Break task into simpler sub-tasks
  • Use different approach (e.g., few-shot instead of zero-shot)

Iterative Refinement

  1. Test initial prompt → 60% success
  2. Add examples → 75% success
  3. Clarify format → 85% success
  4. Add constraints → 92% success
  5. Deploy with confidence

Prompt Optimization Techniques

Few-Shot Learning

  • Add 2-3 examples showing input/output
  • Better than zero-shot by 10-30% typically

Negative Examples

  • Show what NOT to do
  • "Do NOT include: [these things]"

Explicit Instructions

  • "Return ONLY [x], no explanation"
  • "Must be valid [format]"
  • "Use [specific terminology]"

Temperature Tuning (if supported)

  • Lower temp (0.1-0.3): More deterministic, focused
  • Higher temp (0.7-1.0): More creative, varied

Token Limit

  • Constraining output length forces conciseness
  • "Response must be under 150 tokens"

Phase 5: Document & Deploy

Document Prompt

## Task: [Task Name]
**Purpose**: [Why this prompt needed]
**Model**: qwen3-coder (local) or GPT-4 (cloud)
**Success Rate**: 92% on test set

**Prompt**:
[Full prompt]

**Test Cases**: [Link to test results]
**Version**: 1.0
**Last Updated**: 2026-03-08

Version Control

  • Keep prompts in git (prompts/ directory)
  • Track changes: version numbers, improvement notes
  • Test results per version

Monitoring

  • Track success rate in production
  • Log inputs that fail
  • Iterate based on real-world usage

Example Workflows

Code Generation Prompt

ollama run qwen3-coder << 'EOF'
You are an expert Python developer.

Generate a Python function that:
- Parses a CSV file
- Filters rows where "age" > 18
- Returns a list of dictionaries

Requirements:
- Use type hints
- Include docstring with example
- Handle errors gracefully

Example usage:
```python
data = load_csv("people.csv")
adults = filter_adults(data, age_threshold=18)
print(adults)  # [{name: "Alice", age: 25}, ...]

Your implementation:


Note: Test output locally, refine if needed, then use in production.

## Common Mistakes to Avoid

- **Vague prompts**: "Write code" → Specify language, requirements
- **Too many tasks**: One prompt per task (chain them if needed)
- **No examples**: Always include 1-2 examples for clarity
- **Unclear format**: Specify output format explicitly
- **Missing context**: Provide domain knowledge upfront
- **Assuming knowledge**: Define terms, don't assume background
- **Inflexible constraints**: Allow some flexibility unless strict requirement

## Testing Locally Before Cloud

Always test with Ollama first:
- qwen3-coder: code, reasoning, technical
- llama3:8b: general, chat, balanced
- nomic-embed-text: embeddings/search

This saves API costs and keeps data local during development.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.