From protocols
Background knowledge for writing and launching subagent prompts. Covers prompt file conventions, worker identity declarations, batch dispatch patterns, and parallel swarm safety. Auto-invocable when dispatching agents.
npx claudepluginhub ctoth/protocols-plugin --plugin protocolsThis skill uses the workspace's default tool permissions.
Use when: launching Task tool for delegated work.
Guides Next.js Cache Components and Partial Prerendering (PPR): 'use cache' directives, cacheLife(), cacheTag(), revalidateTag() for caching, invalidation, static/dynamic optimization. Auto-activates on cacheComponents: true.
Processes PDFs: extracts text/tables/images, merges/splits/rotates pages, adds watermarks, creates/fills forms, encrypts/decrypts, OCRs scans. Activates on PDF mentions or output requests.
Share bugs, ideas, or general feedback.
Use when: launching Task tool for delegated work.
Always use subagent_type: general-purpose when dispatching via Task tool. NEVER use Explore, Plan, or other specialized agent types even in planning mode - they cannot write report files and will fail.
Only the general-purpose agent can write files. Other agent types (Explore, Plan, etc.) are read-only. Since subagents need to write reports to ./reports/, you MUST use general-purpose.
Subagents start fresh. They don't know directory structure, file paths, common workarounds, or project conventions. Inline prompts get long, lose context, and you forget critical info.
Always write prompts to files. This provides:
project/
├── prompts/ # Subagent task prompts (input)
└── reports/ # Subagent deliverables (output)
Before launching any subagent, ensure both directories exist.
Every subagent prompt MUST start with this line before anything else:
You are a WORKER agent launched via the Task tool. Execute this task directly. Do NOT read foreman.md. Do NOT coordinate — DO the work yourself.
This goes at the very top of every prompt file AND in the Task tool's prompt parameter. Non-negotiable.
Write to ./prompts/{task-name}.md:
**You are a WORKER agent launched via the Task tool. Execute this task directly. Do NOT read foreman.md. Do NOT coordinate — DO the work yourself.**
# Task: [Clear Title]
## Context
[What the subagent needs to know about the project state]
## Objective
[Single, specific deliverable]
## Files to Read
- `exact/path/to/file.py` - why relevant
## Files to Modify
- `exact/path/to/file.py` - what to change
## Test Command
` ``bash
[exact command to verify success]
` ``
## Output
Write findings/status to `./reports/{task-name}-report.md`
## CRITICAL: File Modified Error Workaround
If Edit/Write fails with "file unexpectedly modified":
1. Read the file again with Read tool
2. Retry the Edit
3. Try path formats: `./relative`, `C:/forward/slashes`, `C:\back\slashes`
4. NEVER use cat, sed, echo - always Read/Edit/Write
5. If all formats fail, STOP and report - do not use bash workarounds
In Task tool message:
@prompts/{task-name}.md
Execute this task. Write your report to ./reports/{task-name}-report.md when done.
ONE task, ONE deliverable.
Bad: "Run tests, find failures, analyze causes, fix them, document findings" Good: "Run tests, capture output to report file"
If prompt has multiple verbs (run, compare, analyze, fix, document), you're asking too much.
One-sentence task = one-sentence prompt. State the goal, not the process. Agents are competent — don't hand-hold. A 50-line prompt for "download a screenshot" is you wasting everyone's time. If you can say it in one sentence, the prompt IS one sentence.
When dispatching N subagents doing the same task on different inputs (e.g., processing 7 papers, fixing 5 files), write ONE template prompt file. Each agent references the same @prompts/batch-taskname.md with only the varying parameter (URL, path, title) in the Task tool's prompt field. Do NOT write N near-identical prompt files.
Every scout prompt MUST include this constraint:
Do not speculate. Every claim in your report must be verified by reading source code or observing test output. If you cannot verify something, say "I did not verify this" — do not use words like "may", "possibly", "might", "could be", or "likely". If you don't know, say you don't know. Trace the actual code path. Read the actual source. An unverified theory presented as a finding is worse than no finding at all.
This is not optional. This goes in every scout prompt. Every single one.
You may be running alongside other agents in parallel.
FORBIDDEN GIT COMMANDS - NEVER USE THESE:
git stash - DESTROYS uncommitted work across the entire repogit restore - overwrites filesgit checkout - overwrites filesgit reset - destroys commits/changesgit clean - deletes untracked filesIf you mess up a file beyond repair: STOP, write what happened to your report, exit. Foreman will decide what to do. Do NOT try to "fix" or "clean up" - you'll destroy other agents' work.
Prompt files are an audit trail. If prompts/scout-foo.md already exists from a previous session, do NOT overwrite it. Pick a new name: prompts/scout-foo-v2.md, prompts/scout-foo-format.md, or any descriptive variant. Filenames are not a scarce resource. Overwriting destroys the record of what was dispatched before.
Never write python -c "..." or uv run python -c "...". Not even for "quick" checks. Write a .py file, then run it.
Why: A python -c oneliner evaporates after one use. The next agent that needs the same data must regenerate the entire thing from scratch. A script file is a reusable artifact: write once, run forever, zero marginal token cost.
Write to scripts/something.py first, then uv run python scripts/something.py. No exceptions.