agentleFS
mohammaddaoudfarooqimohammaddaoudfarooqi/agent-engineering-skills/skills/github-actions/SKILL.md

github-actions

Skill0 starsChanged 2 days agoApache-2.0View on GitHub

GitHub Actions workflow authoring for AI coding agents. Analyzes a repo's project type, language, and deployment targets, then generates production-grade CI/CD workflows with security hardening, caching, and optimization. Handles greenfield, brownfield, and audits. Use when the user requests GitHub Actions workflows: CI pipelines, CD deployments, release automation, or scheduled jobs, or when existing workflows need auditing, optimizing, or hardening. Triggers on phrases like "set up CI", "add CI/CD", "deploy on tag", "publish to npm/PyPI", "harden this pipeline", "pin actions to SHA", "OIDC", or "audit my workflows", and when creating or editing files under `.github/workflows/`, `action.yml`/`action.yaml`, or `.github/dependabot.yml`. Also triggers when migrating from GitLab CI, CircleCI, Travis, Jenkins, or Drone to GitHub Actions. Do NOT use for non-GitHub CI systems unless migrating TO GitHub Actions, or for general bash scripting, Makefiles, or local build config.

  • Reads credentials
  • Installs packages

57 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use gitlab-ci, react-native-brownfield-migration and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • jcsaaddupuySkill

    gitlab-ci

    GitLab CI/CD configuration guide

    Also in 6 projects that use this

  • maikotrindadeSkill

    react-native-brownfield-migration

    Provides an incremental adoption strategy to migrate native iOS or Android apps to React Native or Expo using @callstack/react-native-brownfield for initial setup. Use when planning migration steps, packaging XCFramework/AAR artifacts, and integrating them into host apps.

    Also in 4 projects that use this

  • ffsshhttiikkSkill

    nodejs

    JavaScript runtime built on Chrome's V8 JavaScript engine

    Also in 4 projects that use this

  • ihiteshguptaSkill

    terraform

    Expert in Infrastructure as Code with Terraform. Use for creating, managing, and versioning infrastructure across cloud providers.

    Also in 8 projects that use this

  • maikotrindadeSkill

    upgrading-react-native

    Upgrades React Native apps to newer versions by applying rn-diff-purge template diffs, updating package.json dependencies, migrating native iOS and Android configuration, resolving CocoaPods and Gradle changes, and handling breaking API updates. Use when upgrading React Native, bumping RN version, updating from RN 0.x to 0.y, or migrating Expo SDK alongside a React Native upgrade.

    Also in 3 projects that use this

  • Sorcha-PlatformSkill

    grpc

    Build or review gRPC services and clients in .NET. USE FOR: ASP.NET Core gRPC, protobuf contracts, unary or streaming RPC, gRPC client factory, interceptors, deadlines, cancellation, channel reuse, backend service integration. DO NOT USE FOR: broad browser-facing APIs without gRPC-Web tradeoff review, SignalR realtime hubs, plain REST APIs. INVOKES: dotnet build/test and focused service or client smoke checks when code changes.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

