agentleFS
CranotCranot/roam-code/.claude/skills/prompt-optimizer/SKILL.md

prompt-optimizer

Skill517 starsChanged 2 months agoApache-2.0View on GitHub

Optimize a vague subagent brief into a structured Agent task brief carrying falsifier, invariant, source-citation rule, and concrete-noun anchors. Invoke before Agent tool dispatch (Explore / general-purpose / Plan), before drafting research-wave specs, before writing HANDOVER memos, before composing /loop self-prompts. Source: agi-in-md Comparator-Aware Prompt Diagnostics paper + 81-prism Twinks catalog.

46 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use continuous-agent-loop, deployment-patterns and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • InfopibeSkill

    continuous-agent-loop

    Patterns for continuous autonomous agent loops with quality gates, evals, and recovery controls.

    Also in 4 projects that use this

  • InfopibeSkill

    deployment-patterns

    Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.

    Also in 3 projects that use this

  • xiaobei930Skill

    search-first

    Research-before-coding workflow: systematically search existing solutions before custom implementation. Use when introducing new libraries, tools, or solving unfamiliar problems.

    Also in 3 projects that use this

  • mryeastcodeSkill

    context-budget

    Audits Claude Code context window consumption across agents, skills, MCP servers, and rules. Identifies bloat, redundant components, and produces prioritized token-savings recommendations.

    Also in 3 projects that use this

  • LangChainSkill

    docker-patterns

    Best practices for Docker containerization and multi-stage builds

    Also in 3 projects that use this

  • xfstudioSkill

    architecture-decision-records

    Write and maintain Architecture Decision Records (ADRs) following best practices for technical decision documentation. Use when documenting significant technical decisions, reviewing past architectural choices, or establishing decision processes.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 34 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before any Agent dispatch (Explore / general-purpose / Plan)

    line 16
  2. Very specific:

    Before drafting a dev/SPEC-*.md research wave

    line 17
  3. Distinctive:

    Before writing a HANDOVER memo a future agent reads cold

    line 18
  4. Very specific:

    Before composing a /loop self-pacing prompt

    line 19
  5. Very specific:

    When dispatching ≥4 agents in parallel (memory: feedback_continuous_saturation_refill_to_four), optimize each brief independently — …

    line 51
  6. Distinctive:

    Every claim in the optimized brief carries one tag:

    line 61

“Common” is measured: kept by at least 6 in 10 of the 34 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Prompt Optimizer

A structured-assignment generator for subagent dispatch. The brief is the dominant variable for subagent quality, not the model (agi-in-md LAW 1). This skill forces every dispatch through a stable 6-field shape so subagents return source-grounded findings instead of summary-mode paragraphs.

When to invoke

  • Before any Agent dispatch (Explore / general-purpose / Plan)
  • Before drafting a dev/SPEC-*.md research wave
  • Before writing a HANDOVER memo a future agent reads cold
  • Before composing a /loop self-pacing prompt

Skip for maximally-specific requests (one-symbol fact lookup, single-line continuation, conversational reply with full context already in window).

Three rules

  1. Preserve the vanilla brief verbatim. Copy the original first. Normalize only path quoting. Without the vanilla as comparator, A/B scoring is meaningless.
  2. Apply the 6-field template. Load references/optimized-prompt-template.md and fill every field: Task, Target, Grounding rules, Process, Final output, Falsifier. Anchor every claim on concrete-noun terminals per LAW 4 (see roam-code/CLAUDE.md "Concrete-noun anchor vocabulary" for the accepted set).
  3. Iterate v1 → v2 → final. Each pass names one ornament removed or one anchor sharpened. Stop when the next edit would not change the next agent's action (CLAUDE.md maintenance contract: Behavioral Coverage × Token Cost = Constant).

Roam-code dispatch matrix

SubagentBrief shapeFalsifier example
Explorebreadth (quick / medium / very thorough) + exact symbol or pattern"If you do not find X, that is the answer — do not invent it"
general-purposefile paths + line numbers + exact API up front"Every claim cites file:line; unsourced claims get deleted"
Plantrade-off matrix + rejected alternatives + chosen path with rationale"Name two rejected paths; if none, design space was too narrow"

When dispatching ≥4 agents in parallel (memory: feedback_continuous_saturation_refill_to_four), optimize each brief independently — subagents share no context.

claude subagent is BANNED on this host (memory: feedback_no_claude_subagent, W1072 worktree-MAX_PATH); route every optimized brief to Explore / general-purpose / Plan.

Epistemic tags

Every claim in the optimized brief carries one tag:

  • [SOURCE] — directly read from file/log/output (maps to roam direct confidence)
  • [DERIVED] — computed from sources (maps to derived)
  • [ASSUMED] — working hypothesis pending verification (maps to inferred)
  • [UNVERIFIABLE] — out-of-scope or unprovable from artifacts at hand (maps to legacy_fallback)

Canonical vocabulary: src/roam/evidence/_vocabulary.py → CLAIM_CONFIDENCES (4-member closed enum).

Output shape

For a rewrite return:

  • vanilla — original brief verbatim
  • optimized_final — dispatch-ready text
  • iteration_notes — concise v1 / v2 / final diff rationale
  • measurement_plan — 8-axis scoring plan when A/B was requested

For an A/B return:

  • Dispatch parameters (subagent_type, working dir, identical context)
  • 8-axis comparison from references/optimized-prompt-template.md
  • Final opinion + caveats

Reference

references/optimized-prompt-template.md carries the 6-field skeleton, the Codex CLI cross-family pattern, the 8-axis scoring rubric, and the documented failure modes.

Upstream

Source: agi-in-md/.agents/skills/prompt-optimizer/. Empirical backing: the 81-prism catalog with 22 top-tier "Twinks" scored on production code + the Comparator-Aware Prompt Diagnostics paper. The 12 agi-in-md laws are already imported into roam-code/CLAUDE.md; this skill operationalizes them at dispatch time.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.