agentleFS
BorislavStefanov31BorislavStefanov31/bs31-agents/skills/done-when/SKILL.md

done-when

Skill8 starsChanged 8 days agoMITView on GitHub

Use when a command can decide that a task is finished (tests pass, a build succeeds, a type

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before starting, and before calling done, any task a command can judge.

    line 16
  2. Distinctive:

    Keep it local, repeatable and free of side effects: No deploy, no sending, no writes outside the project: it runs at every stop attempt.

    line 24
  3. Very specific:

    The owner's "stop" wins at once: Run scripts/done-when.mjs halt, then stop.

    line 36
  4. Distinctive:

    No command can decide the finish, or the owner has not agreed the condition.

    line 80

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.

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

done-when

A command the owner approved decides when you may stop; your sense of being finished does not.

When to use

Before starting, and before calling done, any task a command can judge; and when wiring the hook or loop that enforces it.

Rules

  1. Agree the check first. State the completion condition as a command, get a yes, then save it as the executable ./done-when.sh at the project root. Ask your questions before creating it. A check invented after the work fits whatever was built.
  2. Keep it local, repeatable and free of side effects. No deploy, no sending, no writes outside the project: it runs at every stop attempt.
  3. The owner approves the exact file. Show the whole file and ask the owner to run scripts/done-when.mjs approve in their own terminal. It runs with no permission prompt, so the gate refuses it unless its content matches that approval. A commit is not approval, you never approve, and any edit voids it.
  4. Run the gate before stopping. Pass means finished; anything else means work on what it reports.
  5. Fix the work, never the check. Changing the condition, or an existing check, needs the owner's yes and a new approval.
  6. Honour the round limit. The owner sets it at approval (default 5). A limit named in the task goes in .done-when/limit and can only lower it. Running out is not success: say the work is not done and quote the check.
  7. The owner's "stop" wins at once. Run scripts/done-when.mjs halt, then stop. Never run it otherwise.
  8. An unapproved check does not run. Show the file, ask for approval, stop, and call the work unverified.
  9. The owner installs the hook, per project. User-wide, it would run checks from unknown repositories.

What to produce

./done-when.sh, the approval record (kept outside the project), one line per stop in .done-when/outcomes.log, and a final message naming the outcome: passed, attempts-exhausted, owner-halted or not-approved.

#!/bin/sh
# done when the importer's tests pass and the type check is clean
npm test -- importer && npx tsc --noEmit
{"at":"2026-11-25T09:14:02Z","outcome":"passed","session":"7c1e","rounds":2,"limit":5}

The helper script

Needs Node 18+. Run from the project root, with the full path to the script (see "Script paths" below); see --help.

  • node scripts/done-when.mjs approve [--max N]: owner only, in an interactive terminal.
  • node scripts/done-when.mjs gate: the stop hook. Exit 0 lets you stop, exit 2 sends you back with the reason. Without a hook, run gate --manual yourself before every stop; it counts rounds and writes the log.
  • node scripts/done-when.mjs run -- <agent command>: the loop for harnesses with no stop hook; the failure report becomes the command's last argument.

For Claude Code, the owner merges stop-hook.settings.json into .claude/settings.local.json and fixes the script path. As of late 2026, check your version: the hook gets JSON on stdin (session_id, cwd), exit code 2 with a reason on stderr keeps the agent working, and the harness ends the turn itself after eight blocks in a row with no tool call.

What the script cannot stop: an agent with a shell writing the approval store or the halt marker. The snippet's deny rule covers the edit tool only; rules 3 and 7 cover the rest.

Stop and ask

  • No command can decide the finish, or the owner has not agreed the condition.
  • The check looks wrong, flaky or impossible: report it, do not edit it.
  • The check would need network, credentials or writes outside the project.

Not for

Timers and recurring prompts, batches with no model, sandboxing what the check runs, or test design.

Script paths

scripts/... in this file means the scripts/ folder of this skill, wherever the skill is installed. From a project root that is usually .claude/skills/done-when/scripts/, so the full form of a command is node .claude/skills/done-when/scripts/<file>.mjs ....

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.