Best practices for code editing, search, and file operations
apply_patch over write_file for modifying existing files. It sends only the changed portion, preventing accidental full-file rewrites.read_file before editing. Understand the context before changing code. Never edit a file you haven't read.glob for file discovery instead of shell with find or ls. It's faster, safer, and returns structured results sorted by modification time.grep for content search instead of shell with grep or rg. It provides structured output modes (content, file paths, counts) and pagination.list_dir for directory exploration instead of shell with ls.read_file, then move to the next change.grep to search for all occurrences of the same pattern before committing a fix.shell to run the project's test command.