Skip to content

Commit bcabc7e

Browse files
author
Mark Heynes
committed
feat: add github actions and codespaces efficiency skill
1 parent 6397070 commit bcabc7e

7 files changed

Lines changed: 320 additions & 0 deletions

File tree

docs/README.skills.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-skills) for guidelines on how to
177177
| [gh-cli](../skills/gh-cli/SKILL.md)<br />`gh skills install github/awesome-copilot gh-cli` | GitHub CLI (gh) comprehensive reference for repositories, issues, pull requests, Actions, projects, releases, gists, codespaces, organizations, extensions, and all GitHub operations from the command line. | None |
178178
| [git-commit](../skills/git-commit/SKILL.md)<br />`gh skills install github/awesome-copilot git-commit` | Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping | None |
179179
| [git-flow-branch-creator](../skills/git-flow-branch-creator/SKILL.md)<br />`gh skills install github/awesome-copilot git-flow-branch-creator` | Intelligent Git Flow branch creator that analyzes git status/diff and creates appropriate branches following the nvie Git Flow branching model. | None |
180+
| [github-actions-codespaces-efficiency](../skills/github-actions-codespaces-efficiency/SKILL.md)<br />`gh skills install github/awesome-copilot github-actions-codespaces-efficiency` | Audit and improve GitHub Actions and Codespaces efficiency. Use this skill when a user wants to reduce CI minutes, cancel redundant runs, add dependency caching, narrow workflow triggers with path filters, slim devcontainers, right-size Codespaces, tune idle timeout guidance, or scope prebuilds to high-value branches. | `agents`<br />`references/actions.md`<br />`references/codespaces.md`<br />`references/patterns.md`<br />`references/reporting.md` |
180181
| [github-copilot-starter](../skills/github-copilot-starter/SKILL.md)<br />`gh skills install github/awesome-copilot github-copilot-starter` | Set up complete GitHub Copilot configuration for a new project based on technology stack | None |
181182
| [github-issues](../skills/github-issues/SKILL.md)<br />`gh skills install github/awesome-copilot github-issues` | Create, update, and manage GitHub issues using MCP tools. Use this skill when users want to create bug reports, feature requests, or task issues, update existing issues, add labels/assignees/milestones, set issue fields (dates, priority, custom fields), set issue types, manage issue workflows, link issues, add dependencies, or track blocked-by/blocking relationships. Triggers on requests like "create an issue", "file a bug", "request a feature", "update issue X", "set the priority", "set the start date", "link issues", "add dependency", "blocked by", "blocking", or any GitHub issue management task. | `references/dependencies.md`<br />`references/images.md`<br />`references/issue-fields.md`<br />`references/issue-types.md`<br />`references/projects.md`<br />`references/search.md`<br />`references/sub-issues.md`<br />`references/templates.md` |
182183
| [github-release](../skills/github-release/SKILL.md)<br />`gh skills install github/awesome-copilot github-release` | Guides IA through releasing a new version of a GitHub library end-to-end. Handles SemVer versioning and Keep a Changelog formatting automatically. | `references/commit-classification.md`<br />`references/semver-rules.md` |
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
name: github-actions-codespaces-efficiency
3+
description: Audit and improve GitHub Actions and Codespaces efficiency. Use this skill when a user wants to reduce CI minutes, cancel redundant runs, add dependency caching, narrow workflow triggers with path filters, slim devcontainers, right-size Codespaces, tune idle timeout guidance, or scope prebuilds to high-value branches.
4+
---
5+
6+
# GitHub Actions and Codespaces Efficiency
7+
8+
Use this skill as a lean entrypoint for GitHub Actions and Codespaces efficiency work. Keep the hot path small: inspect the repo, identify the waste source, then load only the reference material needed for the current task.
9+
10+
## Use This Skill When
11+
12+
- The user wants to reduce GitHub Actions runtime, CI cost, or wasted workflow runs.
13+
- The user wants faster Codespaces startup or lower Codespaces spend.
14+
- The repo has `.github/workflows/*.yml`, a `.devcontainer/`, or explicit Codespaces configuration questions.
15+
- The user asks for caching, concurrency, path filters, matrix reduction, prebuild strategy, machine sizing, or idle-timeout guidance.
16+
17+
## Load Only What You Need
18+
19+
Start with the repo configuration, then load references selectively:
20+
21+
- Read [`references/actions.md`](./references/actions.md) for GitHub Actions audits, job gating, matrix reduction, live validation, and workflow-specific fixes.
22+
- Read [`references/codespaces.md`](./references/codespaces.md) for devcontainer, machine-sizing, prebuild, and idle-timeout guidance.
23+
- Read [`references/reporting.md`](./references/reporting.md) when the user asks what changed, wants a before/after efficiency report, or wants another review pass over the remaining expensive jobs.
24+
- Read [`references/patterns.md`](./references/patterns.md) only when you need concrete YAML or configuration examples during implementation.
25+
26+
If the task is CI-only, do not load the Codespaces reference. If the task is Codespaces-only, do not load the Actions reference.
27+
28+
## Core Workflow
29+
30+
### 1. Measure first
31+
32+
Inspect the current configuration before proposing changes:
33+
34+
- Workflow triggers and whether repeated pushes waste runs
35+
- Dependency installation and cache behavior
36+
- Whether docs-only or config-only changes trigger heavy validation
37+
- Whether matrix breadth matches the actual decision being made
38+
- Whether devcontainers or Codespaces defaults are oversized
39+
40+
### 2. Rank fixes by payoff
41+
42+
Prefer this order unless repo context says otherwise:
43+
44+
1. Add dependency caching with lockfile-based keys
45+
2. Add or correct `concurrency` cancellation
46+
3. Remove duplicate workflow coverage before merging jobs together
47+
4. Narrow workflow or job triggers safely
48+
5. Reduce matrix breadth to match risk and event type
49+
6. Trim oversized devcontainer or Codespaces defaults
50+
51+
### 3. Keep changes conservative
52+
53+
- Do not hide required release, schema, migration, or shared-library validation behind overly-broad filters.
54+
- Do not assume fewer jobs means faster PR feedback; preserve parallelism unless runner cost matters more and the critical path stays acceptable.
55+
- Treat compatibility matrices as policy, not default ceremony.
56+
- Prefer opt-in triggers for nonessential write-back jobs such as formatting bots.
57+
- Separate repo-editable changes from GitHub/org settings recommendations.
58+
59+
### 4. Verify in GitHub when possible
60+
61+
YAML lint is necessary but not sufficient.
62+
63+
- Validate trigger behavior with live runs when possible.
64+
- Use a low-scope change, such as a workflow-only or docs-only update, to prove heavy jobs actually skip.
65+
- Treat unexpected live behavior as a real bug even when the YAML looks correct.
66+
67+
## Required Output Shape
68+
69+
When using this skill, keep the response compact and structured around these four sections:
70+
71+
1. `Waste sources`: the top cost or latency drivers you found
72+
2. `Proposed fixes`: the small set of highest-confidence changes
73+
3. `Validation`: what was proven live, what was only checked locally, and any remaining risk
74+
4. `Impact`: expected savings separately from measured savings
75+
76+
For measured impact, separate:
77+
78+
- PR wall-clock time
79+
- Total runner time across jobs
80+
- Jobs or matrix legs avoided entirely
81+
82+
## Review Rubric
83+
84+
Use this rubric when reviewing current or updated efficiency work:
85+
86+
- `Scope discipline`: only relevant domain guidance was loaded
87+
- `Safety`: required validation coverage was preserved
88+
- `Token efficiency`: the skill or report stayed focused on the active task
89+
- `Measurement quality`: expected and measured gains were clearly separated
90+
91+
If one rubric dimension is weak, call that out explicitly instead of averaging it away.
92+
93+
## References
94+
95+
- [`references/actions.md`](./references/actions.md)
96+
- [`references/codespaces.md`](./references/codespaces.md)
97+
- [`references/reporting.md`](./references/reporting.md)
98+
- [`references/patterns.md`](./references/patterns.md)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "GitHub Actions and Codespaces Efficiency"
3+
short_description: "Reduce GitHub CI and Codespaces waste"
4+
default_prompt: "Use $github-actions-codespaces-efficiency to audit this repo for GitHub Actions and Codespaces efficiency, then propose the highest-value fixes with clear validation and expected impact."
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# GitHub Actions Efficiency
2+
3+
Load this reference only when the task involves GitHub Actions or CI workflow efficiency.
4+
5+
## Audit Order
6+
7+
Inspect in this order:
8+
9+
1. `.github/workflows/*.yml`
10+
2. Docs describing CI expectations
11+
3. Existing reports or run history if the user wants measured impact
12+
13+
Start with common, low-risk waste:
14+
15+
1. Missing dependency caches
16+
2. Missing `concurrency` cancellation
17+
3. Over-broad workflow triggers
18+
4. Duplicate workflow coverage across files or jobs
19+
5. Expensive jobs that run on every change regardless of scope
20+
21+
## Actions-Specific Guidance
22+
23+
### Trigger scoping
24+
25+
- Use `paths` or `paths-ignore` when whole workflows truly should not run for some file classes.
26+
- Use job-level gating when event-level filters are too coarse.
27+
- Prefer explicit changed-file detection when reliability matters more than clever filter expressions.
28+
29+
### Job shaping
30+
31+
- Do not merge jobs blindly. If separate jobs preserve parallelism and shorten the critical path, keep them separate.
32+
- Keep lightweight coordination or change-detection jobs separate from heavy execution jobs when that makes skip behavior obvious.
33+
- If a workflow-only change still runs the full suite, treat that as evidence the gating model is too broad.
34+
35+
### Matrix reduction
36+
37+
Match matrix breadth to the decision being made:
38+
39+
- Full matrix for releases or explicit compatibility validation
40+
- Reduced compatibility matrix for runtime, plugin, packaging, or framework-integration changes
41+
- Single representative latest-version leg for ordinary code changes
42+
- No heavy test job for clearly non-runtime changes when lighter protection already exists
43+
44+
### Optional maintenance jobs
45+
46+
Formatting or autofix jobs that write back to a branch are often better as opt-in jobs.
47+
48+
Good triggers:
49+
50+
- PR label such as `ci:format`
51+
- Manual dispatch
52+
- Explicit comment-command flow if the repo already supports it
53+
54+
If you use a label trigger, remember to listen for PR `labeled` and usually `unlabeled` events or the label change will not reevaluate the job.
55+
56+
## Safe-Change Rules
57+
58+
- Do not hide required release, migration, or shared-library validation.
59+
- Do not widen changed-file scope accidentally when replacing a wrapper action.
60+
- Treat severity drift as a regression risk.
61+
- Match the real check surface before replacing a broad action with native tools.
62+
63+
## Live Validation
64+
65+
Prefer live GitHub validation when possible:
66+
67+
- Trigger `workflow_dispatch` workflows once
68+
- Verify stale-run cancellation with two quick updates
69+
- Verify path-gating with an incremental ignored-only or workflow-only change on an existing branch
70+
- Confirm heavy jobs skip in the UI instead of assuming they would
71+
72+
Do not treat the first push on a brand-new branch as a clean path-ignore test.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Codespaces and Devcontainer Efficiency
2+
3+
Load this reference only when the task involves `.devcontainer/`, Codespaces sizing, prebuilds, or workspace cost.
4+
5+
## Audit Order
6+
7+
Inspect:
8+
9+
1. `.devcontainer/devcontainer.json`
10+
2. Related Dockerfiles, features, and setup scripts
11+
3. Any docs that recommend machine sizes, prebuilds, or startup expectations
12+
13+
## Common Waste Sources
14+
15+
- Oversized base images
16+
- Unnecessary packages or extensions
17+
- Slow post-create bootstrap steps
18+
- Prebuilds enabled for too many branches
19+
- Missing guidance on machine sizing or idle timeout discipline
20+
21+
## Preferred Fix Order
22+
23+
1. Remove unnecessary packages, features, and extensions
24+
2. Reduce startup commands and post-create installs
25+
3. Recommend the smallest machine size that preserves throughput
26+
4. Narrow prebuild scope to default and high-traffic branches
27+
5. Add or tighten idle-timeout and cleanup guidance
28+
29+
## Safe-Change Rules
30+
31+
- Do not optimize startup by removing tools the team actually needs every day.
32+
- Distinguish repo changes from org or user settings.
33+
- Prefer documentation when the effective control lives outside the repo.
34+
- Avoid turning the devcontainer into a production-like image unless the team explicitly needs that.
35+
36+
## Reporting Focus
37+
38+
When reporting Codespaces improvements, separate:
39+
40+
- Faster startup
41+
- Lower steady-state workspace cost
42+
- Lower prebuild spend
43+
- Guidance-only recommendations that still need org or user action
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Canonical Patterns
2+
3+
Load this reference only when you need concrete examples during implementation.
4+
5+
## Dependency Cache
6+
7+
```yaml
8+
- uses: actions/cache@v4
9+
with:
10+
path: ~/.npm
11+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
12+
restore-keys: |
13+
${{ runner.os }}-node-
14+
```
15+
16+
Adapt the cache path and invalidation file to the repo's ecosystem.
17+
18+
## Cancel Stale Runs
19+
20+
```yaml
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
```
25+
26+
## Scope Triggers
27+
28+
```yaml
29+
on:
30+
push:
31+
paths:
32+
- "src/**"
33+
- "tests/**"
34+
- "package.json"
35+
```
36+
37+
Use `paths-ignore` when exclusion is easier to maintain than inclusion.
38+
39+
## Job-Level Changed-File Gating
40+
41+
Use a small change-detection step that emits explicit outputs such as:
42+
43+
- `docs_relevant`
44+
- `runtime_relevant`
45+
- `compat_relevant`
46+
- `run_tests`
47+
48+
Gate downstream jobs on those outputs when event-level filters are not expressive enough.
49+
50+
## Matrix Reduction
51+
52+
Use the minimum matrix that matches the decision:
53+
54+
- Full matrix on release
55+
- Reduced compatibility matrix on sensitive runtime surfaces
56+
- Single representative leg for ordinary code changes
57+
58+
## Optional Write-Back Job
59+
60+
Use label-driven or manual triggers for jobs that mutate the PR branch, such as formatting bots.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Efficiency Reporting and Follow-Up Review
2+
3+
Load this reference when the user asks what changed, wants a before/after report, or asks for another pass over remaining expensive jobs.
4+
5+
## Reporting Rules
6+
7+
- Separate expected savings from measured savings.
8+
- Do not claim exact time or cost savings without before/after run data.
9+
- Call out confounders such as cache warm-up, changed matrix breadth, runner changes, or unusually small PRs.
10+
11+
Use this phrasing when data is incomplete:
12+
13+
`I can report the efficiency mechanisms that changed, but I cannot honestly claim exact minutes saved without comparing before/after GitHub Actions runs.`
14+
15+
## What To Measure
16+
17+
Gather:
18+
19+
1. A baseline sample before the change
20+
2. A post-change sample after caches warm
21+
3. Per-workflow or per-job duration comparisons
22+
4. Avoided runs, skipped jobs, or avoided matrix legs
23+
24+
Always separate:
25+
26+
- PR wall-clock time
27+
- Total runner time across jobs
28+
- Work avoided entirely
29+
30+
These answer different questions. A change can reduce runner spend without materially improving the fastest feedback path.
31+
32+
## Follow-Up Review Pass
33+
34+
After the first round of fixes is validated, inspect the remaining expensive jobs:
35+
36+
- Compare setup time versus execution time
37+
- Identify heavyweight wrapper actions and confirm what they really enforce
38+
- Review whether each matrix dimension still serves an active decision
39+
- Recheck after caches warm
40+
- Break down the dominant slow step before proposing further changes
41+
42+
Keep the follow-up compact. Report the next few highest-value opportunities, not a long wishlist.

0 commit comments

Comments
 (0)