Reusable Workflow Patterns
This skill provides the catalog, template, and documentation standards used by the Reusable Workflow Builder agent to detect cross-platform CI/CD patterns and produce standardized GitHub Actions reusable workflows.
Supported CI/CD systems for pattern discovery
| System |
File patterns |
| GitHub Actions |
.github/workflows/*.yml |
| GitLab CI/CD |
.gitlab-ci.yml |
| Azure DevOps |
azure-pipelines.yml, .azure-pipelines/*.yml |
| Jenkins |
Jenkinsfile, .jenkins/*.groovy |
| CircleCI |
.circleci/config.yml |
| Travis CI |
.travis.yml |
| Drone CI |
.drone.yml |
| Others |
Bitbucket, TeamCity, Bamboo, Buildkite |
Pattern categories
- 🏗️ Build — npm/Maven/Docker/language-specific build processes
- 🧪 Test — unit, integration, E2E, security, performance testing
- 🚀 Deploy — cloud (AWS/Azure/GCP), containers, serverless, infrastructure
- 🔒 Security — SAST/DAST, dependency scanning, compliance checks
- 📊 Quality — code coverage, linting, quality gates
Selection criteria
A pattern becomes a reusable workflow when it shows:
- High frequency — 10+ repositories
- Significant complexity — 5+ steps
- Low variation — standardizable
- Clear parameters — configurable inputs
Scan scope
The user controls the scope of analysis. Three modes are supported and can be freely combined:
| User input |
Scope |
org-name |
All repositories in that organization |
org-name/repo-name |
That specific repository only |
| Mixed list |
Union of all specified orgs and repos |
Always respect the stated scope — never crawl repos or orgs not explicitly provided.
Pattern-recognition workflow
Adapt these steps to the input scope:
Scope resolution
- For each
org-name entry: use mcp_github_search_repositories to enumerate all repos in that org.
- For each
org-name/repo-name entry: use that repo directly — no enumeration needed.
- Deduplicate if a repo appears both via org scan and explicit reference.
Universal pipeline discovery — search each repo for CI/CD files across all supported systems (see table above).
Cross-platform content analysis — retrieve and parse configurations.
Universal pattern extraction — identify common structures and steps.
Cross-system frequency analysis — count pattern occurrences across the resolved repo set.
- When scope is a single repo or a small explicit list, lower the frequency threshold (see Selection criteria) — a pattern present in 3+ files within a monorepo is still worth extracting.
Translation scoring — rank by frequency, complexity reduction, and GitHub Actions conversion feasibility.
Platform mapping — map equivalent concepts to GitHub Actions.
Reusable workflow template
name: Reusable Node.js Build Workflow
on:
workflow_call:
inputs:
node-version:
description: 'Node.js version to use'
required: false
default: '18'
type: string
build-command:
description: 'Custom build command'
required: false
default: 'npm run build'
type: string
outputs:
build-success:
description: 'Build success status'
value: ${{ jobs.build.outputs.success }}
jobs:
build:
runs-on: ubuntu-latest
steps:
# ✅ Only verified actions from trusted publishers
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: 'npm'
- run: npm install
- run: ${{ inputs.build-command }}
Output file rules
For every reusable workflow produced, create exactly two files:
.github/workflows/reusable-<name>.yml — the reusable workflow (workflow_call trigger only)
docs/<name>-usage.md — the usage documentation (one per workflow, 1:1)
Never create: README.md, WORKFLOWS.md, consolidated docs, scripts (.sh, .bat, .ps1, .py, .js), custom actions, caller workflows, or workflow templates.
Usage documentation template
Each docs/<name>-usage.md must contain:
# Reusable [Workflow Name] Usage Guide
## Pattern Analysis Summary
- **Frequency**: Found in X repositories across Y organizations
- **Source CI/CD Systems**: [List systems: GitHub Actions, GitLab CI, Jenkins, etc.]
- **Complexity Reduction**: [Explain how this replaces X previous steps]
## Migration Benefits
- **From GitLab CI**: [If applicable, before/after]
- **From Jenkins**: [If applicable, before/after]
- **From Azure DevOps**: [If applicable, before/after]
- **Standardization**: [Consistency improvements]
## Basic Usage Example
```yaml
name: Example Workflow
on: [push, pull_request]
jobs:
job-name:
uses: ./.github/workflows/reusable-[name].yml
with:
param1: 'value1'
param2: 'custom-value'
```
## Advanced Usage Example
```yaml
name: Production Workflow
on:
push:
branches: [main]
jobs:
job-name:
uses: ./.github/workflows/reusable-[name].yml
with:
param1: 'production-value'
param2: 'advanced-setting'
secrets:
SECRET_NAME: ${{ secrets.SECRET_NAME }}
```
## Input Parameters Reference
| Parameter | Description | Required | Default | Example |
| --------- | ------------- | -------- | ----------- | ---------- |
| param1 | [Description] | Yes | - | `'value'` |
| param2 | [Description] | No | `'default'` | `'custom'` |
## Output Reference
| Output | Description | Type |
| ------- | ------------- | ------ |
| output1 | [Description] | string |
## Migration Examples
### From GitLab CI
**Before (.gitlab-ci.yml):**
```yaml
[Show original GitLab CI configuration]
```
**After (GitHub Actions):**
```yaml
[Show how to use this reusable workflow instead]
```
### From Jenkins
**Before (Jenkinsfile):**
```groovy
[Show original Jenkins configuration]
```
**After (GitHub Actions):**
```yaml
[Show how to use this reusable workflow instead]
```
## Best Practices
- [Specific best practices for using this workflow]
- [Security considerations]
- [Performance tips]
Quality and security requirements
- Verified publishers only: prioritize
actions/*, azure/*, aws-actions/*, google-github-actions/*
- Latest stable versions of all actions, pinned to commit SHA (see
migration-core guardrails)
- Trigger:
workflow_call only
- Location:
.github/workflows/reusable-<name>.yml
- Validation: every workflow must pass
actionlint
1---2name: reusable-workflow-patterns3description: Catalog of common CI/CD patterns (build, test, deploy, security, quality), scan scope resolution (org-wide or specific repos), the reusable workflow template, selection criteria, and usage-documentation template. Load when detecting recurring CI/CD patterns across GitHub orgs and/or repositories to generate standardized `reusable-*.yml` workflows with corresponding `docs/<name>-usage.md` files.4---56# Reusable Workflow Patterns78This skill provides the catalog, template, and documentation standards used by the Reusable Workflow Builder agent to detect cross-platform CI/CD patterns and produce standardized GitHub Actions reusable workflows.910## Supported CI/CD systems for pattern discovery1112| System | File patterns |13| -------------- | ----------------------------------------------- |14| GitHub Actions | `.github/workflows/*.yml` |15| GitLab CI/CD | `.gitlab-ci.yml` |16| Azure DevOps | `azure-pipelines.yml`, `.azure-pipelines/*.yml` |17| Jenkins | `Jenkinsfile`, `.jenkins/*.groovy` |18| CircleCI | `.circleci/config.yml` |19| Travis CI | `.travis.yml` |20| Drone CI | `.drone.yml` |21| Others | Bitbucket, TeamCity, Bamboo, Buildkite |2223## Pattern categories2425- **🏗️ Build** — npm/Maven/Docker/language-specific build processes26- **🧪 Test** — unit, integration, E2E, security, performance testing27- **🚀 Deploy** — cloud (AWS/Azure/GCP), containers, serverless, infrastructure28- **🔒 Security** — SAST/DAST, dependency scanning, compliance checks29- **📊 Quality** — code coverage, linting, quality gates3031## Selection criteria3233A pattern becomes a reusable workflow when it shows:3435- **High frequency** — 10+ repositories36- **Significant complexity** — 5+ steps37- **Low variation** — standardizable38- **Clear parameters** — configurable inputs3940## Scan scope4142The user controls the scope of analysis. Three modes are supported and can be freely combined:4344| User input | Scope |45|---|---|46| `org-name` | All repositories in that organization |47| `org-name/repo-name` | That specific repository only |48| Mixed list | Union of all specified orgs and repos |4950**Always** respect the stated scope — never crawl repos or orgs not explicitly provided.5152## Pattern-recognition workflow5354Adapt these steps to the input scope:55561. **Scope resolution**57 - For each `org-name` entry: use `mcp_github_search_repositories` to enumerate all repos in that org.58 - For each `org-name/repo-name` entry: use that repo directly — no enumeration needed.59 - Deduplicate if a repo appears both via org scan and explicit reference.60612. **Universal pipeline discovery** — search each repo for CI/CD files across all supported systems (see table above).62633. **Cross-platform content analysis** — retrieve and parse configurations.64654. **Universal pattern extraction** — identify common structures and steps.66675. **Cross-system frequency analysis** — count pattern occurrences across the resolved repo set.68 - When scope is a single repo or a small explicit list, lower the frequency threshold (see Selection criteria) — a pattern present in 3+ files within a monorepo is still worth extracting.69706. **Translation scoring** — rank by frequency, complexity reduction, and GitHub Actions conversion feasibility.71727. **Platform mapping** — map equivalent concepts to GitHub Actions.7374## Reusable workflow template7576```yaml77name: Reusable Node.js Build Workflow78on:79 workflow_call:80 inputs:81 node-version:82 description: 'Node.js version to use'83 required: false84 default: '18'85 type: string86 build-command:87 description: 'Custom build command'88 required: false89 default: 'npm run build'90 type: string91 outputs:92 build-success:93 description: 'Build success status'94 value: ${{ jobs.build.outputs.success }}9596jobs:97 build:98 runs-on: ubuntu-latest99 steps:100 # ✅ Only verified actions from trusted publishers101 - uses: actions/checkout@v4102 - uses: actions/setup-node@v4103 with:104 node-version: ${{ inputs.node-version }}105 cache: 'npm'106 - run: npm install107 - run: ${{ inputs.build-command }}108```109110## Output file rules111112For **every** reusable workflow produced, create **exactly two** files:1131141. `.github/workflows/reusable-<name>.yml` — the reusable workflow (`workflow_call` trigger only)1152. `docs/<name>-usage.md` — the usage documentation (one per workflow, 1:1)116117**Never** create: `README.md`, `WORKFLOWS.md`, consolidated docs, scripts (`.sh`, `.bat`, `.ps1`, `.py`, `.js`), custom actions, caller workflows, or workflow templates.118119## Usage documentation template120121Each `docs/<name>-usage.md` must contain:122123````markdown124# Reusable [Workflow Name] Usage Guide125126## Pattern Analysis Summary127- **Frequency**: Found in X repositories across Y organizations128- **Source CI/CD Systems**: [List systems: GitHub Actions, GitLab CI, Jenkins, etc.]129- **Complexity Reduction**: [Explain how this replaces X previous steps]130131## Migration Benefits132- **From GitLab CI**: [If applicable, before/after]133- **From Jenkins**: [If applicable, before/after]134- **From Azure DevOps**: [If applicable, before/after]135- **Standardization**: [Consistency improvements]136137## Basic Usage Example138```yaml139name: Example Workflow140on: [push, pull_request]141142jobs:143 job-name:144 uses: ./.github/workflows/reusable-[name].yml145 with:146 param1: 'value1'147 param2: 'custom-value'148```149150## Advanced Usage Example151```yaml152name: Production Workflow153on:154 push:155 branches: [main]156157jobs:158 job-name:159 uses: ./.github/workflows/reusable-[name].yml160 with:161 param1: 'production-value'162 param2: 'advanced-setting'163 secrets:164 SECRET_NAME: ${{ secrets.SECRET_NAME }}165```166167## Input Parameters Reference168| Parameter | Description | Required | Default | Example |169| --------- | ------------- | -------- | ----------- | ---------- |170| param1 | [Description] | Yes | - | `'value'` |171| param2 | [Description] | No | `'default'` | `'custom'` |172173## Output Reference174| Output | Description | Type |175| ------- | ------------- | ------ |176| output1 | [Description] | string |177178## Migration Examples179### From GitLab CI180**Before (.gitlab-ci.yml):**181```yaml182[Show original GitLab CI configuration]183```184185**After (GitHub Actions):**186```yaml187[Show how to use this reusable workflow instead]188```189190### From Jenkins191**Before (Jenkinsfile):**192```groovy193[Show original Jenkins configuration]194```195196**After (GitHub Actions):**197```yaml198[Show how to use this reusable workflow instead]199```200201## Best Practices202- [Specific best practices for using this workflow]203- [Security considerations]204- [Performance tips]205````206207## Quality and security requirements208209- **Verified publishers only**: prioritize `actions/*`, `azure/*`, `aws-actions/*`, `google-github-actions/*`210- **Latest stable versions** of all actions, pinned to commit SHA (see `migration-core` guardrails)211- **Trigger**: `workflow_call` only212- **Location**: `.github/workflows/reusable-<name>.yml`213- **Validation**: every workflow must pass `actionlint`