Agent skill
agent-prompting
Write effective prompts for Task tool sub-agents, slash commands, and system prompts. Covers Claude 4.x prompting patterns, context engineering, output format specification, and parallel delegation. Use when spawning sub-agents, creating slash commands, or writing system prompts.
Install this agent skill to your Project
npx add-skill https://github.com/randalmurphal/claude-config/tree/main/skills/agent-prompting
SKILL.md
Agent Prompting & Delegation
Purpose: Write effective prompts that produce clear, structured outputs from sub-agents and custom commands.
Related: For CLAUDE.md/AGENTS.md file structure, see ai-documentation skill.
Claude 4.x Prompting Changes
Claude 4.x models follow instructions more precisely. Adjust your prompting style:
| Old Style (Pre-4.x) | New Style (4.x) | Why |
|---|---|---|
CRITICAL: You MUST always... |
Use this pattern when... |
4.x responds to normal language |
NEVER do X under any circumstances |
Avoid X because [reason] |
Reasoning helps more than shouting |
IMPORTANT: Remember to... |
Just state it directly | 4.x pays attention without emphasis |
| Aggressive repetition | State once clearly | 4.x doesn't need reinforcement |
Context awareness: Claude 4.x tracks its token budget. For long tasks, it may try to wrap up as context fills. Add this if needed:
Your context will be compacted as needed - continue working fully without stopping early due to token concerns.
Parallel tool calling: Claude 4.x aggressively parallelizes. If you need sequential execution, say so explicitly.
Core Principles
- Clear over clever - Ambiguity is the enemy
- Structure over prose - Bullets, tables, code blocks
- Examples over explanations - Show what you want
- Context engineering > prompt engineering - Right context matters more than perfect wording
- Reasoning over commands - Explain WHY, not just WHAT
Essential Prompt Components
Required
- Clear Objective - What success looks like in one sentence
- Success Criteria - Measurable outcomes
- Expected Output Format - Structure specified
Recommended
- Context - Only what's directly relevant (not everything)
- Error Handling - What to do if not found/fails
- Files Hint - Where to start looking
Prompt Template
[Clear objective in one sentence]
Success criteria:
- [Measurable outcome 1]
- [Measurable outcome 2]
Context: [Only what's directly relevant]
Expected output:
[Specific structure]
If [error condition]:
- [How to handle]
Start looking in: [Files hint]
When to Use Agents vs Tools
| Condition | Action |
|---|---|
| Know exact file | Read tool directly |
| Know exact pattern | Grep tool directly |
| Need to explore/discover | Use Task (agent) |
| Need to analyze/synthesize | Use Task (agent) |
| >3 files to investigate | Use Task (agent) |
Parallel vs Sequential
PARALLEL (single message, multiple Tasks):
- Tasks are independent
- No shared state
- 5-10x speedup
SEQUENTIAL:
- Task B depends on Task A output
- Shared state (file modifications)
- Order matters
Inline Standards by Agent Type
Include key standards in prompts. Even with CLAUDE.md, inline standards guarantee visibility.
Implementation Agents
Standards:
- Logging: import logging; LOG = logging.getLogger(__name__)
- try/except only for connection errors (network, DB, cache)
- Type hints required, 80 char limit
- Don't run tests unless instructed
Output: Brief summary (3-5 sentences)
Test Agents
Standards:
- 1:1 file mapping: tests/unit/test_<module>.py
- 95% coverage target
- Mock everything external to the function being tested
- Don't run tests unless instructed
Load: testing-standards skill
Review Agents
Focus areas:
- Improper try/except (wrapping safe operations like dict.get)
- Logging setup (logging.getLogger(__name__))
- Type hints, line length
Output format:
{"status": "COMPLETE", "critical": [...], "important": [...], "minor": [...]}
Fix Agents
Standards:
- Fix properly - no workarounds or # noqa shortcuts
- If architectural issue: escalate with options
- Max 3 attempts, then escalate
Output: Brief summary of what was fixed
Investigation Agents
Approach:
- Start narrow, expand if needed
- Use Grep before Read (cheaper)
- Include file:line references in findings
Documentation Agents
Load ai-documentation skill first.
Standards:
- Concise over comprehensive
- Tables/bullets over paragraphs
- Include file:line references
- Context-loaded files: 100-400 lines
- Reference docs (docs/): can be longer
Slash Commands
Location: .claude/commands/<command-name>.md
Structure:
Description of what this command does.
$ARGUMENTS will be replaced with user input after the command.
[Your prompt template here]
Example (.claude/commands/review-pr.md):
Review the PR for ticket $ARGUMENTS.
1. Fetch PR context using gitlab scripts
2. Check code against project standards
3. Look for:
- Improper error handling
- Missing tests
- Style violations
4. Output findings as inline comments
Usage: /review-pr INT-1234
Slash Command Best Practices
| Do | Don't |
|---|---|
| Single clear purpose | Multi-purpose commands |
| Use $ARGUMENTS for input | Hardcode values |
| Reference skills to load | Duplicate skill content |
| Keep under 50 lines | Write essays |
System Prompts (CLAUDE.md)
For file structure and organization: See ai-documentation skill.
For content tone (Claude 4.x):
# Good - Direct and clear
When modifying shared code, check who calls it first.
Use retry_run() for all MongoDB writes.
# Avoid - Aggressive/shouting
CRITICAL: You MUST ALWAYS check callers before modifying shared code!!!
NEVER forget to use retry_run() - THIS IS MANDATORY!
Key sections for CLAUDE.md:
- Project purpose (1-2 sentences)
- Key commands (build, test, lint)
- Code patterns to follow
- Common gotchas
- What to ask about vs proceed
Hooks
Location: .claude/settings.json or project settings
Types:
PreToolUse- Before tool executionPostToolUse- After tool executionNotification- On events
Example (lint on file write):
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"command": "python-code-quality --fix $FILE"
}
]
}
}
Hook outputs appear as <user-prompt-submit-hook> in conversation - treat as user feedback.
Common Pitfalls
| Pitfall | Fix |
|---|---|
| Vague objective | "Find JWT verification" → "Find JWT verification with file:line" |
| Over-emphasis | Remove CRITICAL/MUST/NEVER - state directly |
| Context overload | Only what's directly relevant |
| Missing output format | Specify structure explicitly |
| Too simple tasks | Use tools directly instead of agents |
| Aggressive language | Claude 4.x responds to normal instructions |
Quick Reference
Before spawning an agent:
- Is my objective clear in one sentence?
- Will the agent know when it's done?
- Have I specified the output format?
- Can I run this in parallel with other tasks?
- Am I using normal language (not SHOUTING)?
Before writing a slash command:
- Does this need to be reusable?
- Is there a single clear purpose?
- Am I using $ARGUMENTS for variable input?
Before updating CLAUDE.md:
- Load ai-documentation skill
- Is this context-loaded? Keep it concise
- Am I stating things once, clearly?
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
test-driven-development
Use when implementing any feature, bug fix, or behavior change - before writing implementation code. Enforces strict RED-GREEN-REFACTOR cycle where tests are written and seen failing before any production code exists.
spec-formats
Templates for brainstorm artifacts and manifest.json. Load when using /spec.
review-initiative
Use after /breakdown-work or manual initiative creation, before running tasks. Use when initiative has 5+ tasks, multiple dependencies, or references a design document.
MCP Integration
Set up and use MCP (Model Context Protocol) servers to extend Claude Code capabilities including PRISM semantic memory, filesystem access, and database integration. Use when setting up MCP servers, debugging MCP connections, or understanding MCP tool usage.
systematic-debugging
Use when debugging any failure, bug, or unexpected behavior - especially before attempting any fix. Enforces root cause investigation before implementation to prevent fix-thrashing and symptom-masking.
plasma6-panel-config
Configure KDE Plasma 6 panels, widgets, digital clock fonts, and Panel Colorizer styling. Use when modifying panel appearance, copying panel configs between monitors, fixing widget fonts, or troubleshooting Panel Colorizer not applying styles.
Didn't find tool you were looking for?