Official agent skill

Dynamic Workflows

by PostHog in PostHog/code

How to write JavaScript workflow scripts for the workflow tool - fanning work out across many isolated subagents with agent(), parallel(), and pipeline(), then synthesizing one result.

OfficialMITAuto-check passedAgent Workflows

Install Dynamic Workflows

skills CLI
$ npx skills add PostHog/code --skill dynamic-workflows -a claude-code

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

GitHub CLI
$ gh skill install PostHog/code dynamic-workflows --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/PostHog/code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/packages/harness/src/extensions/workflow/skills/dynamic-workflows .claude/skills/dynamic-workflows && 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
dynamic-workflows
GitHub stars
179
Token cost
~2.3k tokens
SKILL.md length
925 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

How to write JavaScript workflow scripts for the workflow tool - fanning work out across many isolated subagents with agent(), parallel(), and pipeline(), then synthesizing one result.

  • A task decomposes into several independent investigations
  • SKILL.md covers When to use it, Script shape, API and Which agent, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Changes (codebase audits

What it does

Dynamic Workflows is an agent skill from PostHog/code, published by the product's own GitHub organization. How to write JavaScript workflow scripts for the workflow tool - fanning work out across many isolated subagents with agent(), parallel(), and pipeline(), then synthesizing one result. Use when a task decomposes into several independent investigations or changes (codebase audits, many-file analysis, wide research, multi-perspective review, applying the same edit across many independent files).

Its SKILL.md is about 2.3k 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 Agent Workflows, covering Subagents. It works with JavaScript. The repository describes itself as: The era of self-driving development is here. The licence is MIT.

When your agent uses it

  • A task decomposes into several independent investigations
  • Changes (codebase audits
  • Many-file analysis
  • Multi-perspective review

Example prompts

  • “/dynamic-workflows”

What it can do on your machine

Read from SKILL.md and the folder at commit a4c32df. 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

    No scripts in the folder and no shell commands in SKILL.md (its code samples are javascript).

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

  • Network

    No URLs in SKILL.md.

    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

Dynamic Workflows loads about 2.3k tokens when it runs. Until then it costs about 104 tokens; SKILL.md has 925 words of instructions outside code blocks.

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

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 PostHog/code at commit a4c32df, republished under its MIT licence (© PostHog). 925 words, ~2,250 tokens.

Download SKILL.mdSave it as .claude/skills/dynamic-workflows/SKILL.md (or your agent's skills folder).
name
dynamic-workflows
description
How to write JavaScript workflow scripts for the `workflow` tool - fanning work out across many isolated subagents with agent(), parallel(), and pipeline(), then synthesizing one result. Use when a task decomposes into several independent investigations or changes (codebase audits, many-file analysis, wide research, multi-perspective review, applying the same edit across many independent files).

Dynamic Workflows

The workflow tool executes a JavaScript orchestration script you write. The script holds the loop, branching, and intermediate results; each agent() call runs one isolated subagent in its own pi process; only the script's return value comes back into your context. This is how you audit 20 files, research 8 topics, or apply the same change across 20 independent files without burning your own context window on the intermediate output.

When to use it

  • The work decomposes into several independent investigations or changes whose intermediate outputs you don't need verbatim - only a synthesis (or a report of what changed).
  • Examples: audit every route/module for a property, summarize each package of a monorepo, verify a list of findings adversarially, research N alternatives, rename an API across every file that references it.

Do not use it for: a single question or a single edit (use subagent or just do it directly), one or two parallel tasks (use subagent parallel mode), or work needing your full conversation context.

Script shape

Prefer the strict declared-plan contract below. Strict mode turns on only when meta.phases is a literal object the runtime can read without executing code; older/dynamic scripts keep their legacy behavior. Do not set token budgets: choose only the appropriate persona/model tier and let the host account actual usage.

javascript
export const meta = {
  name: 'audit_routes',
  goal: 'Produce a decision-ready router audit',
  inputs: ['repository'],
  phases: [
    { title: 'Scan', goal: 'Map routers', inputs: ['repository'], produces: ['router inventory'] },
    { title: 'Audit', goal: 'Check the inventory', inputs: ['router inventory'], produces: ['router audits'] },
    { title: 'Synthesize', goal: 'Deliver the verdict', inputs: ['router audits'], produces: ['audit verdict'] },
  ],
  synthesis: { phase: 'Synthesize', inputs: ['router audits'], produces: ['audit verdict'] },
}

phase('Scan')

const inventory = await agent(
  'List every *.router.ts file under packages/host-router/src/routers. Reply with only JSON.',
  {
    label: 'route inventory',
    objective: 'Produce the complete router inventory for the audit.',
    inputs: ['repository'],
    produces: 'router inventory',
    schema: { type: 'object', required: ['files'], properties: { files: { type: 'array', items: { type: 'string' } } } },
  },
)
if (!inventory) return { ok: false, error: 'inventory failed' }

phase('Audit')
const audits = await agent(
  'Audit the router inventory against the one-line-forward rule. Return every violation as JSON.',
  { label: 'router audit', objective: 'Audit all discovered routers for inline logic.', inputs: ['router inventory'], produces: 'router audits', schema: { type: 'object', required: ['violations'] } },
)

phase('Synthesize')
const verdict = await agent(
  'Summarize the supplied router audits into {ok, violations: [...]}. Reply with only JSON.',
  { label: 'final verdict', agent: 'Plan', objective: 'Create the final decision-ready audit report.', inputs: ['router audits'], produces: 'audit verdict', schema: { type: 'object', required: ['ok', 'violations'] } },
)
return verdict

In strict mode, activate declared phases exactly in order; agent inputs are artifact-name arrays (not inline records), every declared phase output must be published exactly once (an agent automatically publishes its declared produces, or use publish(name, value) for aggregates), and the final synthesis phase must publish its named final artifact. Give every phase a goal, every agent a unique label and objective, and all real handoffs named inputs/outputs.

Rules: plain JavaScript (no TypeScript, no import/require); the leading export const meta = { name, description } is optional but conventional; the script must call agent() at least once; the return value must be JSON-serializable (a common mistake is returning an unawaited agent() promise).

API

GlobalBehavior
agent(prompt, opts)Runs one subagent; resolves to its final text, or the parsed+shape-checked object when opts.schema is set, or null on failure. Opts: label (short, unique - drives the live display), objective (responsibility), inputs (artifact-name strings or a record of named string values), produces (one artifact name), agent ('Explore' default, 'Plan', or 'General'), schema (plain JSON Schema), cwd, model (tier keyword, see below).
parallel(thunks)await parallel(items.map(i => () => agent(...))) - functions, not promises. Results in input order; failed branches are null.
pipeline(items, ...stages)Fans items through sequential stages (map → verify → summarize). Items run concurrently; each item's stages run in order; each stage receives (previousValue, originalItem, index). A failed stage nulls that item's slot.
phase(title, meta?)Marks a new stage of work for the live progress display. Prefer phase('Audit', { goal: '...', inputs: ['inventory'], produces: ['findings'] }) so the upcoming plan and dependencies are visible before it runs. goal, inputs, and produces are optional; dynamic/conditional phases remain supported.
log(message)Appends a workflow-level log line (shown in the expanded view).
parseJson(text)Extracts JSON from an agent's text reply, tolerating fences and surrounding prose. Prefer schema on agent() instead.
argsThe JSON value passed in the tool call's args parameter.
cwdThe workflow's working directory (string).

Limits: 8 agents run concurrently, 256 per workflow. require, fs, fetch, and timers are unavailable inside the script - all real work happens inside subagents.

Show full SKILL.md (376 more words)Show less

Which agent

AgentCapabilityModel (default)Use for
Explore (default)Read-onlyFast/cheapRecon, per-item checks, broad search
PlanRead-onlyInherits your modelJudgment-heavy planning or synthesis
GeneralRead-writeInherits your modelThe actual edits an investigation identified, or any fan-out that needs real changes

Only General edits files. Reach for it when a change is mechanical/independent enough to parallelize (e.g. the same fix across many files) rather than applying every edit yourself after the workflow returns.

Model override

agent()'s model option picks a different model than the persona's own default for just that call, using a tier keyword, not a guessed exact model id (the available model list changes over time, so a literal id can silently be wrong):

  • 'strong' - the best available model. Use for a genuinely hard General edit or a judgment call worth spending more on.
  • 'medium' - a solid mid-tier model.
  • 'cheap' - fast and cheap. Use to bump a Plan/General call down for something simple, or to run more Explore-style recon than the default budget would allow.

Omit model entirely to use the persona's own default (most calls should).

javascript
await agent('Investigate whether this auth check has a bypass.', { agent: 'Plan', model: 'strong', label: 'auth bypass check' })

Failure semantics

A failed agent() / parallel() branch / pipeline() item becomes null plus a log line; the rest of the workflow continues. Always check for nulls before synthesizing - audits.filter(Boolean) or an explicit guard. Only aborts and script bugs (unknown agent name, bad arguments, exceeding limits) fail the whole workflow.

Writing good workflows

  • Subagents share no context with you or each other: every prompt must carry its own file paths, constraints, and any prior findings it depends on. Add objective, inputs, and produces to each agent call: they add a concise child context block and let the live workflow show responsibility and downstream artifact use.
  • Use schema whenever an agent's output feeds a later stage; use free text only for the final human-readable synthesis. Define a schema once in a const and reuse it across parallel agents instead of repeating large nested object literals.
  • End with a synthesis step and return a compact value (verdict + key findings), not a dump of every intermediate output - the return value is all you get back.
  • Default to Explore for recon and per-item checks, Plan for judgment-heavy synthesis, and General only for the calls that actually need to write files.

© PostHog, 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 packages/harness/src/extensions/workflow/skills/dynamic-workflows of PostHog/code.

Open the folder on GitHubat commit a4c32df

Compare with similar skills

Dynamic Workflows 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.

Dynamic Workflows compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Dynamic Workflows this skillPostHog/code179—~2.3kAutomated safety check: PassMIT
Open Dynamic Workflowsxz1220/open-dynamic-workflows104—~1.1kAutomated safety check: PassMIT
Run Workflowginlix-ai/LangAlpha1.8k—~1.7kAutomated safety check: PassApache-2.0
Claude Code Agent Developmentanthropics/claude-plugins-official37k8 repos~2.8kAutomated safety check: PassApache-2.0
Subagent Driven DevelopmentAsvarox/allkaraoke26137 repos~1.2kAutomated safety check: PassNone
Dispatching Parallel Agentsultralisp/ultralisp25840 repos~1.5kAutomated safety check: PassNone

Similar skills

  • Open Dynamic Workflows

    xz1220/open-dynamic-workflows

    编写并运行 dynamic workflow:用 Claude Code 的 workflow 方言写一段简短的 JavaScript 脚本,再用 odw CLI 在宿主 agent 的上下文之外,把子任务扇出给 coding-agent CLI (Codex、Claude Code、Gemini、Qwen、Kimi 或自定义),后台跑完后只取回最终结果。

    104 GitHub stars~1.1k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • Run Workflow

    ginlix-ai/LangAlpha

    Orchestrate parallel subagent pipelines from a JavaScript workflow script.

    1.8k GitHub stars~1.7k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Claude Code Agent Development

    anthropics/claude-plugins-official

    Official

    Explains how to write agents for Claude Code plugins: the markdown file with YAML frontmatter, trigger descriptions, model and color settings, and system prompt design.

    37k GitHub starsUsed in 8 repos~2.8k tokens
    Agent WorkflowsAuto-check passed
  • Subagent Driven Development

    Asvarox/allkaraoke

    A skill your agent uses when executing implementation plans with independent tasks in the current session

    261 GitHub starsUsed in 37 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • Dispatching Parallel Agents

    ultralisp/ultralisp

    A skill your agent uses when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies

    258 GitHub starsUsed in 40 repos~1.5k tokens
    Agent WorkflowsAuto-check passed
  • Launches one separate agent through Paseo to give a second opinion on the current task, with a self-contained briefing and no permission to edit files.

    20k GitHub starsUsed in 1 repo~756 tokens
    Agent WorkflowsAuto-check passed

More from PostHog/code

All 10 skills in this repo
  • Canvas Templates

    PostHog/code

    Official

    How PostHog "canvas" dashboards work end-to-end — the two rendering tiers (json-render vs freeform React-in-iframe), the agent system prompts that steer each, and the RIGHT way to fetch PostHog data…

    179 GitHub stars~2.2k tokensUpdated 2 mo ago
    Auto-check passed
  • MCP Servers

    PostHog/code

    Official

    Install, configure, authenticate, and troubleshoot MCP (Model Context Protocol) servers for this agent.

    179 GitHub stars~1.9k tokensUpdated 2 mo ago
    Auto-check passed
  • Merging PRs

    PostHog/code

    Official

    Merge a PR into main through the Trunk merge queue and babysit it until it lands.

    179 GitHub stars~1.3k tokensUpdated 2 mo ago
    Auto-check passed
  • Onboarding Videos

    PostHog/code

    Official

    Add, replace, and optimize the looping demo videos in the onboarding "welcome" bento grid (packages/ui/src/features/onboarding).

    179 GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed
  • Quill Code

    PostHog/code

    Official

    Edit the @posthog/quill design system locally and consume the change in this repo (posthog-code) before it is published to npm.

    179 GitHub stars~1.1k tokensUpdated 2 mo ago
    Auto-check passed
  • Storybook Stories

    PostHog/code

    Official

    Write Storybook stories for PostHog UI components. An agent skill from PostHog/code.

    179 GitHub stars~929 tokensUpdated 2 mo ago
    Auto-check passed

Works with

Categories

Questions about Dynamic Workflows

What does Dynamic Workflows do?

How to write JavaScript workflow scripts for the workflow tool - fanning work out across many isolated subagents with agent(), parallel(), and pipeline(), then synthesizing one result. Dynamic Workflows is an agent skill from PostHog/code, published by the product's own GitHub organization. How to write JavaScript workflow scripts for the workflow tool - fanning work out across many isolated subagents with agent(), parallel(), and pipeline(), then synthesizing one result.

When should I use Dynamic Workflows?

Dynamic Workflows fits situations like: A task decomposes into several independent investigations; changes (codebase audits; many-file analysis; multi-perspective review.

How do I install Dynamic Workflows in Claude Code?

Run `npx skills add PostHog/code --skill dynamic-workflows -a claude-code`. Or copy the skill folder (packages/harness/src/extensions/workflow/skills/dynamic-workflows in PostHog/code) into .claude/skills/dynamic-workflows in your project. Claude Code loads it when a task matches its description.

How do I install Dynamic Workflows in Codex?

Run `npx skills add PostHog/code --skill dynamic-workflows -a codex`. Or copy the skill folder (packages/harness/src/extensions/workflow/skills/dynamic-workflows in PostHog/code) into .agents/skills/dynamic-workflows in your project. Codex loads it when a task matches its description.

Can I use Dynamic Workflows 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 PostHog/code --skill dynamic-workflows -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/dynamic-workflows, .gemini/skills/dynamic-workflows, .github/skills/dynamic-workflows and .opencode/skills/dynamic-workflows in your project.

What does Dynamic Workflows need to run?

SKILL.md names no scripts, command-line tools or credentials: Dynamic Workflows is instructions for the agent only.

Does Dynamic Workflows access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Dynamic Workflows 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 Dynamic Workflows use?

Dynamic Workflows 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 Dynamic Workflows use?

About 2.3k tokens (SKILL.md is roughly 9k 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 Dynamic Workflows?

Skills that share tags, products or a category with Dynamic Workflows: Open Dynamic Workflows (xz1220/open-dynamic-workflows, 104 stars), Run Workflow (ginlix-ai/LangAlpha, 1.8k stars), Claude Code Agent Development (anthropics/claude-plugins-official, 37k stars) and Subagent Driven Development (Asvarox/allkaraoke, 261 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Dynamic Workflows?

PostHog (a GitHub organization, an official publisher) maintains it in PostHog/code, which has 179 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on August 5, 2026.

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