Optimizing a pipeline
Skill gustavo-meilus/superpipelines/skills/optimizing-a-pipeline
Optimize an existing named Superpipelines workflow for topology, model tiers, cost, latency, and reliability.From its SKILL.md
npx -y skills add gustavo-meilus/superpipelines --skill optimizing-a-pipelineAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
11.4 KB, ~2.8k tokens by cl100k_base, as published. Nobody here has run it
Optimizing a Pipeline — On-Demand Optimization Workflow
<overview> Top-level orchestrator for optimizing an existing pipeline. A read-only `pipeline-optimizer` analyst surveys the selected bundle across four axes (topology structure, model-tier cost, past-run signals, protocol/prompt quality); a discovery session (4D → brainstorm → grill) converges the findings into an `optimization_plan` with the user; the approved plan is batch-applied atomically through the existing mutation and `change-models` engines, gated by a `pipeline-auditor` DELTA pass and proven by a mandatory full audit. Orchestration lives only here (`SUB_AGENT_SPAWNING: FALSE`); the optimizer never mutates (render-inline, #33). </overview> <glossary> <term name="Opportunity">A single proposed improvement rendered by the optimizer, carrying an axis, impact, affected steps, and a suggested engine.</term> <term name="optimization_plan">The reconciled set of accepted/rejected/modified opportunities returned by `sk-pipeline-grilling MODE=optimization`.</term> <term name="Batch apply">Staging ALL approved changes in one `edit-{ts}/` and promoting them all-or-nothing — a multi-change optimization is one semantic change.</term> <term name="Snapshot">A pre-mutation copy of the bundle in `edit-{ts}/backup/` plus a git checkpoint, used for rollback.</term> </glossary>Workflow Phases
<protocol> ### PHASE 0 — SELECTION - Reuse the `running-a-pipeline` Phase 0 multi-scope discovery pattern: call `sk-pipeline-paths.ENUMERATE_ALL_SCOPE_ROOTS(workspace)`, merge every `<root>/superpipelines/registry.json`, annotate each entry with `source_tier` and `scope`. - Present the pipelines; capture the selection `{ROOT, P, pattern, source_tier}`. - Load `sk-platform-dispatch` → `DETECT()` → `platform_profile` (cache once; same probe/fallback rules as `running-a-pipeline` Phase 0.25). Emit every `platform_profile.degradation_warnings` entry. - IF `$ARGUMENTS` named a pipeline, pre-select it; still confirm before proceeding.PHASE 0.5 — NO-ACTIVE-RUN SOFT GATE
- Scan
<ROOT>/superpipelines/temp/{P}/*for run directories; read eachpipeline-state.jsontop-levelstatus. - IF any run is
runningorescalated(non-terminal):AskUserQuestion: (a) discard those run states and proceed (delete the non-terminal run dirs), or (b) abort and let the user finish/handle them manually.
- <HARD-GATE>NEVER stage or mutate the bundle while a
running/escalatedrun exists unless the user explicitly chose discard.escalated/failedrun dirs are never deleted silently.</HARD-GATE>
PHASE 1 — SURVEY
- Dispatch the read-only
pipeline-optimizervia profile-driven dispatch — the SAMEplatform_profile.capabilities.dispatch_mechanismbranching used bycreating-a-pipelinePhase 4 (native_task→Task();native_subagent/model_driven→ platform-native;inline→ Tier 2 inline loop). Hand it absolute paths (resolved viask-pipeline-paths) totopology.json, the bundleagents/dir, thetemp/{P}/*/pipeline-state.jsonhistory, anyrun-telemetry.jsonl, and theplatform_profile. - The optimizer renders an opportunity report as terminal output and NEVER writes a file.
- <HARD-GATE>Persistence is the orchestrator's job (#33): write the rendered report to
<ROOT>/superpipelines/temp/{P}/optimize-{ts}/findings.md(ensure the dir exists first).</HARD-GATE> - IF the optimizer returns
DONE_WITH_CONCERNS(telemetry-blind axes), surface the advisory on enabling the opt-in telemetry hook (CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1+ registersubagent-telemetry). NEVER auto-edit settings. - IF no opportunities were found: report that and exit cleanly — nothing to optimize.
PHASE 2 — DISCOVERY
sk-4d-method— frame what "better" means for this pipeline (cost? latency? reliability? clarity?). Produce thehardenedconstraints.superpipelines:brainstorming— divergent exploration of alternative redesigns and their trade-offs against the findings.sk-pipeline-grilling GRILL(MODE=optimization, findings, hardened)— convergent: walk each opportunity one at a time, capturing accept/reject/modify + rationale. Returns theoptimization_plan.- <HARD-GATE>The grilling reconciliation gate must close with ZERO unresolved opportunities before Phase 3.</HARD-GATE>
PHASE 3 — PLAN GATE (single human approval)
- Present the
optimization_planconcretely: the chosen opportunities, the resulting topology diff (steps merged/split/parallelized/removed), the model-tier diff, and the predicted effect against thehardenedsuccess criteria. - ONE
AskUserQuestionapproval for the whole plan (plan-gate + batch-apply: the changes interact and must be approved/audited/promoted together). - <HARD-GATE>No staging, snapshot, or mutation before this approval returns yes. Rejection ends the workflow with the findings preserved.</HARD-GATE>
PHASE 4 — BATCH APPLY (atomic)
- Snapshot: copy the bundle to
<ROOT>/superpipelines/temp/{P}/edit-{ts}/backup/AND create a git checkpoint commit. This is the rollback source. - Stage ALL changes in one
edit-{ts}/(never promote partials):- Topology changes (merge/split/parallelize/reorder/remove) route through the existing mutation engines —
updating-a-pipeline-step/adding-a-pipeline-step/deleting-a-pipeline-step(architect STEP-* modes), staging into the sharededit-{ts}/. - Model-tier changes route through
change-modelsMode C (per-agentmodel_tier:override) — recommend a tier direction only; concrete model IDs stay in profile JSON (DEPENDENCY_INVERSION). - Advisory-only (Axis-4) opportunities are NOT auto-applied; surface them for manual follow-up.
- Topology changes (merge/split/parallelize/reorder/remove) route through the existing mutation engines —
- DELTA audit: run ONE combined
pipeline-auditorDELTA pass over the whole staged delta. - <HARD-GATE>SEV-0/1 == 0 is required to promote. Any SEV-0/1 → roll back from the snapshot, restore the git checkpoint, and surface the findings. Do NOT promote a partial set.</HARD-GATE>
- Promote all-or-nothing: on a clean DELTA audit, promote the entire
edit-{ts}/atomically. - Stamp: bump
plugin_versionontopology.json, theregistry.jsonentry, and every touched agent; settopology.metadata.optimization = { ts, opportunities_applied: [...], baseline_ref }(baseline_ref= the git checkpoint).
PHASE 5 — POST-APPLY PROOF
- <HARD-GATE>MANDATORY full
pipeline-auditorpass over the promoted bundle. Any SEV-0/1 → auto-rollback from the snapshot + git checkpoint.</HARD-GATE> - Graph-integrity check: every
depends_onresolves to an existing step; no orphan edges; no unreachable non-entry step; I/O contracts chain (each consumed input is produced upstream). Any failure → auto-rollback. - Persist the auditor report per the
commands/audit-steps.mdREPORTING contract (orchestrator owns persistence; ensureaudit/exists; writeaudit/latest.md; updateregistry.json last_audit). - Offer an optional live smoke-run via
running-a-pipeline(not mandatory —PARITY_TESTING: MANUAL_PHASE1). - Write the durable provenance report to
<ROOT>/superpipelines/pipelines/{P}/optimization-report-{ts}.md(opportunities applied/rejected, diffs, audit verdict, baseline_ref). </protocol>
Red Flags — STOP
- "The optimizer can write
findings.mditself to save a step." → STOP. Read-only render-inline; the orchestrator persists (#33). - "Promote the topology changes now; apply the tier changes after." → STOP. Batch-apply is all-or-nothing; partial promotion leaves the bundle in an unaudited interleaved state.
- "The DELTA audit found a SEV-1, but it's minor — promote anyway." → STOP. SEV-0/1 == 0 gates promotion. Roll back.
- "A run is escalated, but optimizing won't touch it." → STOP. Phase 0.5 gate: mutating the definition under a live run corrupts resume. Discard explicitly or abort.
- "Skip the snapshot — the git checkpoint is enough." → STOP. Both are required; the snapshot is the staging-local rollback source, the checkpoint the version baseline.
- "Re-check the isolation defect while surveying." → STOP. That is
pipeline-auditor's job (DEPENDENCY_INVERSION); the optimizer delegates. - "Apply the advisory (Axis-4) quality fixes automatically." → STOP. Advisory-only opportunities are surfaced for manual decision, never auto-applied.
Rationalization Table
<rationalization_table>
| Excuse | Reality |
|---|---|
| "One plan gate is too slow — approve each change inline." | The changes interact; piecemeal approval can promote a half-coherent topology. One plan, one gate, one atomic promote. |
| "The optimizer already audited the bundle." | It did not — it surveys opportunities. Compliance/isolation is the auditor's DELTA + full passes (DEPENDENCY_INVERSION). |
| "Skip the post-apply full audit; the DELTA passed." | The DELTA only saw the changed delta. The full pass + graph-integrity prove the whole bundle still chains. |
| "No telemetry, so skip past-run analysis silently." | Degrade and SAY SO — surface the opt-in hook advisory so the next run can ground cost/latency signals. |
"Down-tier this step to fast and name the model." | Name a tier direction only; route through change-models Mode C. Concrete IDs live in profile JSON. |
| "Rolling back is wasteful after staging so much." | A failed audit/graph check means the staged set is unsafe. Rollback is the contract, not a failure of effort. |
| </rationalization_table> |
Reference Files
agents/pipeline-optimizer.md+skills/pipeline-optimizer-protocol/SKILL.md— the read-only survey worker.skills/pipeline-optimizer-references/references/opportunity-taxonomy.md— opportunity classes + heuristics.sk-pipeline-grilling/SKILL.md—MODE=optimizationreconciliation (returnsoptimization_plan).sk-4d-method/SKILL.md·superpipelines:brainstorming— the discovery session.updating-a-pipeline-step·adding-a-pipeline-step·deleting-a-pipeline-step— topology mutation engines (edit-{ts}/staging).change-models/SKILL.md— Mode C per-agentmodel_tier:override.pipeline-auditor+commands/audit-steps.md— DELTA + full audit and report persistence.running-a-pipeline/SKILL.md— Phase 0 discovery pattern reused here; optional Phase 5 smoke-run.sk-pipeline-paths/SKILL.md— scope-root and path resolution.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most performance cost skills give in ~2.8k tokens
Counted across 797 of the 1,117 authors here whose files we hold, read 2026-09-06
- Check for product marketing context firstin 46 of 797, across 20 files
- Measure before optimizingin 31 of 797, across 25 files
- Profile first to identify the actual bottleneckin 23 of 797, across 22 files
- Verify your robots.txt allows AI crawlersin 21 of 797, across 12 files
- Import directly and avoid barrel filesin 19 of 797, across 15 files
- Spawn all runs in the same turnin 18 of 797, across 11 files
- Write a draft of the skillin 17 of 797, across 10 files
- Understand the user's intentin 17 of 797, across 10 files
- Use React.cache for per-request deduplicationin 16 of 797, across 11 files
- Profile before optimizingin 16 of 797, across 14 files
- Include specific numbers with sourcesin 15 of 797, across 8 files
- Add lazy loading to below-fold imagesin 15 of 797, across 10 files
Said here and by no other author read
- Scan roots and capture pipeline selection
- Check for active runs before mutating
- Dispatch the read-only pipeline-optimizer
- Persist the rendered optimizer report
- Run 4D method, brainstorming, and grilling
- Present optimization plan for user approval
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.