Skip to main content
skill CX Codex

grinding-until-pass — Claude Code skill: loop until tests pass

A skill that keeps the agent in a fix → run → check loop until tests pass, the build succeeds or linting comes back clean.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add spencerpauly/awesome-cursor-skills --skill grinding-until-pass -a claude-code
Open on GitHub

What grinding-until-pass does

The skill lays out a four-step loop. First you name the goal command whose exit code decides success: npm test, npm run build, npm run lint, npx tsc --noEmit, or all of them chained with &&. Then the agent runs it, reads the output, finds the root cause and makes the smallest possible fix. Back to the run step.

The loop rules are strict. Ten iterations maximum — after that the agent stops and reports what is blocking progress. It fixes one error at a time, never deletes tests, and never silences errors with @ts-ignore, eslint-disable or any. If the error count grows instead of shrinking, it stops and reassesses.

For Cursor the skill documents a hook in .cursor/hooks.json: a stop event runs bash .cursor/scripts/check-tests.sh, the script checks the exit code and returns a followup_message when tests still fail. The catch is speed. Slow suites make the loop crawl, so the author suggests --bail or --fail-fast. And the agent is persistent, not inventive: a fix that needs a design change still needs you.

What it helps with

  • clear failing tests after a large refactor
  • fix type errors introduced by a dependency upgrade
  • repair the build after merging a branch with conflicts
  • clean up lint violations without disabling rules
  • get tsc type-checking to a clean run

Example prompts for the agent

  • run npm test and keep fixing the code until every test passes
  • loop on npm run lint && npx tsc --noEmit && npm test && npm run build until it's all green
  • after the refactor, make npx vitest run pass without errors

How to install grinding-until-pass

1Skills CLI (Vercel)

npx skills add spencerpauly/awesome-cursor-skills --skill grinding-until-pass -a claude-code

2Manually: put the files in place

~/.claude/skills/grinding-until-pass/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/grinding-until-pass/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about grinding-until-pass

How do I install grinding-until-pass in Claude?

Run npx skills add spencerpauly/awesome-cursor-skills --skill grinding-until-pass -a claude-code. The skill lands at ~/.claude/skills/grinding-until-pass/SKILL.md.

What does grinding-until-pass do?

It gives the agent a loop: run the goal command, read the error, apply a minimal fix, repeat. It stops when tests, build or lint pass, or after 10 iterations.

What limits the loop?

A 10-iteration cap, a one-error-at-a-time rule, and a ban on deleting tests or silencing errors with @ts-ignore and eslint-disable. Slow suites make it drag, so the author suggests --bail or --fail-fast.

Source text

SKILL.md · CC0-1.0
---
name: grinding-until-pass
description: Keep iterating on code changes until the tests pass, the build succeeds, or linting is clean. Runs in a tight loop of fix → run → check → repeat. Use when you want the agent to autonomously grind through test failures or build errors.
---

# 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: `npm test` or `npx vitest run`
   - Build: `npm run build`
   - Lint: `npm run lint`
   - Type-check: `npx tsc --noEmit`
   - All of the above: `npm run lint && npx tsc --noEmit && npm test && npm run build`

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 `@ts-ignore`, `eslint-disable`, or `any` types to silence errors. Fix the actual problem.
- **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

You can automate this with a Cursor hook in `.cursor/hooks.json` that triggers after the agent's turn ends, checks if tests pass, and sends a follow-up message if they don't:

```json
{
  "hooks": [
    {
      "event": "stop",
      "command": "bash .cursor/scripts/check-tests.sh",
      "description": "Re-run tests after agent stops and send follow-up if failing"
    }
  ]
}
```

The script checks the exit code and returns a `followup_message` if tests are still failing.

## 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.

© spencerpauly · CC0-1.0 · spencerpauly/awesome-cursor-skills

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set59

visual-qa-testing Opens your app in Cursor's built-in browser, grabs a screenshot, reads console errors and audits network requests. Handy right after UI edits. CX Codex +1 642installs auditing-security Audits codebases for hardcoded secrets, OWASP Top 10 flaws, and insecure settings. Helps spot security risks before shipping code. CX Codex +1 593installs suggesting-cursor-rules Watches for repeated code corrections and suggests saving them as Cursor rules. It helps lock project conventions so you do not repeat the same instructions. CX Codex +1 554installs systematic-debugging Enforces a structured debugging workflow on your AI assistant instead of random edits. It helps isolate elusive bugs and verify root causes with evidence. CX Codex +1 545installs verifying-in-browser Starts the dev server after code changes, opens the app in a browser and checks rendering, console errors and network health. CX Codex +1 540installs using-ui-stack Makes the agent build interfaces from fixed rules: an 8px grid, 60-30-10 colors, type scale, dark mode and interaction states. CX Codex +1 539installs parallel-code-review Runs four parallel read-only subagents to inspect a diff across security, speed, correctness, and readability. Built for vetting large or risky pull requests. CX Codex +1 530installs reviewing-code A skill that walks your code through a checklist: correctness, maintainability, performance, types and tests. Useful when a change needs review before merge. CX Codex +1 516installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor