AI coding in a monorepo: tips for large projects

/

Monorepos are challenging for AI because the context window fills up with irrelevant files. I worked on a 200-file monorepo for 3 months. Here is the AI workflow that scaled.

How do you keep AI context focused in a monorepo?

Create narrow-scope context files. Instead of one massive .cursorrules, I use package-level rules files. Each package has its own CLAUDE.md with its specific stack, conventions, and dependencies. Cursor reads the nearest CLAUDE.md. This keeps AI context relevant and prevents it from referencing unrelated packages.

What monorepo tasks does AI handle well?

Package-level refactoring where the scope is well-defined. ‘Update the auth package to use JWT tokens’ works well. Cross-package changes like ‘update the auth package and all packages that import it’ require careful prompting and multiple sessions.

References

  1. Cursor AI Review
  2. Claude Code Review
  3. AI Code Validation Guide

Leave a Reply

Your email address will not be published. Required fields are marked *