Index of every page on this site: llms.txt
All skills
Run it yourself

Audits a repository's GitHub Actions workflows for CI optimization opportunities — missing caches, redundant setup, sleep-based readiness, long test jobs without sharding, full-history checkout, dead env vars, build-cache misconfig, and ~60 more patterns across caching, redundancy, parallelization, conditional execution, trigger scope, and hidden failures. Use when: (1) analyzing a repo's CI for optimization opportunities, (2) producing a prioritized report with measured wall-clock and runner-minute savings, (3) re-auditing after upstream CI changes. Do not trigger for: general CI setup help, writing new workflows from scratch, non-GitHub-Actions CI systems, or security/posture audits — use `ci-secure` for those.

Use this Skill: https://skilld.dev/gh/starslingdev/skills/ci-speedup

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencespatternsopt31-conditional-step-with-unconditional-setup.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

OPT31 — Conditional Step With Unconditional Setup

Anti-pattern: A step (typically a tool install, browser install, or large download) exists ONLY to support a downstream step that has an if: condition gating it. The downstream step is conditionally skipped (e.g., when a secret is missing, when a feature is disabled, on certain branches), but the upstream setup step runs unconditionally — paying the full setup cost for runs where the consumer never executes.

A second form occurs in an aggregate job: a shell-only step reads needs.<job>.result values and fails when a producer was unsuccessful, but it runs after checkout or a setup-* action. A failed dependency therefore pays for setup before the result gate ends the job.

Why this is missed by OPT1 (Unnecessary Tool Install): OPT1 catches the case where the tool is NEVER invoked in the job. OPT31 catches the case where the tool IS invoked, but only conditionally — and the install step is missing the same condition.

Detection heuristic:

  1. For each job, walk steps in order. For every step that has an if: condition (especially conditions referencing env.*, secrets.*, branch names, or labels):
  2. Look at the immediately preceding setup steps (within the same job, no needs: boundary). Identify the setup steps whose only consumer is this conditional step.
  3. Examples of "setup-and-consumer" pairings:
    • bunx playwright install (setup) → playwright test or e2e (consumer)
    • apt-get install <pkg> → <pkg> --version or invocation
    • pip install <test-only-package> → only used in test invocation
    • gh auth setup-git → only used in conditional gh calls
  4. Flag if the setup is unconditional but the consumer's if: would skip in some fraction of runs.
  5. The savings = setup_step_p50_seconds × P(consumer skips).

For the aggregate-job form, require a result step that reads only literal needs.*.result values, can exit non-zero, and has no continue-on-error. Every simple command in it (split on ;, &&, || and |) must be a shell control, output or test builtin, and it must use bash or sh with no working-directory at step, job or workflow level. Flag only checkout or setup-* actions before the first such result gate. Withhold the finding when the gate runs a repository script or tool, uses command substitution or an input redirect, tests a file, reads a variable that is not in step, job or workflow env (an earlier step may export it), reads another GitHub context or an unreadable expression, or when setup already has a needs-result condition.

Fix: Copy the if: condition from the consumer step onto the setup step (or wrap both in a guard step that exits early). Example:

# Before
- name: Install Playwright Chromium
  run: cd apps/web && bunx playwright install --with-deps chromium # always runs (~16s)

- name: Web smoke e2e
  if: env.CLERK_SECRET_KEY != ''
  run: cd apps/web && bunx playwright test smoke

# After
- name: Install Playwright Chromium
  if: env.CLERK_SECRET_KEY != '' # add same condition
  run: cd apps/web && bunx playwright install --with-deps chromium

- name: Web smoke e2e
  if: env.CLERK_SECRET_KEY != ''
  run: cd apps/web && bunx playwright test smoke

For a needs-result gate, move that unchanged gate to the first step, before checkout and toolchain setup. Preserve its complete success predicate and test successful, failed, cancelled, skipped and missing dependency results.

Sizing: Runner-minute effect is a saving: the affected setup steps' measured billed compute on runs where the conditional consumer is skipped or a dependency result is unsuccessful. Do not state a number until both the setup time and that run share are measured. A result gate that ends a failed run earlier normally does not reduce successful pull-request merge wait.

Real-world example (blen-starter-kit): ci.yml web-quality job has Install Playwright Chromium (line 92, ~16s) followed by Web smoke e2e (line 95) gated on if: env.CLERK_SECRET_KEY != '' && env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY != ''. PRs from forks (no Clerk secrets) pay 16s for setup that's never consumed.

Public evidence: openclaw/crabbox pull request #2868: the coverage gate fails at its first step and skips checkout and Go setup when a producer fails.

Risk: LOW. The conditional-consumer fix is defensive when both steps keep the same condition. Moving a needs-result gate is safe only under the narrower shell-only detection above; changing its predicate can instead hide a producer failure, so preserve it byte-for-byte.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 alert2d3 checks · Risk SAFE
  • Gen Agent Trust Hub2d

    The skill is a robust CI optimization tool that audits GitHub Actions workflows. It identifies performance bottlenecks using deterministic logic and provides analysis of job logs. While it processes untrusted log data, it includes strong defensive instructions to mitigate indirect prompt injection. A minor best-practice issue regarding unsafe YAML loading was identified in a utility script.

  • Socket2d

    No alerts

  • Snyk2d

    Risk: CRITICAL · 2 issues

Signed by skilld at 9a84115. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 16 hours ago.

Activeupdated yesterday

README badge

README badge for starslingdev/skills/ci-speedup