44a5fa24f9a25c1295107787bb6b8f41fc07831c braney Thu Apr 9 15:48:44 2026 -0700 Add CLAUDE.md for AI assistant guidelines, no redmine Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> diff --git src/CLAUDE.md src/CLAUDE.md new file mode 100644 index 00000000000..7734db498c0 --- /dev/null +++ src/CLAUDE.md @@ -0,0 +1,14 @@ +# CLAUDE.md — UCSC Genome Browser Kent Source Tree + +AI assistant guidelines for modifying the kent codebase. + +## Key Rules + +- Always search `src/inc/` and `src/lib/` for existing utility functions before writing inline parsing, conversion, or data manipulation code. The kent tree has 222+ headers covering most common operations (e.g., `htmlColor.h` for color parsing, `obscure.h` for misc utilities, `hash.h` for hash tables). Writing a new implementation when one exists leads to code review failures. +- Use `sqlSafef()` or `sqlDyStringPrintf()` for ALL SQL query construction — never `safef()` or `dyStringPrintf()`. +- Use `safef()`, `safecpy()`, `safecat()` instead of `sprintf()`, `strcpy()`, `strcat()`. +- Use `needMem()` / `AllocVar()` instead of `malloc()` — all kent code assumes zeroed memory. +- Struct `next` must be the first member for any struct used in singly-linked lists. +- Make the smallest change that achieves the goal. Do not restructure surrounding code. +- Preserve existing patterns even when a "cleaner" design is conceivable. +- After building, run binaries from `~/bin/x86_64/`, not bare command name (system PATH resolves to production binaries).