goon / CLAUDE.md
Binx
Initial commit: analysis app, deployment config, UI improvements
da605e9

CLAUDE.md β€” Project Conventions

File Operations

  • When asked to edit a file, use Glob/Grep to locate it rather than asking the user for the path.
  • Prefer targeted reads (offset + limit) over reading entire large files.
  • Before creating a new file, check whether a suitable one already exists.
  • Do not re-read a file after editing it to verify β€” edits would have errored if they failed.

Editing Conventions

  • When editing R/Quarto files, check for stale object/column name references after renames (e.g., title -> new name) across the entire file, not just the edit site.
  • Make the minimal change needed β€” do not refactor or clean up surrounding code unless asked.
  • Do not add comments, docstrings, or type annotations to code you did not change.
  • Avoid backwards-compatibility shims for removed code; delete unused code outright.

R Conventions

  • This project uses data.table, not data.frame/dplyr. Always use data.table syntax (e.g., DT[, .(col)], :=) and verify column access patterns work on data.table objects before finalizing edits.
  • Use set* functions (setnames, setorder, setkey) for in-place mutations to avoid copies.
  • Prefer fread/fwrite over read.csv/write.csv.
  • Do not load tidyverse or dplyr unless explicitly requested.

Performance / Memory

  • Large datasets hit R memory limits β€” prefer chunking, avoid unnecessary copies, and add defensive guards for list vs data.table structures before rbindlist.
  • Never use rbind in a loop; accumulate results in a list and call rbindlist once.
  • Avoid apply-family functions on large data.tables; use vectorized data.table operations instead.
  • Check object.size() / lobstr::obj_size() when debugging memory issues rather than guessing.

Token Efficiency

  • Do not summarize what you just did at the end of a response β€” the diff is visible.
  • Do not repeat back the user's request before answering.
  • Skip pleasantries and filler phrases ("Great question!", "Certainly!", etc.).
  • When reading code to answer a question, read only the relevant section, not the whole file.
  • Use files_with_matches output mode for Grep unless line content is needed.