Official agent skill

Optimize Agentic Workflow

by github in github/gh-aw

Analyze and reduce token consumption in agentic workflows — guardrail-specific entry points, measurement, and optimization techniques.

OfficialMITAuto-check passedAI & LLM Engineering

Install Optimize Agentic Workflow

skills CLI
$ npx skills add github/gh-aw --skill optimize-agentic-workflow -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install github/gh-aw optimize-agentic-workflow --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/github/gh-aw.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/optimize-agentic-workflow .claude/skills/optimize-agentic-workflow && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
optimize-agentic-workflow
GitHub stars
5.3k
Token cost
~1.2k tokens
SKILL.md length
588 words
Files
1
Skills in repo
52
Repo updated
First seen
Licence
MIT

At a glance

Analyze and reduce token consumption in agentic workflows — guardrail-specific entry points, measurement, and optimization techniques.

  • Works in 4 steps: Extract the run ID → Run gh aw audit --json → Inspect agent_usage.aic,… → …
  • Tasks that involve LLM cost and token optimization
  • SKILL.md covers Load These References First, Available Commands, Start the Conversation and Fast Path: Run URL Provided, plus 3 more sections
  • Calls gh

What it does

Optimize Agentic Workflow is an agent skill from github/gh-aw, published by the product's own GitHub organization. Analyze and reduce token consumption in agentic workflows — guardrail-specific entry points, measurement, and optimization techniques.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering LLM cost and token optimization. It works with GitHub. The repository describes itself as: GitHub Agentic Workflows. The licence is MIT.

When your agent uses it

  • Tasks that involve LLM cost and token optimization

Example prompts

  • “/optimize-agentic-workflow”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Extract the run ID
  2. Run gh aw audit --json
  3. Inspect agent_usage.aic, agent_usage.input_tokens, agent_usage.output_tokens, agent_usage.cache_read_tokens
  4. Identify the most expensive phases before asking additional questions

What it can do on your machine

Read from SKILL.md and the folder at commit eb63040. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • gh

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use gh, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Optimize Agentic Workflow loads about 1.2k tokens when it runs. Until then it costs about 40 tokens; SKILL.md has 588 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~40
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from github/gh-aw at commit eb63040, republished under its MIT licence (© github). 588 words, ~1,180 tokens.

