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.

referencespatternsopt112-restored-go-build-cache-trimmed-before-reuse.md

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

OPT112 — Restored Go Build Cache Trimmed Before Reuse

TL;DR: actions/setup-go and actions/cache restore Go build-cache entries with their saved modification times. cmd/go trims entries unused for five days (plus a one-hour mtime granularity), at most once a day, when a Go command finishes. Once the restored archive is past that limit, the job's first Go command deletes every entry it did not itself use, and a later command with different flags (for example a plain build after -race tests) recompiles what the archive held. Mark the restored files as recently used before the first Go command so cmd/go keeps both populations.

Detection heuristic (every gate required; reads only what an ordinary job prints, no extra flags or markers):

  1. A captured long-pole job log restores a Go build cache: setup-go's standard Cache restored from key: setup-go-* line, or an actions/cache step whose logged path: input names go-build or GOCACHE. Two different Go keys in one log, or a later step that touches the Go build cache (the fix already in place), withhold the finding.
  2. GitHub's cache inventory returns exactly one archive for that key; its created_at splits the job's sampled successful runs into runs that restored it while it was younger than five days (fresh) and runs that restored it at least five days and one hour after creation (old).
  3. At least two fresh and two old runs are confirmed from their own logs to restore that same exact key without a retention step.
  4. The old runs' median job duration exceeds the fresh runs' median by at least 30 seconds, and every old run is slower than the fresh median.
  5. Missing or ambiguous cache metadata, too few runs in either window, or no slowdown keeps the finding quiet.

Fix recipe, safest first:

  1. Immediately after setup-go or actions/cache, resolve go env GOCACHE, create it on a cache miss, and touch every restored file before any Go command runs.
  2. Keep the existing cache key, flags, package set, race coverage, and failure behavior. Do not substitute a warm-up build: the warm-up can trim the other flag population before it is used.
  3. Pin the retention step's position in a workflow contract test, then compare the same job before and after. Confirm the later build no longer recompiles the broad package set and that every test still runs.

Guardrail: touching cache entries changes only their access recency; it must not turn an untrusted cache into executable input, weaken the cache key, skip a race or non-race build, or hide a failed restore. On a cache miss, the retention step is a no-op. Preserve Go's own cache validation and every existing test flag.

Sizing: the wall-clock saving is the measured median slowdown of old-archive runs over fresh-archive runs of the same cache key, the same job and the same dependency set. The runner-minute saving is stated as a ceiling: that slowdown times the workflow's 30-day run count, because runs that restore an archive younger than five days save nothing. The comparison is between sampled runs, not a before/after of the fix, so confirm it on the same job after adding the retention step.

Real-world example (OpenClaw), their numbers, not a forecast for another repository: openclaw/crabbox #2833 reported the first in-test CLI build falling from a 135-second mean to 30 seconds after retaining restored Go cache entries, while the race-shard test time fell by about 110 seconds.

Risk: LOW. The change is reversible and leaves cache keys and test commands intact, but its ordering is load-bearing: it must run after restore and before the first Go command.

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