/awesome-ai:gha-best-practicesfrom Ashley's Awesome AI
Enforces GitHub Actions best practices: triggers, draft guards, path filters, concurrency, permissions, secrets, action pinning, timeouts, caching, artifacts, checkout depth, installs, step naming, actionlint, and Dependabot. Loads automatically when creating or editing workflow files.
Ships in Ashley's Awesome AI. 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.
Apply every rule to each workflow file you create or modify. Fix existing violations in the same edit, unasked.
Declare explicit pull_request types. Bare pull_request: (implicit opened, synchronize,
reopened) fires on drafts and never on ready_for_review, so a draft-skipped job never runs
when the PR is marked ready.
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
Skip drafts on every pull_request job:
jobs:
build:
if: github.event.pull_request.draft == false
Mixed-trigger workflow → add the escape clause, or the job never runs on push:
if: github.event.pull_request.draft == false || github.event_name != 'pull_request'
push and pull_request with paths-ignore for docs-only changes.paths and paths-ignore are mutually exclusive on one event.docs/** and **/*.md are safe.workflow_dispatch; manual runs ignore filters.on:
push: ...
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths-ignore:
- "**/*.md"
- "docs/**"
workflow_dispatch:
Never make a path-filtered workflow a required status check. A filtered-out workflow never
reports, so the required check stays Pending and blocks merge. (A skipped job reports
Success; a skipped workflow reports nothing.) Pick one:
| Need | Do |
|---|---|
| Required check | No path filter on it |
| Path filter | Check stays optional |
| Both | One unfiltered workflow: a changes job detects paths, the required job gates on its output with if: and reports Success when skipped |
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Detect changed paths
id: filter
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
with:
predicate-quantifier: every
filters: |
code:
- '**'
- '!docs/**'
- '!**/*.md'
build:
needs: changes
if: needs.changes.outputs.code == 'true'
Never use a same-named second workflow with the inverse filter: a PR touching both paths runs both, they share the concurrency group and cancel each other, and required checks match job names, not workflow names.
Every workflow:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
pull-requests: write only when the job posts comments or status checks.write-all. Never omit the block; omission inherits broad defaults.jobs:
test:
permissions:
contents: read
Step-scoped only. Job- or workflow-level env exposes the secret to every step, third-party
actions included.
# WRONG
jobs:
deploy:
env:
API_KEY: ${{ secrets.API_KEY }}
# CORRECT
steps:
- name: Deploy
env:
API_KEY: ${{ secrets.API_KEY }}
run: ./deploy.sh
GITHUB_TOKEN. A PAT or GitHub App token only when the user asks for one.echo "::add-mask::$TOKEN".if: env.SECRET != ''. Let the step fail; skipping hides a config error
behind a green run.secrets: inheritNever by default. It passes the callee every repo/org secret, including ones added later.
# WRONG
jobs:
deploy:
uses: ./.github/workflows/deploy.yml
secrets: inherit
# CORRECT
jobs:
deploy:
uses: ./.github/workflows/deploy.yml
secrets:
GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
on.workflow_call.secrets with required:, so a missing
one fails at call time instead of arriving as an empty string.GITHUB_TOKEN; the callee gets its own, scoped by its permissions.inherit allowed only when caller and callee share a repo and the needed set varies per
caller. Justify it inline.Resolve every version at write time, never from memory or an example:
tag=$(gh api repos/<owner>/<repo>/releases/latest --jq .tag_name)
gh api repos/<owner>/<repo>/commits/$tag --jq .sha
Pin every action, actions/* included, to the full commit SHA plus a version comment. Never a
mutable tag (@latest, @main, @v7): a moved tag runs new code with the job's token and
secrets. Dependabot keeps the SHAs current.
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
timeout-minutes on every job; the default is 6 hours. CI tests 10–15 · deploys 10 · Sonar 10.
jobs:
test:
timeout-minutes: 15
Key off a lockfile hash, never a static string. uv, Playwright, and similar: built-in cache
option, or actions/cache with a lockfile-derived key.
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
cache: 'pnpm'
cache-dependency-path: web/pnpm-lock.yaml
if: always() so reports survive failed tests. Explicit retention-days (default is 90).
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: test-report
path: coverage/
retention-days: 30
fetch-depth: 0 only for jobs that read full history: Sonar, release-please, changelog
generation. Build and test jobs keep the shallow default.
Disable lifecycle scripts; they run arbitrary package code on a runner holding secrets.
| Package manager | Command |
|---|---|
| npm | npm ci --ignore-scripts |
| pnpm | pnpm install --frozen-lockfile --ignore-scripts |
| yarn (Berry, v2+) | yarn install --immutable --mode=skip-build |
| yarn (Classic, v1) | yarn install --frozen-lockfile --ignore-scripts |
| bun | bun install --frozen-lockfile --ignore-scripts |
A package that needs its build script (native bindings) gets that one script as its own named step. Never re-enable all scripts.
Every step gets a descriptive name:.
actionlint (brew) to the pre-commit hook and make ai-checks..github/dependabot.yml: github-actions plus every package ecosystem in the repo, each with
open-pull-requests-limit: 2 unless the user sets another.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub anchildress1/awesome-ai --plugin awesome-ai7 skills in this plugin
/changelog-writerUse when asked to rewrite or update `CHANGELOG.md` entries. Produces narrative, dry-humor release notes matching the file's existing voice; never edits outside the targeted section./eslint-plugin-configuringGenerate or update an ESLint plugin that exports rule configs compatible with ESLint v8 (eslintrc) and ESLint v9 (flat config)./generate-commit-messageDerive one Conventional Commits v1.0.0 message from the staged diff and create the signed commit directly. Trigger only on explicit intent to commit: "commit this", "commit these changes", "/commit", "go ahead and commit", "make the commit", "git commit", "make atomic commits", "split this into commits", or a confirmation like "yes, commit it". Enforces the type enum, 72-char subject, 100-char body/footer lines, and a required AI-attribution trailer, so the result passes commitlint on the first try. Do NOT trigger on message-only questions ("write a commit message", "what should the commit message be") — this skill's only output path is a real commit, and answering those with one records work the user merely asked to preview.
/pr-comment-reviewAudit and remediate an open GitHub PR's review feedback: verify Copilot and Codex actually reviewed, drive every unresolved thread to a fix-or-justify reply, correct PR title/description drift against the real diff, and run a one-time self-review pass. Trigger on "have all PR comments been addressed", "did copilot and codex review this", "reply to the PR comments", "address the PR feedback", "is this PR ready to merge", "clean up this PR before merging", "make sure nothing got missed on this PR" — and on generic "review comments" mentions, on single-bot mentions, and when prepping a new PR for review before comments exist. Not a fresh review of an unpushed working diff; that's `/code-review`.
/readme-generatorGenerate, audit, or improve a project README following a 15-section structure (Title, Table of Contents, About, Features, Tech Stack, Architecture, Project Structure, Getting Started, Configuration, Security, How to Contribute, What's Next, License, Acknowledgements, Author) with Mermaid diagrams for architecture and flows. Use this skill whenever the user asks to "write a README", "create a README", "draft a README", "generate README.md", "scaffold project docs", "document this repo", "improve my README", "audit my README", "what should go in my README", or starts a new repository and needs documentation. Also trigger on phrases like "the README is bare", "this project has no docs", "fill in my README sections", or any request that produces or reviews a top-level repository README./test-writerWrite, extend, or review tests in any codebase. Use this skill whenever the user asks to write tests, add test coverage, test a new feature, fix failing tests, or audit existing test files — regardless of language, framework, or project. Also trigger for "add tests for", "write tests for", "cover this with tests", "test this file", "update the tests", "improve coverage", or "this needs tests". This skill enforces universal testing rules (no .skip, no lowering thresholds, full-path coverage) and adapts its mock patterns and tooling to whatever stack the repo uses.
Other plugins' skills for the same job