Download SKILL.mdSave it as .claude/skills/optimize-agentic-workflow/SKILL.md (or your agent's skills folder).
name
optimize-agentic-workflow
description
Analyze and reduce token consumption in agentic workflows — guardrail-specific entry points, measurement, and optimization techniques.

Agentic Workflow Token Optimizer

Help users reduce the AI token usage and cost of GitHub Agentic Workflows in this repository.

Load These References First

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.md

Load these only when relevant:

  • .github/aw/experiments.md
  • .github/aw/safe-outputs.md

Available Commands

bash
gh 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

Start the Conversation

Ask for one of these inputs:

  • a workflow run URL (or run ID) to analyze
  • a workflow name to review the source
  • the guardrail that was exceeded (max-ai-credits, max-daily-ai-credits, max-tool-denials, max-turns / timeout)

Fast Path: Run URL Provided

If the user gives a GitHub Actions run URL:

  1. Extract the run ID
  2. Run gh aw audit <run-id> --json
  3. Inspect agent_usage.aic, agent_usage.input_tokens, agent_usage.output_tokens, agent_usage.cache_read_tokens
  4. Identify the most expensive phases before asking additional questions

Guardrail-Specific Entry Points

max-ai-credits exceeded

The workflow was stopped because it consumed more AI Credits than the configured per-run budget.

Priority checks:

  1. Which tool calls dominated token usage? (token-usage.jsonl)
  2. Is the prompt front-loading large payloads that could be fetched on demand?
  3. Are there repetitive extraction steps that sub-agents could handle cheaply?
  4. Does the frontier model handle tasks that a small model could do?
max-daily-ai-credits exceeded

The workflow is being blocked because its 24-hour AI Credits budget is exhausted.

Priority checks:

  1. What is the run cadence? (scheduled too frequently?)
  2. Does the workflow use cheap triage before escalating to the frontier model?
  3. Is batching or caching applicable to reduce run frequency?
  4. Are there noop early-exits for events that do not require agent action?
max-tool-denials exceeded

The Copilot SDK hit the tool-denial threshold, indicating the prompt attempted actions outside the allowed tool policy.

Priority checks:

  1. What tool was repeatedly denied? (last denied reason in the failure issue)
  2. Is the tool missing from the workflow's permissions/firewall config?
  3. Can the prompt be revised to avoid the denied operation entirely?
  4. Would a DataOps pre-step satisfy the data need without a tool call?
Show full SKILL.md (266 more words)Show less
Timeout / max-turns exceeded

The agent ran out of time or turns before completing the task.

Priority checks:

  1. Is the task decomposable into smaller, faster sub-tasks?
  2. Are there long-running tool calls that could be replaced with DataOps pre-steps?
  3. Is the prompt asking the agent to do too much in one run?
  4. Can max-turns or timeout-minutes be raised, or should the task be split?

Optimization Analysis Plan

After measuring token usage, produce a prioritized plan:

  1. Measure — run gh aw audit <run-id> --json and summarize AI Credits and per-call token breakdown
  2. Diagnose the harness — classify failures across context assembly, tool interaction, generation control, orchestration, memory management, and output processing
  3. Identify top cost drivers — list the three most expensive phases/tool calls
  4. Apply quick wins first — DataOps pre-steps, gh-proxy, cli-proxy, prompt trimming
  5. Sub-agent delegation — identify repetitive per-item loops suitable for small-model workers
  6. Reuse execution experience — preserve compact task features, configuration deltas, outcomes, costs, and diagnoses in cache-memory when cross-run reuse is useful; apply relevant recurring patterns to similar cases
  7. Prompt caching — verify stable instructions and reusable experience appear before dynamic content
  8. Experiment correctness first — add an experiments: entry, compare output quality first, and use metric: "aic" to choose among equivalent-quality variants
  9. Validate quality — confirm the optimized run produces equivalent safe outputs

Present the plan clearly before making any edits. Confirm with the user before applying changes.

Editing Workflow

  1. Edit .github/workflows/<workflow-name>.md
  2. Recompile: gh aw compile <workflow-name>
  3. Commit both the source and the generated .lock.yml
  4. Report the estimated savings and link to the PR or commit

© github, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/optimize-agentic-workflow of github/gh-aw.

Open the folder on GitHubat commit eb63040

Compare with similar skills

Optimize Agentic Workflow next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Optimize Agentic Workflow compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Optimize Agentic Workflow this skillgithub/gh-aw5.3k—~1.2kAutomated safety check: PassMIT
Bug AuditVasiHemanth/tokentelemetry376—~1kAutomated safety check: PassMIT
Levyra Context EfficiencyLUC4N3X/Levyra-deepsound543—~1.3kAutomated safety check: NotesGPL-3.0
Agentflowsickn33/agentic-awesome-skills47k2 repos~2kAutomated safety check: PassMIT
Context Compressionguanyang/open-agent-hub9732 repos~4.6kAutomated safety check: PassMIT
TriageTalAter/annyang6.8k—~810Automated safety check: NotesMIT

Similar skills

  • Bug Audit

    VasiHemanth/tokentelemetry

    Weekly multi-agent audit for serious bugs (data integrity, silent caps, staleness, timestamp math, trust boundaries).

    376 GitHub stars~1k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Levyra Context Efficiency

    LUC4N3X/Levyra-deepsound

    A skill your agent uses for genuinely high-volume Levyra work such as builds, tests, lint, logs, broad searches, dependency output, Git/GitHub or CodeRabbit inspection, CI diagnostics, agent setup…

    543 GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check: notes
  • Agentflow

    sickn33/agentic-awesome-skills

    Orchestrate autonomous AI development pipelines through your Kanban board (Asana, GitHub Projects, Linear).

    47k GitHub starsUsed in 2 repos~2k tokens
    Testing & QAAuto-check passed
  • Context Compression

    guanyang/open-agent-hub

    This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve…

    973 GitHub starsUsed in 2 repos~4.6k tokens
    AI & LLM EngineeringAuto-check passed
  • Triage

    TalAter/annyang

    Triage and close GitHub issues on TalAter/annyang. An agent skill from TalAter/annyang.

    6.8k GitHub stars~810 tokensUpdated yesterday
    AI & LLM EngineeringAuto-check: notes
  • Bounty Hunter

    1sadjlk/bounty-hunter-skill

    A professional AI bounty hunter persona named Atlas. An agent skill from 1sadjlk/bounty-hunter-skill.

    282 GitHub starsUsed in 1 repo~761 tokens
    AI & LLM EngineeringAuto-check passed

More from github/gh-aw

All 52 skills in this repo
  • Official

    Drives a real browser from the command line with playwright-cli to open pages, interact, mock requests, save state and work with Playwright tests.

    5.3k GitHub starsUsed in 23 repos~2.8k tokens
    Auto-check passed
  • Official

    Designs and verifies a deterministic grader that measures whether a GitHub Agentic Workflow run reached its real-world or repository outcome.

    5.3k GitHub stars~6.8k tokensUpdated today
    Auto-check passed
  • Official

    Scaffolds, edits, reloads and debugs a canvas extension that the GitHub Copilot CLI can open in its side panel.

    5.3k GitHub stars~3.7k tokensUpdated today
    Auto-check passed
  • Official

    Drives an open pull request to merge-ready from inside a GitHub Copilot cloud agent, resolving review threads and local checks concurrently, without merging or retriggering CI.

    5.3k GitHub stars~3.8k tokensUpdated today
    Auto-check: warnings
  • Official

    Bumps gh-aw's pinned gh-aw-firewall version, rebuilds generated artifacts, and flags upstream spec or schema changes that need follow-up work.

    5.3k GitHub stars~899 tokensUpdated today
    Auto-check passed
  • Official

    Guide to the console struct tag system in gh-aw: headers, titles, number and cost formats, omitempty, and how structs, slices and maps render in the terminal.

    5.3k GitHub stars~736 tokensUpdated today
    Auto-check passed

Works with

Questions about Optimize Agentic Workflow

What does Optimize Agentic Workflow do?

Analyze and reduce token consumption in agentic workflows — guardrail-specific entry points, measurement, and optimization techniques. Optimize Agentic Workflow is an agent skill from github/gh-aw, published by the product's own GitHub organization. Analyze and reduce token consumption in agentic workflows — guardrail-specific entry points, measurement, and optimization techniques.

When should I use Optimize Agentic Workflow?

Optimize Agentic Workflow fits situations like: tasks that involve LLM cost and token optimization.

How do I install Optimize Agentic Workflow in Claude Code?

Run `npx skills add github/gh-aw --skill optimize-agentic-workflow -a claude-code`. Or copy the skill folder (.github/skills/optimize-agentic-workflow in github/gh-aw) into .claude/skills/optimize-agentic-workflow in your project. Claude Code loads it when a task matches its description.

How do I install Optimize Agentic Workflow in Codex?

Run `npx skills add github/gh-aw --skill optimize-agentic-workflow -a codex`. Or copy the skill folder (.github/skills/optimize-agentic-workflow in github/gh-aw) into .agents/skills/optimize-agentic-workflow in your project. Codex loads it when a task matches its description.

Can I use Optimize Agentic Workflow in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add github/gh-aw --skill optimize-agentic-workflow -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/optimize-agentic-workflow, .gemini/skills/optimize-agentic-workflow, .github/skills/optimize-agentic-workflow and .opencode/skills/optimize-agentic-workflow in your project.

What does Optimize Agentic Workflow need to run?

Going by SKILL.md and its folder, Optimize Agentic Workflow needs the command-line tools its instructions call (gh).

Does Optimize Agentic Workflow access the network?

SKILL.md contains no URLs. Its commands use gh, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Optimize Agentic Workflow safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Optimize Agentic Workflow use?

Optimize Agentic Workflow is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Optimize Agentic Workflow use?

About 1.2k tokens (SKILL.md is roughly 4.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Optimize Agentic Workflow?

Skills that share tags, products or a category with Optimize Agentic Workflow: Bug Audit (VasiHemanth/tokentelemetry, 376 stars), Levyra Context Efficiency (LUC4N3X/Levyra-deepsound, 543 stars), Agentflow (sickn33/agentic-awesome-skills, 47k stars) and Context Compression (guanyang/open-agent-hub, 973 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Optimize Agentic Workflow?

github (a GitHub organization, an official publisher) maintains it in github/gh-aw, which has 5,350 GitHub stars. The repository holds 52 skills in this directory. The repository was last updated on October 7, 2026.

Source: github/gh-aw on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.