← Back to library

Turn every agent mistake into a lint rule

gojkoa, a solo SaaS founder on Hacker News, enforces agent guardrails with deterministic tools rather than prompts. ESLint, extended with custom plugins covering code, HTML, SCSS, YAML and Markdown, runs as a hook after every file edit, and the rules now number in the thousands. Each agent slip becomes a new tested rule, and a separate script vets shell commands.

  • OutcomeRun your linter after every agent edit, and each time the agent does something wrong, have it add a lint rule, with tests, so it cannot repeat it.
  • SetupUnder an hour
  • LevelAdvanced
  • Creditgojkoa on Hacker News
View original
Works with
Claude Code

Published Oct 23, 2026Updated Oct 23, 2026AI dry run on sample input: passed Oct 23, 2026Source verified Oct 23, 2026

When should you use it?

  • The agent repeats the same mistakes
  • You approve too many commands by hand
  • You already use a linter

Not for: Projects with no linting; Teams that cannot maintain custom rules

What do you need, and what do you get?

You need

  • Linter and hook settings
  • List of past mistakes
  • Command rules

You get

  • Custom rules with tests
  • Lint after each edit
  • Automatic command approvals

How does it work, step by step?

  1. Hook the linterRun lint after each file the agent writes or edits.
  2. Catch a mistakeWhen it does something wrong, describe it.
  3. Write a ruleHave the agent write a rule plus unit tests, with a message saying what to do instead.
  4. Parse commandsRun a pre-command script that approves, rejects or asks.
  5. Learn from asksWhen it asks, find out why and add a rule.

The prompt

Our own prompt, inspired by gojkoa on Hacker News and written to work in Claude Code. Values in lime are placeholders.

Fill in the blanks (optional; the copied prompt uses your values)

Prompt1 variable
You just made this mistake: {mistake}. Write a custom lint rule that catches it, with unit tests showing a failing and a passing example.
The rule's error message must say what to do instead. Do not change other rules. Run the tests and show me the result.

Inspired by gojkoa on Hacker News: Comment in Ask HN: Any Software Engineers here who enjoy their AI-native dev workflow?. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • Thousands of rules need upkeep; test them.
  • Rules without helpful messages leave the agent guessing.
  • A parser can miss tricky shell syntax; keep risky commands on ask.

Our take

Prompts are suggestions; linters are enforcement. gojkoa's approach takes that difference seriously. Each time an agent makes a mistake, the response is not a longer instruction file but a rule that will catch the same error forever, and the agent itself writes the rule along with tests proving it works. Over time this turns a frustrating pattern of repeated errors into an accumulating safety net, which is why the rule count has grown so large. Running the linter as a hook after every edit means problems surface while the agent still has context to fix them. A clear message with each failure, saying what to do instead, saves a round of guessing. The command checker applies the same idea to shell use, approving safe commands, blocking dangerous ones and asking about the rest, which reduces the approval fatigue that leads people to click yes on everything. Start small: take five mistakes from last month, turn each into a rule with a test, and add more only as new mistakes appear.

Where the time goes back: Mistakes get fixed once instead of every session, and approvals stop interrupting you.

FAQ

Why not rules in the prompt?
Deterministic checks always run, while prompt rules can be ignored.
What does the regulator do?
It parses each shell command and approves, rejects or asks you.

Source and credit

Inspired by gojkoa on Hacker News. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.

Inspired by
Comment in Ask HN: Any Software Engineers here who enjoy their AI-native dev workflow?
Creator
gojkoa on Hacker News
Published on
Hacker News
Original date
Sep 6, 2026
License
Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
Originally for
Claude Code
AI dry run
Oct 23, 2026: passed. Dry-run tested by our AI test agent on sample input. PASS: Gates held on desk check; no live sends, bookings or purchases.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in IT & Security

All 82 IT & Security playbooks →

Related playbooks

IT & SecurityWorkflow✓ AI dry run

Compare an agent run with a task you did by hand

Before you believe big productivity claims, time and cost one routine agent task against a similar one you did yourself, counting review and cleanup.

Credit: Chris_Newton on Hacker News

Under an hour
IT & SecuritySkill✓ AI dry run

Find repeat fixes and good habits in your team's PRs

Have Claude Code look across a chosen window of commits and pull request review comments for the same fix or review note coming up again and again, suggest turning the top ones into a project rule or skill you write in your own words, and list good practices already in the repo that other teams could copy.

Credit: anthropics

Under an hour
IT & SecurityPrompt✓ AI dry run

Recheck intent by rereading your own messages

On long projects, ask the agent to go back over every message you wrote, restate what you wanted, then measure the work against that.

Credit: visarga on Hacker News

Minutes
IT & SecurityWorkflow✓ AI dry run

Stack-specific guard hooks for coding agents

Generate hooks that block the destructive commands of your framework, plus pre-push checks, after a few questions about your stack.

Credit: u/AdEast5873 on r/claude

Under an hour