Hacker News new | ask | show | jobs
by ZitchDog 71 days ago
I've been having good luck with fairly autonomous LLM coding with the following rules:

  * TypeScript everywhere with extreme enforcement of the type system.

  * No "as" casts, no "any" declarations, all code must understand the shape of its data

  * All boundaries validated using a typed validation library. Many use zod, I prefer tjs. I also have strictly typed pg and express wrappers.

  * No files longer than 300 lines

  * All of these rules are enforced by an eslint configuration that runs in a pre commit hook.

Global state and classes could also be removed via eslint rules, that would be interesting, though I haven't found it to be an issue in practice once the types are strictly enforced.
1 comments

How do you enforce the use of validation library with eslint?
Can't fully enforce that one, but I require only my specific HTTP router / SQL library to be used, and disallow the import of express / pg libraries via eslint. I also disable the use of JSON.parse via eslint. Combined with strong language in the CLAUDE.md, I haven't seen it get around my guard rails.