Dd instrument rum

From datadog-labs/agent-skills · View interactive version

Dd instrument rum is an AI agent skill from the GitHub repository datadog-labs/agent-skills. Instrument browser-based web applications with Datadog Browser RUM. Detect the application framework, router, package manager, bundler, entrypoint, credentials, and existing RUM setup; add or safely complete classic Browser RUM instrumentation for React, Next.js App or Pages Router, Angular, Vue, Nu

How to use this skill

Skill file

Datadog Browser RUM instrumentation

Instrument only the browser application in scope. Do not add Datadog APM, tracing, LLM Observability, Logs, source-map upload, user identification, Vercel metadata, Shopify, Salesforce, or unrelated Datadog products.

Use normal file inspection, editing, and command tools for every step except optional RUM application creation. Use only CreateRumApplication for that operation, as described in references/common-credentials.md; never invent Datadog tool names.

Ground rules

Phase 1: analyze the target

Locate the browser application

Identify the project root that produces browser code. In a monorepo, inspect workspace configuration, scripts, Dockerfiles, and CI/deployment configuration to find the frontend manifest used by the real build rather than editing the repository root by assumption. Record that manifest path and its package manager before editing. If several independent browser applications are plausible and the user did not select one, ask which application to instrument.

Reject non-browser applications such as Ink CLIs and projects with no HTML/browser build target.

Detect the framework and runtime shape

Inspect dependencies and source layout in this order so meta-frameworks win over their underlying UI library:

  1. nuxt -> Nuxt
  2. next -> Next.js; distinguish App Router from Pages Router by source layout
  3. @angular/core -> Angular; distinguish standalone bootstrap from NgModule
  4. vue -> Vue
  5. svelte or @sveltejs/kit -> Svelte or SvelteKit
  6. react -> React
  7. Browser entrypoint without the above -> generic/vanilla browser application

Also detect:

Read references/rum-core.md, then read exactly the applicable framework reference:

| Target | Reference |

|---|---|

| React, React Router, TanStack Router | references/rum-react.md |

| Next.js App or Pages Router | references/rum-nextjs.md |

| Angular | references/rum-angular.md |

| Vue | references/rum-vue.md |

| Nuxt | references/rum-nuxt.md |

| Svelte, vanilla, generic SPA, iframe-hosted app | references/rum-other-frameworks.md |

Validate every prerequisite in the selected reference before provisioning credentials or editing. Do not upgrade a framework and do not silently fall back to core-only RUM when a detected framework plugin is incompatible.

Detect existing RUM instrumentation

Search source, HTML, and configuration files while excluding dependency, build, generated, and coverage directories such as node_modules, dist, build, .next, .nuxt, and coverage.

Check for:

Treat package presence alone as insufficient: a dependency may be unused.

Phase 2: instrument

Resolve credentials through references/common-credentials.md only after analysis succeeds. If analysis found one valid existing init, reuse its existing credentials and skip credential replacement entirely. Supplied task credentials may be used only when creating a new init. Then:

  1. Install the core SDK and compatible framework package(s) with the detected package manager, using the deployed frontend manifest. For an existing valid init, install only a missing integration package; never replace already-valid RUM packages or configuration.
  2. Apply the canonical configuration and install method from references/rum-core.md. For an existing valid init, apply only missing compatible fields to that same object; do not copy credential or canonical-option placeholders over existing values.
  3. Apply the selected framework reference, including router tracking and safe framework error integration when those surfaces exist.
  4. Update the lockfile with the same package manager. Never hand-edit a generated lockfile.
  5. Detect configured formatting from manifest scripts such as lint:fix, fix, or format and from ESLint/Prettier configuration. Run the project's formatter or fix command only for files changed by this work.

Do not add allowedTracingUrls or any backend/CORS/tracing configuration; those belong to an APM onboarding workflow.

Phase 3: verify and report

Follow references/common-verify-report.md. Before reporting success, inspect the final diff against the pre-edit project. When an existing valid init was found, verify that every pre-existing init value—including both credentials—remains byte-for-byte unchanged and that the only setup changes are the required missing integration wiring (plus any strictly necessary dependency/lockfile change). If an existing value changed, restore it before reporting success. Do not report success unless required packages are persisted, the resulting setup contains exactly one init, and the normal build succeeds.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.