Copybook中文Search

Rules

Repeat mistakes as helpers and lint rules

The agent keeps making one mistake: the right way in a helper, the old way banned by lint, an error that names the helper to use.

191 saves on X, as of Posted

Prompt
Go through the corrections in AGENTS.md or CLAUDE.md and the last 50 commits in this repo (focus on fixes and reverts). Find patterns the agent keeps getting wrong that lint can catch, up to 3. If you find fewer, report fewer. For each one:
1. Write a helper function or type that wraps the right way to do it
2. Add a rule in the lint tool the project already uses that bans the old pattern, with an error message that names the helper to use. Prefer the tool's built-in ban rules
3. Replace the old pattern in existing code, then run lint and the tests to confirm they pass
Finally, add a line to AGENTS.md or CLAUDE.md (whichever the project uses): after writing code, run lint and switch to the helper the error points to. If the project has no lint tool, tell me first. Show me the list first, with where each pattern came from and how many current violations it has. Change nothing until I confirm.

Next Send it to Claude Code or Codex in your repo, then confirm the list it shows you.

The better AI gets at writing code, the more abstractions you should write.

Turn the way you want things done into ready-made functions for the agent, then use lint to block the other ways. The only option it has left is the one you want.

Start with the mistakes your agent keeps making. Give each one a lint rule whose error message names the function to use, and when the agent runs its checks, it sees the error and fixes it on its own. Send this to Claude Code or Codex.