agentleFS
ZAidBinAsifZAidBinAsif/flutter-ai-starter/.cursor/skills/grind-until-green/SKILL.md

grind-until-green

Skill0 starsChanged 5 months agoMITView on GitHub

Loop fix and re-run until flutter test, flutter analyze, or build passes

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    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:

    Use this skill when you want the agent to keep working autonomously until a specific goal is met — all tests pass, the build succeeds, or …

    line 8
  2. Distinctive:

    Read the error output carefully.

    line 23
  3. Distinctive:

    After a large refactor that broke multiple tests

    line 42
  4. Distinctive:

    After upgrading a dependency that introduced type errors

    line 43
  5. Distinctive:

    After merging a branch with conflicts that need resolution

    line 44
  6. Distinctive:

    When you want to "just make it green" and trust the agent to grind through it

    line 45
  7. Very specific:

    Use --bail or --fail-fast flags to stop at the first failure for faster iteration.

    line 68

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

Grind Until Pass

Use this skill when you want the agent to keep working autonomously until a specific goal is met — all tests pass, the build succeeds, or linting is clean. Instead of stopping after one attempt, the agent loops until done.

Steps

  1. Define the goal command — the command whose exit code determines success:

    • Tests: flutter test
    • Analyze: flutter analyze --fatal-infos
    • Format check: dart format --set-exit-if-changed .
    • Build: flutter build apk or flutter build web (as needed)
    • All: flutter analyze --fatal-infos && flutter test
  2. Run the command — execute it and capture the output.
  3. If it fails — analyze and fix:
    • Read the error output carefully.
    • Identify the root cause: failing test assertion, type error, lint violation, import error, etc.
    • Make the minimal fix. Don't refactor — just fix the error.
    • Go back to step 2.
  4. If it passes — stop and report:
    • Report what was fixed and how many iterations it took.
    • Summarize the changes made.

Rules for the Loop

  • Maximum 10 iterations — if after 10 attempts the command still fails, stop and report what's blocking progress. Something fundamental is wrong and needs human input.
  • Fix one thing at a time — don't try to fix all errors at once. Fix the first error, re-run, and see if the fix resolves downstream errors too.
  • Don't delete tests — if a test is failing, fix the code to make it pass. Don't modify the test unless the test itself is clearly wrong (testing old behavior that was intentionally changed).
  • Don't suppress errors — don't add // ignore: or dynamic to silence errors without fixing the root cause.
  • Track progress — if the number of errors is increasing instead of decreasing, stop and reassess the approach.

When to Use This

  • After a large refactor that broke multiple tests
  • After upgrading a dependency that introduced type errors
  • After merging a branch with conflicts that need resolution
  • When you want to "just make it green" and trust the agent to grind through it

Advanced: Cursor Hooks Integration

This repo ships a Cursor hook in .cursor/hooks.json that triggers after the agent's turn ends and runs the single project gate:

{
  "hooks": [
    {
      "event": "stop",
      "command": "bash .cursor/scripts/check-tests.sh",
      "description": "Run project verification after agent stops"
    }
  ]
}

The script runs dart run tool/verify.dart; a non-zero exit means the repo is not green.

Notes

  • This works best with fast test suites. If your tests take 5+ minutes, the loop will be slow.
  • Use --bail or --fail-fast flags to stop at the first failure for faster iteration.
  • The agent will be thorough but not creative — if the fix requires a design change, it'll need human guidance.

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.