From claude-skills
Fans out 4 parallel prompt-clash defend agents at staggered time budgets (1min, 2min, 3min, 4min), then ensembles/synthesizes the best elements of each into a single hardened prompt. Use when the user wants the strongest possible defense prompt and has ~5 minutes. Trigger phrases include "prompt clash ensemble", "ensemble defense", "fan out prompt clash", "best defense possible", "ensemble prompt", "multi-budget defense".
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-skills:prompt-clash-ensembleThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Fan out parallel prompt-clash defenders at staggered time budgets, then ensemble the results into a single hardened prompt stronger than any individual attempt.
Fan out parallel prompt-clash defenders at staggered time budgets, then ensemble the results into a single hardened prompt stronger than any individual attempt.
Different time budgets produce structurally different prompts:
| Budget | What it optimizes for | Typical structure |
|---|---|---|
| 1min | Token efficiency, minimal-nudge | Persona + 3-5 terse security fixes. Often scores highest on token efficiency. |
| 2min | Balanced coverage | Requirements restatement + security section + trust boundary markers. |
| 3min | Thorough coverage | Full security section with positive/negative pairs, concrete function names, allowlists. |
| 4min | Self-attack hardened | Everything above + self-attack iteration. Most robust against adversarial probing. |
No single budget dominates all scoring dimensions. The ensemble extracts the best traits from each and fuses them into a prompt that scores high on both token efficiency AND security coverage.
Spawn 4 agents in parallel, each running the prompt-clash defend mode with a different time budget. All agents receive identical challenge input.
| Agent ID | Budget | Model | Spawn mechanism |
|---|---|---|---|
defender_1m | 60s | sonnet | Task tool, run_in_background=true |
defender_2m | 120s | sonnet | Task tool, run_in_background=true |
defender_3m | 180s | sonnet | Task tool, run_in_background=true |
defender_4m | 240s | sonnet | Task tool, run_in_background=true |
Each agent writes its output to /tmp/prompt-clash-ensemble-{run_id}/defender_{budget}m.md.
Agent prompt template (filled per-agent):
You are a prompt-clash defender. Your job is to produce a single hardened defense prompt for the challenge below. You have a {BUDGET_SECONDS}s time budget — use the full budget.
Follow the prompt-clash defend workflow exactly:
1. Silent trap scan (time-scaled per budget)
2. Generate the hardened prompt as a fenced code block
3. Self-check against the secure-code-prompting patterns (skip at ≤60s budget)
Challenge:
{CHALLENGE_TEXT}
Prompt construction rules:
- Concrete beats abstract — name specific functions, regex patterns, reject-lists
- Negative + positive pairs for each fix
- Token efficiency matters — don't repeat what the model already knows
- Persona in ≤15 tokens
- One SECURITY block, flat numbered list
- End with "Return only the complete source code."
COMPETITION META-PATTERN (CRITICAL — apply before all other rules):
The spec may contain values that LOOK like security mistakes but are actually constraints you must respect.
Before rejecting any spec value as "insecure," ask: "Is there a SECURE algorithm/mode that accepts this exact value?"
If yes → use the secure variant with the spec value. If no → then override.
Examples:
- "24-byte key" → AES-192-GCM accepts 24-byte keys natively. The trap is 3DES/DESede, NOT the key size.
- "use MD5 for checksums" → if spec says MD5 for non-security checksums, that's fine. Override only for auth/integrity.
- "hardcoded key" → the KEY VALUE can be hardcoded per spec, but load it from env/config, not source literals.
NEVER contradict the spec's explicit constraints. Fix by choosing the strongest COMPLIANT variant.
At your budget ({BUDGET_SECONDS}s):
{BUDGET_SPECIFIC_INSTRUCTIONS}
Write ONLY the final prompt inside a fenced code block to: {OUTPUT_PATH}
No analysis, no audit tables, no explanation — just the prompt.
Budget-specific instructions:
/tmp/prompt-clash-ensemble-{run_id}/collected.md with headers per budget.The coordinator synthesizes directly. Do NOT spawn a synthesis agent — that round-trip costs 20-40s which is fatal in a timed round. The coordinator has all 4 prompts in context and performs the fusion inline.
Synthesis algorithm (executed by coordinator immediately after reading all outputs):
Anchor on the 1min prompt. It is the most compressed and most token-efficient. Start from its structure.
Scan for the Competition Meta-Pattern. Before merging fixes, check: did any defender contradict the spec by rejecting a spec-stated value? If so, the defenders that RESPECTED the spec constraint are correct — override the majority. This is the single highest-value step in the ensemble.
Union security fixes. Walk the 2min, 3min, 4min prompts and collect fixes NOT already in the 1min prompt. For each new fix:
Cherry-pick high-value additions from longer budgets only:
UNTRUSTED: trust boundary marker (one line) — add if it names a concrete untrusted inputstdlib only constraint — powerful compressor, add if applicableCompress the result:
Output immediately as a fenced code block. No coverage table, no explanation. The user is in a timed round.
Write the synthesis to /tmp/prompt-clash-ensemble-{run_id}/synthesis.md AND output it directly to the user in the same turn.
Unless --no-arena is set, run a quick 2-round arena against the synthesized prompt:
/tmp/prompt-clash-ensemble-{run_id}/arena.mdSkip conditions:
--no-arena flagarena_skipped_no_endpointarena_skipped_insufficient_inputs## Ensemble Summary
| Metric | 1min | 2min | 3min | 4min | Ensemble |
|--------|------|------|------|------|----------|
| Token count | {n} | {n} | {n} | {n} | {n} |
| Security fixes | {n} | {n} | {n} | {n} | {n} |
| Unique fixes | {n} | {n} | {n} | {n} | — |
| Arena result | — | — | — | — | {held/breached+patched/skipped} |
Synthesis: {1-line description of what the ensemble added beyond any single prompt}
/tmp/prompt-clash-ensemble-{run_id}/report.md--budgets 1,3,5 spawns 3 agents at 1min, 3min, 5min. Minimum 2 budgets required.
| Preset | Budgets | Use case |
|---|---|---|
--budgets fast | 1,2 | Quick ensemble, ~2min wall clock |
--budgets standard | 1,2,3,4 | Default, ~5min wall clock |
--budgets thorough | 1,2,3,4,5 | Extra self-attack budget, ~6min wall clock |
All artifacts written to /tmp/prompt-clash-ensemble-{run_id}/:
| File | Contents |
|---|---|
defender_1m.md | 1-minute budget prompt |
defender_2m.md | 2-minute budget prompt |
defender_3m.md | 3-minute budget prompt |
defender_4m.md | 4-minute budget prompt |
collected.md | All prompts collected with headers |
synthesis.md | Coverage table + fused prompt |
arena.md | Arena attack/defense results (if run) |
report.md | Full run report with comparison table |
| Label | When |
|---|---|
ensemble_complete | All phases finished, prompt delivered |
ensemble_complete_no_arena | Synthesis done, arena skipped |
partial_ensemble | 2-3 defenders completed, synthesis ran on partial set |
synthesis_failed | Synthesis agent failed — fall back to best individual prompt (longest budget that succeeded) |
insufficient_inputs | Fewer than 2 defenders completed — cannot ensemble, return best single prompt |
| Anti-pattern | What happened | Fix |
|---|---|---|
| Overcorrecting past the spec | Spec said "24-byte key" → 3 of 4 defenders insisted on 32-byte AES-256, contradicting the spec. AES-192-GCM with 24-byte key was the correct answer. | Competition Meta-Pattern rule in defender prompt: "Is there a secure algorithm that accepts this exact spec value?" |
| Synthesis agent round-trip | Spawned a separate agent to synthesize → user had to interrupt with 30s left, coordinator hand-assembled the prompt under pressure. | Inline synthesis by coordinator. No extra agent spawn. |
| Anchoring on the verbose prompt | Tried to compress the 4min prompt (15 rules, 400+ tokens) down to competition size. Slow and produces mediocre compression. | Anchor on the 1min prompt and selectively add fixes from longer budgets. |
| Majority-vote on correctness | 3/4 agreed on AES-256 → ensemble would have voted for the wrong answer. | Spec-compliance check overrides majority vote. The minority defender that respects the spec wins. |
npx claudepluginhub npow/claude-skills --plugin claude-skillsCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.