Create GitHub Reusable Workflows to Share CI Logic Across Repos
Once you have multiple repos running similar CI steps, extract them into a reusable workflow — a fix in one place fixes all of them. Ask Claude to write the callable workflow and the caller stub.
# Prompt:
# "Create a GitHub reusable workflow for PHP projects stored in .github/workflows/php-ci.yml:
# - Inputs: php-version (default '8.3'), run-coverage (bool, default false)
# - Jobs: lint (Pint), static analysis (PHPStan level 9), tests (Pest)
# - Cache Composer dependencies keyed by composer.lock hash
# - Upload coverage to Codecov if run-coverage is true
# - Output test-outcome (pass/fail) for caller workflows to branch on
# Also write the caller workflow that another repo would use."
The tricky part of reusable workflows is inputs vs secrets scoping — Claude gets this right and comments why each value is an input versus a secret that needs explicit inheritance.
The resulting caller is clean and minimal:
jobs:
ci:
uses: my-org/.github/.github/workflows/php-ci.yml@main
with:
php-version: '8.3'
run-coverage: true
secrets: inherit
Claude also handles the edge cases: workflow_call trigger syntax, making outputs available across jobs, and ensuring the cache key invalidates correctly when composer.lock changes.
Copying CI YAML between repos is tech debt waiting to happen — one reusable workflow fixes every repo at once.
Log in to leave a comment.
The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.
The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.
Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.