agentleFS
flegarsflegars/greenlyt/skills/run/SKILL.md

run

Skill0 starsChanged 21 days agoMITView on GitHub

Runs the greenlyt loop on an approved spec. A test writer writes failing tests first, a developer makes them pass, and four independent reviewers (spec, architecture, security, non-regression) challenge the result round after round, until the tests are really green and no blocking objection is left. A refactoring agent then simplifies the code, which is reverted if it breaks anything, and a draft pull request is opened on GitHub or Azure DevOps. Reports deviations from the spec, and stops with a failure report and open questions when the attempt cap is reached. Resumes an interrupted, waiting or failed run. Trigger on /greenlyt:run, "run the greenlyt loop on <slug>", "implement the spec <slug> with greenlyt".

57 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use report, status and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    report

    Turn an exploration (threads, findings, charts) into a single Markdown report — note, blog post, executive summary, KPI dashboard, slide brief, or multi-section analytical report, with embedded charts.

    Also in 5 projects that use this

  • AnthropicSkill

    status

    Case status summary by audience — client-facing (plain language), internal (for the professor), or court-ready (formal caption format per local rules). Same facts, different framing and depth. Use when a student needs to update the client, brief the professor, or prepare a court status report.

    Also in 5 projects that use this

  • BlockSkill

    plan

    Draft a TDD, PRD, or lightweight plan in the conversation without committing it.

    Also in 6 projects that use this

  • MicrosoftSkill

    doctor

    Diagnose an Amplifier CLI environment through the CLI doctor agent. USE WHEN a user requests CLI runtime, settings or missing-capability inspection. DO NOT USE for project bugs or other hosts.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    verify

    End-to-end app testing pipeline for browser-based web apps on cloud browsers via Azure Playwright Workspaces: verify the live app, author tests for working flows, heal failing tests, then re-run with video and produce one consolidated report. Three phases (app verification, test authoring, test healing) plus a scoped final sanity run; each phase emits a sub-report. Use when asked to "verify my app", "make sure my app works and has good test coverage", "do a full QA pass", "add tests where I'm missing coverage", "fix failing tests and add new ones", "smoke test before deploy", "QA my deployment", or any combined verify-and-test ask. Requires Azure CLI (`az login`) and a Playwright Workspace resource ID — bootstraps configs on first invocation. Browser-based web apps with Playwright only — not for unit/API tests, native mobile/desktop, load/perf, or full accessibility audits.

    Also in 6 projects that use this

  • AnthropicSkill

    debug

    Structured debugging session — reproduce, isolate, diagnose, and fix. Trigger with an error message or stack trace, "this works in staging but not prod", "something broke after the deploy", or when behavior diverges from expected and the cause isn't obvious.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 0 are distinctive, and 9 are very specific to this project.

  • 0

    Common

    Most of the 54 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    failed: check that the spec has Status: approved, otherwise point to /greenlyt:spec <slug> and stop.

    line 60
  2. Very specific:

    Tests first: Run this step when no test is locked yet ("$GL" state get <run_id> '.lockedTests | length' is 0, which also covers a round 1 …

    line 81
  3. Very specific:

    Start greenlyt:test-writer with the spec path, the round, the already locked files, and (after round 1) those coverage objections.

    line 82
  4. Very specific:

    Implementation: Start greenlyt:implementer with:

    line 85
  5. Very specific:

    Start greenlyt:refactorer with the spec path, the baseBranch and the non-blocking remarks ("$GL" state get <run_id> '[.verdict.objections[] …

    line 105
  6. Very specific:

    If git status --porcelain -- .

    line 106
  7. Very specific:

    Read "$GL" state get <run_id> .verdict.deviations and "$GL" config .deviations.

    line 117
  8. Very specific:

    Fix: if attempt < maxAttempts → "$GL" state set-status <run_id> running, "$GL" env up and back to 2.1, passing these deviations to the …

    line 122
  9. Very specific:

    Write to $S/<run_id>.acceptance.md the Markdown AC → evidence table (one row per criterion of the spec: | AC-n | test(s) | file(s) |), …

    line 128

“Common” is measured: kept by at least 6 in 10 of the 54 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/greenlyt:run

Orchestrates the loop. Every operation on state, tests, git and the forge goes through the plugin's CLI. Never edit .greenlyt/state/ by hand, and never claim a result the CLI has not observed.

GL="${CLAUDE_PLUGIN_ROOT}/bin/greenlyt"
S=".greenlyt/state"

The run happens where you are. Every command, agent and git operation runs in the current working directory: the worktree Claude was started in (Orca, claude --worktree…) or the repository itself. Never cd, git -C or copy files into another clone or worktree of the repository, even if the run looks easier to do there. When the tests cannot run on this directory as configured, section 0 mounts a disposable test environment for it instead.

Tests always go through the CLI: "$GL" test <run_id> for the loop, and "$GL" env run-tests for the agents. Whenever an agent below is told to run the test suite, give it this exact command line, with $GL expanded to its absolute path.

Agents

AgentRoleWrites
greenlyt:test-writerWrites the failing tests that prove each acceptance criterion (TDD)tests only
greenlyt:implementerMakes the locked tests passproduction code
greenlyt:spec-reviewerSpec conformance, AC coverage, deviations, spec issuesnothing
greenlyt:architecture-reviewerProject architecture, patterns, placement, dependenciesnothing
greenlyt:security-reviewerInjection, secrets, authz, validation, dependenciesnothing
greenlyt:regression-reviewerExisting tests, public contracts, out-of-scope behaviornothing
greenlyt:refactorerSimplifies the change once it is approvedproduction code
greenlyt:env-scoutWorks out how to run the tests on this worktree (section 0)nothing

The reviewers to run are those listed in "$GL" config .reviewers (default: spec, architecture, security, regression). Reviewer <name> is the agent greenlyt:<name>-reviewer.

A Stop hook keeps you from stopping while the run is running. Kill switch: before every step below, run "$GL" killed. If it exits 0, run "$GL" state set-status <run_id> aborted, then "$GL" env down, and hand back immediately.

0. Test environment

Runs before section 1, for a new run and for a resumed one.

  1. "$GL" env show prints the recipe remembered for this repository (shared by all its worktrees). If there is one, announce it in one line (summary, savedAt) and go to 0.3.
  2. Otherwise start greenlyt:env-scout with the testCommand ("$GL" config .testCommand). Extract its JSON block and write it to $S/env-recipe.json.
    • "needed": false → "$GL" env save $S/env-recipe.json, say in one line that the tests run as configured, then 0.3.
    • "needed": true → show the user the summary, the evidence, the three commands (setup, testCommand, teardown), what it creates, the disk usage, the prerequisites and the limits. Ask with AskUserQuestion: mount it (and remember it for the next runs), adjust it (take their corrections into $S/env-recipe.json, then ask again), or cancel (stop, no run). On approval, "$GL" env save $S/env-recipe.json. Exit code 2 means the recipe is invalid: have the scout fix it with the CLI's message.
  3. "$GL" env up mounts the environment (does nothing if it is already mounted or not needed). On failure (exit 3), the CLI has already run the teardown: show the output, offer "$GL" env forget so that the next /greenlyt:run scouts again, and stop.

From now on the environment stays mounted until the run hands back to the user. Every time the run hands back to the user (preflight failure, kill switch, success, failure, waiting for a decision, any stop) run "$GL" env down first, so nothing mounted for the tests is left on the machine. Exit code 4 means the teardown failed: show its output and tell the user what may still be mounted. The Stop hook also runs env down once no run is in progress, as a safety net.

1. Start

The argument is the slug. The spec is <docsDir>/specs/<slug>.md, where docsDir comes from "$GL" config .docsDir.

  1. run_id=$("$GL" state find <slug>) finds an existing run (running, stalled, waiting or failed). If found, git checkout <branch of the run> ("$GL" state get <run_id> .branch), then by status:
    • running or stalled (interrupted run): "$GL" state set-status <run_id> running, then read "$GL" state get <run_id> .refactor.status:
      • running → step 3.2 (refactoring was interrupted: revert it);
      • applied, unchanged or reverted → step 3.3 (refactoring is over);
      • empty, and "$GL" decide <run_id> prints success → step 3.1 (the last round was approved);
      • otherwise → section 2 (Loop).
    • waiting: go straight to step 3.3 (decision on deviations).
    • failed: check that the spec has Status: approved, otherwise point to /greenlyt:spec <slug> and stop. If the spec changed and is not ignored (git check-ignore -q <spec> fails), commit it (git add <spec> && git commit -m "docs(greenlyt): update spec <slug>"). Then "$GL" state rebudget <run_id> and go to section 2 (Loop).
  2. Otherwise, run_id=$("$GL" preflight <docsDir>/specs/<slug>.md). On failure, "$GL" env down, explain the code to the user and stop:
CodeMeaning
10no config, or no testCommand → /greenlyt:init
11kill switch is on
12spec missing or not approved → /greenlyt:spec
13the working tree is not clean → commit or stash
14another run is already in progress → resume it with /greenlyt:run <its slug>, or abort it with "$GL" state set-status <run_id> aborted
15the test suite already fails on the base branch
16started on a protected branch and the work branch <branchPrefix><slug> already exists
17started on a protected branch and the config or the spec is missing from the base branch → commit .greenlyt/config.json on the base branch

Preflight runs in place on the current branch when it is not protected (typically a worktree's own branch); it creates <branchPrefix><slug> from the base branch only when you start on a protected branch. Announce the run: run-id, branch, cap, reviewers.

2. Loop

Repeat:

  1. attempt=$("$GL" state next-attempt <run_id>). Exit code 3 (cap reached) → step 4.
  2. Tests first. Run this step when no test is locked yet ("$GL" state get <run_id> '.lockedTests | length' is 0, which also covers a round 1 interrupted before locking), and otherwise only if the previous verdict has blocking objections about missing or meaningless tests (refs AC-n from the spec reviewer):
    1. Start greenlyt:test-writer with the spec path, the round, the already locked files, and (after round 1) those coverage objections.
    2. "$GL" tests lock <run_id> <file>... with exactly the files listed under "Files to lock" in its summary. A file that is already locked keeps its original version: the test writer cannot rewrite a locked test either.
    3. "$GL" test <run_id>: the new tests must be red. If the suite is green, start the test writer once more and tell it its tests prove nothing, then repeat 2.2.2 and 2.2.3 once. If it is still green, "$GL" state tdd-warning <run_id> "<which tests were already green>" and go on.
  3. Implementation. Start greenlyt:implementer with:
    • the spec path, the round attempt / maxAttempts, the locked test files ("$GL" state get <run_id> '.lockedTests | keys');
    • from round 2 on: the blocking objections of the previous verdict ("$GL" state get <run_id> '[.verdict.objections[] | select(.severity != "minor")]') and the test output ("$GL" state get <run_id> .tests.tail);
    • the deviations the user asked to remove, if any.
  4. Checks. "$GL" tests check <run_id>: a non-zero exit means a locked test or the greenlyt config was changed; it becomes a critical objection, which greenlyt verdict picks up by itself. Then "$GL" test <run_id>: the recorded exit code is the only one that counts.
  5. Review. Start all configured reviewers in parallel, in a single message. Give each one the spec path, the baseBranch, the exit code and test output (read from the state), and the developer's summary. Extract the JSON block from each answer and write it to $S/<run_id>.verdict.<name>.
  6. Verdict. "$GL" verdict <run_id> $S/<run_id>.verdict.<name>... with one file per reviewer that answered. The CLI deletes the files it merged, so a verdict can never be reused in a later round. If the CLI rejects a reviewer's verdict (invalid format), run that reviewer once more with the error; on a second rejection, write for it {"reviewer": "<name>", "objections": [{"ref": "<name>", "severity": "major", "detail": "unreadable reviewer verdict"}], "deviations": [], "specIssues": []}. A reviewer without a verdict file is reported as missing and the round is never approved.
  7. "$GL" commit-tour <run_id>.
  8. "$GL" decide <run_id>:
    • retry → summarize the round in one line (tests, blocking objections per reviewer) and start again at 2.1;
    • exhausted → step 4;
    • success → step 3.

3. Success

3.1 Refactoring

Refactoring runs at most once per run and does not consume an attempt. Skip to 3.3 if "$GL" config .refactor is not true, or if "$GL" state get <run_id> .refactor.status is already set.

  1. "$GL" refactor start <run_id> records the green commit, its test result and its verdict.
  2. Start greenlyt:refactorer with the spec path, the baseBranch and the non-blocking remarks ("$GL" state get <run_id> '[.verdict.objections[] | select(.severity == "minor")]').
  3. If git status --porcelain -- . ':(exclude).greenlyt' is empty (nothing changed), "$GL" refactor done <run_id> (recorded as unchanged) and go to 3.3.
  4. Otherwise run steps 2.4, 2.5 and 2.6 again (checks, all reviewers, verdict), then "$GL" decide <run_id>:
    • success → git add -A -- . ':(exclude).greenlyt/state' ":(exclude)<docsDir>/runs" && git commit -m "refactor(greenlyt): simplify <slug>", then "$GL" refactor done <run_id> (recorded as applied), then 3.3;
    • anything else → step 3.2.

3.2 Refactoring revert

"$GL" refactor revert <run_id> "<why: red tests, or the blocking objections>". This stashes the refactoring leftovers, restores the green commit and restores its recorded test result and verdict, so no re-review is needed. Go to 3.3.

3.3 Deviations

Read "$GL" state get <run_id> .verdict.deviations and "$GL" config .deviations.

  • No deviation, or deviations is report → 3.4.
  • Otherwise (ask): "$GL" state set-status <run_id> waiting, "$GL" env down, then present each deviation (description, files, rationale) and ask the user with AskUserQuestion: accept all deviations, or fix (say which ones to remove).
    • Accept → "$GL" state set-status <run_id> running, then 3.4.
    • Fix: if attempt < maxAttempts → "$GL" state set-status <run_id> running, "$GL" env up and back to 2.1, passing these deviations to the developer as to be removed. Otherwise → step 4 (the run fails: never a pull request with a rejected deviation).

3.4 Report and pull request

  1. Gate: "$GL" decide <run_id> must print success. Otherwise, never open a pull request: go back to section 2 (Loop) if it prints retry, or to step 4 if it prints exhausted.
  2. report=$("$GL" report <run_id> success), then, unless the report is ignored (git check-ignore -q "$report" succeeds), git add "$report" && git commit -m "docs(greenlyt): report <run_id>".
  3. Write to $S/<run_id>.acceptance.md the Markdown AC → evidence table (one row per criterion of the spec: | AC-n | test(s) | file(s) |), built from the spec and the test writer's summaries, checked against the diff.
  4. body=$("$GL" report <run_id> pr $S/<run_id>.acceptance.md).
  5. url=$("$GL" pr <run_id> "$body").
  6. "$GL" state set-status <run_id> succeeded, then "$GL" env down.
  7. Give the user: the draft pull request URL, the number of rounds, the accepted deviations, the non-blocking remarks, the refactoring outcome, the report path.

4. Failure

  1. report=$("$GL" report <run_id> failure). Do not commit it, push nothing.
  2. "$GL" state set-status <run_id> failed, then "$GL" env down.
  3. Show the user: the report path, the tests still red, the unresolved blocking objections per reviewer and the open questions (specIssues). If there are none, write the questions yourself that would refocus the spec, based on the recurring objections.
  4. Suggest the next step: /greenlyt:spec <slug> to update the spec with their answers, then /greenlyt:run <slug> to run the loop again with a fresh budget on the same branch.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.