/kenji:audit-cicdfrom kenji skills
Audits GitHub Actions CI/CD for cost, speed, and safety. Uses gh CLI to analyze billing, run history, runner types, and cache storage. Helps cut minutes and spend without losing coverage.
Ships in kenji skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Degree of freedom: MIXED — Steps 1–3 judgment [HIGH freedom]; Step 0
gh inventory and Step 4 deletes [LOW freedom — run exactly].
Systematic audit of GitHub Actions workflows to cut the Actions bill (minutes +
storage) and speed up CI without losing test coverage or deploy safety.
Uses the gh CLI for live billing, run history, and storage data.
| Skill | Owns |
|---|---|
| audit-cicd (this) | GitHub Actions CI/CD audit for cost, speed, and safety |
audit-gate-logic | Read-only CI gate logic: silent bypass, ratchet gaming, duplicate gates |
housekeep-gates | Consolidate accreted CI gates, ratchets, hooks into one aggregator check |
audit-infra-cost | Read-only hosting, database, storage, egress, and serverless spend audit |
runs-on, concurrency, or gh minute/storage number$ × safety; never score a cut that drops coverageObserve:
build-mobile.ymlruns-on: macos-15onpush:to every branch; noif:gate; private repo. Interpret: every push bills ~10× Ubuntu for an iOS job nobody requested. Classify: expensive-runner on ordinary push. Severity: Very high (~10×). Finding:build-mobile.yml| macos on push | dispatch/tag-only | ~10×
Measure before optimizing. Only private repos consume the paid minute allowance; public repos get free minutes — don't spend effort there.
# Which repos actually cost money (private, active, recent pushes)?
gh repo list <owner> --limit 200 --json name,visibility,isArchived,pushedAt \
--jq 'sort_by(.pushedAt)|reverse|.[]|select(.visibility=="PRIVATE" and .isArchived==false)|"\(.name)\t\(.pushedAt[0:10])"'
# Per repo: active workflows, run volume (last 14d), and runner types
gh api "repos/<owner>/<repo>/actions/workflows" --jq '.workflows[]|select(.state=="active")|.name'
gh run list --repo <owner>/<repo> --created ">=YYYY-MM-DD" --limit 200 --json databaseId --jq 'length'
# Storage (the other half of the bill)
gh api "repos/<owner>/<repo>/actions/artifacts" --paginate --jq '[.artifacts[]|select(.expired==false)|.size_in_bytes]|add'
gh api "repos/<owner>/<repo>/actions/cache/usage" --jq '.active_caches_size_in_bytes'
Rank repos by runs × runner-multiplier. A macos-* job counts ~10x a
ubuntu job; *-large/bigger runners cost more than standard.
For each .github/workflows/*.yml, check for the recurring cost drivers:
push: [main]
and pull_request for main (every merge bills twice). PR gates
verification; a separate deploy.yml handles main. If both are needed,
guard per-job with if: github.event_name == '...'.concurrency — no cancel-in-progress, so rapid pushes/PR
syncs stack full runs instead of superseding.macos-* / *-large firing
on every push instead of workflow_dispatch or version tags only.paths: / paths-ignore:).needs: [...]).upload-artifact without
retention-days keeps outputs 90 days; heavy reports uploaded on
success (if: always()) instead of if: failure().schedule: where weekly suffices.| Lever | Fix | Impact |
|---|---|---|
| macOS/large on push | Gate to workflow_dispatch / tags | Very high (~10x) |
| Doomed heavy jobs | needs: [cheap-gate] so they skip on failure | High |
| Double-billing triggers | Drop the redundant trigger (keep the gate) | High |
| No concurrency | Add cancel-in-progress | Medium |
| No path filters | paths: / paths-ignore: | Medium |
| Daily crons | Move to weekly | Medium |
| Artifact retention | retention-days: 1–7 + if: failure() | Storage |
| Repeated installs | Cache deps / Playwright browsers / build cache | Medium |
# Concurrency — every workflow. CI/verification cancels superseded runs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Deploy/release: never cancel a live deploy. For combined verify-on-PR +
# deploy-on-push workflows, cancel PR churn only:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
# Expensive runner: dispatch/tag-only, not every push
build-ios:
runs-on: macos-15
if: ${{ inputs.platform == 'ios' || startsWith(github.ref, 'refs/tags/') }}
timeout-minutes: 60 # cap runaway 10x spend
# Lean artifacts
- uses: actions/upload-artifact@v4
if: failure()
with: { name: report, path: report/, retention-days: 3 }
# Stop the gitleaks SARIF pile-up
env: { GITLEAKS_ENABLE_UPLOAD_ARTIFACT: "false" }
Artifacts and caches are ephemeral CI outputs; deleting them is safe but irreversible. Confirm with the user, then:
# Delete non-expired artifacts in a repo
gh api "repos/<owner>/<repo>/actions/artifacts" --paginate \
--jq '.artifacts[]|select(.expired==false)|.id' \
| xargs -I{} gh api -X DELETE "repos/<owner>/<repo>/actions/artifacts/{}"
# Delete caches
gh api "repos/<owner>/<repo>/actions/caches" --paginate --jq '.actions_caches[].id' \
| xargs -I{} gh api -X DELETE "repos/<owner>/<repo>/actions/caches/{}"
npm audit, CVE scans) continue-on-error or move them to a
schedule — keep the check.deploy.yml triggers on the CI workflow_run
for push, do not remove the push trigger from CI.PATCH required_status_checks.contexts in the
same change or merges hang. Verify:
gh api repos/<owner>/<repo>/branches/<main>/protection/required_status_checks --jq '.contexts'startup_failure
(YAML parses) and that intended jobs skip/run:
gh run view <id> --json jobs --jq '.jobs[]|"\(.conclusion // .status) \(.name)"'UI-only at the time of writing — check whether the settings API now covers them before telling the user it is manual.
gh count, not "CI feels expensive"runs-on still present$ × runner multiplieraudit-gate-logic; hosting bill → audit-infra-cost## CI/CD Audit: [owner]
### Spend snapshot
- Actions billable: ~$X/mo (private repos exhaust the included minutes)
- Top spenders: [repo — ~$Y, driver], ...
- Storage: [X GB artifacts / Y GB caches]
### Findings (prioritized)
| # | Repo | Workflow | Anti-pattern | Fix | Impact |
|---|------|----------|--------------|-----|--------|
| 1 | repo | build-mobile.yml | macOS on every push | dispatch/tag-only | ~10x |
### Already healthy
- [repos/workflows already using concurrency, gated runners, path filters]
### Manual actions (user-only)
- [ ] Default artifact/log retention → 14 days
- [ ] Actions spending budget + alerts
- [ ] Rotate leaked secret(s), if any
### Expected outcome
~$A → ~$B/mo, no loss of test coverage or deploy safety.
audit-gate-logic — does the gate actually stop what it claims (bypass / ratchet)audit-infra-cost — hosting / DB / egress (not Actions minutes)test-visual-regression — screenshot CI artifact retentionaudit-security / deploy-verify / workflow-pr / create-hookWhat SKILL.md sets; muted values are Claude Code's defaults
highThree short reads, in order
npx claudepluginhub kensaurus/skills --plugin kenji162 skills in this plugin
/audit-accessibilityWCAG 2.2 AA audit via playwright-cli: axe-core, keyboard, contrast, target size, focus, ARIA. Use when "audit accessibility", "check a11y", "WCAG audit", "check keyboard nav", or "test screen reader".
/audit-agent-speedMeasure and fix a slow coding-agent setup: status line, hooks, instruction bloat, effort, worktree pile-up, antivirus and indexer scans. Use when "Claude is slow" or "CPU is pinned". App speed → audit-performance.
/audit-analyticsRead-only audit of product-analytics events (PostHog, Amplitude, Mixpanel, GA4): taxonomy, funnels, consent-gated firing, dead or duplicate events. Use when "audit our analytics", "are we tracking the right events", or "funnel instrumentation".
Other plugins' skills for the same job