49 rules. 0 are common, 39 are distinctive, and 10 are very specific to this project.

  • 0

    Common

    Most of the 44 edited versions we read keep these.

  • 39

    Distinctive

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always run this phase: Before writing any workflow, build a complete picture of the project.

    line 87
  2. Distinctive:

    Read README.md/CLAUDE.md and manifest files first, then work through the deterministic 12-step detection sequence in …

    line 94
  3. Distinctive:

    Before planning or writing anything, understand what workflows already exist and assess their state.

    line 126
  4. Distinctive:

    Match existing conventions: Do NOT impose new conventions on a brownfield project unless the user explicitly requests a style change.

    line 185
  5. Distinctive:

    Every project needs at minimum:

    line 198
  6. Distinctive:

    Use the workflow inventory from Phase 1: Do NOT plan from scratch. Plan only what changes.

    line 276
  7. Distinctive:

    When adding a new workflow to an existing set:

    line 281
  8. Distinctive:

    When auditing existing workflows for security/performance:

    line 297
  9. Distinctive:

    DELETE (remove dead workflow)

    line 302
  10. Distinctive:

    When the user asks to rewrite a specific workflow:

    line 320
  11. Distinctive:

    Read the existing workflow fully (done in Phase 1)

    line 322
  12. Distinctive:

    When migrating from another CI system:

    line 340
  13. Very specific:

    Read the source CI config (.circleci/config.yml, Jenkinsfile, .gitlab-ci.yml)

    line 342
  14. Distinctive:

    Write each planned workflow using the appropriate template and security rules.

    line 363
  15. Distinctive:

    Write workflows in this order:

    line 373
  16. Very specific:

    Apply security hardening: Follow every rule in references/security-hardening.md:

    line 388
  17. Distinctive:

    Use OIDC for cloud auth where possible

    line 392
  18. Distinctive:

    Add dependency caching (use setup action's built-in cache where available)

    line 396
  19. Distinctive:

    Add concurrency groups to cancel stale runs

    line 397
  20. Distinctive:

    Use matrix strategy for multi-version testing

    line 398
  21. Distinctive:

    Add path filters to avoid unnecessary runs

    line 399
  22. Distinctive:

    Verify YAML syntax: Ensure valid YAML, proper indentation, correct GitHub Actions syntax.

    line 400
  23. Distinctive:

    Apply only planned changes: Follow the delta plan from Phase 2.

    line 415
  24. Distinctive:

    Do NOT restructure, restyle, or "improve" sections outside scope.

    line 416
  25. Distinctive:

    Match existing conventions: Use the same naming style, comment style, and patterns discovered in Phase 1.

    line 417
  26. Very specific:

    Match existing style: If existing workflows use name: Build and Test for jobs, continue that pattern.

    line 432
  27. Distinctive:

    Preserve structure: Keep the existing job ordering unless it's part of the planned changes.

    line 435
  28. Distinctive:

    Never silently remove steps: If a step needs removal, note it in your plan and confirm with the user.

    line 437
  29. Distinctive:

    Refactor only what you're asked to change: Do NOT improve adjacent workflows, fix unrelated issues, or add features not in the plan.

    line 440
  30. Distinctive:

    When rewriting a specific workflow (user explicitly requested):

    line 445
  31. Very specific:

    Create from the approved plan: Write the new version using the PRESERVE/REPLACE/ADD breakdown from Phase 2.

    line 447
  32. Distinctive:

    For preserved content: Keep trigger logic, secrets, and custom scripts intact.

    line 451
  33. Distinctive:

    For replaced content: Write fresh from repository analysis.

    line 453
  34. Distinctive:

    For added content: Follow greenfield per-workflow process.

    line 454
  35. Distinctive:

    Present the full new workflow for review: before replacing.

    line 455
  36. Very specific:

    Every workflow file follows the same skeleton: explicit name, explicit on: triggers (never defaults), a least-privilege permissions: block, …

    line 459
  37. Very specific:

    Always recommend adding .github/dependabot.yml to keep both the github-actions ecosystem and project dependencies updated.

    line 495
  38. Distinctive:

    After writing, verify every workflow against the codebase and GitHub Actions best practices.

    line 504
  39. Very specific:

    Version workflows alongside code: All workflows live in .github/workflows/.

    line 579
  40. Very specific:

    Review workflow changes in PRs: Use CODEOWNERS on .github/ to require review for workflow changes.

    line 580
  41. Distinctive:

    Keep actions updated: Use Dependabot for GitHub Actions ecosystem updates.

    line 582
  42. Distinctive:

    Dependabot: Keep actions and dependencies updated

    line 602
  43. Distinctive:

    actionlint: Add as a CI step or pre-commit hook

    line 603
  44. Very specific:

    Never fabricate action names: If you're unsure an action exists, use a raw run: command instead.

    line 650
  45. Very specific:

    Never hardcode secrets: Always reference ${{ secrets.* }}.

    line 653
  46. Distinctive:

    Never write workflows you haven't verified: Check every command, path, and action reference against the actual repository.

    line 655
  47. Distinctive:

    Missing path filters: Every push triggers every workflow regardless of changes

    line 675
  48. Distinctive:

    Treating first draft as final: Always verify against the codebase

    line 686
  49. Distinctive:

    Ignoring existing workflows: Not reading current workflows before modifying

    line 687

“Common” is measured: kept by at least 6 in 10 of the 44 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GitHub Actions Workflow Authoring

Generate production-grade GitHub Actions workflows from systematic repository analysis. Every workflow is security-hardened, performance-optimized, and verified against the codebase.

Workflow Router

Determine the workflow type before starting. This drives which phases apply, which templates to use, and whether to write from scratch or edit existing workflows.

Do any GitHub Actions workflows already exist?
  (.github/workflows/*.yml or .github/workflows/*.yaml)
  |
  NO --> GREENFIELD (no workflows exist)
  |       Phases: Discover -> Plan -> Write -> Verify
  |
  YES --> What type of change?
           |
           +-> New feature/service needs a pipeline
           |     --> WORKFLOW ENHANCEMENT (brownfield)
           |     Phases: Discover -> Audit Existing -> Plan (delta) -> Write -> Verify
           |
           +-> Existing workflow needs fixing/updating
           |     --> WORKFLOW UPDATE (brownfield)
           |     Phases: Discover -> Audit Existing -> Plan (delta) -> Write (edit) -> Verify
           |
           +-> Workflows exist but have security/performance issues
           |     --> WORKFLOW AUDIT (brownfield)
           |     Phases: Discover -> Audit Existing -> Plan (assessment) -> Write (edit) -> Verify
           |
           +-> User wants a specific workflow rewritten
           |     --> TARGETED REWRITE (brownfield)
           |     Phases: Discover -> Audit Existing (single workflow) -> Write (replace) -> Verify
           |
           +-> User wants a specific new workflow type
           |     --> TARGETED NEW WORKFLOW
           |     Phases: Discover -> Write (specific) -> Verify
           |
           +-> Migrating from another CI system
                 --> CI MIGRATION
                 Phases: Discover -> Audit Source CI -> Plan -> Write -> Verify

Signal detection:

Signal in requestLikely type
"Add CI", "add GitHub Actions", "set up CI/CD" (no workflows exist)Greenfield
"Add CI", "add pipeline" (workflows already exist)Workflow Enhancement
"Fix the CI", "workflow is broken", "build fails"Workflow Update
"Workflow is slow", "optimize CI", "reduce build time"Workflow Audit
"Security audit", "harden workflows", "pin actions"Workflow Audit
"Rewrite the CI", "redo the pipeline"Targeted Rewrite
"Add deploy workflow", "add release pipeline"Targeted New Workflow
"Add Docker build", "publish to npm/PyPI"Targeted New Workflow
"Migrate from Jenkins/CircleCI/GitLab"CI Migration
"Add a cron job", "scheduled workflow"Targeted New Workflow

Phase 0: Discover Repository

Always run this phase. Before writing any workflow, build a complete picture of the project. See references/repo-discovery.md for the full discovery method.

What to detect

Read README.md/CLAUDE.md and manifest files first, then work through the deterministic 12-step detection sequence in references/repo-discovery.md (with its file→tool lookup tables) to establish:

  1. Language and ecosystem and package manager (from manifests and lockfiles: package.json, pyproject.toml, go.mod, Cargo.toml, pom.xml, etc.)
  2. Framework (Next.js, Django, Spring Boot, Rails, …)
  3. Build system (Webpack, Vite, Turborepo, Nx, Gradle, Maven, Make, …)
  4. Test setup and lint/format tools (framework, runner command, config)
  5. Containerization (Dockerfile, docker-compose, Kubernetes manifests)
  6. Infrastructure as Code (Terraform, Pulumi, CloudFormation, CDK)
  7. Monorepo signals (workspace configs, Nx/Turborepo/Lerna)
  8. Deployment targets (cloud/serverless/Vercel/Netlify/Kubernetes config)
  9. Existing CI (.github/workflows/*.yml, plus other systems: .circleci/, Jenkinsfile, .gitlab-ci.yml, .travis.yml)
  10. Branch and release strategy (default branch, protected/release branches, tags, GitHub Releases, changelogs, version files)

Output: Repository Profile

Compile the detected attributes into a mental model (do not write a file unless requested) using the Composite Profile format in references/repo-discovery.md. This profile drives every subsequent phase.


Phase 1: Audit Existing Workflows (Brownfield Only)

Skip this phase for greenfield projects.

Before planning or writing anything, understand what workflows already exist and assess their state.

Read every existing workflow

For each .github/workflows/*.yml file found in Phase 0:

  1. Read it fully. Parse the YAML structure: triggers, permissions, jobs, steps, secrets usage, caching, matrix strategies.
  2. Classify its purpose: CI (test/lint/build), CD (deploy), Release (publish/tag), Maintenance (dependabot, stale issues), Scheduled (cron jobs).
  3. Note its conventions: naming style, job naming, step naming, comment style, environment variable patterns.
  4. Assess security posture: permissions declared? Actions pinned by SHA? Secrets handling? Fork protections? OIDC usage?
  5. Assess performance: caching used? Unnecessary steps? Job parallelism? Matrix strategy? Concurrency groups?

Existing workflow inventory

Build a mental inventory:

Existing Workflow Inventory
  [file path] | [purpose] | [triggers] | [security: good/fair/poor] | [performance: good/fair/poor]
  ci.yml       | CI        | push, PR   | fair (unpinned actions)    | fair (no caching)
  deploy.yml   | CD        | push main  | good (OIDC, pinned)        | good
  ...

What to preserve in brownfield

Content TypeExamplePreserve?
Working trigger logicPath filters, branch filtersAlways
Environment-specific secretsAWS credentials, deploy tokensAlways
Custom scripts/stepsProject-specific build logicAlways
Concurrency groupsExisting cancel-in-progress logicAlways
Job dependenciesEstablished needs: chainsDefault yes
Unpinned actionsuses: actions/checkout@v4Replace with SHA pin
Overly broad permissionspermissions: write-allReplace with least privilege
Duplicated logicSame steps in multiple workflowsRefactor to reusable
Dead workflowsWorkflows for removed featuresRemove

Rule: Working workflows are valuable. A workflow that runs correctly is better than a theoretically perfect one that breaks. Preserve working logic and improve incrementally.

Brownfield conventions contract

Extract the workflow conventions from existing files and follow them:

  • File naming: kebab-case? snake_case? What prefix/suffix patterns?
  • Job naming: How are jobs named? Descriptive or terse?
  • Step naming: Named steps or anonymous? Style of names?
  • Comment style: Are inline comments used? YAML comments?
  • Secret naming: Convention for secret names (SCREAMING_SNAKE, etc.)?
  • Environment patterns: How environments are used (if at all)?

Match existing conventions. Do NOT impose new conventions on a brownfield project unless the user explicitly requests a style change.


Phase 2: Plan Workflows

Greenfield planning

Derive a complete CI/CD plan from the repository discovery.

Pipeline architecture

Every project needs at minimum:

  1. CI workflow (pull request validation):
    • Lint/format check
    • Type check (if applicable)
    • Unit tests
    • Build verification
  2. CI workflow (main branch):
    • Everything in PR CI, plus:
    • Integration tests (if applicable)
    • Artifact building
    • Trigger CD (if applicable)
  3. CD workflow (if deployment target exists):
    • Build artifacts/containers
    • Deploy to environments (staging, production)
    • Environment protection rules
  4. Release workflow (if library or publishable):
    • Version bumping
    • Package publishing (npm, PyPI, Maven, crates.io)
    • GitHub Release creation
  5. Maintenance workflows (recommended):
    • Dependabot configuration
    • Stale issue/PR management
    • Scheduled security scans

Workflow plan algorithm

Based on the repository profile from Phase 0:

FOR EACH detected language:
  -> Add CI job: setup + install + lint + test + build
  -> Select template from references/workflow-templates.md

IF Dockerfile exists:
  -> Add Docker build/push job
  -> Select registry (GHCR by default)

IF IaC files exist:
  -> Add infrastructure validation job (plan on PR, apply on merge)

IF monorepo detected:
  -> Add change detection job
  -> Make CI jobs conditional on changed paths
  -> See references/pipeline-patterns.md for monorepo patterns

IF deployment target detected:
  -> Add CD workflow with environment protection
  -> See references/pipeline-patterns.md for deployment patterns

IF library (not service):
  -> Add release/publish workflow triggered by tags

ALWAYS:
  -> Apply security hardening (references/security-hardening.md)
  -> Add concurrency groups
  -> Add caching for dependencies
  -> Set explicit permissions (least privilege)

Plan output

Workflow Plan
- .github/workflows/ci.yml — CI pipeline (lint, test, build) on PR + push main
- .github/workflows/deploy.yml — Deploy to staging/prod with environment protection
- .github/workflows/release.yml — Publish package on tag push
- .github/dependabot.yml — Dependency update automation

Present the plan to the user for approval before writing.

Brownfield planning

Use the workflow inventory from Phase 1. Do NOT plan from scratch. Plan only what changes.

Workflow Enhancement: Delta plan

When adding a new workflow to an existing set:

  1. Identify which EXISTING workflows might be affected (shared secrets, concurrency groups, deployment targets)
  2. Identify the NEW workflow to create
  3. For existing workflows, specify ONLY what changes (if anything)
Workflow Delta Plan
- .github/workflows/ci.yml — KEEP (no changes needed)
- .github/workflows/deploy.yml — MODIFY: add staging environment before prod
- .github/workflows/docker.yml — CREATE: Docker build + push to GHCR

Workflow Audit: Assessment plan

When auditing existing workflows for security/performance:

  1. List all issues found in Phase 1 with severity
  2. Propose fixes grouped by category (Security > Performance > Maintenance)
  3. For each workflow: KEEP (as-is), EDIT (fix issues), REWRITE (replace), DELETE (remove dead workflow)
  4. Present to user for approval
Audit Findings & Plan
  ci.yml:
    - [Critical] Actions not pinned to SHA → EDIT: pin all actions
    - [High] No permissions declared → EDIT: add least-privilege permissions
    - [Medium] No dependency caching → EDIT: add cache configuration
  deploy.yml:
    - [High] Uses long-lived AWS keys → EDIT: migrate to OIDC
    - [Low] No concurrency group → EDIT: add concurrency
  old-ci.yml:
    - [Low] Duplicate of ci.yml → DELETE

Targeted Rewrite: Single-workflow plan

When the user asks to rewrite a specific workflow:

  1. Read the existing workflow fully (done in Phase 1)
  2. Identify what to PRESERVE (working trigger logic, secrets, custom scripts)
  3. Identify what to REPLACE (insecure patterns, poor performance, outdated actions)
  4. Identify what to ADD (missing security, caching, concurrency)
  5. Present the plan
Rewrite Plan: ci.yml
  PRESERVE: Trigger logic (push/PR), test matrix (Node 18/20), deploy job dependency
  REPLACE:  Unpinned actions (pin to SHA), npm install (use npm ci + caching),
            missing permissions (add least-privilege)
  ADD:      Concurrency group, artifact upload for test reports, type checking step

Get user approval before rewriting.

CI Migration plan

When migrating from another CI system:

  1. Read the source CI config (.circleci/config.yml, Jenkinsfile, .gitlab-ci.yml)
  2. Map each job/stage to a GitHub Actions equivalent
  3. Identify feature gaps (some CI features don't map 1:1)
  4. Plan the migration as a set of new workflows
Migration Plan: CircleCI → GitHub Actions
  CircleCI build job → .github/workflows/ci.yml (lint + test + build)
  CircleCI deploy job → .github/workflows/deploy.yml (with environment protection)
  CircleCI scheduled scan → .github/workflows/security.yml (cron schedule)
  Gap: CircleCI orbs used → Replace with equivalent GitHub Actions

Present the plan to the user for approval before writing.


Phase 3: Write Workflows

Greenfield: Write from scratch

Write each planned workflow using the appropriate template and security rules. See references/workflow-templates.md for ecosystem-specific templates. See references/security-hardening.md for security rules. See references/pipeline-patterns.md for CI/CD patterns.

Writing sequence

Write workflows in this order:

  1. CI workflow first (validates that the build/test pipeline works)
  2. CD workflow (deployment depends on CI)
  3. Release workflow (publishing depends on build)
  4. Maintenance workflows (dependabot, security scans)

Per-workflow process (greenfield)

For each workflow:

  1. Select template: Choose from references/workflow-templates.md based on language/ecosystem detected in Phase 0.
  2. Customize for project: Replace template placeholders with actual commands, paths, versions from the repository profile.
  3. Apply security hardening: Follow every rule in references/security-hardening.md:
    • Set explicit permissions: (least privilege)
    • Pin all actions to full SHA
    • Use OIDC for cloud auth where possible
    • Protect secrets from fork exposure
    • Guard against script injection
  4. Add performance optimization:
    • Add dependency caching (use setup action's built-in cache where available)
    • Add concurrency groups to cancel stale runs
    • Use matrix strategy for multi-version testing
    • Add path filters to avoid unnecessary runs
  5. Verify YAML syntax: Ensure valid YAML, proper indentation, correct GitHub Actions syntax.
  6. Add inline comments: Explain non-obvious choices (why a specific SHA, why a particular cache key, why a permission).

Brownfield: Edit existing workflows

Read before writing. For every workflow you modify, read it fully first (already done in Phase 1). Never modify a workflow you haven't read.

Per-workflow process (brownfield)

For each workflow being modified:

  1. Re-read the workflow. Confirm your understanding from Phase 1.
  2. Apply only planned changes. Follow the delta plan from Phase 2. Do NOT restructure, restyle, or "improve" sections outside scope.
  3. Match existing conventions. Use the same naming style, comment style, and patterns discovered in Phase 1.
  4. Preserve working logic. Trigger conditions, environment variables, secrets references, and custom scripts survive unless explicitly marked for change.
  5. Verify every edit. Each changed action version, command, or path must be verified against the codebase.
  6. Minimize diff. Change only what needs changing. Smaller diffs are easier to review.

Brownfield-specific rules

  • Edit, don't rewrite. Unless the user requests a rewrite, modify the existing workflow surgically. Fix the specific issues; leave working steps alone.
  • Match existing style. If existing workflows use name: Build and Test for jobs, continue that pattern. Do NOT switch to name: build-and-test because you prefer it.
  • Preserve structure. Keep the existing job ordering unless it's part of the planned changes.
  • Never silently remove steps. If a step needs removal, note it in your plan and confirm with the user. A step that looks unnecessary may have a non-obvious purpose.
  • Refactor only what you're asked to change. Do NOT improve adjacent workflows, fix unrelated issues, or add features not in the plan.

Targeted Rewrite process

When rewriting a specific workflow (user explicitly requested):

  1. Create from the approved plan. Write the new version using the PRESERVE/REPLACE/ADD breakdown from Phase 2.
  2. Start from the template in references/workflow-templates.md, then transplant preserved logic into the new structure.
  3. For preserved content: Keep trigger logic, secrets, and custom scripts intact.
  4. For replaced content: Write fresh from repository analysis.
  5. For added content: Follow greenfield per-workflow process.
  6. Present the full new workflow for review before replacing.

Shared: Workflow structure conventions

Every workflow file follows the same skeleton: explicit name, explicit on: triggers (never defaults), a least-privilege permissions: block, a concurrency: group (cancel-in-progress: true, except deploy/release/IaC workflows — see references/pipeline-patterns.md), then jobs: whose first step is a SHA-pinned actions/checkout. The CI templates in references/workflow-templates.md share this exact header (factored into its "Shared CI header" section); start from a template rather than reconstructing the skeleton by hand.

Shared: Action version pinning

Always pin actions to full commit SHA (with the version tag as an inline comment); never use tags or branches. See references/security-hardening.md for the rule, rationale, and how to find SHAs.

Shared: Caching strategy

Prefer setup-action caching over raw actions/cache where available — setup actions handle cache paths and keys automatically from the lockfile:

EcosystemCache Method
Node.jsactions/setup-node with cache: 'npm' (or pnpm/yarn)
Pythonactions/setup-python with cache: 'pip' (or pipenv/poetry)
Goactions/setup-go (cache on by default)
RustSwatinem/rust-cache (Cargo.lock + rustc version)
Javaactions/setup-java with cache: 'gradle' or 'maven'
Rubyruby/setup-ruby with bundler-cache: true
Genericactions/cache with a custom lockfile-hash key

See references/pipeline-patterns.md for cache-key design, Docker layer caching, and the .NET NuGet approach.

Shared: Dependabot configuration

Always recommend adding .github/dependabot.yml to keep both the github-actions ecosystem and project dependencies updated. Use the canonical example (with the per-ecosystem id mapping) in references/workflow-templates.md.


Phase 4: Verify Workflows

After writing, verify every workflow against the codebase and GitHub Actions best practices.

Verification checklist (all workflows)

Each item pairs a requirement with how to detect a violation:

  • Valid YAML: proper indentation, no syntax errors
  • Triggers correct: events match intent; watch for on: push without a branch filter (runs on every push)
  • Permissions declared: explicit permissions: at workflow or job level — a missing block defaults to overly broad access
  • Least privilege: no unnecessary write permissions
  • Actions pinned: every uses: is a full SHA — flag any @vN or branch ref
  • Commands exist: every run: references valid scripts/tools/paths, and matches the project's actual tooling (e.g. not npm test when the project uses pnpm)
  • Secrets referenced correctly: all ${{ secrets.* }} names exist; no hardcoded credentials in the file
  • Caching configured: dependencies cached where possible — flag a setup action used without its cache: parameter
  • Concurrency set: a concurrency: group is present (missing → queue buildup)
  • Branch filters correct: triggers reference the real default branch (e.g. not master when default is main)
  • Path filters appropriate: paths: reference directories that actually exist
  • Matrix strategy sensible: tested versions current; language/tool versions come from the matrix or config, not hardcoded
  • Artifact handling correct: upload/download artifact names are consistent
  • Environment protection: deploy jobs reference proper environments
  • No script injection: untrusted ${{ github.event.* }} input is never used directly in run: blocks

Additional brownfield verification

  • Preserved logic intact: Trigger conditions, secrets, and custom scripts from existing workflows were not lost
  • Conventions maintained: Naming, commenting, and structure style match the rest of the existing workflows
  • No unplanned changes: Only the sections identified in the delta plan were modified
  • No steps silently removed: Every removal was in the approved plan
  • Diff is minimal: Changes are surgical, not a full rewrite (unless Targeted Rewrite was the chosen workflow type)

Verification method

For each workflow:

  1. Validate YAML syntax by reading it carefully for indentation and structure issues
  2. Check all referenced paths exist in the repository (scripts, config files, directories)
  3. Verify action references are valid (action exists, SHA is real)
  4. Verify commands match the project's actual tools and scripts (check package.json scripts, Makefile targets, etc.)
  5. Check secret names match what the project expects (documented in README or existing workflows)
  6. Simulate trigger scenarios mentally: what happens on PR, push to main, tag push, schedule?
  7. (Brownfield) Compare against original to confirm only planned changes were made

The "how to detect" hint on each verification checklist item above names the common errors to look for (unpinned actions, missing permissions, wrong branch names, dead path filters, wrong commands, missing cache/concurrency, script injection, hardcoded versions).


Phase 5: Maintenance Strategy

Workflows rot when they fall behind ecosystem changes. Embed maintenance practices.

Workflow-as-code principles

  • Version workflows alongside code. All workflows live in .github/workflows/.
  • Review workflow changes in PRs. Use CODEOWNERS on .github/ to require review for workflow changes.
  • Keep actions updated. Use Dependabot for GitHub Actions ecosystem updates.
  • Delete dead workflows. Unused workflows create confusion and security risk.
  • Document non-obvious choices. Inline comments explain WHY, not WHAT.

Automated maintenance (recommend to user)

ToolPurpose
Dependabot (github-actions ecosystem)Auto-update action versions
actionlintLint workflow files for syntax and best practice issues
CODEOWNERS on .github/Require review for workflow changes
OpenSSF ScorecardAutomated security assessment of CI/CD practices
GitHub branch protectionRequire status checks to pass before merge

Recommend to user

Suggest adding these where relevant:

  1. Branch protection rules: Require CI to pass before merge
  2. CODEOWNERS: Protect .github/ directory
  3. Dependabot: Keep actions and dependencies updated
  4. actionlint: Add as a CI step or pre-commit hook
  5. Environment protection rules: Require approval for production deploys

Failure Recovery

Workflow issue
  |
  +-> Can't determine project type
  |     +-> Read more source files and config
  |     +-> Check build scripts in package.json/Makefile
  |     +-> Ask user for clarification
  |
  +-> Conflicting CI config (multiple systems)
  |     +-> Ask user which system is canonical
  |     +-> Treat GitHub Actions as target; other as reference
  |
  +-> Unsure which actions to use
  |     +-> Prefer official actions (actions/*, github/*)
  |     +-> For ecosystem tools, use most-adopted community action
  |     +-> Check references/workflow-templates.md for recommendations
  |     +-> When in doubt, use raw `run:` commands instead of actions
  |
  +-> Existing workflows are complex but fragile (brownfield)
  |     +-> Preserve working logic first
  |     +-> Never rewrite from scratch unless user requests it
  |     +-> Fix one issue at a time, verify between changes
  |
  +-> Monorepo with unclear service boundaries
  |     +-> Look for workspace configs (package.json workspaces, nx.json, turbo.json)
  |     +-> Check for independent package.json/go.mod files in subdirectories
  |     +-> Ask user to confirm service/package boundaries
  |
  +-> Migration from another CI system
  |     +-> Map concepts: jobs->jobs, stages->jobs with needs, orbs->reusable workflows
  |     +-> Not everything maps 1:1 — document gaps
  |     +-> Prioritize: get CI working first, optimize later
  |
  +-> Conventions in existing workflows conflict with best practices (brownfield)
        +-> Follow existing conventions (consistency > correctness)
        +-> Only change conventions if user explicitly requests it
        +-> Exception: always fix critical security issues (unpinned actions,
            missing permissions, script injection) regardless of convention

Never fabricate action names. If you're unsure an action exists, use a raw run: command instead. Verify action names against known actions.

Never hardcode secrets. Always reference ${{ secrets.* }}.

Never write workflows you haven't verified. Check every command, path, and action reference against the actual repository.


Anti-Patterns

Security anti-patterns

  • Unpinned actions: Using @v4 instead of @sha — supply chain attack vector
  • Missing permissions: No permissions: block — defaults to overly broad access
  • Script injection: Using ${{ github.event.* }} directly in run: blocks
  • Long-lived credentials: Storing AWS/GCP keys as secrets instead of using OIDC
  • Fork secret exposure: Running pull_request_target with checkout of PR code
  • Overly broad GITHUB_TOKEN: Granting write permissions when read suffices

Performance anti-patterns

  • No caching: Reinstalling dependencies from scratch every run
  • No concurrency groups: Queue buildup on rapid pushes
  • Monolithic workflows: One huge workflow instead of parallel jobs
  • Unnecessary triggers: Running full CI on docs-only changes
  • Missing path filters: Every push triggers every workflow regardless of changes
  • Excessive matrix: Testing on 12 OS/version combos when 4 would suffice

Architecture anti-patterns

  • Workflow sprawl: 20 small workflow files with overlapping triggers
  • Duplicate logic: Same steps copy-pasted across workflows (use reusable workflows)
  • Missing needs:: Jobs that should be sequential running in parallel
  • No environment protection: Deploy to production without approval gates
  • No Dependabot: Actions and dependencies never updated

Process anti-patterns

  • Treating first draft as final: Always verify against the codebase
  • Ignoring existing workflows: Not reading current workflows before modifying
  • Over-engineering: Adding complex matrix builds for a single-language project
  • Premature optimization: Adding self-hosted runners before measuring need

Reference Files

  • Repository discovery: See references/repo-discovery.md for deterministic repository analysis: language detection, ecosystem identification, deployment target detection, and monorepo discovery
  • Workflow templates: See references/workflow-templates.md for complete YAML templates per ecosystem: Node.js, Python, Go, Rust, Java, Docker, Terraform, and monorepo configurations
  • Security hardening: See references/security-hardening.md for permissions model, action pinning with current SHAs, OIDC configuration, secret management, fork protection, and script injection prevention
  • Pipeline patterns: See references/pipeline-patterns.md for CI/CD patterns: caching strategies, matrix builds, concurrency groups, reusable workflows, monorepo change detection, deployment strategies, release automation, and scheduled pipelines

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.