sentry-react-native / ios
AGENTS.md1.8k starsChanged 3 months agoMITView on GitHub
Depth lives in the skills. code-guidelines (.agents/skills/, esp. references/native-bridge.md) is authoritative for bridge and native conventions — load it before non-trivial work. This file is the quick reference for the iOS surface; where a convention here overlaps a skill, the skill wins. Catch everything at the boundary and reject — never let an exception reach the app. The reject error code is the shared @"SentryReactNative", not a per-method code: ✅ Always - Resolve or reject every exported method — a…
Trending
Quiet this year.thin dataabout the whole repository
Who's talking about getsentry/sentry-react-native
- bluesky-social/social-app“Make Sentry optional”GitHub · Sep 8, 2023 · 21 reactions
- expo/sentry-expo“Critical Security - Upgrade @sentry/react-native to 1.3.9”GitHub · May 21, 2020 · 15 reactions
- expo/expo“[SDK 51] Xcode 16 compilation fails on pegged Sentry version”GitHub · Jul 2, 2024 · 14 reactions
- react/react-native“[0.60.3] --sourcemap-output | enableHermes: false | gradle file | wrong output path”GitHub · Jul 17, 2019 · 10 reactions
- expo/expo“[expo] Bump recommended @sentry/react-native version”GitHub · Sep 25, 2024 · 8 reactions
The biggest 5 of 9 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 9
Talked about on GitHub (9 times).
On GitHub · 9
- Sep 8, 2023Make Sentry optional — bluesky-social/social-app21 reactions
- May 21, 2020Critical Security - Upgrade @sentry/react-native to 1.3.9 — expo/sentry-expo15 reactions · 28 comments
- Jul 2, 2024[SDK 51] Xcode 16 compilation fails on pegged Sentry version — expo/expo14 reactions · 12 comments
- Jul 17, 2019[0.60.3] --sourcemap-output | enableHermes: false | gradle file | wrong output path — react/react-native10 reactions · 8 comments
- Sep 25, 2024[expo] Bump recommended @sentry/react-native version — expo/expo8 reactions · 1 comment
4 more on GitHub
- Jul 19, 2024Update sessions after running beforeSend — getsentry/sentry-cocoa7 reactions · 6 comments
- Jun 22, 2022Bundling React Native with Hermes manually — react/react-native7 reactions · 24 comments
- Nov 6, 2019Implement hermes source maps — getsentry/rust-sourcemap7 reactions · 2 comments
- May 30, 2023Upgrade `@sentry/react-native` to version `5` — expo/sentry-expo6 reactions · 6 comments
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- packages/core/AGENTS.mdAGENTS.md
- packages/core/android/AGENTS.mdAGENTS.md
- samples/expo/AGENTS.mdAGENTS.md
- samples/react-native/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- code-guidelinesSkill
- design-firstSkill
- diagnosing-bugsSkill
- reviewSkill
- specSkill
- test-guidelinesSkill
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Use clang-format (enforced by CI)
- Very specific: line 20
Use nullability annotations (nullable, nonnull)
- Distinctive: line 24
Use swiftlint (enforced by CI)
- Distinctive: line 25
Follow Swift API design guidelines
- Distinctive: line 60
Add local pod to sample's Podfile:
- Very specific: line 88
A target's whole directory is scanned for resources: Every target points at one source directory (ios, ios/Swift, cpp) rather than the …
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
packages/core/ios — Objective-C & Swift
Depth lives in the skills.
code-guidelines(.agents/skills/, esp.references/native-bridge.md) is authoritative for bridge and native conventions — load it before non-trivial work. This file is the quick reference for the iOS surface; where a convention here overlaps a skill, the skill wins.
Formatting & Linting
| Task | Command |
| ObjC/C++ format (clang-format) | yarn fix:clang |
| Swift format (swiftlint) | yarn fix:swift |
| ObjC/C++ lint check | yarn lint:clang |
| Swift lint check | yarn lint:swift |
Code Conventions
Objective-C
- Use clang-format (enforced by CI)
- Prefix classes with
RNSentry - Use nullability annotations (
nullable,nonnull)
Swift
- Use swiftlint (enforced by CI)
- Follow Swift API design guidelines
Native Bridge Pattern (Objective-C)
Catch everything at the boundary and reject — never let an exception reach the app. The reject error code is the shared @"SentryReactNative", not a per-method code:
RCT_EXPORT_METHOD(nativeOperation:(NSString *)param
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
@try {
BOOL result = [self performOperation:param];
resolve(@(result));
} @catch (NSException *exception) {
reject(@"SentryReactNative", exception.reason, nil);
}
}Boundaries
✅ Always
- Resolve or reject every exported method — a
Promiseleft neither resolved nor rejected hangs the JS caller. - Catch native exceptions at the bridge — an exception that reaches the app crashes it.
- Gate any user data added to events/breadcrumbs/spans on
sendDefaultPii.
🚫 Never
- Reach for
PrivateSentrySDKOnlyfrom new code — route hybrid-SDK access throughRNSentryInternal(see below). - Bump the bundled sentry-cocoa version by hand — go through
scripts/update-cocoa.sh.
Working with Local sentry-cocoa
- Build sentry-cocoa:
cd sentry-cocoa && make init - Edit
RNSentry.podspecto remove version constraint - Add local pod to sample's Podfile:
pod 'Sentry', :path => '../../../../sentry-cocoa'
Swift Package Manager (../Package.swift)
React Native 0.87+ can autolink through SwiftPM instead of CocoaPods, so the
package ships a Package.swift next to RNSentry.podspec. Both describe the
same sources; keep them in sync.
Three SwiftPM constraints shape the layout — don't undo them by moving files:
- No mixed-language targets. Swift lives in
ios/Swift/and compiles as the separateRNSentrySwifttarget..mfiles import its generated interface throughios/RNSentrySwiftBridge.h, never<RNSentry/RNSentry-Swift.h>directly — that spelling only exists under CocoaPods. - No Swift module in Objective-C++. Under SwiftPM the Swift interface is
only reachable as a Clang module, and
@importis rejected in.mmfiles (enabling C++ modules breaks React Native's C++ headers). So.mmcallers go throughRNSentryInternalWrapper, a plain Objective-C forwarder that mirrorsRNSentryInternalselector for selector. Add a member there when a.mmfile needs a new one; don't include the bridge header from.mm. - No header maps. The public headers are mirrored as forwarding headers in
ios/include/RNSentry/, which is the target'spublicHeadersPath, so#import <RNSentry/RNSentrySDK.h>keeps working. Add a mirror for every new public header (and tos.public_header_files); the podspec excludes the directory so CocoaPods doesn't see two headers per name. - A target's whole directory is scanned for resources. Every target points
at one source directory (
ios,ios/Swift,cpp) rather than the package root, which would pick up a localnode_modulesor Xcode build output and fail to resolve.
The autolinked target name must stay RNSentry, because it is also the prefix
consumers import headers under. It is pinned in both places React Native looks:
spm.name in react-native.config.js (0.87) and swiftpmConfig.name in
package.json (0.88+).
Internal API access (SentrySDK.internal)
RNSentry consumes sentry-cocoa's hybrid-SDK surface (SentrySDK.internal.*)
through a Swift bridge in RNSentryInternal.swift. The bridge imports Sentry
with @_spi(Private) because several sub-APIs (performance.currentScreenFrames,
replay.configure, envelope.{store,capture,deserialize}) are SPI-gated.
.m/.mm callers import the auto-generated RNSentry-Swift.h and route
through [RNSentryInternal …] instead of accessing sentry-cocoa internals
directly.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

