Instructions for LLM agents. Keep edits minimal (headers + bullets). Use
/agents-mdskill when editing.
Applies to all review agents (human-assisted, Bugbot, code-review skill). Review bots should verify changes align with the nested AGENTS.md files: Sources/AGENTS.md, Tests/AGENTS.md, scripts/AGENTS.md, .github/AGENTS.md, Samples/AGENTS.md, develop-docs/AGENTS.md.
In order of importance:
- Thread safety — SDK runs on arbitrary queues; check for data races, unprotected shared state, missing synchronization
- Memory management — retain cycles, leaks in ObjC code, strong reference cycles in closures/blocks
- Public API surface — backward compatibility, nullability annotations,
NS_SWIFT_NAMEcorrectness, SPI vs public visibility - Cross-platform correctness —
#if os(...)guards,@availableannotations, platform-specific imports - Error handling — silent failures, swallowed errors, missing fallback paths (the SDK must never crash the host app)
- Performance — hot path allocations, unnecessary main thread work, serialization overhead
- Never crash the host app — all public entry points must be defensive
SentrySDK.start()can be called from any thread — initialization must be thread-safe- Swizzling — must be idempotent and check for prior swizzling
- C/C++ code (SentryCrash) — buffer overflows, null pointer dereferences, signal safety
- Session Replay — privacy-sensitive; verify redaction/masking logic
- Envelope serialization — correct byte ordering, length prefixes, JSON encoding
- Test names:
test<Function>_when<Condition>_should<Expected>() - New/changed code must have corresponding tests
guard caseoverif casefor pattern matching in testsXCTUnwrap+element(at:)for safe array access (not direct subscript)- File renames preserve git history (
git mv) - No AI assistant references in commits or PR descriptions
- ObjC uses
[[Class alloc] init], not[Class new]
- Style/formatting — handled by pre-commit hooks (SwiftLint, clang-format, dprint)
- Test verbosity — tests follow DAMP (not DRY); duplicate test code is acceptable
// -- Arrange --/// -- Act --/// -- Assert --— required test pattern- Conventional commit format — validated by CI
- Non-changelog changes include
#skip-changelog - Breaking changes clearly documented
- Untestable error paths documented