/agent-skills:dd-ios-sdk-v3-upgradefrom agent-skills
Upgrades iOS apps from Datadog's v2 mobile SDK (dd-sdk-ios 2.x) to v3, handling module changes, Objective-C imports, user info, RUM views, Session Replay privacy levels, and URLSession instrumentation.
Ships in agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill when an iOS project uses the Datadog iOS SDK 2.x (dd-sdk-ios) and must be
upgraded to a stable 3.x release. The v3 migration removes the DatadogObjc module, makes
the user ID mandatory, replaces the legacy URLSession delegates and splits the Session
Replay privacy level into three settings.
Do not use it when:
This skill incorporates the "Migration from 2.x to 3.0" section of
MIGRATION.md at tag 3.19.0, checked against the public API surface of
3.19.0 and 2.30.2. Where this skill is more specific than that guide, it says so. Use the
instructions below as the source of truth; consult the live guide only when the project uses
an API not covered here or the chosen target is newer than 3.19.0 (the guide is unchanged at
3.20.0).
env, site, service or
trackingConsent values the project already sets.DatadogObjc is not a new feature.clientToken: unchanged
and nothing else. This rule has been broken before, always when listing the values that were
kept; see the check at the end of step 10.Before editing, inspect the project for:
XCRemoteSwiftPackageReference for dd-sdk-ios in
*.xcodeproj/project.pbxproj, Package.swift, Podfile and Podfile.lock, Cartfile and
Cartfile.resolved, or manually linked XCFrameworks. Several may coexist;Package.resolved, Podfile.lock,
Cartfile.resolved) and not from memory;Datadog* product or pod in use, and every import Datadog…, @import Datadog…
and #import <Datadog…>; and the Alamofire extension (pod 'DatadogAlamofireExtension',
import DatadogAlamofireExtension, DDRequestInterceptor, DDEventMonitor);Datadog.initialize, Datadog.setUserInfo, RUMView(path:,
SessionReplay.Configuration and defaultPrivacyLevel, and any use of
DatadogURLSessionDelegate, DDURLSessionDelegate or DDNSURLSessionDelegate;xcodebuild -version, or use the version the task states when xcodebuild is not available.Stop and report, without editing, in these cases:
When you stop, edit nothing, not even the source code, and say in the report what you found, why the upgrade cannot proceed and what the project owner can decide, for example moving to Swift Package Manager. Do not make that move yourself.
Follow the appendix section "Choose the target version" at the end of this file. In short:
Package.swift requirements (platforms and
swift-tools-version) the project's deployment target and Xcode meet.3.14.0 only
when GitHub itself cannot be reached (connection errors or timeouts from every method); a missing
tool such as git: command not found is not a network failure, so use the curl method.
When you use the fallback, say so prominently in the report, with the reason. It is the newest 3.x verified to compile
with Xcode 16.0, and it supports iOS 12 and later. You cannot check the requirements of any other
version without network, so do not pick one from memory. If the project's Xcode is known to be
older than 16, stop and report: 3.14.0 needs swift-tools-version: 6.0.upToNextMajorVersion from the older tag
silently resolves back to the newest release at build time, which fails exactly the requirement
you just named. This is the case where the project's kind must change. Example for 3.16.1 chosen
because 3.17.0 needs iOS 15:
requirement = {
kind = versionRange;
maximumVersion = 3.17.0;
minimumVersion = 3.16.1;
};
Never write "no capping needed" after moving down. Only when the chosen version is the newest
stable release do you keep the project's existing kind.swift-tools-version does not reveal every compiler requirement. If the build in step 10 fails
with syntax errors inside Datadog package sources, treat it as a failed requirement, move down
one tag, and report it.Use the chosen concrete version everywhere. Do not leave a mix of v2 and v3 products, and do not use moving versions. Follow the appendix at the end of this file for the edit and the resolve command of each manager.
The v3 products are DatadogCore, DatadogCrashReporting, DatadogLogs, DatadogRUM,
DatadogSessionReplay, DatadogTrace and DatadogWebViewTracking.
DatadogObjc product, pod or framework. Its contents now live in the product modules.
When the project linked DatadogObjc, link the module of every product the code uses (see the appendix):
DatadogObjc used to bring Core, RUM, Logs and Trace along.DatadogCore is present.dd-sdk-ios reference. Keep its kind (for example
upToNextMajorVersion) and set its version to the chosen one; do not switch to an exact version
and add no second reference. Exception: if you moved down in step 2, use the capped
versionRange described there (chosen tag up to, but excluding, the first incompatible one).Package.resolved or Podfile.lock by hand. Xcode or
CocoaPods rewrites them when the customer builds; a hand-edited originHash or revision is worse
than a stale file. Run the resolve command only when the tool is available, and never copy its
output into the report as if you had edited the file.pod 'DatadogAlamofireExtension' if present, and update the Datadog pods with
pod update (plain pod install keeps the old pinned versions). Carthage: update the requirement and link the v3 xcframeworks, as the appendix says.Remove every import DatadogObjc and @import DatadogObjc. In Objective-C, import the
modules of the products in use (@import DatadogCore;, @import DatadogRUM;,
@import DatadogLogs;, and so on), and keep the @import DatadogSessionReplay; that already
exists. The Objective-C names (DDDatadog, DDConfiguration, DDRUM, DDLogs, …) are unchanged;
change one only if the compiler reports that it no longer exists.
In v3 Datadog.setUserInfo(id:name:email:extraInfo:) requires a non-optional id.
id needs no change.id, or with id: nil, no longer compiles. If the code has an optional
user identifier, call it only when present (if let id { Datadog.setUserInfo(id: id, …) }).+[DDDatadog setUserInfoWithId:name:email:extraInfo:] (already deprecated in
2.x) no longer exists. Use setUserInfoWithUserId:name:email:extraInfo: where an identifier
exists. Passing nil there compiles with only a nullability warning, but it violates the
contract: treat it as a missing identifier.TODO saying that an id is required.
Report it as a behavior change: user information is no longer sent until the owner provides
an id.RUMView(path: x, attributes: a) with RUMView(name: x, attributes: a).Monitor.addViewAttribute… / removeViewAttribute… APIs are optional. Do not adopt them.RUM.Configuration has new options that are on by default in 3.19.0: trackMemoryWarnings
and trackSlowFrames. The upgrade therefore starts reporting memory warnings and slow frames
without any code change. Do not set them yourself; report them as behavior changes so the owner
can turn them off if they want the previous telemetry.These are behavior changes, not edits. Report them; change code only if it fails to compile.
session.id.
FirstPartyHostsTracing samples every request by default and injects the trace context
only into sampled requests. Report any project that configures tracing for first-party hosts.Network.os and device attributes now share one model across Logs, RUM and Trace, at the root of
each event. Queries on the previous log or span attribute paths deserve a check.phys_footprint, so its values are not comparable with v2.defaultPrivacyLevel is replaced by three settings. Where the project passes
defaultPrivacyLevel: to SessionReplay.Configuration(...) or assigns the property, replace
it with these values, which are the conversion the SDK itself applied in 2.30.2:
defaultPrivacyLevel (v2) | textAndInputPrivacyLevel | imagePrivacyLevel | touchPrivacyLevel |
|---|---|---|---|
.allow | .maskSensitiveInputs | .maskNone | .show |
.maskUserInput | .maskAllInputs | .maskNonBundledOnly | .hide |
.mask | .maskAll | .maskAll | .hide |
In Objective-C the v2 code creates [[DDSessionReplayConfiguration alloc] initWithReplaySampleRate:<rate>]
and then assigns the defaultPrivacyLevel property (DDSessionReplayConfigurationPrivacyLevel…:
Allow, Mask, MaskUserInput). In v3 both the single-argument initializer and the property are gone.
Use initWithReplaySampleRate:textAndInputPrivacyLevel:imagePrivacyLevel:touchPrivacyLevel: with
DDTextAndInputPrivacyLevel… (MaskSensitiveInputs, MaskAllInputs, MaskAll),
DDImagePrivacyLevel… (MaskNone, MaskNonBundledOnly, MaskAll) and DDTouchPrivacyLevel…
(Show, Hide), with the same values as the table, and delete the property assignment.
The v2 default was .mask, which equals the v3 defaults. A project that never passed
defaultPrivacyLevel needs no change. A project that already passes the three settings needs
no change. Keep every other argument (replaySampleRate, startRecordingImmediately,
customEndpoint) exactly as it is.
The legacy delegate types no longer exist. From 3.7.0, resource and trace tracking is automatic once
urlSessionTracking is configured in RUM.Configuration and/or Trace.Configuration, but the
detailed timing breakdown (DNS, SSL, time to first byte) that the legacy delegates provided
now needs an explicit registration.
urlSessionTracking configuration. Do not add one.DatadogURLSessionDelegate, DDURLSessionDelegate or
DDNSURLSessionDelegate with a plain delegate: subclass NSObject and conform to
URLSessionDataDelegate, keep the delegate's own methods, and remove super calls to the old
base class. Keep passing that delegate to the URLSession.URLSessionInstrumentation lives in the DatadogInternal module. In the file that registers the
delegate add import DatadogInternal and nothing else: with Swift Package Manager do not
add a DatadogInternal product to the project, because it is not a product of the package
(adding it fails the build with Missing package product 'DatadogInternal'). With CocoaPods it
comes with DatadogCore; with Carthage the xcframework is already linked.RUM.enable or Trace.enable, so the timing breakdown
is preserved. Use the API that exists in the chosen version: read
DatadogInternal/Sources/NetworkInstrumentation/URLSession/URLSessionInstrumentation.swift
from the package checkout, or from
https://raw.githubusercontent.com/DataDog/dd-sdk-ios/<tag>/DatadogInternal/Sources/NetworkInstrumentation/URLSession/URLSessionInstrumentation.swift
when there is no checkout. Use
URLSessionInstrumentation.enableDurationBreakdown(with: .init(delegateClass: Delegate.self))
when it exists; URLSessionInstrumentation.enable(with:) is deprecated in recent 3.x
releases and must not be introduced there.URLSessionInstrumentation.enable(with:). If the project already calls it and the chosen
version has enableDurationBreakdown(with:), rename the call and keep its arguments.DatadogAlamofireExtension pod was deprecated in 2.x and no longer exists in 3.x.
Remove the pod and import DatadogAlamofireExtension, and remove DDRequestInterceptor() and
DDEventMonitor() from every Session(...) that uses them, keeping any other interceptor or
monitor. Alamofire requests are then tracked automatically through urlSessionTracking. To keep
the timing breakdown the extension provided, register Alamofire's delegate once, after RUM.enable
(import Alamofire and import DatadogRUM):
URLSessionInstrumentation.enableDurationBreakdown(with: .init(delegateClass: Alamofire.SessionDelegate.self)).
Never add the Alamofire registration to a project that did not use the extension.Resolve the packages with the manager's command and build the project's scheme with its
normal command (for example xcodebuild build -scheme <scheme> -destination 'generic/platform=iOS Simulator'
with code signing disabled). Prefer the command the project's CI uses. If the tools are not
available, do not simulate either step: report that they did not run and leave the resolved file
untouched.
Before finishing, confirm that:
DatadogObjc is gone;DatadogURLSessionDelegate, DDURLSessionDelegate, DDNSURLSessionDelegate,
RUMView(path: or defaultPrivacyLevel remains, and no active setUserInfo call lacks an id
(a commented-out call with a TODO is acceptable and must be reported);curl -fsSL "https://raw.githubusercontent.com/DataDog/dd-sdk-ios/<tag>/Package.swift" | sed -n '/products:/,/dependencies:/p' | grep -oE 'name: "[A-Za-z]+"' | cut -d'"' -f2 | sort -u
grep -ohE 'productName = Datadog[A-Za-z]+;' <App>.xcodeproj/project.pbxproj | sed 's/productName = //;s/;//' | sort -u
A product that is not in the first list (for example DatadogInternal) must be removed, with its
build file and its entries. Do the same for the import Datadog... lines: each module is a
product, or DatadogInternal, which needs no product;If one of these checks fails and you cannot fix it, restore the project to its original state and report what blocked the upgrade. Do not deliver a change that you know will not compile.
Fix only migration-related failures. Do not rewrite unrelated code or remove instrumentation to get a successful build.
Report the original and resulting SDK versions, how the target version was chosen (and any move down, with the failing requirement), the dependency manager and its resolve command, the files changed, the Session Replay values applied, the behavior changes from steps 6 and 7, the decisions left to the owner, and the exact build command with its result.
Before you send the report, check it for the client token. Take the value of clientToken from
the project and make sure it appears nowhere in your report. If it does, rewrite that line as
clientToken: unchanged. The report is public to the reviewer of the pull request.
The target is always a 3.x release, so every listing below keeps only 3.x.y tags.
Print the newest 3.x release and its requirements in one step. This avoids the rate-limited GitHub REST API:
TAG=$(git ls-remote --tags --refs https://github.com/DataDog/dd-sdk-ios | sed 's#.*refs/tags/##' | grep -E '^3\.[0-9]+\.[0-9]+$' | sort -V | tail -1); echo "newest 3.x: $TAG"; curl -fsSL "https://raw.githubusercontent.com/DataDog/dd-sdk-ios/$TAG/Package.swift" | grep -E 'swift-tools-version|\.(iOS|tvOS|visionOS)\('
If git is not installed (git: command not found) or fails, list the versions with curl
instead. Use the public tags page, which is not rate limited like the REST API and lists every
tag, including patch releases that the changelog omits (for example 3.16.1):
for p in 1 2 3; do curl -fsSL "https://github.com/DataDog/dd-sdk-ios/tags?page=$p"; done | grep -oE 'releases/tag/3\.[0-9]+\.[0-9]+' | sed 's#.*/##' | sort -uV | tail -1
Each page lists about ten tags, newest first. Print the whole list (drop tail -1) to see older
tags, and raise the page count if you need versions older than the first three pages. Then read
that tag's Package.swift with the curl command above.
Only if both ways fail to reach GitHub, use the fallback version 3.14.0 (see
step 2 of SKILL.md) and report it. Do not guess any other version.
Compare those requirements with the project, and choose the newest tag whenever they are met.
.iOS(...), .tvOS(...) and .visionOS(...) entries give the minimum deployment target
of each platform.swift-tools-version gives the minimum Xcode: 5.9 needs Xcode 15, 6.0 needs Xcode 16, 6.2
needs Xcode 26. Any Xcode 26.x meets 6.2.swift-tools-version needs.Move down to an older tag only when you can name the specific requirement that the newest tag
fails, and state it in the report. To see older tags, run the listing without tail -1, then
read that tag's requirements with the same curl command.
Known breakpoints:
| Version | Change |
|---|---|
| 3.10.0 | First release with visionOS support |
| 3.17.0 | iOS and tvOS minimum raised from 12 to 15 |
| 3.15.0 to 3.18.0 | Declare swift-tools-version: 6.0, but their sources use syntax that Xcode 16.0 (Swift 6.0) rejects (unexpected ',' separator); they need a Swift 6.1 compiler, which is Xcode 16.3 or later. Verified on 3.15.0, 3.16.1 and 3.18.0. 3.14.0 is the newest that builds with Xcode 16.0 |
| 3.19.0 | Requires swift-tools-version: 6.2 (Xcode 26) |
For example, a project with a deployment target of iOS 13 and Xcode 26 takes 3.16.x: iOS 12
minimum. With Xcode 16.0 it must take 3.14.0, the newest that compiles there.
swift-tools-version does not reveal every compiler requirement (see 3.15.0 to 3.18.0), so the
build in step 10 of SKILL.md has the last word.
If no 3.x release fits, stop and report the unmet prerequisite. Do not raise the deployment target.
CocoaPods only: check that the chosen version is published. pod trunk info DatadogCore works
where CocoaPods is installed. Otherwise:
curl -fsS https://trunk.cocoapods.org/api/v1/pods/DatadogCore | python3 -c "import json,sys; print('$TAG' in [v['name'] for v in json.load(sys.stdin)['versions']])"
If it prints False, use the newest published version that still fits steps 2 to 4. Sort the
versions numerically, not as text (3.9.1 is older than 3.20.0), and say in the report why the
newest tag was not used.
Report the chosen version and why it was chosen.
Version resolution does not consider the project's deployment target or Xcode version. An open range can therefore resolve to a newer release that the project cannot build.
upToNextMajorVersion
stays upToNextMajorVersion, and an exact requirement stays exact. Do not switch kinds.3.16.0 ..< 3.17.0. This is the one case where the kind changes.~> <X.Y.Z> allows only patch updates, so use it in both cases.~> <X.Y.Z> allows anything up to the next major version. When an older version was
chosen for compatibility, use == <VERSION>.After resolving, read the version actually pinned in Package.resolved, Podfile.lock or
Cartfile.resolved, and confirm that it meets the requirements checked above. If you cannot
resolve because the tool is not installed, leave the resolved file untouched and report that it
must be regenerated.
https://github.com/DataDog/dd-sdk-iosdd-sdk-iosEdit project.pbxproj in its existing style.
In the existing XCRemoteSwiftPackageReference for dd-sdk-ios, change only the version in
requirement:
requirement = {
kind = upToNextMajorVersion;
minimumVersion = <VERSION>;
};
For a capped range, use kind = versionRange; minimumVersion = <VERSION>; maximumVersion = <FIRST_INCOMPATIBLE>;.
Remove DatadogObjc, if the project links it. Delete all four places that mention it, and
confirm with a search that no DatadogObjc is left:
XCSwiftPackageProductDependency object;packageProductDependencies;PBXBuildFile object;PBXFrameworksBuildPhase files list.Add the products the code needs, when the project linked DatadogObjc without them. In v2,
DatadogObjc brought the Core, RUM, Logs and Trace modules along. In v3 each module must be linked:
DatadogCore always, and DatadogRUM, DatadogLogs or DatadogTrace for the DDRUM,
DDLogs or tracing classes the code uses. Do this only for products the code already uses.
Every new object ID must be exactly 24 uppercase hexadecimal characters and must not already occur in the file. Do not invent IDs by hand. Generate them with a command and assign each to exactly one object:
python3 -c 'import secrets; [print(secrets.token_hex(12).upper()) for _ in range(<N>)]'
For each product, add an XCSwiftPackageProductDependency with package = <PKG_ID>; productName = <Product>;,
add its ID to packageProductDependencies, and add a PBXBuildFile with productRef = <PRODUCT_ID>
to the PBXFrameworksBuildPhase.
Resolve with xcodebuild -resolvePackageDependencies -project <App>.xcodeproj (or -workspace),
if xcodebuild is available. Otherwise leave Package.resolved as it is: never edit it by hand.
dependencies: [
.package(url: "https://github.com/DataDog/dd-sdk-ios", .upToNextMajor(from: "<VERSION>")),
// capped range instead: .package(url: "https://github.com/DataDog/dd-sdk-ios", "<VERSION>"..<"<FIRST_INCOMPATIBLE>"),
],
Change only the version in the existing requirement and keep its form. Remove
.product(name: "DatadogObjc", package: "dd-sdk-ios") from every target, and add the product
modules the code needs, as in step 3 above. Resolve with swift package resolve or
xcodebuild -resolvePackageDependencies, if available.
In Podfile:
~> <VERSION>, in each target block where it appears.pod 'DatadogObjc'. Make sure DatadogCore is present, plus the pod of every module whose
code the project uses.pod update DatadogCore DatadogRUM … (list every Datadog pod in the
Podfile), or bundle exec pod update … when a Gemfile pins CocoaPods. Plain pod install keeps the old
versions pinned in Podfile.lock.Podfile.lock, and build through the .xcworkspace.Podfile, leave Podfile.lock untouched, and report that the
pods must be updated. Do not install Ruby tooling.github "DataDog/dd-sdk-ios" in Cartfile following the Version
requirement section.carthage update dd-sdk-ios --use-xcframeworks --platform <PLATFORMS>, where <PLATFORMS> is
the comma-separated list of the target's platforms, for example iOS,tvOS. This updates only
dd-sdk-ios. Datadog does not ship prebuilt Carthage binaries. If Carthage is not installed, edit the
Cartfile, leave Cartfile.resolved untouched, and report that the update must be run.DatadogCore.xcframework and DatadogInternal.xcframework, plus one
xcframework for each product the project uses (DatadogRUM, DatadogLogs, DatadogTrace,
DatadogSessionReplay, DatadogCrashReporting with CrashReporter, DatadogWebViewTracking).
Unlink DatadogObjc.xcframework. Link and embed them exactly the way the project already handles
its other Carthage xcframeworks.Cartfile.resolved.Use this only when the project already vendors xcframeworks for its dependencies.
The release zip contains only iOS and tvOS slices. When the target builds for visionOS, stop before editing anything and report that the manual XCFramework path does not support visionOS. Do not work around it by switching the project to another dependency manager. After extracting, confirm that each required framework has slices for the platforms where it will be linked. If any slice is missing, stop before linking.
Datadog.xcframework.zip from the GitHub release for the chosen tag.DatadogObjc.xcframework.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub datadog-labs/agent-skills --plugin agent-skills78 skills in this plugin
/agent-observability-auto-experimentRun an iterative code-improvement hill-climb against real Datadog LLM-Obs data, locally, with Claude Code as the agent. Establishes a baseline eval, makes one focused change, re-scores both splits with the same harness, keeps the change when held-out test improves without overfitting val (labeling within-noise gains tentative), and repeats. This is the skill published as "Autoresearch" in Datadog Agent Observability. Use when the user says "run an auto experiment", "run autoresearch", "hill-climb this code", "iteratively improve X and measure the delta", "optimize this code/agent/pipeline/prompt against my traces", "auto-optimize against LLM-Obs", or wants the local equivalent of the auto_experiments worker. Works from an ml_app, a dataset_id, an annotation_queue_id (a queue of human-labelled interactions), a list of trace_ids, or (by exception) a local dataset file. The corpus and its val/test splits live in Datadog LLM-Obs Datasets, created once per run with a timestamp in their names./agent-observability-build-eval-from-annotationsFit a Datadog LLM-Obs evaluator to human labels. Takes an annotation queue, works out where in the trace the labelled property actually lives, drafts an LLM-judge that predicts the human label, scores that judge against the already-labelled rows with a metric agreed with the user, then hill-climbs it — inspect the errors, make one focused change, re-score, keep it only if it beats the best — for a bounded number of iterations, and finally publishes the winner to Datadog as a DISABLED evaluator (not a Datadog draft — a real evaluator with `enabled: false`). Use when the user says "build an eval from my annotations", "build an evaluator from the annotation queue", "turn my annotations into an evaluator", "learn an evaluator from my labels", "fit a judge to the annotation queue", "auto-label", "auto labelling", "automate this annotation queue", "scale up my human labels", or wants the rest of a queue graded the way the humans graded the first rows. Needs an annotation queue with at least two classes present in the human labels (e.g. one true and one false for a boolean).Other plugins' skills for the same job