From Greenfield
Initializes or audits a project with guardrails for agentic coding: planning, decision-completeness, and evidence-backed changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/greenfield:greenfield [optional: project path][optional: project path]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Install the planning and guardrail harness that keeps an agentic coding project correct
supplements/checklist.mdsupplements/ecosystem-profiles.mdsupplements/exemplars/adr-template.mdsupplements/exemplars/agent-roster.mdsupplements/exemplars/hooks.mdsupplements/exemplars/rules.mdsupplements/exemplars/ticket-template.mdsupplements/exemplars/work-items.mdsupplements/exemplars/work-skill.mdsupplements/interview.mdsupplements/success-factors.mdInstall the planning and guardrail harness that keeps an agentic coding project correct and resumable, into a target repo — empty (init) or existing (audit). Lead with the principles; derive the concrete artifacts at runtime to fit the project's stack.
On invocation, go straight to Process step 1: print the fixed summary below verbatim as
plain text, then ask init vs audit and begin the interview. Do not inspect the working
directory to guess the mode — ask the user. Running /greenfield is the instruction — do
not wait for further direction.
Premise under everything: agent-written code is first-class. It meets the same bar as hand-written code, so the project needs guardrails that keep agent work correct, verifiable, resumable, and consistent — not a lighter standard because "an agent wrote it."
Two rules govern this skill:
./supplements/exemplars/ are reference realizations to adapt to the project's stack,
not templates to copy verbatim. This skill carries every format it needs and depends on
no other skill.These hold across stacks — a data pipeline, a mobile app, an editor plugin — and only their
form varies. Each: the principle → the guardrail that secures it → the failure it prevents.
Depth and per-stack variation live in ./supplements/success-factors.md.
file:line; counts come
from tools; each change is proven — matches <file:line> or novel — validated via <url>. → research step + citation field + a fact-checker agent. Prevents
hallucinated specifics shipping as fact.scenario → expected written as test stubs before implementation.
→ a Verification ticket section + a testing rule. Prevents the agent rationalizing
whatever it produced as correct.tickets/ + WORK-ITEMS.md + docs/adr/. Survives
context loss, compaction, and session boundaries.docs/adr/ +
ADR template. Stops future agents relitigating or silently breaking settled
invariants.verify gate + a commit-time hook. The faster the gate, the more often it runs./work phases. A differently-prompted second
set of eyes catches what the author's context cannot./work Phase 0 + merge gate. Keeps main
releasable and changes reversible..claude/rules/*.md deliver the right constraint at the moment it applies. → layered
CLAUDE.md + rules with paths: globs. A flat instruction wall decays; scoped rules
stay salient./work Phase 1 approach pass (planned) + Phase 8 stop-and-ask
(surprises). Too many asks waste the human; too few risk unapproved drift.model: frontmatter. Match spend to the judgment
required./work retrospective phase. The harness is a living
system; surfaced friction compounds when fixed.Every factor maps to an artifact; the form varies. The interview fills the right column.
| # | Factor | Securing artifact | Varies by stack as… |
|---|---|---|---|
| 1 | Decision-completeness | tickets/TEMPLATE.md + ticket-planner agent | ticket sections drop domain-specific rows |
| 2 | Evidence over recall | Research + proven/novel field + fact-checker | citation targets (docs/repos) |
| 3 | Specify-first | Verification section + testing rule | test framework + assertion style |
| 4 | Externalized memory | tickets/ + WORK-ITEMS.md + docs/adr/ | none (portable) |
| 5 | Decision provenance | docs/adr/ + ADR template | none (portable) |
| 6 | Fast deterministic gate | a single verify command + commit hook | make verify / npm run check / swift test… |
| 7 | Executable architecture | fitness-function tool or rule+reviewer | import-linter / dependency-cruiser / SPM+lint |
| 8 | Independent review | .claude/agents/* roster | which lenses; domain reviewers added |
| 9 | Isolated / green main | /work Phase 0 + merge gate | worktree+ff-only (local) / branch+PR (remote) |
| 10 | Progressive disclosure | layered CLAUDE.md + .claude/rules/* | which path globs |
| 11 | Human-in-the-loop | /work Phase 1 approach pass + Phase 8 triggers | merge approval vs auto-merge |
| 12 | Effort tiering | per-agent model: | available model tiers |
| 13 | Self-improving harness | /work retrospective phase | none (portable) |
Install the refined realizations as the default: parallel review, hook-enforced gate, auto-merge on green, retrospective + next-ticket phases, path-scoped rules, per-module CLAUDE.md. These are the strongest forms of each factor; scale them down for a small project by reducing sizing (fewer ADRs, a trimmed roster), never by dropping a factor.
Add one cadence the per-ticket loop does not cover: a phase-gate audit. At the end of each roadmap phase — not each ticket — seed a ticket that runs a deep, multi-agent audit (an "ultracode" pass: many reviewer subagents fanned out in parallel) across architecture, code correctness, security, and performance. The per-ticket gate and reviewers each see one diff at a time, so cross-cutting drift slips through; the phase boundary is the cheapest place to catch it before it compounds. Fold the audit's findings back in as the next phase's tickets.
Run these steps. Load supplements as each step needs them.
Your first output on invocation — before the mode question and before anything else — is this summary, so the user knows what they are getting. Emit it verbatim and identical every time, as plain text (not a quote, blockquote, or code block), with the bullet list intact:
greenfield installs a planning-and-guardrail harness so agent-written code stays correct and resumable. It secures all 13 success factors with concrete artifacts:
verify command (lint + types + tests +
architecture) is the Definition of Done, run at commit time..claude/rules/* deliver the right
constraint where it applies./work command — ties tickets, the gate, reviewers, and a retrospective together.I'll ask a few questions, then either scaffold a new project (init) or audit this repo and install what's missing (audit).
Then ask the mode outright with one AskUserQuestion — init (scaffold a new project) vs
audit (review this repo and install what's missing). Do not inspect the working
directory or guess the mode from a path argument; ask the user. The target path is not
resolved here — it is the interview's first question (Batch A), so a path passed as
/greenfield <path> only seeds that question's default, it never preselects the mode.
Audit needs the path before profiling. When the user picks audit, take the target path as the interview's first question, then profile the stack there (manifests, build/test/lint config, git remote, source layout) so the remaining questions confirm inferences instead of asking them.
Ask the interview's Batch A first (target path and stack via AskUserQuestion, purpose as a free-text prompt) so you know the project shape to research. That shape — "a Rust CLI", "a SwiftUI to-do app", "a FastAPI service" — is usually one you have not set up before, and recall is not enough to constrain it well. Then, before the architecture questions, fan out a round of research and let primary sources drive the recommendations. Run several searches in parallel (and fetch the sources behind the hits):
./supplements/ecosystem-profiles.md and extend or correct it from what you find.Prefer primary sources; corroborate a secondary claim with a second source. Synthesize into 2-4 candidate architectures, each a named style with its tradeoff and its source — this is the input the interview's architecture question presents. Shorten this only when you can already constrain the stack from primary knowledge and the user confirms.
Resolve the runtime details with ./supplements/interview.md. Infer what you can (in audit,
from the profile); ask only the rest, and ask every question through AskUserQuestion — never a
free-form prose prompt — except purpose, which is a single free-text question. Open-ended
answers like path and stack still go through AskUserQuestion: offer inferred candidate options
and let the user type a custom value in the "Other" field. It resolves: identity, stack, architecture + the boundary to enforce, gate
command, git posture, reviewer roster + model tiers, rules, and scale knobs. Present each
technical choice as researched options: mark
the staff-engineer pick (recommended) with a one-line why and its source, and name the
architecture style and cite the sources that will constrain the project so the user can
accept it or offer their own. Reach decision-completeness before generating — no "TBD".
Author each artifact at runtime, adapted to the project. Use ./supplements/exemplars/* as
references to adapt, not stamp — each carries the format it needs, so no other skill is required.
First emit the would-generate manifest (the files and their one-line purpose) and get the
user's go-ahead; write only what is approved. Declining the manifest writes nothing — that is
the no-write preview, in either mode.
./supplements/checklist.md top to bottom; for each factor, create its
securing artifact. Seed adr-001 with the architecture decision — its named style, the
sources behind it, and the boundary the arch-enforcement guards.check/test script becomes the gate). Migrate inline decisions into
ADRs and backlog/scratch notes into tickets.For factors 6 and 7, map the gate and the boundary check to the stack with
./supplements/ecosystem-profiles.md (Python, Node/TS, Swift, Rust, Go, and a generic fallback).
verify gate once — it must pass green on the seeded project./work skill's agent references all resolve../supplements/checklist.md — every factor present./work it).WORK-ITEMS.md
empty and write tickets/TEMPLATE.md, but do not author a first ticket — recommend it as
the next action (step 5) for the user to /work; write adr-001 (architecture) and
adr-002 (quality gates); install hooks; prove the gate green on the empty scaffold.| If the step is… | Read |
|---|---|
| Understanding/teaching the factors | ./supplements/success-factors.md |
| Auditing a repo or building the to-do | ./supplements/checklist.md |
| Running the interview | ./supplements/interview.md |
| Choosing gate / arch-enforcement / test tooling | ./supplements/ecosystem-profiles.md |
| Authoring a specific artifact | ./supplements/exemplars/<artifact>.md |
./supplements/success-factors.mdWhat: the 13 factors elaborated — mechanism, failure mode, per-stack form. When to read: explaining a factor, or deciding how to realize one for an unusual stack.
./supplements/checklist.mdWhat: factor × securing artifact × present/partial/absent. The single spine for both modes. When to read: every run — it is the build to-do (init) and the gap audit (audit).
./supplements/interview.mdWhat: the question script; infer-vs-ask guidance; AskUserQuestion groupings; how to present
researched options with a (recommended) pick and cited architecture.
When to read: step 3, every run.
./supplements/ecosystem-profiles.mdWhat: concrete gate / arch-enforcement / test / hook mappings for Python, Node/TS, Swift/iOS, Rust, Go, and a generic fallback. When to read: resolving factors 6 and 7 for the project's stack.
./supplements/exemplars/What: "adapt, do not copy" reference realizations — ticket-template.md,
work-items.md, work-skill.md, adr-template.md, agent-roster.md, rules.md,
hooks.md.
When to read: authoring that artifact in step 4.
A run is correct when: the target's verify gate passes green; the commit hook is
installed and fires; every .claude/agents/* referenced by the generated /work resolves;
./supplements/checklist.md shows all 13 factors present; and (audit) git status
shows only intended additions.
npx claudepluginhub davidegreenwald/claude-greenfieldScaffolds greenfield project architecture and AI agent harness via interview-driven decisions. Outputs markdown spec with code structure exemplar, tests, guardrails, CLAUDE.md setup, and unified plan. Invoke via /scaffold for new projects.
Greenfield project scaffolding: architecture decisions, harness setup, and requirements generation via interview-driven derivation chain. Use for new projects or major restructures.
Bootstrap polyglot monorepos or new components by selecting specs, generating AGENTS.md with canonical skill symlinks, and laying an empty folder skeleton. Also audits existing scaffolded repos for drift.