From pg-plugin
Use when the user states something they want — a goal, wish, feature, fix, or annoyance ("I want…", "set a goal", "/define-goal"), asks to clarify success criteria or turn fuzzy intent into a measurable objective, OR hands over a document with multiple items (bug report doc, feedback list, meeting notes) to convert. Also use to add work to the docs/goals queue. Defines goals only; never starts the implementation work.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pg-plugin:define-goalThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Shape the user's intent into a goal contract an agent can pursue honestly: a measurable
Shape the user's intent into a goal contract an agent can pursue honestly: a measurable outcome, explicit evidence, bounded scope, and a stop condition. The user may not be an engineer — plain language with them; precise, verifiable contracts in the artifacts.
Every goal ends at one of two destinations:
/goal line for this session or a headless run.docs/goals/ queue for dispatch to work.Defining ends the skill. Never implement. Do not create planning artifacts, ledgers, decision logs, or resume files beyond the goal file itself.
There is no create_goal or get_goal tool. The built-in /goal command is user-run only:
after each turn, a separate evaluator model reads the conversation transcript and checks
whether the condition holds (condition cap: 4,000 chars). The evaluator cannot run commands
or read files — every clause must be provable by output that appears in the transcript
(test results, exit codes, diffs, counts). Never write taste conditions ("clean", "better").
Quality bar before handing off — the contract must answer: what concrete thing will be true? what evidence proves it? what threshold defines success? what scope bounds matter? what should cause the agent to stop and ask?
When the want is a bug, or a feature touching code you can't pin from a quick read, do NOT investigate in your own context — fan out read-only subagents, all in ONE message so they run concurrently:
Explore agent type (read-only,
runs on a fast cheap model by design); no Explore in this environment → a general
subagent with model: haiku. At most one judgment agent per fan-out with
model: sonnet to weigh the evidence and rank root-cause hypotheses — search agents
report what the code shows (files, call paths, suspect commits); ranking what it means
happens in the sonnet agent or your own synthesis. The queue's config.model never
applies here — it governs code-writing agents only.git log/blame on suspect areas), config/wiring (flags, env,
versions). For a feature: where similar features live, surfaces to touch (routes, UI,
schema, jobs), constraints (migrations, auth, test layout).path:line, a hypothesis WITH evidence, confidence, and what would confirm it./goal line in a code block (built-in slash commands cannot be invoked by
Claude); for headless or scheduled runs show claude -p "/goal …". If a goal is already
active this session and matches, continue under it instead of duplicating./dispatch once, or keep it running with /loop 15m /dispatch.docs/goals/
├── index.yaml # config + queue state — status lives ONLY here
├── 001-<slug>.md # goal contracts — content only, never status
├── archive.yaml # archived completed entries (created by dispatch hygiene)
└── done/ # archived completed goal files
index.yaml — a config: block, then one line-block per goal, queue order top-to-bottom
within priority:
# docs/goals/index.yaml — queue state. Status changes: orchestrator only, via the
# claim protocol in the dispatch skill.
# status: not_started | in_progress | completed | blocked
config:
base: main # integration branch — goals branch FROM it and merge BACK to it
merge: pr # pr = a human merges | auto = the factory merges after gates pass
wip: 2 # max goals in progress at once (parallelism)
model: inherit # spawned code agents: inherit | a model alias (sonnet, haiku, opus)
skills: [] # repo-wide skills every implementer must invoke
execution: native # native = in-process agents | herdr = fresh claude per goal in a herdr worktree pane (needs the herdr CLI on the runner)
autonomy: balanced # herdr only: conservative | balanced | bold — how readily the orchestrator auto-answers a blocked implementer vs escalates to you
goals:
001-receipt-emails: {status: not_started, priority: high}
002-rate-limit-api: {status: not_started, depends_on: [001-receipt-emails]}
On first queue creation, ask the user once (AskUserQuestion): which branch is the
integration base (main? staging? other?), and the merge policy (pr — safest, a human
merges every PR; auto — the factory rebases, re-verifies, and merges back itself).
Defaults when unspecified: the repo's default branch, merge: pr, wip: 2,
model: inherit, no repo skills, execution: native, autonomy: balanced.
model: sonnet trades implementation depth for
weekly-limit headroom — sensible on simple repos, not on gnarly ones. A per-goal base:
field on an index entry overrides config.base (epic branches). execution: herdr
requires the herdr CLI on the runner; absent it, dispatch degrades to native.
Rules that keep the queue safe:
index.yaml, never in goal-file frontmatter — dual-write drifts.status: not_started. Only
dispatch changes status afterward.NNN-slug (zero-padded, next = max existing + 1; slug = 2–4 kebab-case words
from the title). Never renumber; priority is an index field, not a filename position.priority is optional (default normal) — set high only when the user signals urgency.chore(goals): add <id> (one commit per batch is fine) on
the queue's base branch, and push. Push rejected → git pull --rebase; if another
session minted your NNN meanwhile, renumber YOUR new goal (file + entry) to the next
free number and push again — never renumber existing goals. If the repo forbids direct
commits to the base branch, use a short-lived branch + PR and tell the user the goal
enters the queue when it merges. Create docs/goals/ and index.yaml on first use.---
id: 001-receipt-emails
title: Customers get a receipt email after payment
created: 2026-06-12
type: feature # bug | feature | chore — shapes the contract, see below
skills: [] # goal-specific skills the implementer must invoke, e.g. [agent-browser]
---
## Outcome (plain language)
<one paragraph the user can recognize their want in>
## Context / why
<source (request or report excerpt), plus code areas you located>
## Acceptance criteria
- [ ] <observable behavior 1>
- [ ] <repo's typecheck/lint command> exits 0
- [ ] <repo's owning-package test command> passes
- [ ] For UI work: verified in the browser, screenshot attached to the PR
## Constraints (hard rules)
<repo hard rules from CLAUDE.md/AGENTS.md, verbatim>
- Never merge mid-work — merge-back follows the queue's merge policy (a human under
`pr`, the orchestrator under `auto`). Never push protected branches.
- Never edit docs/goals/ — the orchestrator owns queue state.
## Out of scope
<bullets>
## If blocked
Stop and report attempted paths, evidence, the blocker, and what would unlock you.
## Goal contract
/goal <acceptance criteria restated as one transcript-verifiable condition: exact commands
+ expected outputs, the constraints above, and "open a PR from branch goal/<id> targeting
the queue's base branch, whose body includes 'Goal: <id>', a plain-language summary for a
non-technical reviewer, and verification evidence (test output, screenshots)."> Stop when
every criterion verifiably passes, or when blocked (follow "If blocked") — never grind
past a blocker.
Titles are plain language ("Customers get a receipt email after payment"), not jargon.
One goal = one independently shippable change; split an ambitious want only when the parts
ship and verify independently, ordering with depends_on. Goals run in parallel up to
config.wip, so also chain with depends_on any two goals that will touch the same
files — a dependency is far cheaper than a merge conflict between parallel implementers.
Populate the frontmatter skills: field from the skills actually available in this
session (the available-skills list), matched to the code area you located — domain skills
only (browser/UI verification, platform skills like Cloudflare or Postgres, a project's
own skills), at most ~4, never invented names. Method skills (TDD, plans, verification)
are mandated by dispatch's brief — don't repeat them. Repo-wide skills belong in
config.skills instead; suggest moving one there when every goal would list it.
Shape by type: — each type has a non-negotiable element, and it overrides the
template's stock criteria where they conflict (a bug's failing test goes first, above the
behavior criteria; a chore's full-suite check replaces the owning-package one):
path:line evidence (including the losing ones — the implementer's failing
test arbitrates). First acceptance criterion, always: "a failing test reproducing the
root cause, passing after the fix."The Goal contract section is the implementer's completion condition — dispatch hands the
whole file to its implementer, and the user can run it directly via claude -p "/goal …".
Keep the contract line under the 4,000-char cap (reference the file's sections instead of
restating when long), and phrase UI evidence as transcript-visible output (the screenshot
capture command's output and the PR URL), never as the attachment itself — the evaluator
only reads text.
When given a document (pasted text, file path, attachment):
index.yaml AND archive.yaml (an archived goal can
otherwise be re-filed). Pure questions/opinions → "not goal-able".id | proposed title | priority | dup-of | notes.Sizing the orchestration: with ~5+ confirmed items and the Workflow tool available
(Claude Code ≥2.1.154; can be disabled — never assume it), run the per-item work as one
workflow — pipeline(items, locate, draft) with finder agents on cheap models — instead
of repeated fan-outs; drafts land in script variables, never as files — the step-4
approval table still gates every file write. The user also approves the workflow's phase
plan before it runs. Below that size, or without the tool, the plain Recon fan-out is
cheaper and simpler — the Claude Code docs' own threshold.
/dispatch, or /loop 15m /dispatch).Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub pragmaticgrowth/pg-plugin --plugin pg-plugin