Techniques··4 min read

How to Prepare Code for AI Code Review

Share code with ChatGPT, Claude or Gemini effectively: what to include, what to strip, and how to fit large codebases into context.

Less code, better review

Dumping a whole repository dilutes the model's focus and burns tokens on generated files. Pick the files that actually touch the problem.

What to include

A compact package helps:

  • A short description of the goal or bug
  • The file tree (directories only)
  • Relevant source files and type definitions
  • Error messages and logs
  • Not: lockfiles, build output, minified assets

Check the size

Paste the bundle into the Token Counter. For long logs, the Context Compressor removes duplicated lines while preserving error terms you specify.

Try it free in your browser

  • Context Compressor — Reduce token usage with compression strategies tuned for LLMs.
  • Token Counter — Live token, character, and context-window meter for any prompt. Uses official tiktoken encoders.

Tools mentioned

Frequently asked

Should I include package lockfiles?

No. They are huge and rarely relevant. Include package.json or equivalent instead.

How do I share a large codebase?

Share a file tree and the specific files involved in the change, then add more on request.

Keep reading