Skip to content

skillDevOps and cloudgithub-actions

GitHub Actions Workflows

Writes GitHub Actions workflows that run fast, cache dependencies, use least-privilege tokens and share steps through reusable workflows.

npx workspacetemplates add github-actions-workflows --tool claude-code

Writes 1 file to .claude/skills/github-actions-workflows/

.claude/skills/github-actions-workflows/SKILL.md30 lines · 1.7 KBFile
---
name: github-actions-workflows
description: Writes GitHub Actions workflows that run fast, cache dependencies, use least-privilege tokens and share steps through reusable workflows.
---

# GitHub Actions workflows

Write workflows that are fast, minimal in permissions and easy to reuse.

## Steps

1. Read `.github/workflows/` and the project's build and test scripts. Reuse the exact commands developers run locally.
2. Set `permissions: contents: read` at the top of the file. Raise it per job only when needed, such as `pull-requests: write` for a comment job.
3. Pick triggers on purpose: `pull_request` for checks, `push` to the default branch for deploys, `workflow_dispatch` for manual runs. Add `concurrency` with `cancel-in-progress: true` for pull request runs.
4. Use the setup action's built-in cache (`cache: npm`, `cache: pip`) before writing a custom `actions/cache` step. Key custom caches on the lockfile hash.
5. Split independent work (lint, unit tests, build) into parallel jobs. Use `needs` only for real dependencies.
6. Use a `strategy.matrix` for versions or operating systems, with `fail-fast: false` when you want every result.
7. Move logic repeated in two or more places into a reusable workflow (`on: workflow_call`) or a composite action.
8. Pin third-party actions to a full commit SHA, with the version in a comment.

## Rules

- Never print secrets or pass them on the command line. Use `env:` from `secrets`.
- Never use `pull_request_target` to run code from a fork.
- Set `timeout-minutes` on every job.
- Do not run deploy jobs on pull requests from forks.

## Report

List the files changed, the permissions each job holds, what is cached, and the expected effect on run time.

What it does

Workflow files tend to grow by copy and paste until every repository has five slightly different versions of the same build job. This skill makes the agent design the workflow first: which events trigger it, what can run in parallel, what is cached, and what permissions the token really needs.

The result is a workflow that finishes in minutes, cannot write to your repository unless a job says so, and pulls repeated logic into a reusable workflow or composite action instead of duplicating it.

Example

you › Our Node CI takes 14 minutes. Rewrite the workflow.

agent › Split ci.yml into lint, test and build jobs that run in parallel, enabled cache: npm, added concurrency to cancel stale runs, and set permissions to contents: read. Extracted the deploy steps into .github/workflows/deploy.yml with workflow_call. Expected run time: about 5 minutes.

Questions

Will it touch my deployment secrets?
No. It references secrets by name in the workflow and never asks for or writes their values. You add them in the repository settings.
Why pin actions to a commit SHA?
A tag can be moved after you reviewed it. A full SHA cannot, so a compromised release of an action does not reach your pipeline unnoticed.
  • CI Pipeline Speedup

    SkillDevOps and cloud

    Free
  • Deployment Strategies

    SkillDevOps and cloud

    Free