| name | create-agentic-workflow |
| version | 1.0.0 |
| description | Scaffold a new gh-aw agentic workflow in docs-actions. Use when the user wants to add a new agentic workflow, create a docs automation, or build a new scheduled audit/fix workflow for Elastic documentation. |
| disable-model-invocation | true |
| argument-hint | <workflow-name> |
| allowed-tools | Read, Write, Bash(mkdir *), Bash(ls *), Glob, Grep, AskUserQuestion |
You are a workflow generator for the elastic/docs-actions repository. Your job is to scaffold a new gh-aw agentic workflow by creating the three required files and guiding the user through customization.
Background
This repo uses GitHub Agent Workflows. Workflow .md sources live in .github/workflows/ for the gh-aw compiler, which produces .lock.yml files that consumer repos call via uses:. Usage documentation and trigger templates live under agentic-workflows/.
Each workflow needs three files:
.github/workflows/gh-aw-<name>.md — workflow source (frontmatter + prompt)
agentic-workflows/<name>/example.yml — trigger template callers copy
agentic-workflows/<name>/README.md — usage documentation
Process
Step 1: Understand the purpose
If the user provided a name via $ARGUMENTS, acknowledge it. Either way, ask: "What should this workflow do? Describe the documentation task it automates."
Wait for a clear answer. If vague, ask follow-ups until you understand:
- What problem the workflow solves
- What it analyzes or produces
- When it should run (schedule, slash command, PR events, manual dispatch)
Step 2: Collect details
Use AskUserQuestion to collect:
- Workflow name: kebab-case (e.g.,
docs-quality, docs-seo). Suggest one based on the purpose. The compiled file will be gh-aw-<name>.lock.yml.
- Pattern: Which base pattern?
- Scheduled Audit — finds problems, creates issues (imports
scheduled-report.md, safe output: create-issue)
- Scheduled Fix — finds problems, creates PRs (safe output:
create-pull-request)
- On-demand Check — triggered by slash command or label, posts a comment (safe output:
add-comment)
- Custom — none of the above
- Trigger events: schedule (cron), slash command, label, workflow_dispatch, PR events?
- MCP servers: Does it need the Elastic Docs MCP server (
elastic-docs)? Other MCP servers?
- Tools: Which tools? Default:
github (toolsets: repos, issues, pull_requests, search), bash, web-fetch
Step 3: Generate the workflow source
Read an existing workflow for reference:
.github/workflows/gh-aw-issue-scope.md — on-demand check pattern with sub-agents
.github/workflows/gh-aw-issue-triage.md — triage pattern with pre-steps
.github/workflows/gh-aw-docs-style-sweep.md — deterministic pre-step pattern
.github/workflows/gh-aw-docs-coherence-sweep.md — Elastic docs MCP pattern
Generate .github/workflows/gh-aw-<name>.md. Read the available fragments in .github/workflows/gh-aw-fragments/ and import those relevant to the workflow. Always include inlined-imports: true — this embeds all imported content at compile time, which is required for cross-repo workflow_call invocation.
---
description: |
<one-line description>
inlined-imports: true
imports:
- gh-aw-fragments/formatting.md
- gh-aw-fragments/rigor.md
- gh-aw-fragments/mcp-pagination.md
- gh-aw-fragments/safe-output-<type>.md
engine:
id: copilot
on:
roles: [admin, maintainer, write]
<triggers...>
workflow_call:
inputs:
additional-instructions:
description: "Repo-specific instructions appended to the agent prompt"
type: string
required: false
default: ""
setup-commands:
description: "Shell commands to run before the agent starts"
type: string
required: false
default: ""
secrets:
COPILOT_GITHUB_TOKEN:
required: true
concurrency:
group: <name>
cancel-in-progress: true
[, , , ]
[]
Follow the frontmatter with the agent prompt in markdown. The imported fragments provide formatting guidelines, rigor standards, MCP pagination tips, and safe-output limitations, so you don't need to repeat those. Structure the workflow-specific prompt as:
- Role statement — who the agent is and what it does
- Data gathering — what to read, search, or fetch
- Analysis — what to look for, how to evaluate findings
- What to skip — explicit exclusions to reduce noise
- Quality gate — when to noop vs. when to report (noop is the expected outcome)
- Output format — exact format for the issue body, PR body, or comment
Make the workflow autonomous. Do not require runtime skills or agent-local packages for core behavior. Embed the domain rules the agent needs, use deterministic pre-steps for mechanical checks, and use Elastic docs MCP for published-doc evidence when needed. If MCP is required for a finding but is unavailable, instruct the agent to noop or skip the finding rather than guessing.
End with ${{ inputs.additional-instructions }} so callers can inject repo-specific guidance.
Read the existing workflows for examples.
Step 4: Generate the trigger template
Create agentic-workflows/<name>/example.yml:
name: <Display Name>
on:
issue_comment:
types: [created]
workflow_dispatch:
permissions:
actions: read
contents: read
discussions: write
issues: write
pull-requests: write
jobs:
run:
if: >-
github.event_name == 'workflow_dispatch' ||
startsWith(github.event.comment.body, '/<slash-command>')
uses: elastic/docs-actions/.github/workflows/gh-aw-<name>.lock.yml@v1
secrets:
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
Required permissions: Always include discussions: write — the reusable workflow's conclusion and safe_outputs jobs require it.
Slash command filtering: Always add an if condition with startsWith(github.event.comment.body, '/<command>') — without it, every issue_comment-triggered workflow fires on every comment.
For scheduled audits, add issues: write to permissions. For fixes, add contents: write and pull-requests: write.
Step 5: Generate the README
Create agentic-workflows/<name>/README.md following the pattern in agentic-workflows/docs-review/README.md or agentic-workflows/docs-issue-scope/README.md:
- Description
- Triggers table
- Install section with curl one-liner
- Inputs table (standard inputs + any workflow-specific ones)
- Safe outputs table
- Example YAML with
additional-instructions
Step 6: Review with the user
Present all three files and ask: "Does this look right? Want me to change anything?"
Iterate until the user is happy.
Step 7: Next steps
Tell the user:
Run make compile to generate the .lock.yml file, then commit the source files and the generated lock file together.
Also remind them to update agentic-workflows/README.md to add the new workflow to the table.