Capture your first test error with Sentry and verify it appears in the dashboard.
Use when testing a new Sentry integration, verifying error capture works after
install-auth, or learning how to enrich events with user context, tags, and breadcrumbs.
Trigger with phrases like "test sentry", "sentry hello world",
"verify sentry", "first sentry error", "sentry capture test".
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Capture your first test error with Sentry and verify it appears in the dashboard.
Use when testing a new Sentry integration, verifying error capture works after
install-auth, or learning how to enrich events with user context, tags, and breadcrumbs.
Trigger with phrases like "test sentry", "sentry hello world",
"verify sentry", "first sentry error", "sentry capture test".
Designed for Claude Code, also compatible with Codex and OpenClaw
Sentry Hello World
Overview
Send your first test events to Sentry — a captured message, a captured exception, and a fully-enriched error with user context, tags, and breadcrumbs — then verify each one appears in the Sentry dashboard. This skill covers both Node.js (@sentry/node) and Python (sentry-sdk).
instrument.mjs loaded before app code (Node.js) or sentry_sdk.init() called (Python)
Network access to *.ingest.sentry.io
Instructions
Step 1 — Verify the SDK Is Active
Before sending test events, confirm the SDK initialized correctly. If getClient() returns undefined, the SDK was never initialized — go back to sentry-install-auth.
TypeScript (Node.js):
import * asSentryfrom'@sentry/node';
const client = Sentry.getClient();
if (!client) {
console.error('Sentry SDK not initialized. Ensure instrument.mjs is loaded first.');
console.error('Run with: node --import ./instrument.mjs your-script.mjs');
process.exit(1);
}
console.log('Sentry SDK active — DSN configured');
"Sentry SDK not initialized. Call sentry_sdk.init() first."
1
print
"Sentry SDK active — DSN configured"
Step 2 — Capture a Test Message
captureMessage sends an informational event without a stack trace. Use it to verify basic connectivity between your app and Sentry.
TypeScript:
import * asSentryfrom'@sentry/node';
// captureMessage returns the event ID (a 32-char hex string)const eventId = Sentry.captureMessage('Hello Sentry! SDK verification test.', 'info');
console.log(`Message sent — Event ID: ${eventId}`);
// Also test 'warning' level — appears with yellow indicator in dashboardSentry.captureMessage('Warning-level test message', 'warning');
// IMPORTANT: flush before process exits or events may be lostawaitSentry.flush(2000);
Python:
import sentry_sdk
event_id = sentry_sdk.capture_message("Hello Sentry! SDK verification test.", level="info")
print(f"Message sent — Event ID: {event_id}")
sentry_sdk.capture_message("Warning-level test message", level="warning")
# Flush to ensure delivery before process exits
sentry_sdk.flush()
Step 3 — Capture a Test Exception
captureException sends a full error with stack trace. Always pass an actual Error object (not a string) so Sentry generates a proper stack trace.
TypeScript:
import * asSentryfrom'@sentry/node';
try {
thrownewError('Hello Sentry! This is a test exception.');
} catch (error) {
const eventId = Sentry.captureException(error);
console.log(`Exception sent — Event ID: ${eventId}`);
}
awaitSentry.flush(2000);
Python:
import sentry_sdk
try:
raise ValueError("Hello Sentry! This is a test exception.")
except Exception as e:
event_id = sentry_sdk.capture_exception(e)
print(f"Exception sent — Event ID: {event_id}")
sentry_sdk.flush()
Step 4 — Add User Context and Tags
Enrich events with identity and metadata so you can filter and search in the dashboard. setUser attaches to all subsequent events in the current scope. setTag creates indexed, searchable key-value pairs.
TypeScript:
import * asSentryfrom'@sentry/node';
// Attach user identity — appears in the "User" section of every eventSentry.setUser({
id: 'test-user-001',
email: 'dev@example.com',
username: 'developer',
});
// Tags are indexed and searchable — use for filtering in Issues viewSentry.setTag('test_run', 'hello-world');
Sentry.setTag('team', 'platform');
// setContext adds structured data (not indexed, but visible in event detail)Sentry.setContext('test_metadata', {
ran_at: newDate().toISOString(),
node_version: process.version,
purpose: 'SDK verification',
});
// This event will carry user, tags, and contextSentry.captureMessage('Test event with full context attached', 'info');
awaitSentry.flush(2000);
Breadcrumbs record a trail of events leading up to an error. They appear in the event detail view, giving you the chronological context of what happened before the crash.