diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..18a72c464 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,12 @@ +- Always prefer best practices when writing code. +- Write using concise, legible, and easily maintainable code. +- Avoid repetition where possible, but not at the expense of code legibility. +- Type assertions are an absolute last resort. In almost all cases, they are a crutch that leads to brittle code. +- This codebase has extensive eslint autofix rules and IDEs are configured to use eslint as the format on save tool. Run `eslint --fix` instead of manually figuring out whitespace fixes or other trivial style concerns. Review the results and correct any remaining eslint errors. +- Take advantage of `TypedArray` `subarray` when appropriate. +- The `size` and `pos` properties of `Rectangle` share the same array buffer (`subarray`); they may be used to set the rectangles size and position. +- Prefer single line `if` syntax over adding curly braces, when the statement has a very concise expression and concise, single line statement. +- Do not replace `&&=` or `||=` with `=` when there is no reason to do so. If you do find a reason to remove either `&&=` or `||=`, leave a comment explaining why the removal occurred. +- You are allowed to research code on https://developer.mozilla.org/ and https://stackoverflow.com without asking. +- When adding featueres, always write vitest unit tests using cursor rules in @.cursor +- When writing methods, prefer returning idiomatic JavaScript `undefined` over `null`, unless there is a specific use-case for `null`. \ No newline at end of file