Optimize GitHub Actions matrix strategies for testing across multiple versions, platforms, and configurations. Use when configuring matrix builds, testing multiple versions, cross-platform testing, or optimizing CI resource usage. Trigger words include "matrix strategy", "test matrix", "multiple versions", "cross-platform".
View on GitHubarmanzeroeight/fastagent-plugins
github-actions-toolkit
plugins/github-actions-toolkit/skills/matrix-optimizer/SKILL.md
January 21, 2026
Select agents to install to:
npx add-skill https://github.com/armanzeroeight/fastagent-plugins/blob/main/plugins/github-actions-toolkit/skills/matrix-optimizer/SKILL.md -a claude-code --skill matrix-optimizerInstallation paths:
.claude/skills/matrix-optimizer/# Matrix Optimizer
Configure and optimize GitHub Actions matrix strategies for efficient multi-version and multi-platform testing.
## Quick Start
Basic matrix for testing multiple Node.js versions:
```yaml
strategy:
matrix:
node-version: [16, 18, 20]
```
## Instructions
### Step 1: Identify Matrix Dimensions
**Common matrix dimensions:**
- **Language versions**: Node.js, Python, Ruby, Go versions
- **Operating systems**: ubuntu, macos, windows
- **Architectures**: x64, arm64
- **Dependency versions**: Database versions, framework versions
- **Feature flags**: Different configuration options
**Example dimensions:**
```yaml
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [16, 18, 20]
# This creates 9 jobs (3 OS × 3 versions)
```
### Step 2: Configure Matrix Strategy
**Basic matrix:**
```yaml
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [18, 20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm test
```
**Matrix with include:**
```yaml
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [18, 20]
include:
# Add specific combination
- os: windows-latest
node-version: 20
# Add extra variables for specific combination
- os: ubuntu-latest
node-version: 20
experimental: true
```
**Matrix with exclude:**
```yaml
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [16, 18, 20]
exclude:
# Skip Node 16 on Windows
- os: windows-latest
node-version: 16
# Skip Node 16 on macOS
- os: macos-latest
node-version: 16
```
### Step 3: Optimize for Cost and Speed
**Fail-fast strategy:**
```yaml
strategy:
fail-fast: false # Continue all jobs even if one fails
mat