[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-92a28ff5-01e8-497b-b990-bad78adc60d9":3,"$flh1ExoOsnN8dDuHL6MEWliDQkOKtJcXaqGh5HYKvTdw":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"92a28ff5-01e8-497b-b990-bad78adc60d9","senior-prompt-engineer","当用户要求“优化提示”、“设计提示模板”、“评估LLM输出”、“构建代理系统”、“实现RAG”、“创建少样本示例”、“分析令牌使用”或“设计AI工作流程”时，应使用此技能。用于提示工程模式、LLM评估框架、代理架构和结构化输出设计。","cat_coding_backend","mod_coding","alirezarezvani,coding","---\nname: \"senior-prompt-engineer\"\ndescription: This skill should be used when the user asks to \"optimize prompts\", \"design prompt templates\", \"evaluate LLM outputs\", \"build agentic systems\", \"implement RAG\", \"create few-shot examples\", \"analyze token usage\", or \"design AI workflows\". Use for prompt engineering patterns, LLM evaluation frameworks, agent architectures, and structured output design.\n---\n\n# Senior Prompt Engineer\n\nPrompt engineering patterns, LLM evaluation frameworks, and agentic system design.\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [Tools Overview](#tools-overview)\n  - [Prompt Optimizer](#1-prompt-optimizer)\n  - [RAG Evaluator](#2-rag-evaluator)\n  - [Agent Orchestrator](#3-agent-orchestrator)\n- [Prompt Engineering Workflows](#prompt-engineering-workflows)\n  - [Prompt Optimization Workflow](#prompt-optimization-workflow)\n  - [Few-Shot Example Design](#few-shot-example-design-workflow)\n  - [Structured Output Design](#structured-output-design-workflow)\n- [Reference Documentation](#reference-documentation)\n- [Common Patterns Quick Reference](#common-patterns-quick-reference)\n\n---\n\n## Quick Start\n\n```bash\n# Analyze and optimize a prompt file\npython scripts\u002Fprompt_optimizer.py prompts\u002Fmy_prompt.txt --analyze\n\n# Evaluate RAG retrieval quality\npython scripts\u002Frag_evaluator.py --contexts contexts.json --questions questions.json\n\n# Visualize agent workflow from definition\npython scripts\u002Fagent_orchestrator.py agent_config.yaml --visualize\n```\n\n---\n\n## Tools Overview\n\n### 1. Prompt Optimizer\n\nAnalyzes prompts for token efficiency, clarity, and structure. Generates optimized versions.\n\n**Input:** Prompt text file or string\n**Output:** Analysis report with optimization suggestions\n\n**Usage:**\n```bash\n# Analyze a prompt file\npython scripts\u002Fprompt_optimizer.py prompt.txt --analyze\n\n# Output:\n# Token count: 847\n# Estimated cost: $0.0025 (GPT-4)\n# Clarity score: 72\u002F100\n# Issues found:\n#   - Ambiguous instruction at line 3\n#   - Missing output format specification\n#   - Redundant context (lines 12-15 repeat lines 5-8)\n# Suggestions:\n#   1. Add explicit output format: \"Respond in JSON with keys: ...\"\n#   2. Remove redundant context to save 89 tokens\n#   3. Clarify \"analyze\" -> \"list the top 3 issues with severity ratings\"\n\n# Generate optimized version\npython scripts\u002Fprompt_optimizer.py prompt.txt --optimize --output optimized.txt\n\n# Count tokens for cost estimation\npython scripts\u002Fprompt_optimizer.py prompt.txt --tokens --model gpt-4\n\n# Extract and manage few-shot examples\npython scripts\u002Fprompt_optimizer.py prompt.txt --extract-examples --output examples.json\n```\n\n---\n\n### 2. RAG Evaluator\n\nEvaluates Retrieval-Augmented Generation quality by measuring context relevance and answer faithfulness.\n\n**Input:** Retrieved contexts (JSON) and questions\u002Fanswers\n**Output:** Evaluation metrics and quality report\n\n**Usage:**\n```bash\n# Evaluate retrieval quality\npython scripts\u002Frag_evaluator.py --contexts retrieved.json --questions eval_set.json\n\n# Output:\n# === RAG Evaluation Report ===\n# Questions evaluated: 50\n#\n# Retrieval Metrics:\n#   Context Relevance: 0.78 (target: >0.80)\n#   Retrieval Precision@5: 0.72\n#   Coverage: 0.85\n#\n# Generation Metrics:\n#   Answer Faithfulness: 0.91\n#   Groundedness: 0.88\n#\n# Issues Found:\n#   - 8 questions had no relevant context in top-5\n#   - 3 answers contained information not in context\n#\n# Recommendations:\n#   1. Improve chunking strategy for technical documents\n#   2. Add metadata filtering for date-sensitive queries\n\n# Evaluate with custom metrics\npython scripts\u002Frag_evaluator.py --contexts retrieved.json --questions eval_set.json \\\n    --metrics relevance,faithfulness,coverage\n\n# Export detailed results\npython scripts\u002Frag_evaluator.py --contexts retrieved.json --questions eval_set.json \\\n    --output report.json --verbose\n```\n\n---\n\n### 3. Agent Orchestrator\n\nParses agent definitions and visualizes execution flows. Validates tool configurations.\n\n**Input:** Agent configuration (YAML\u002FJSON)\n**Output:** Workflow visualization, validation report\n\n**Usage:**\n```bash\n# Validate agent configuration\npython scripts\u002Fagent_orchestrator.py agent.yaml --validate\n\n# Output:\n# === Agent Validation Report ===\n# Agent: research_assistant\n# Pattern: ReAct\n#\n# Tools (4 registered):\n#   [OK] web_search - API key configured\n#   [OK] calculator - No config needed\n#   [WARN] file_reader - Missing allowed_paths\n#   [OK] summarizer - Prompt template valid\n#\n# Flow Analysis:\n#   Max depth: 5 iterations\n#   Estimated tokens\u002Frun: 2,400-4,800\n#   Potential infinite loop: No\n#\n# Recommendations:\n#   1. Add allowed_paths to file_reader for security\n#   2. Consider adding early exit condition for simple queries\n\n# Visualize agent workflow (ASCII)\npython scripts\u002Fagent_orchestrator.py agent.yaml --visualize\n\n# Output:\n# ┌─────────────────────────────────────────┐\n# │            research_assistant           │\n# │              (ReAct Pattern)            │\n# └─────────────────┬───────────────────────┘\n#                   │\n#          ┌────────▼────────┐\n#          │   User Query    │\n#          └────────┬────────┘\n#                   │\n#          ┌────────▼────────┐\n#          │     Think       │◄──────┐\n#          └────────┬────────┘       │\n#                   │                │\n#          ┌────────▼────────┐       │\n#          │   Select Tool   │       │\n#          └────────┬────────┘       │\n#                   │                │\n#     ┌─────────────┼─────────────┐  │\n#     ▼             ▼             ▼  │\n# [web_search] [calculator] [file_reader]\n#     │             │             │  │\n#     └─────────────┼─────────────┘  │\n#                   │                │\n#          ┌────────▼────────┐       │\n#          │    Observe      │───────┘\n#          └────────┬────────┘\n#                   │\n#          ┌────────▼────────┐\n#          │  Final Answer   │\n#          └─────────────────┘\n\n# Export workflow as Mermaid diagram\npython scripts\u002Fagent_orchestrator.py agent.yaml --visualize --format mermaid\n```\n\n---\n\n## Prompt Engineering Workflows\n\n### Prompt Optimization Workflow\n\nUse when improving an existing prompt's performance or reducing token costs.\n\n**Step 1: Baseline current prompt**\n```bash\npython scripts\u002Fprompt_optimizer.py current_prompt.txt --analyze --output baseline.json\n```\n\n**Step 2: Identify issues**\nReview the analysis report for:\n- Token waste (redundant instructions, verbose examples)\n- Ambiguous instructions (unclear output format, vague verbs)\n- Missing constraints (no length limits, no format specification)\n\n**Step 3: Apply optimization patterns**\n| Issue | Pattern to Apply |\n|-------|------------------|\n| Ambiguous output | Add explicit format specification |\n| Too verbose | Extract to few-shot examples |\n| Inconsistent results | Add role\u002Fpersona framing |\n| Missing edge cases | Add constraint boundaries |\n\n**Step 4: Generate optimized version**\n```bash\npython scripts\u002Fprompt_optimizer.py current_prompt.txt --optimize --output optimized.txt\n```\n\n**Step 5: Compare results**\n```bash\npython scripts\u002Fprompt_optimizer.py optimized.txt --analyze --compare baseline.json\n# Shows: token reduction, clarity improvement, issues resolved\n```\n\n**Step 6: Validate with test cases**\nRun both prompts against your evaluation set and compare outputs.\n\n---\n\n### Few-Shot Example Design Workflow\n\nUse when creating examples for in-context learning.\n\n**Step 1: Define the task clearly**\n```\nTask: Extract product entities from customer reviews\nInput: Review text\nOutput: JSON with {product_name, sentiment, features_mentioned}\n```\n\n**Step 2: Select diverse examples (3-5 recommended)**\n| Example Type | Purpose |\n|--------------|---------|\n| Simple case | Shows basic pattern |\n| Edge case | Handles ambiguity |\n| Complex case | Multiple entities |\n| Negative case | What NOT to extract |\n\n**Step 3: Format consistently**\n```\nExample 1:\nInput: \"Love my new iPhone 15, the camera is amazing!\"\nOutput: {\"product_name\": \"iPhone 15\", \"sentiment\": \"positive\", \"features_mentioned\": [\"camera\"]}\n\nExample 2:\nInput: \"The laptop was okay but battery life is terrible.\"\nOutput: {\"product_name\": \"laptop\", \"sentiment\": \"mixed\", \"features_mentioned\": [\"battery life\"]}\n```\n\n**Step 4: Validate example quality**\n```bash\npython scripts\u002Fprompt_optimizer.py prompt_with_examples.txt --validate-examples\n# Checks: consistency, coverage, format alignment\n```\n\n**Step 5: Test with held-out cases**\nEnsure model generalizes beyond your examples.\n\n---\n\n### Structured Output Design Workflow\n\nUse when you need reliable JSON\u002FXML\u002Fstructured responses.\n\n**Step 1: Define schema**\n```json\n{\n  \"type\": \"object\",\n  \"properties\": {\n    \"summary\": {\"type\": \"string\", \"maxLength\": 200},\n    \"sentiment\": {\"enum\": [\"positive\", \"negative\", \"neutral\"]},\n    \"confidence\": {\"type\": \"number\", \"minimum\": 0, \"maximum\": 1}\n  },\n  \"required\": [\"summary\", \"sentiment\"]\n}\n```\n\n**Step 2: Include schema in prompt**\n```\nRespond with JSON matching this schema:\n- summary (string, max 200 chars): Brief summary of the content\n- sentiment (enum): One of \"positive\", \"negative\", \"neutral\"\n- confidence (number 0-1): Your confidence in the sentiment\n```\n\n**Step 3: Add format enforcement**\n```\nIMPORTANT: Respond ONLY with valid JSON. No markdown, no explanation.\nStart your response with { and end with }\n```\n\n**Step 4: Validate outputs**\n```bash\npython scripts\u002Fprompt_optimizer.py structured_prompt.txt --validate-schema schema.json\n```\n\n---\n\n## Reference Documentation\n\n| File | Contains | Load when user asks about |\n|------|----------|---------------------------|\n| `references\u002Fprompt_engineering_patterns.md` | 10 prompt patterns with input\u002Foutput examples | \"which pattern?\", \"few-shot\", \"chain-of-thought\", \"role prompting\" |\n| `references\u002Fllm_evaluation_frameworks.md` | Evaluation metrics, scoring methods, A\u002FB testing | \"how to evaluate?\", \"measure quality\", \"compare prompts\" |\n| `references\u002Fagentic_system_design.md` | Agent architectures (ReAct, Plan-Execute, Tool Use) | \"build agent\", \"tool calling\", \"multi-agent\" |\n\n---\n\n## Common Patterns Quick Reference\n\n| Pattern | When to Use | Example |\n|---------|-------------|---------|\n| **Zero-shot** | Simple, well-defined tasks | \"Classify this email as spam or not spam\" |\n| **Few-shot** | Complex tasks, consistent format needed | Provide 3-5 examples before the task |\n| **Chain-of-Thought** | Reasoning, math, multi-step logic | \"Think step by step...\" |\n| **Role Prompting** | Expertise needed, specific perspective | \"You are an expert tax accountant...\" |\n| **Structured Output** | Need parseable JSON\u002FXML | Include schema + format enforcement |\n\n---\n\n## Common Commands\n\n```bash\n# Prompt Analysis\npython scripts\u002Fprompt_optimizer.py prompt.txt --analyze          # Full analysis\npython scripts\u002Fprompt_optimizer.py prompt.txt --tokens           # Token count only\npython scripts\u002Fprompt_optimizer.py prompt.txt --optimize         # Generate optimized version\n\n# RAG Evaluation\npython scripts\u002Frag_evaluator.py --contexts ctx.json --questions q.json  # Evaluate\npython scripts\u002Frag_evaluator.py --contexts ctx.json --compare baseline  # Compare to baseline\n\n# Agent Development\npython scripts\u002Fagent_orchestrator.py agent.yaml --validate       # Validate config\npython scripts\u002Fagent_orchestrator.py agent.yaml --visualize      # Show workflow\npython scripts\u002Fagent_orchestrator.py agent.yaml --estimate-cost  # Token estimation\n```\n","","imported","https:\u002F\u002Fgithub.com\u002Falirezarezvani\u002Fclaude-skills","user_system_seed","SkillOPIC",true,56,1882,"2026-05-16 13:57:53",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"dede6504-fa85-46e9-a29f-f4433b5d3b9b","1.0.0","senior-prompt-engineer.zip",37331,"uploads\u002Fskills\u002F92a28ff5-01e8-497b-b990-bad78adc60d9\u002Fsenior-prompt-engineer.zip","1f1949b17fd1cbeb9654257e4f3f59a4301c1f812fb61868ccf88851a320b7d5","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":12155},{\"path\":\"references\u002Fagentic_system_design.md\",\"isDirectory\":false,\"size\":21700},{\"path\":\"references\u002Fllm_evaluation_frameworks.md\",\"isDirectory\":false,\"size\":13303},{\"path\":\"references\u002Fprompt_engineering_patterns.md\",\"isDirectory\":false,\"size\":13636},{\"path\":\"scripts\u002Fagent_orchestrator.py\",\"isDirectory\":false,\"size\":20488},{\"path\":\"scripts\u002Fprompt_optimizer.py\",\"isDirectory\":false,\"size\":17862},{\"path\":\"scripts\u002Frag_evaluator.py\",\"isDirectory\":false,\"size\":20362}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]