01-package-scaffolding/agent-prompt-engineering/SKILL.md
Design and harden agent, command, workflow, and tool prompts for reliable execution across different AI models. Use when creating or revising repo-local agents to apply model-specific prompting techniques, tighten scope, and prevent common agent failure modes like doom loops, status-over-evidence routing, and impossible read-only delegation. Do not use for one-off prompts or when agents are already working reliably.
npx skillsauth add chelch5/skilllibrary agent-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.
Use this skill when prompt wording controls how agents coordinate, route work, and use tools.
Read the existing prompt, command, or process doc and identify:
Each agent type has specific prompt requirements:
| Role | Key contract | |------|-------------| | Orchestrator / Team Leader | Resolve state from tools first, verify artifacts before routing | | Planner | Decision-complete plans for one ticket only | | Implementer | Follow the approved plan, stop on missing requirements | | Reviewer / QA | Stay read-only, return findings first — never praise before findings | | Utility | Stay narrow and bounded, single-purpose |
Eliminate these common prompt failures:
Status-over-evidence routing — Routing based on labels instead of actual artifacts. Fix: require tool-read proof before stage transitions.
Raw-file stage control — Editing state files directly instead of using tools. Fix: route all state changes through workflow tools.
Impossible read-only delegation — Telling read-only agents to write files. Fix: verify agent capabilities match task requirements before delegating.
# BAD: Read-only agent told to write
agents:
researcher:
permissions: [read]
task: "Read the code and update the docs" # IMPOSSIBLE
# GOOD: Capability-matched delegation
agents:
researcher:
permissions: [read]
task: "Read the code and report findings"
implementer:
permissions: [read, write]
task: "Update the docs based on researcher findings"
Broad command follow-on — Commands that silently continue the whole workflow. Fix: each command should have a clear stop point.
Context amnesia — Agent forgets earlier decisions. Fix: load key constraints at task start, reference source-of-truth files.
Different models have different prompting best practices:
For capable models (Claude Sonnet 4+, GPT-4+):
system_prompt: |
<role>You are an implementer for project-name.</role>
<context>Stack: TypeScript, Node.js, Vitest</context>
<instructions>
1. Read the ticket fully
2. Check for existing patterns in src/
3. Write tests first, then implement
4. Run full test suite before committing
</instructions>
<constraints>
- No any types
- All exports must be typed
- Test coverage > 80%
</constraints>
For less capable models (Haiku, GPT-3.5, smaller models):
system_prompt: |
Follow this exact sequence:
STEP 1: Read file
Command: cat [filename]
STEP 2: Identify change location
Output: "Line [N]: [current content]"
STEP 3: Make edit
Change: [old] → [new]
Do not skip steps. Do not combine steps.
If stuck after 3 attempts: STOP and report blocker.
When hardening for a specific model:
Ensure all prompts are safe for weaker models:
Every agent prompt should include a verification step:
system_prompt: |
Before completing any task, self-verify:
□ Did I follow the stack standards?
□ Did I write tests for new code?
□ Did I run the linter?
□ Does the output match the expected format?
If any check fails, fix before proceeding.
Re-read the final prompt and ask:
Improved agent definitions with:
testing
Manages context window budgets, loading strategies, and compaction techniques for AI-assisted coding sessions. Trigger on 'context window', 'what to load', 'context management', 'context overflow', 'token budget'. DO NOT USE for loading specific project docs into agent context (use project-context) or prompt wording and optimization (use prompt-crafting).
development
Implements authentication, session, token, and authorization patterns for the current stack. Trigger on 'add auth', 'JWT', 'OAuth', 'login endpoint', 'session management', 'API key auth'. DO NOT USE for OWASP hardening checklists (use security-hardening), threat modeling (use security-threat-model), or secret rotation/storage (use security-best-practices).
tools
Defines request/response shapes, versioning, validation, and compatibility rules for API-first work. Trigger on 'design API', 'OpenAPI spec', 'REST schema', 'API versioning', 'generate client SDK'. DO NOT USE for GraphQL schemas, gRPC/protobuf definitions (use stack-standards), auth endpoint logic (use auth-patterns), or external API client wrappers (use external-api-client).
development
Create a repo-local ticket system with an index, machine-readable manifest, board, and individual ticket files. Use when a repo needs task decomposition that autonomous agents can follow without re-planning the whole project each session. Do not use for executing tickets (use ticket-execution) or quick fixes that don't warrant formal tickets.