Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Analyze and reduce token consumption in agentic workflows — guardrail-specific entry points, measurement, and optimization techniques.
.claude/skills/github-optimize-agentic-workflow/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 184% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 32% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 35% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 4% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -33% | 0% |
Help users reduce the AI token usage and cost of GitHub Agentic Workflows in this repository.
Load these files from github/gh-aw (they are not available locally).
.github/aw/github-agentic-workflows.md.github/aw/token-optimization.md.github/aw/workflow-editing.md.github/aw/syntax.mdLoad these only when relevant:
.github/aw/experiments.md.github/aw/safe-outputs.mdbashgh aw audit <run-id> --json gh aw audit <base-run-id> <optimized-run-id> gh aw logs <workflow-name> --json gh aw compile <workflow-name> gh aw status
Ask for one of these inputs:
If the user gives a GitHub Actions run URL:
gh aw audit <run-id> --jsonagent_usage.aic, agent_usage.input_tokens, agent_usage.output_tokens, agent_usage.cache_read_tokensmax-ai-credits exceededThe workflow was stopped because it consumed more AI Credits than the configured per-run budget.
Priority checks:
token-usage.jsonl)max-daily-ai-credits exceededThe workflow is being blocked because its 24-hour AI Credits budget is exhausted.
Priority checks:
max-tool-denials exceededThe Copilot SDK hit the tool-denial threshold, indicating the prompt attempted actions outside the allowed tool policy.
Priority checks:
max-turns exceededThe agent ran out of time or turns before completing the task.
Priority checks:
max-turns or timeout-minutes be raised, or should the task be split?After measuring token usage, produce a prioritized plan:
gh aw audit <run-id> --json and summarize AI Credits and per-call token breakdowngh-proxy, cli-proxy, prompt trimmingcache-memory when cross-run reuse is useful; apply relevant recurring patterns to similar casesexperiments: entry, compare output quality first, and use metric: "aic" to choose among equivalent-quality variantsPresent the plan clearly before making any edits. Confirm with the user before applying changes.
.github/workflows/<workflow-name>.mdgh aw compile <workflow-name>.lock.yml| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 8,481 | 19,947 | +135% | 1 | 1 | 0% | 1,332 | 3,789 | +184% | 0 | 0 | — |
case-02 | fail→pass | 24,908 | 18,875 | -24% | 1 | 1 | 0% | 3,741 | 4,941 | +32% | 0 | 0 | — |
case-03 | fail→fail | 10,951 | 6,549 | -40% | 1 | 1 | 0% | 697 | 1,440 | +107% | 0 | 0 | — |
case-04 | pass→fail | 11,788 | 11,823 | +0% | 1 | 1 | 0% | 2,467 | 3,301 | +34% | 0 | 0 | — |
case-05 | pass→pass | 14,968 | 12,012 | -20% | 1 | 1 | 0% | 2,727 | 3,346 | +23% | 0 | 0 | — |
case-06 | pass→pass | 13,621 | 11,102 | -18% | 1 | 1 | 0% | 2,246 | 3,018 | +34% | 0 | 0 | — |
case-07 | fail→pass | 9,532 | 5,457 | -43% | 1 | 1 | 0% | 1,585 | 2,133 | +35% | 0 | 0 | — |
case-08 | fail→pass | 9,054 | 4,496 | -50% | 1 | 1 | 0% | 1,664 | 1,724 | +4% | 0 | 0 | — |
case-09 | fail→pass | 12,620 | 2,044 | -84% | 1 | 1 | 0% | 2,059 | 1,372 | -33% | 0 | 0 | — |
case-10 | fail→pass | 6,484 | 3,544 | -45% | 1 | 1 | 0% | 1,172 | 1,671 | +43% | 0 | 0 | — |
case-11 | fail→fail | 17,139 | 5,766 | -66% | 1 | 1 | 0% | 2,602 | 2,020 | -22% | 0 | 0 | — |
case-12 | fail→pass | 9,402 | 5,790 | -38% | 1 | 1 | 0% | 1,391 | 1,920 | +38% | 0 | 0 | — |
case-13 | pass→pass | 14,994 | 10,081 | -33% | 1 | 1 | 0% | 2,203 | 2,577 | +17% | 0 | 0 | — |
case-14 | fail→pass | 15,062 | 2,392 | -84% | 1 | 1 | 0% | 2,528 | 1,536 | -39% | 0 | 0 | — |
case-15 | pass→pass | 14,088 | 6,947 | -51% | 1 | 1 | 0% | 2,302 | 2,257 | -2% | 0 | 0 | — |
case-16 | pass→pass | 14,467 | 7,914 | -45% | 1 | 1 | 0% | 2,357 | 2,262 | -4% | 0 | 0 | — |
case-17 | pass→pass | 16,557 | 7,873 | -52% | 1 | 1 | 0% | 2,869 | 2,224 | -22% | 0 | 0 | — |
case-18 | fail→pass | 15,363 | 3,985 | -74% | 1 | 1 | 0% | 2,475 | 1,737 | -30% | 0 | 0 | — |
case-19 | fail→fail | 20,124 | 15,295 | -24% | 1 | 1 | 0% | 3,127 | 3,533 | +13% | 0 | 0 | — |
case-20 | pass→pass | 9,833 | 3,846 | -61% | 1 | 1 | 0% | 1,631 | 1,784 | +9% | 0 | 0 | — |
case-21 | fail→pass | 13,281 | 2,671 | -80% | 1 | 1 | 0% | 2,137 | 1,554 | -27% | 0 | 0 | — |
case-22 | pass→pass | 18,399 | 5,679 | -69% | 1 | 1 | 0% | 2,637 | 2,091 | -21% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +41 percentage points is the difference between those two pass rates over the 21 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.