agentleFS
SentryKnown publishergetsentry/sentry-react-native/packages/core/ios/AGENTS.md

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

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the getsentry/sentry-react-native repository that our weekly crawl found: only 9 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about getsentry/sentry-react-native

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

4 more on GitHub

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
  1. Distinctive:

    Use clang-format (enforced by CI)

    line 18
  2. Very specific:

    Use nullability annotations (nullable, nonnull)

    line 20
  3. Distinctive:

    Use swiftlint (enforced by CI)

    line 24
  4. Distinctive:

    Follow Swift API design guidelines

    line 25
  5. Distinctive:

    Add local pod to sample's Podfile:

    line 60
  6. Very specific:

    A target's whole directory is scanned for resources: Every target points at one source directory (ios, ios/Swift, cpp) rather than the …

    line 88

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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

TaskCommand
ObjC/C++ format (clang-format)yarn fix:clang
Swift format (swiftlint)yarn fix:swift
ObjC/C++ lint checkyarn lint:clang
Swift lint checkyarn 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 Promise left 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 PrivateSentrySDKOnly from new code — route hybrid-SDK access through RNSentryInternal (see below).
  • Bump the bundled sentry-cocoa version by hand — go through scripts/update-cocoa.sh.

Working with Local sentry-cocoa

  1. Build sentry-cocoa: cd sentry-cocoa && make init
  2. Edit RNSentry.podspec to remove version constraint
  3. 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 separate RNSentrySwift target. .m files import its generated interface through ios/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 @import is rejected in .mm files (enabling C++ modules breaks React Native's C++ headers). So .mm callers go through RNSentryInternalWrapper, a plain Objective-C forwarder that mirrors RNSentryInternal selector for selector. Add a member there when a .mm file 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's publicHeadersPath, so #import <RNSentry/RNSentrySDK.h> keeps working. Add a mirror for every new public header (and to s.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 local node_modules or 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.