Skill 詳細
senior-prompt-engineer
AI engineering.
使用前に確認
自動レビューは関連性のみを確認し、安全性や推奨を保証しません。使用前に出典の説明を読んでください。
SKILL.md
これはレビュー時に保存された抜粋です。完全で最新の内容は外部ソースを確認してください。
--- name: "senior-prompt-engineer" description: Use when the user asks to optimize prompts, design prompt templates, evaluate LLM outputs with an eval set, measure RAG retrieval quality, validate agent/tool configurations, analyze token usage, or design structured-output contracts. Covers eval-driven prompt iteration, RAG metrics (relevance, faithfulness, coverage), agent workflow validation, and token/cost budgeting — all model-agnostic, with three stdlib Python tools. --- # Senior Prompt Engineer Eval-driven prompt engineering, RAG quality measurement, and agent workflow validation. Everything here is **model-agnostic by design**: techniques are framed by what they do, not by which model generation they were observed on, and the tools never hardcode model IDs or pricing — you supply your provider's current rates when you want dollar figures. ## Operating Rules 1. **Never change a prompt without a baseline.** Capture metrics first (`--analyze --output baseline.json`), then compare every iteration against it. 2. **Eval set before optimization.** 10–20 representative cases with expected outputs minimum. If the user has no eval set, build one with them before touching the prompt — optimizing against vibes is the #1 failure mode. 3. **Prefer platform features over prompt hacks.** If the provider offers native structured outputs / JSON schema enforcement, tool-use APIs, or prompt caching, use those instead of "respond ONLY with JSON" incantations. Prompt-level format enforcement is the fallback, not the default. 4. **Current-generation models need less scaffolding.** Don't add chain-of-thought boilerplate, role framing, or few-shot examples reflexively — frontier models often do worse with redundant scaffolding. Add each element only when the eval set shows it helps. 5. **Cost numbers are always user-supplied.** Look up the provider's current per-Mtok pricing and pass it via `--price-per-mtok` (never trust a cached price table — including any you remember). ## Tools (exact CLIs, all stdlib) ### 1. Prompt Optimizer — `scripts/prompt_optimizer.py` Static analysis: token estimate, clarity/structure scores (0–100), ambiguity + redundancy detection, few-shot example extraction. ```bash # Full analysis (human-readable report) python3 scripts/prompt_optimizer.py prompt.txt --analyze # Save machine-readable baseline for later comparison python3 scripts/prompt_optimizer.py prompt.txt --analyze --json --output baseline.json # Token estimate; cost only if you supply your provider's current rate python3 scripts/prompt_optimizer.py prompt.txt --tokens --model claude --price-per-mtok 3.00 # Whitespace/redundancy-trimmed version python3 scripts/prompt_optimizer.py prompt.txt --optimize --output optimized.txt # Extract Input/Output few-shot pairs to JSON python3 scripts/prompt_optimizer.py prompt.txt --extract-examples --output examples.json # Compare a revision against the saved baseline python3 scripts/prompt_optimizer.py optimized.txt --analyze --compare baseline.json ``` `--model` accepts any string; only the tokenizer family is inferred (names containing "claude" → 3.5 chars/token, otherwise 4.0). Exit 0 on success, 1 on missing file. ### 2. RAG Evaluator — `scripts/rag_evaluator.py` Measures retrieval and grounding quality from two JSON files (formats printed in `--help`). ```bash python3 scripts/rag_evaluator.py --contexts retrieved.json --questions eval_set.json python3 scripts/rag_evaluator.py --contexts ctx.json --questions q.json --k 10 --json python3 scripts/rag_evaluator.py --contexts ctx.json --questions q.json --output report.json --verbose python3 scripts/rag_evaluator.py --contexts ctx.json --questions q.json --compare baseline_report.json ``` Reports context relevance, precision@k, coverage, answer faithfulness, groundedness. Treat relevance < 0.80 as a retrieval problem (chunking/embedding/filtering), not a prompt problem — fix retrieval before rewriting the generation prompt. ### 3. Agent Orchestrator — `scrGitHub で全文を読む (外部ページ)