openspec-implementation-loop
Skill210 starsChanged 6 months agoApache-2.0View on GitHub
Orchestrates an end-to-end implementation loop for a single OpenSpec change: select a change, ask commit-only vs PR delivery, triage the change to determine an execution strategy (inline, single-implementor, or per-task) based on change size and complexity, implement tasks using the chosen strategy, run review and validation, feed findings back for fixes, push to origin, then either watch GitHub Actions on the branch (commit mode) or create a PR and delegate PR monitoring to the pr-monitoring-loop skill (PR mode). Use when the user wants to implement an approved OpenSpec proposal/change with iterative review and CI feedback.
- Commits and pushes
We split this skill into the rules it gives an agent
60 rules. About 0 are common, 44 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈44
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 23
Run validation and review at the cadence determined by the strategy
- Very specific: line 27
PR mode: Create a PR, then use the pr-monitoring-loop skill to monitor CI, reviews, comments, mergeability, and verify-openspec approval …
- Distinctive: line 34
If a name is provided, use it.
- Distinctive: line 38
Use the AskUserQuestion tool to let the user choose a single active change
- Distinctive: line 44
Do NOT implement multiple changes in one run
- Distinctive: line 50
Use AskUserQuestion (or an equivalent explicit user prompt) right after step 1.
- Very specific: line 55
Pull request: After the initial push of the implementation loop, create a PR (for example with gh pr create).
- Very specific: line 74
Read every file listed in contextFiles.
- Very specific: line 77
If state: "blocked": stop and explain what artifact is missing.
- Very specific: line 78
If state: "all_done": skip directly to the push / CI stage because all top-level tasks are already complete
- Very specific: line 126
follow the openspec-apply-change skill/process for the change
- Distinctive: line 129
keep changes minimal and focused
- Distinctive: line 130
create small, focused git commits as coherent pieces of work are completed
- Distinctive: line 131
run targeted validation while implementing
- Distinctive: line 132
never push to remote
- Distinctive: line 141
read the OpenSpec context files before editing
- Distinctive: line 147
Ask the implementor to report back with:
- Distinctive: line 177
For all strategies: if the implementor (or the orchestrator in inline mode) is blocked, stop and surface the blocker to the user.
- Distinctive: line 187
Treat it as a Terraform entity change when the change is centered on a Terraform resource or data source, for example:
- Very specific: line 199
prefer targeted acceptance test runs using go test -v [-run 'filter'] <package>
- Very specific: line 200
run them with TF_ACC=1
- Very specific: line 202
before considering starting a new local stack, check whether the Elastic stack is already running using the guidance in …
- Very specific: line 203
only run make testacc when the user explicitly instructs you to run the full acceptance suite
- Distinctive: line 205
If the change does not affect code that has relevant acceptance tests, say so explicitly and explain why targeted acceptance coverage is …
- Very specific: line 215
Proposal compliance review: run the openspec-verify-change skill/process
- Distinctive: line 216
Add coverage review only if the change involves a Terraform entity
- Distinctive: line 220
After all tasks are complete, launch the full parallel review battery once:
- Distinctive: line 232
Run the validation runner in parallel with the other review subagents, not as a separate serial phase.
- Distinctive: line 236
After each top-level task's implementor reports completion, launch the same full parallel review battery described in 7d (validation …
- Distinctive: line 238
Run the validation runner in parallel with the other review subagents for the same top-level task.
- Distinctive: line 250
If there are no actionable findings:
- Distinctive: line 254
If there are actionable findings:
- Distinctive: line 259
After fixes, rerun validation and relevant reviews before advancing:
- Distinctive: line 264
all tasks pass review and the loop reaches push readiness, or
- Distinctive: line 268
If the loop stalls, pause and ask the user how to proceed.
- Distinctive: line 272
After every incomplete top-level task has been implemented and passed local review:
- Distinctive: line 273
verify the branch state is ready to push
- Distinctive: line 275
use upstream tracking if needed
- Distinctive: line 283
Never force-push unless the user explicitly asks
- Distinctive: line 284
Do not push before local review passes
- Distinctive: line 288
If the user chose commit-only in step 2:
- Distinctive: line 302
ask it to fix the issues and commit the changes
- Distinctive: line 312
If the user chose pull request in step 2:
- Very specific: line 315
use gh pr create (or equivalent) with an appropriate title and body tied to the OpenSpec change
- Very specific: line 321
do NOT put the state file under .git/ - this repo uses git worktrees, where .git is a file that points at a worktree-specific git dir, …
- Distinctive: line 325
start a delegate subagent for the PR instead of polling in this main implementation-loop agent
- Very specific: line 328
when the delegate returns delegate, launch a fresh delegate subagent scoped only to the reported failure or feedback (with the same …
- Very specific: line 330
When monitoring in PR mode, tell the PR watcher to opt in to verify-openspec behavior per the pr-monitoring-loop skill.
- Distinctive: line 364
Ask commit vs PR at the start (step 2), not when implementation is finished
- Distinctive: line 365
Always triage the change and announce the execution strategy before implementation
- Distinctive: line 367
Always read the OpenSpec context before implementation
- Distinctive: line 368
Per-task strategy: create a fresh implementor subagent for each top-level task.
- Distinctive: line 369
Single-implementor strategy: use one implementor for all tasks.
- Distinctive: line 371
Never archive a change in this workflow.
- Distinctive: line 374
Run the validation subagent in parallel with the other review subagents, not as a separate serial phase
- Very specific: line 375
All strategies must include make lint, make build, and relevant acceptance tests run according to dev-docs/high-level/testing.md (or an …
- Distinctive: line 376
Run reviewers in parallel whenever possible
- Distinctive: line 377
Prefer actionable findings over style nitpicks
- Distinctive: line 380
Keep commit sizes small and purpose-specific
- Distinctive: line 381
Stop and ask the user if the process becomes ambiguous or stuck
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Orchestrate an implementation loop around a single OpenSpec change.
Input: Optionally specify a change name. If omitted, you MUST ask the user which change to implement.
High-level flow
- Select the change
- Ask delivery mode (commit vs PR) - do this immediately after selecting the change, not after implementation
- Load OpenSpec context
- Triage: determine execution strategy - classify as inline, single-implementor, or per-task based on change size and complexity
- Determine remaining top-level tasks
- Implement tasks using the chosen strategy
- Run validation and review at the cadence determined by the strategy
- Aggregate findings and fix; repeat until clean
- Push the branch to
origin - Commit mode: Watch GitHub Actions on the pushed branch/commit
PR mode: Create a PR, then use the
pr-monitoring-loopskill to monitor CI, reviews, comments, mergeability, andverify-openspecapproval through watcher and delegate subagents - Report final outcome
Steps
Select exactly one change
If a name is provided, use it.
Otherwise:
- Run
openspec list --json - Use the AskUserQuestion tool to let the user choose a single active change
- Show the change name, schema if available, and status
IMPORTANT:
- Do NOT guess
- Do NOT auto-select
- Do NOT implement multiple changes in one run
Always announce:
Using change: <name>.- Run
Choose delivery mode (ask immediately - before loading context or starting the implementor)
Use AskUserQuestion (or an equivalent explicit user prompt) right after step 1. Do not defer this until after implementation or push.
Offer two options:
- Commit-only: Push your work to
originon the current branch. After each push, monitor GitHub Actions for the branch / commits you pushed (same behavior as the historical workflow). - Pull request: After the initial push of the implementation loop, create a PR (for example with
gh pr create). Then monitor PR workflow runs (checks on the PR), and actively handle PR reviews as described in step 11.
Record the user's choice and refer to it from push onward (steps 9–11).
- Commit-only: Push your work to
Load OpenSpec status and context
Run:
openspec status --change "<name>" --json openspec instructions apply --change "<name>" --jsonParse the outputs to determine:
schemaName- current task progress
statecontextFiles- the ordered list of top-level tasks (for example
1,2,3) and which of them are still incomplete
Read every file listed in
contextFiles.Handle states:
- If
state: "blocked": stop and explain what artifact is missing; suggest continuing the change artifacts first - If
state: "all_done": skip directly to the push / CI stage because all top-level tasks are already complete - Otherwise: proceed to triage and implementation
Triage: determine execution strategy
Evaluate the change to choose an execution strategy that balances implementation quality with subagent overhead. The goal is to avoid spawning unnecessary subagents for small changes while preserving full rigor for large ones.
Signals to evaluate:
Signal Source Top-level task count Count ## N.headings in tasksTotal subtask count Count - [ ]/- [x]itemsFile scope Infer from task descriptions - single package/area vs. cross-cutting Inter-task coupling Do later tasks build directly on earlier ones? Complexity Do tasks involve non-trivial logic (custom types, plan modifiers, complex CRUD) or are they straightforward (config, docs, Makefile, CI, specs)? Choose one of three strategies:
Strategy When to use Implementation Review Inline ≤2 top-level tasks AND ≤~10 subtasks AND single area AND straightforward changes Orchestrator implements directly, no implementor subagent Run validation commands directly; spawn review subagents only if the change touches non-trivial logic Single-implementor ≤4 top-level tasks OR ≤~15 subtasks, with coherent scope One implementor subagent handles all remaining tasks One round of parallel review after all tasks complete Per-task >4 top-level tasks, OR >15 subtasks, OR multi-area scope, OR tasks are largely independent across different packages Fresh implementor per top-level task Full parallel review after each top-level task These thresholds are guidelines, not rigid rules. Use judgment:
- A 3-task change where each task is in a different package might warrant per-task
- A 5-task change that is all in one file might be fine as single-implementor
- A 2-task change with complex custom type logic might benefit from single-implementor over inline for the review coverage
Announce the chosen strategy and reasoning. The user can override.
Determine the remaining top-level tasks
Build an ordered queue of incomplete top-level tasks from the OpenSpec task list.
Interpret a top-level task as the parent task number such as
1,2, or3. Each top-level task includes all of its nested subtasks such as1.1,1.2,1.3.For each incomplete top-level task:
- gather the subtasks that belong to it
- understand the intended scope from the proposal/design/specs
- process the top-level tasks sequentially unless the user explicitly asks for a different strategy
Implement tasks using the chosen strategy
Inline strategy:
The orchestrator implements all tasks directly without spawning an implementor subagent:
- follow the
openspec-apply-changeskill/process for the change - sync delta specs when implementation requires spec synchronization, but never archive the change
- ignore any task that asks for the change to be archived;
verify-openspecis responsible for archiving when it is satisfied - keep changes minimal and focused
- create small, focused git commits as coherent pieces of work are completed
- run targeted validation while implementing
- never push to remote
Single-implementor strategy:
Launch one write-capable subagent for all remaining tasks:
- instruct it to implement all remaining top-level tasks in sequence, completing all nested subtasks within each before moving to the next
- follow the
openspec-apply-changeskill/process for the change - sync delta specs when implementation requires spec synchronization, but never archive the change
- ignore any task that asks for the change to be archived;
verify-openspecis responsible for archiving when it is satisfied - read the OpenSpec context files before editing
- keep changes minimal and focused
- create small, focused git commits as coherent pieces of work are completed
- run targeted validation while implementing
- never push to remote
Ask the implementor to report back with:
- top-level tasks completed
- nested subtasks completed
- commits created
- tests run
- blockers or open questions
Per-task strategy:
Launch a dedicated fresh write-capable subagent for the current top-level task only. Do not reuse the prior task's implementor for later top-level tasks.
The implementor prompt should instruct it to:
- implement only the selected change
- focus only on the current top-level task and complete all of its nested subtasks before stopping
- follow the
openspec-apply-changeskill/process for the change - sync delta specs when implementation requires spec synchronization, but never archive the change
- ignore any task that asks for the change to be archived;
verify-openspecis responsible for archiving when it is satisfied - read the OpenSpec context files before editing
- keep changes minimal and focused
- create small, focused git commits as coherent pieces of work are completed
- run targeted validation while implementing
- never push to remote
Ask the implementor to report back with:
- the top-level task completed
- nested subtasks completed
- commits created
- tests run
- blockers or open questions
For all strategies: if the implementor (or the orchestrator in inline mode) is blocked, stop and surface the blocker to the user.
- follow the
Run validation and review
The validation and review cadence depends on the execution strategy.
7a. Determine the review type
Inspect the change artifacts and implementation to decide whether this is a Terraform entity change.
Treat it as a Terraform entity change when the change is centered on a Terraform resource or data source, for example:
- specs reference
Resource implementation:orData source implementation: - changed code is primarily in a resource/data source package
7b. Validation requirements (all strategies)
Required baseline commands:
- run
make lint - run
make build
Required acceptance-test validation:
- determine which acceptance tests are relevant to the code changed
- prefer targeted acceptance test runs using
go test -v [-run 'filter'] <package> - run them with
TF_ACC=1 - include the commonly required environment variables from
dev-docs/high-level/testing.mdwhen needed:ELASTICSEARCH_ENDPOINTS,ELASTICSEARCH_USERNAME,ELASTICSEARCH_PASSWORD, andKIBANA_ENDPOINT - before considering starting a new local stack, check whether the Elastic stack is already running using the guidance in
dev-docs/high-level/testing.md - only run
make testaccwhen the user explicitly instructs you to run the full acceptance suite
If the change does not affect code that has relevant acceptance tests, say so explicitly and explain why targeted acceptance coverage is not applicable.
7c. Inline strategy: lightweight review
The orchestrator runs validation commands (
make lint,make build, relevant acceptance tests) directly rather than spawning a validation subagent.For straightforward changes (config, docs, Makefile, CI, spec-only), a self-review by the orchestrator is sufficient. Do not spawn review subagents.
For changes that touch non-trivial logic (custom types, plan modifiers, complex CRUD, error handling), spawn a minimal set of review subagents:
- Critical code review: review for coding standards, idiomatic patterns, logic issues, error handling gaps
- Proposal compliance review: run the
openspec-verify-changeskill/process - Add coverage review only if the change involves a Terraform entity
7d. Single-implementor strategy: one review round
After all tasks are complete, launch the full parallel review battery once:
a. Validation runner - launch a dedicated validation subagent to run the validation requirements from step 7b. Use a subagent so these checks do not consume the orchestrator's working context.
b. Critical code review - review for coding standards, idiomatic Go/Terraform provider patterns, obvious logic issues, error handling gaps, and risky regressions. Return prioritized findings only.
c. Proposal compliance review - run the
openspec-verify-changeskill/process for the same change. Return only actionable mismatches, missing work, or notable warnings.d. Coverage review for Terraform entities - if this is a Terraform entity change, run the
schema-coverageskill/process. Focus on untested or weakly tested high-risk attributes and behaviors.e. Coverage review for non-entity changes - if this is not a Terraform entity change, run a thorough test analysis instead. Prefer explicit coverage tooling where possible, for example
go test -cover. Identify high-risk code paths that lack direct test coverage.Run the validation runner in parallel with the other review subagents, not as a separate serial phase.
7e. Per-task strategy: review after each top-level task
After each top-level task's implementor reports completion, launch the same full parallel review battery described in 7d (validation runner, critical code review, proposal compliance review, and the appropriate coverage review).
Run the validation runner in parallel with the other review subagents for the same top-level task.
For all review subagents, ask them to return:
- severity
- concise finding
- evidence
- recommended fix
- specs reference
Aggregate findings and decide whether to loop
Combine the validation results and review outputs into a single actionable list.
If there are no actionable findings:
- Inline / single-implementor: proceed to push
- Per-task: mark the current top-level task as locally complete; start a fresh implementor for the next incomplete top-level task, or proceed to push if none remain
If there are actionable findings:
- Inline: the orchestrator fixes the issues directly with minimal diffs and additional small focused commits
- Single-implementor: resume the implementor subagent, give it the aggregated findings, and ask it to fix them with minimal diffs and additional small focused commits
- Per-task: resume the current top-level task's implementor subagent, give it the aggregated findings, and ask it to fix them with minimal diffs and additional small focused commits
After fixes, rerun validation and relevant reviews before advancing:
- Inline / single-implementor: rerun before proceeding to push
- Per-task: rerun before moving to the next top-level task
Repeat until:
- all tasks pass review and the loop reaches push readiness, or
- the implementor (or orchestrator) becomes blocked, or
- the same issue repeats without progress
If the loop stalls, pause and ask the user how to proceed.
Push the branch
After every incomplete top-level task has been implemented and passed local review:
- verify the branch state is ready to push
- push the current branch to
origin - use upstream tracking if needed
Example:
git push -u origin HEADGuardrails:
- Never force-push unless the user explicitly asks
- Do not push before local review passes
- Commit-only mode: watch GitHub Actions (branch / commits)
If the user chose commit-only in step 2:
After pushing:
- inspect workflow runs for the current branch and the commits you pushed (for example with
gh run listfiltered by branch, orghagainst the latest commit SHA) - watch or poll the latest relevant workflow runs until they complete
- expect the acceptance test suite to take around 15 minutes to complete
- once the only remaining jobs are long-running acceptance tests, poll less frequently instead of checking aggressively
If CI succeeds:
- finish with a concise summary (or continue to step 12 if you already reported)
If CI fails:
- collect the failing workflow, job, and relevant log details
- launch a fresh write-capable implementor subagent scoped only to resolving the CI failures
- ask it to fix the issues and commit the changes
- push again
- continue watching CI
Repeat until:
- CI is green, or
- a failure cannot be resolved without user input
PR mode: create PR, watch PR checks, poll reviews, address feedback
If the user chose pull request in step 2:
Create the PR after the initial push (step 9), if it does not already exist:
- use
gh pr create(or equivalent) with an appropriate title and body tied to the OpenSpec change - record the PR number or URL
State file:
- the script auto-uses
.agents/skills/pr-monitoring-loop/scripts/state/.pr-monitor-<pr>.json(gitignored), so subagents can simply invokecheck-pr-state.py <pr>andlastPolledAt/ seen IDs persist across watcher restarts without any explicit path management - pass
--state-file <path>only when you need isolation (e.g., parallel watchers on different branches that share a PR number, or tests). When you do override, pass the same path to every subagent in this loop - do NOT put the state file under
.git/- this repo uses git worktrees, where.gitis a file that points at a worktree-specific git dir, which would fragment state across worktrees watching the same PR
Delegate PR monitoring to
pr-monitoring-loop:- load and follow the
pr-monitoring-loopskill for the entire PR monitoring phase - start a delegate subagent for the PR instead of polling in this main implementation-loop agent
- instruct the delegate to invoke
.agents/skills/pr-monitoring-loop/scripts/check-pr-state.py <pr>on every cadence tick (or use--watchwith the cadence guidance documented inpr-monitoring-loop) so CI (commit-pinned), reviews, PR comments, review comments, unresolved threads, merge conflicts, and stale branch state are checked together. Append--state-file <path>only if you decided to override the default path above. - allow the delegate to fix and push changes it judges simple, then perform the thread-resolution protocol for any addressed threads (reply with addressing commit SHA, then
resolveReviewThread), and continue watching the new PR head - when the delegate returns
delegate, launch a fresh delegate subagent scoped only to the reported failure or feedback (with the same--state-file); after the delegate commits, pushes, replies, and resolves addressed threads, restart the watch cycle for the new head commit with a new delegate
When monitoring in PR mode, tell the PR watcher to opt in to
verify-openspecbehavior per thepr-monitoring-loopskill. Thepr-monitoring-loopskill defines when to apply theverify-openspeclabel (viarequiresOpenspecVerification) and when the PR is considered verified (runState == "approved"). Do not restate those rules here.- use
Report final outcome
Summarize:
- change name
- schema
- delivery mode (commit-only vs PR)
- execution strategy used (inline, single-implementor, or per-task) and reasoning
- implementation/review/CI loop status
- top-level tasks completed in the loop
- commits created during the loop
- local validation run during the loop (
make lint,make build, and relevant acceptance tests or an explicit explanation when acceptance tests were not applicable) - tests or coverage checks used
- final CI state (and PR link if PR mode)
- PR review handling summary if PR mode (including polling cadence, whether the loop restarted after pushes, and whether
verify-openspecapproved the PR or timed out) - any remaining blockers or risks
Recommended subagent responsibilities
Subagent usage scales with the chosen strategy:
- Implementor (single-implementor and per-task strategies): makes code changes, updates tasks, runs targeted validation, and creates small focused commits. Per-task uses one fresh implementor per top-level task; single-implementor uses one for the entire change.
- Validation runner (single-implementor and per-task strategies): a subagent that runs
make lint,make build, and relevant acceptance tests, then reports a concise validation summary. Use a subagent so validation does not consume the orchestrator's context. - Critical reviewer: reviews code quality and logic
- Spec reviewer: checks the implementation against the approved OpenSpec change
- Coverage reviewer: checks test coverage quality using the appropriate strategy
- PR watcher: a fresh subagent using
pr-monitoring-loopto poll PR state, directly fix simple actionable issues, and return non-simple work to the main agent for delegation to a fresh subagent
For the inline strategy, the orchestrator fills the implementor and validation runner roles directly. Review subagents are spawned only when the change touches non-trivial logic.
Guardrails
- Operate on one change only
- Ask commit vs PR at the start (step 2), not when implementation is finished
- Always triage the change and announce the execution strategy before implementation
- The user can override the chosen strategy at the triage step
- Always read the OpenSpec context before implementation
- Per-task strategy: create a fresh implementor subagent for each top-level task; do not reuse one implementor across top-level tasks. Do not advance to the next top-level task until the current task has passed local review.
- Single-implementor strategy: use one implementor for all tasks; run one review round after all tasks complete
- Inline strategy: the orchestrator implements directly; spawn review subagents only for non-trivial logic changes
- Never archive a change in this workflow; only sync delta specs when needed
- Ignore tasks that request archiving the change proposal;
verify-openspecwill archive the change when it is happy - For single-implementor and per-task strategies, run local validation in a dedicated subagent so the orchestrator does not spend its own context on lint/build/test execution
- Run the validation subagent in parallel with the other review subagents, not as a separate serial phase
- All strategies must include
make lint,make build, and relevant acceptance tests run according todev-docs/high-level/testing.md(or an explicit explanation when acceptance tests are not applicable) - Run reviewers in parallel whenever possible
- Prefer actionable findings over style nitpicks
- Feed local review and commit-mode CI failures back into the loop instead of fixing them ad hoc outside the loop
- In PR mode, use
pr-monitoring-loop; do not spend main-agent context on repeated PR polling - Keep commit sizes small and purpose-specific
- Stop and ask the user if the process becomes ambiguous or stuck
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- elastic/terraform-provider-ec★ 18339% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- existing-entity-requirementsSkill
- flaky-test-catcherSkill
- new-entity-requirementsSkill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-continue-changeSkill
- openspec-exploreSkill
- openspec-new-changeSkill
- openspec-plus-applySkill
- openspec-plus-designSkill
- openspec-plus-proposalSkill
- openspec-plus-specSkill
- openspec-plus-tasksSkill
- openspec-plus-tddSkill
- openspec-proposeSkill
- openspec-sync-specsSkill
- openspec-verify-changeSkill
- pr-monitoring-loopSkill
- requirements-verificationSkill
- schema-coverageSkill
- agentic-workflowsSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

