Guide · Agent skill
How to use the Sentry Error Tracking agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The error-tracking skill is a set of instructions and code examples that tells an AI agent how to add Sentry v8 error tracking and performance monitoring to a Node.js and TypeScript project. It is aimed at teams already using Sentry who want every service to capture errors the same way. After reading this guide you will know how to install the skill, how to ask for work that triggers it, and what it needs and does not do. Agent skills are folders containing a SKILL.md file that an agent reads when a task matches the skill's description. This skill does not connect to Sentry on its own; it shapes the code the agent writes.
Quick start
- 1Download and unzip. Download the ZIP from this page and unzip it. The folder contains SKILL.md.
- 2Place the skill. Put the error-tracking folder in ~/.claude/skills/ for all projects, or in .claude/skills/ inside one project. Alternatively, upload it under Settings → Capabilities → Skills in the Claude apps.
- 3Install Sentry packages. Add @sentry/node (Sentry v8) and, for profiling examples, @sentry/profiling-node to a Node.js and TypeScript project.
- 4Set your DSN. Create a Sentry account, copy your DSN, and set it as the SENTRY_DSN environment variable. Keep it out of source control.
- 5Ask for instrumentation. Request error handling, a controller, a cron job or database tracing in plain terms, naming your stack and service.
- 6Review and test. Read the generated code, then trigger a test error and confirm it appears in Sentry.
What the error-tracking skill makes the agent do
Once installed, the agent follows Sentry v8 patterns whenever it writes error handling, new controllers or routes, cron jobs, or database calls. The skill states a critical rule that all errors must be captured to Sentry, and that console.error alone is not acceptable.
The skill also asks the agent to wrap cron jobs and slow operations in performance spans, and to attach user, service and environment context to error reports.
- Controller and route errors are sent to Sentry with captureException, with tags and extra data.
- Cron jobs get a span named for the job, with a captured exception and a non-zero exit code on failure.
- Database calls can be wrapped in spans so query timing shows in Sentry.
- Reports include user ID, a service tag and an environment tag where available.
Install the skill from the ZIP
Download the ZIP for this skill from this page and unzip it. The skill is a single file, SKILL.md. To make it available to all your projects, place the unzipped folder in ~/.claude/skills/. To make it available only to one project, place it in that project's .claude/skills/ folder.
If you use the Claude apps, you can upload the skill instead. Open Settings, go to Capabilities, then Skills, and upload it there.
- Personal install: ~/.claude/skills/error-tracking/
- Project install: .claude/skills/error-tracking/ inside your project
- Claude apps: Settings → Capabilities → Skills
~/.claude/skills/error-tracking/SKILL.mdTrigger the skill with natural requests
You do not need to name the skill. The skill's description lists the situations where it applies, so ask for work in those terms. Requests that match the description include adding error handling, creating a new controller, instrumenting a cron job, or tracking database performance.
Be specific about your stack. The examples assume Node.js, TypeScript and @sentry/node, so mention them if your project uses them.
- "Add error handling to the invoice controller and report failures to Sentry."
- "Instrument the nightly cleanup cron job with Sentry so its runtime and failures are tracked."
- "Wrap the user profile queries in Prisma with a Sentry performance span."
- "Create a new orders route with Sentry error capture and request context."
Set up the Sentry initialisation and DSN
The skill's examples create an instrument file that calls Sentry.init. The DSN is read from the SENTRY_DSN environment variable, and the examples set the environment from NODE_ENV with a fallback of development. The skill's examples use a tracesSampleRate and profilesSampleRate of 0.1, and import nodeProfilingIntegration from @sentry/profiling-node.
You must supply your own Sentry account and DSN. Keep the DSN out of source control, because it is a secret.
- Requires @sentry/node (Sentry v8) in your project.
- Requires @sentry/profiling-node for the profiling examples.
- Set SENTRY_DSN in your environment before running the service.
import * as Sentry from '@sentry/node';
import { nodeProfilingIntegration } from '@sentry/profiling-node';
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV || 'development',
integrations: [
nodeProfilingIntegration(),
],
tracesSampleRate: 0.1,
profilesSampleRate: 0.1,
});Instrument cron jobs and database calls
The skill marks cron instrumentation as mandatory. The instrument file must be the first import in the job, after the shebang line. The job body runs inside Sentry.startSpan with a cron operation type, and it logs and exits with code 1 on failure.
For database work, the skill shows a direct span around a Prisma query. It also mentions a custom helper class, DatabasePerformanceMonitor, from the original production project. You only need that helper if you build an equivalent for your own codebase; the direct span works without it.
- The instrument import must be the first line after the shebang.
- The skill's configuration sample sets a slowQueryThreshold of 100 and enableN1Detection to true. These are sample values in a config.ini file, not settings the skill applies automatically.
- Test endpoints such as /api/sentry/test-error are suggested to confirm the integration works end to end.
const result = await Sentry.startSpan({
name: 'db.userProfile.findMany',
op: 'db.query',
attributes: { 'db.model': 'UserProfile', 'db.operation': 'findMany' }
}, async () => {
return await prisma.userProfile.findMany({ take: 5 });
});Safety notes: scripts and network use
This skill does not run scripts. It is instructions and code examples only. It does use the network, in the sense that the code it produces sends error reports and performance data to Sentry at the DSN you provide.
Because error reports can include user IDs and workflow metadata, do not use this skill where sending that data to a third party is not allowed, such as systems holding sensitive personal data. Review the context the agent attaches before deploying.
- Keep SENTRY_DSN out of source control.
- Check which user and workflow fields end up in error reports.
- Review the generated code before it ships, since the skill is a set of patterns rather than a tested library.
Tips for getting good results
Give the agent your service name and environment so the tags it sets are meaningful. Ask it to follow the controller pattern if your project already has a base controller class, because the skill's first example relies on a BaseController with a handleError method.
If you have a domain-specific error helper, point the agent to it. The skill's workflow example shows the call shape for such a helper, but you must build the helper yourself.
- Name your service and environment in the request.
- Point the agent to existing base classes or helpers in your code.
- Ask for a test endpoint so you can confirm events reach Sentry.
What people use it for
- Adding consistent Sentry error capture to controllers and Express-style routes across several Node.js services.
- Instrumenting a scheduled cron job so its execution and failures show up in Sentry.
- Wrapping Prisma queries in spans to see which database calls are slow.
- Adding performance spans around async operations such as calls to external services.
Frequently asked questions
How do I install the error-tracking agent skill?
Download the ZIP from this page and unzip it. Place the error-tracking folder in ~/.claude/skills/ for all projects, or in a project's .claude/skills/ folder. In the Claude apps, you can instead upload it under Settings → Capabilities → Skills.
What do I need to use this skill?
You need a Node.js and TypeScript project, the @sentry/node package for Sentry v8, and a Sentry account with a DSN set in SENTRY_DSN. @sentry/profiling-node is needed for the profiling examples, and a Prisma or similar database client is optional for the database examples.
Does this skill create a Sentry account or connect my project to Sentry?
No. The skill only contains instructions and code examples. You must create your own Sentry account and supply your DSN, and the generated code sends reports to that DSN.
Is the error-tracking skill free?
The skill is published under the MIT licence. The source does not state any pricing for Sentry itself, so check Sentry's own terms for its service costs.
Does this skill work with languages other than Node.js and TypeScript?
Not as written. The examples assume @sentry/node and TypeScript, so other stacks would need the guidance reworked.
Why does the agent keep saying not to use console.error alone?
The skill's critical rule states that all errors must be captured to Sentry and that console.error alone is not enough. The agent is told to send errors to Sentry in addition to any logging.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if your team already runs Node.js and TypeScript services on Sentry and wants every agent-written error handler, controller, cron job and database call to follow one pattern. Pick something else if you do not use Sentry or Node.js, or if you cannot send user IDs and workflow data to a third party.
Download the skill