claude-code-framework/essential/skills/workflow/prompt-engineering/SKILL.md
Optimize prompts for Claude Code agents, API calls, and multi-agent orchestration. Use when writing system prompts, agent instructions, or refining LLM interactions. Triggers on "improve prompt", "write a prompt", "agent instructions", "system prompt", "prompt not working", "LLM output quality".
npx skillsauth add tokenized2027/claude-initilization-v7 prompt-engineeringInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Design prompts that produce reliable, high-quality output from Claude and other LLMs — especially for autonomous agent workflows.
Bad prompts produce inconsistent agent output, burn tokens, and require human intervention. Good prompts let your mini PC agents run autonomously with predictable results.
Before writing any prompt, answer:
Example:
"I need a JSON object with fields:
title(string, <60 chars),description(string, 1-3 sentences),priority(low|medium|high)"
Every effective prompt has these layers:
ROLE → Who the AI is (expertise, constraints)
CONTEXT → What it needs to know (background, data)
TASK → What to do (specific, measurable)
FORMAT → How to output (structure, examples)
GUARDRAILS → What NOT to do (common failure modes)
Template:
You are a [ROLE] with expertise in [DOMAIN].
## Context
[Background information the model needs]
## Task
[Specific, measurable instruction]
## Output Format
[Exact structure expected — include an example]
## Rules
- [Guardrail 1: what to avoid]
- [Guardrail 2: edge case handling]
- [Guardrail 3: quality requirement]
One good example beats 100 words of instruction.
## Example
Input: "Build a user dashboard"
Output:
{
"title": "User Analytics Dashboard",
"components": ["stats-bar", "activity-chart", "recent-actions-table"],
"data_sources": ["/api/users/stats", "/api/users/activity"],
"priority": "high"
}
For complex tasks, provide 2-3 examples showing different edge cases.
For multi-step reasoning, explicitly request thinking:
## Task
Analyze this API response and determine if the integration is healthy.
Think step by step:
1. Check if the status code is 2xx
2. Check if the response time is under 500ms
3. Check if required fields are present
4. Summarize health status
For autonomous agents burning API credits:
You are the [AGENT_NAME] agent in a multi-agent system.
## Your Role
[2-3 sentences on what you do]
## Memory Protocol
- Read project memory before starting any task
- Write decisions and patterns to memory after completing work
- Check for handoff notes from previous agents
## Task Workflow
1. [Step 1]
2. [Step 2]
3. [Step 3]
## Output Requirements
- Write complete files only — never partial snippets
- Include all imports
- Test before declaring done
## Handoff
When complete, write a handoff note with:
- What you built
- What's left for the next agent
- Any blockers or decisions deferred
Given this task description, determine which agent should handle it.
Agents available:
- frontend-developer: UI, React, dashboards, components
- backend-developer: APIs, database, server logic
- system-architect: design decisions, tech stack, architecture
- devops-engineer: Docker, deployment, CI/CD, monitoring
Task: "{task_description}"
Respond with ONLY a JSON object:
{"agent": "agent-name", "reason": "one sentence", "subtasks": ["if applicable"]}
Review this code for production readiness. Check EACH of these:
1. Error handling: Are all error paths covered?
2. Types: Are TypeScript types complete (no `any`)?
3. Edge cases: What happens with empty data, null values, large inputs?
4. Security: Any hardcoded secrets, SQL injection, XSS vectors?
5. Performance: Any N+1 queries, unbounded loops, memory leaks?
For each check, respond:
- ✅ PASS: [brief note]
- ❌ FAIL: [what's wrong + fix]
| Failure | Cause | Fix | |---------|-------|-----| | Inconsistent output format | No format specification | Add explicit format + example | | Hallucinated data | Insufficient context | Provide the actual data in the prompt | | Too verbose | No length constraint | Add "Respond in under X words/lines" | | Ignores instructions | Instructions buried at the end | Move critical rules to the top | | Wrong code language | Ambiguous tech stack | Specify language + version explicitly | | Agent goes off-task | Vague task description | Use the ROLE-CONTEXT-TASK-FORMAT structure |
✅ Use prompt-engineering when:
❌ Don't use prompt-engineering for:
development
Methodical debugging using reproducible steps, instrumentation, and root-cause analysis. Use when something is broken and you don't know why. Triggers on "bug", "broken", "not working", "error", "fails intermittently", "regression", "unexpected behavior".
tools
Structured ideation and design review before any creative or constructive work. Use before building features, components, architecture, dashboards, or automation workflows. Triggers on "plan this", "design this", "brainstorm", "think through", "what should we build", "how should I approach".
testing
Generates test files for components and functions with setup, basic tests, and mocks. Use when user says "add tests", "create test", "test this component", or mentions testing.
development
Generates React components with TypeScript, props interface, and example usage. Use when user says "create component", "new component", "add React component", or mentions creating UI elements.