Senior prompt engineer

From borghei/Claude-Skills · View interactive version

Senior prompt engineer is an AI agent skill from the GitHub repository borghei/Claude-Skills. Prompt engineering and LLM evaluation. Use when optimizing prompts, designing prompt templates, evaluating LLM outputs, building agentic systems, implementing RAG, creating few- shot examples, or designing structured-output workflows.

How to use this skill

Skill file

Senior Prompt Engineer

Prompt engineering patterns, LLM evaluation frameworks, and agentic system design. Provides static (deterministic) analysis tools to optimize prompts, evaluate RAG retrieval and generation quality, and validate/visualize agent workflows — plus deep reference libraries of prompt patterns, evaluation metrics, and agent architectures.

Core Capabilities

Prompting Reasoning Models

Current frontier models reason before they answer, which changes what a good prompt looks like:

prompt_optimizer.py flags forced chain-of-thought and shouted imperatives, so you can run it on an inherited prompt to find them.

When to Use

Clarify First

What shapes this skill's output most is the target model, the job the prompt has to do, and the data you can test it against. Settle the inputs below before producing anything. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.

Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.

Tools Overview

| Tool | Purpose | Example (runs as written) |

|------|---------|---------|

| prompt_optimizer.py | Heuristic prompt review: vague wording, missing output format, forced chain-of-thought, ALL-CAPS emphasis, structure, token estimate; --optimize, --extract-examples, --compare | python scripts/prompt_optimizer.py assets/sample_prompt_flawed.txt --analyze |

| rag_evaluator.py | Lexical RAG scoring: context relevance, faithfulness (numbers absent from the context count as unsupported), groundedness, Precision@K; --min-faithfulness gate | python scripts/rag_evaluator.py --contexts assets/sample_contexts.json --questions assets/sample_questions.json --min-faithfulness 0.7 |

| agent_orchestrator.py | Validate an agent config, draw its flow (ASCII/Mermaid), estimate tokens and cost per run | python scripts/agent_orchestrator.py assets/sample_agent.yaml --estimate-cost --input-price 0.003 --output-price 0.015 |

No tool carries a price table: costs appear only when you pass prices per 1K tokens from the

provider's current pricing page (the numbers above are example values). --model only picks

a characters-per-token ratio, so token counts are estimates, not tokenizer output. Scores

are heuristics for finding problems; confirm with an eval set.

Exit codes: 0 ok; 1 rag_evaluator.py faithfulness below --min-faithfulness, or

agent_orchestrator.py --validate found errors; 2 bad input (missing or empty file,

invalid JSON, wrong shape, --estimate-cost without prices).

Samples: sample_prompt_flawed.txt (vague verbs, "think step by step", four shouted

imperatives, no output format) against sample_prompt_clean.txt (goal, context, criteria,

JSON contract, one example); sample_questions.json has one answer that invents a rate limit,

so faithfulness is 0.50 and the 0.7 gate exits 1.

Workflow

  1. Collect 10-20 real inputs with the outputs you expect before changing the prompt.
  2. Run prompt_optimizer.py --analyze on the current prompt and fix the flagged issues: add the goal, audience and output contract; remove scripted reasoning and shouted rules.
  3. Validate on the eval set with the target model and compare against the baseline (--compare keeps the static metrics side by side).
  4. For RAG, run rag_evaluator.py on the retrieved contexts and answers; read every answer it marks unsupported.
  5. Done when the eval set meets the agreed pass rate, the faithfulness gate passes, and the prompt states goal, constraints and output format without forced reasoning steps.

References

Load the reference that matches the task — keep this file lean and pull detail on demand:

Scope & Limitations

This skill covers:

This skill does NOT cover:

Anti-Patterns

Scripting the Model's Thinking

Mistake: Adding "think step by step" or a forced Thought: / Answer: template to every prompt.

Why it happens: It was the single most reliable trick on earlier models.

Instead: Reasoning models already think; the scaffold costs tokens and can degrade the answer. State the goal and output contract, and raise the reasoning setting if depth is lacking. Keep explicit steps only for non-reasoning models or when the steps are the deliverable.

Shouting the Rules

Mistake: "You MUST ALWAYS... NEVER..." for ordinary preferences.

Why it happens: Emphasis seems to make rules stick.

Instead: Current models follow instructions closely; capitals make them apply a rule where it does not fit. Write the rule calmly with its reason so the model can generalise.

Tuning Without an Eval Set

Mistake: Editing a prompt until one or two hand-picked inputs look right.

Why it happens: It is fast and feels like progress.

Instead: Keep a small set of real inputs with expected outputs and score every version against it. A heuristic score from prompt_optimizer.py finds smells; it does not measure quality.

Files

| File | Purpose |

|------|---------|

| scripts/prompt_optimizer.py | Heuristic prompt analysis and cleanup |

| scripts/rag_evaluator.py | Lexical RAG retrieval and faithfulness scoring with a gate |

| scripts/agent_orchestrator.py | Agent config validation, flow diagrams, token and cost estimates |

| assets/sample_prompt_flawed.txt, sample_prompt_clean.txt | Before/after prompts for the optimizer |

| assets/sample_contexts.json, sample_questions.json | RAG inputs with one fabricated answer (gate exits 1) |

| assets/sample_agent.yaml | Two-tool ReAct agent config |

| references/*.md | Patterns for reasoning and non-reasoning models, evaluation, agent design, tool reference |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.