A CLAUDE.md is just a markdown file at the root of your repo. Copy the content below into your own project's CLAUDE.md to give your agent the same context.
npx versuz@latest install gnachman-iterm2 --kind=claude-mdcurl -o CLAUDE.md https://raw.githubusercontent.com/gnachman/iTerm2/HEAD/CLAUDE.md## Code Best Practices - Avoid writing javascript, html, or CSS that's more than one line long in Swift. Create a new file and use the existing template mechanism to load it. - After creating a new file, `git add` it immediately - To add a file to the Xcode project, use `tools/add_file_to_xcodeproj.rb <file_path> <target_name>` (e.g., `tools/add_file_to_xcodeproj.rb sources/Example.swift iTerm2SharedARC`) - In Swift, use it_fatalError and it_assert instead of fatalError and assert, which do not create useful crash logs. In ObjC, assert is ok although ITAssertWithMessage is preferable. Asserts are enabled in release builds. - Don't write more than one line of inline javascript, html, or css. Instead create a new file and load it using iTermBrowserTemplateLoader.swift - Don't create dependency cycles. Use delegates or closures instead. - To run unit tests in ModernTests, use tools/run_tests.expect. It takes an argument naming the test or tests, such as `tools/run_tests.expect ModernTests/iTermScriptFunctionCallTest/testSignature` - When renaming a file tracked by git (and almost all of them are) use `git mv` instead of `mv` - To make a debug build run `tools/build.sh` (or `tools/build.sh Development`). This saves logs to `tmp/build.log` and shows only errors/warnings on failure. - Little scripts or text files that are used for manual testing of features go in tests/ - The deployment target for iTerm2 is macOS 12. You don't need to perform availability checks for older versions. - Don't replace curly quotes with straight quotes. Same for apostrophes and single quotes. If you need help typing a curly quote, just ask. Here are some you can copy and paste: ‘’“” - In user-visible strings do not use " except as a shorthand for inch. Prefer curly quotes like “ and ”. I know this goes against your nature, but fight hard here. - Ask permission before using auto layout if it's not already in use in a given file. Debugging auto layout is the worst hell. - The deployment target is macOS 12. Don't add availability checks for 12 and lower. - Never `git add` submodules without express written permission. - Don't include AI-generated markdown files (summaries, plans, etc.) in commits — only ship code. - Avoid duplicate expressions; hoist shared computations into a named `const` before branching. - Don't change defaults silently. - Use [iTermUserDefaults userDefaults] instead of [NSUserDefaults standardUserDefaults] - Use `make run` to build and run a debug build. - Do not use associated objects (objc_getAssociatedObject or objc_setAssociatedObject) without express written permission. - You should treat warnings as errors. - If you get stuck, ask for help. It's better to ask me to look at something in the debugger than to flail around for a long time. - If your changes introduce compiler warnings, fix them. - After landing a feature or bugfix, update docs/notes-3.7.txt (the release notes). Max width of a line is 50 characters. - The sources directory is organized into folders. Before adding a new file, consider which directory it belongs in. Some are named after features while others are named after their role. - User Defaults keys that should only be stored locally begin with the prefix NoSync. If a user chooses to load prefs from a custom location (e.g., Dropbox) they may be prompted to write settings when a non-NoSync key changes. To avoid disrupting them in this manner, user defaults that are not actual configuration settings (e.g., a list of recent items) get a NoSync prefix.