Claude-code-templates github-actions-creator
Use when the user wants to create, generate, or set up a GitHub Actions workflow. Handles CI/CD pipelines, testing, deployment, linting, security scanning, release automation, Docker builds, scheduled tasks, and any custom workflow for any language or framework.
git clone https://github.com/davila7/claude-code-templates
T=$(mktemp -d) && git clone --depth=1 https://github.com/davila7/claude-code-templates "$T" && mkdir -p ~/.claude/skills && cp -r "$T/cli-tool/components/skills/development/github-actions-creator" ~/.claude/skills/davila7-claude-code-templates-github-actions-creator && rm -rf "$T"
cli-tool/components/skills/development/github-actions-creator/SKILL.mdGitHub Actions Creator
You are an expert at creating GitHub Actions workflows. When the user asks you to create a GitHub Action, follow this structured process to deliver a production-ready workflow file.
Workflow Creation Process
Step 1: Analyze the Project
Before writing any YAML, scan the project to understand the stack:
-
Check for language/framework indicators:
→ Node.js (check for React, Next.js, Vue, Angular, Svelte, etc.)package.json
/requirements.txt
/pyproject.toml
→ Pythonsetup.py
→ Gogo.mod
→ RustCargo.toml
/pom.xml
→ Java/Kotlinbuild.gradle
→ RubyGemfile
→ PHPcomposer.json
→ Dart/Flutterpubspec.yaml
→ SwiftPackage.swift
/*.csproj
→ .NET*.sln
-
Check for existing CI/CD:
→ existing workflows (avoid conflicts).github/workflows/
→ container builds availableDockerfile
→ multi-service setupdocker-compose.yml
/vercel.json
→ deployment targetsnetlify.toml
/terraform/
→ infrastructure as codepulumi/
-
Check for tooling:
/.eslintrc*
→ ESLint configuredeslint.config.*
→ Prettier configuredprettier*
/jest.config*
/vitest.config*
→ test frameworkpytest.ini
→ environment variables needed.env.example
→ build commands availableMakefile
Step 2: Ask Clarifying Questions (if needed)
If the user's request is ambiguous, ask ONE focused question. Common clarifications:
- "Create a CI pipeline" → "Should it run tests only, or also lint and type-check?"
- "Add deployment" → "Where does this deploy? (Vercel, AWS, GCP, Docker Hub, etc.)"
- "Set up tests" → "Should tests run on PR only, or also on push to main?"
If the intent is clear, skip this step and proceed.
Step 3: Generate the Workflow
Create the
.github/workflows/{name}.yml file following these rules:
File Naming
- Use descriptive kebab-case names:
,ci.yml
,deploy-production.ymlrelease.yml - For simple CI:
ci.yml - For deployment:
ordeploy.ymldeploy-{target}.yml - For scheduled tasks:
scheduled-{task}.yml
YAML Structure Rules
name: Human-readable name # Always include on: # Use the most specific triggers push: branches: [main] # Specify branches explicitly paths-ignore: # Skip docs-only changes when appropriate - '**.md' - 'docs/**' pull_request: branches: [main] permissions: # Always set minimal permissions contents: read concurrency: # Prevent duplicate runs on PRs group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: job-name: runs-on: ubuntu-latest # Default to ubuntu-latest timeout-minutes: 15 # Always set a timeout steps: - uses: actions/checkout@v4 # Always pin to major version
Core Patterns by Use Case
CI (Test + Lint)
Trigger:
pull_request + push to main
Jobs: lint, test (parallel when possible)
Key features: dependency caching, matrix testing for multiple versions
Deployment
Trigger:
push to main (or release tags)
Jobs: test → build → deploy (sequential with needs)
Key features: environment protection, secrets for credentials, status checks
Release / Publish
Trigger:
push tags matching v* or workflow_dispatch
Jobs: test → build → publish → create GitHub Release
Key features: changelog generation, artifact upload, npm/PyPI/Docker publish
Scheduled Tasks
Trigger:
schedule with cron expression
Jobs: single job with the task
Key features: workflow_dispatch for manual trigger too, failure notifications
Security Scanning
Trigger:
pull_request + schedule (weekly)
Jobs: dependency audit, SAST, secret scanning
Key features: SARIF upload to GitHub Security tab, fail on critical
Docker Build & Push
Trigger:
push to main + tags
Jobs: build → push to registry
Key features: multi-platform builds, layer caching, image tagging strategy
Essential Actions Reference
Setup Actions (always pin to major version)
| Action | Purpose |
|---|---|
| Clone repository |
| Node.js with caching |
| Python with caching |
| Go with caching |
| Java/Kotlin |
| Rust toolchain |
| Ruby with bundler cache |
| .NET SDK |
Build & Deploy Actions
| Action | Purpose |
|---|---|
| Docker multi-platform builds |
| Docker registry authentication |
| AWS authentication |
| GCP authentication |
| Azure authentication |
| Cloudflare Workers deploy |
| Vercel deployment |
Quality & Security Actions
| Action | Purpose |
|---|---|
| CodeQL SAST scanning |
| Container vulnerability scan |
| Coverage upload |
| Dependency audit on PRs |
Utility Actions
| Action | Purpose |
|---|---|
| Generic caching |
| Store build artifacts |
| Retrieve artifacts between jobs |
| Create GitHub Releases |
| Slack notifications |
| Automated PR creation |
Security Best Practices (ALWAYS follow)
- Minimal permissions: Always declare
at workflow or job levelpermissions - Pin actions to major version: Use
not@v4
or full SHA for readability@main - Never echo secrets: Secrets are masked but avoid
echo ${{ secrets.X }} - Use environments: For production deploys, use GitHub Environments with protection rules
- Validate inputs: For
, validate input valuesworkflow_dispatch - Avoid script injection: Never use
directly in${{ github.event.*.body }}
— pass via environment variablesrun: - Use GITHUB_TOKEN: Prefer
over PATs when possible${{ secrets.GITHUB_TOKEN }} - Concurrency controls: Use
to prevent parallel deploysconcurrency
# WRONG - script injection vulnerability - run: echo "${{ github.event.issue.title }}" # CORRECT - pass through environment variable - run: echo "$ISSUE_TITLE" env: ISSUE_TITLE: ${{ github.event.issue.title }}
Caching Strategies
Node.js
- uses: actions/setup-node@v4 with: node-version: 20 cache: 'npm' # or 'yarn' or 'pnpm'
Python
- uses: actions/setup-python@v5 with: python-version: '3.12' cache: 'pip' # or 'poetry' or 'pipenv'
Go
- uses: actions/setup-go@v5 with: go-version: '1.22' cache: true
Rust
- uses: actions/cache@v4 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
Docker
- uses: docker/build-push-action@v6 with: cache-from: type=gha cache-to: type=gha,mode=max
Matrix Testing Patterns
Multiple Node.js versions
strategy: matrix: node-version: [18, 20, 22] fail-fast: false
Multiple OS
strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }}
Complex matrix with exclusions
strategy: matrix: os: [ubuntu-latest, windows-latest] node-version: [18, 20] exclude: - os: windows-latest node-version: 18
Cron Syntax Quick Reference
| Schedule | Cron |
|---|---|
| Every hour | |
| Daily at midnight UTC | |
| Weekdays at 9am UTC | |
| Weekly on Sunday | |
| Monthly 1st | |
Output Format
After creating the workflow file, provide:
- What the workflow does — one-paragraph summary
- Required secrets — list any secrets the user needs to configure in Settings > Secrets
- Required permissions — if the workflow needs non-default repository permissions
- How to test — how to trigger the workflow (push, create PR, manual dispatch)
Common Patterns to Combine
When the user asks for something generic like "set up CI/CD", create a single workflow with multiple jobs:
jobs: lint: # Fast feedback test: # Core validation build: # Ensure it compiles/bundles needs: [lint, test] deploy: # Only after everything passes needs: build if: github.ref == 'refs/heads/main'
Keep workflows focused. Prefer one workflow per concern over one massive workflow, unless the jobs are tightly coupled.