sentry-local-dev-loop
Configure Sentry for local development with environment-aware settings. Use when setting up dev vs prod DSN routing, enabling debug mode, tuning sample rates for local work, or testing source maps locally. Trigger with phrases like "sentry local dev", "sentry development config", "debug sentry locally", "sentry dev environment", "sentry spotlight".
What this skill does
# Sentry Local Dev Loop
## Overview
Configure Sentry for local development with environment-aware DSN routing, debug-mode verbosity, full-capture sample rates, `beforeSend` inspection, Sentry Spotlight for offline event viewing, and `sentry-cli` source map verification. All configuration uses environment variables so nothing leaks into commits.
## Prerequisites
- `@sentry/node` v8+ installed (TypeScript/Node) or `sentry-sdk` v2+ installed (Python)
- Separate Sentry project created for development (different DSN from production)
- `.env` file with `SENTRY_DSN_DEV` and `NODE_ENV=development`
- Network access to `*.ingest.sentry.io` (or use Spotlight for fully offline work)
## Instructions
### Step 1 -- Environment-Aware Configuration
Create an initialization file that routes events to the correct Sentry project based on environment, enables debug logging in dev, and captures 100% of traces locally:
```typescript
// instrument.mjs — import via: node --import ./instrument.mjs app.mjs
import * as Sentry from '@sentry/node';
const env = process.env.NODE_ENV || 'development';
const isDev = env !== 'production';
Sentry.init({
// Route to dev project locally, prod project in production
dsn: isDev
? process.env.SENTRY_DSN_DEV
: process.env.SENTRY_DSN,
environment: env,
release: isDev ? 'dev-local' : process.env.SENTRY_RELEASE,
// Full capture in dev — you need every event for debugging
tracesSampleRate: isDev ? 1.0 : 0.1,
sampleRate: isDev ? 1.0 : 1.0,
// Verbose SDK output to console in dev
debug: isDev,
// Include PII locally for easier debugging (never in prod)
sendDefaultPii: isDev,
// Sentry Spotlight — shows events in local browser UI
// Install: npx @spotlightjs/spotlight
spotlight: isDev,
beforeSend(event, hint) {
if (isDev) {
const exc = event.exception?.values?.[0];
const label = exc
? `${exc.type}: ${exc.value}`
: event.message || 'event';
console.log(`[Sentry Dev] ${label}`);
console.log(` Tags: ${JSON.stringify(event.tags || {})}`);
}
return event;
},
beforeSendTransaction(event) {
if (isDev) {
const duration = event.timestamp && event.start_timestamp
? ((event.timestamp - event.start_timestamp) * 1000).toFixed(0)
: '?';
console.log(`[Sentry Dev] Transaction: ${event.transaction} (${duration}ms)`);
}
return event;
},
});
```
Set up environment files to keep DSNs out of source:
```bash
# .env.development
SENTRY_DSN_DEV=https://[email protected]/0
SENTRY_ENVIRONMENT=development
NODE_ENV=development
# .env.production
SENTRY_DSN=https://[email protected]/0
SENTRY_ENVIRONMENT=production
SENTRY_RELEASE=v1.2.3
NODE_ENV=production
```
Add DSN safety to `.gitignore`:
```gitignore
.env
.env.development
.env.production
.env.local
```
### Step 2 -- Local Verification and Performance Debugging
Create a verification script that confirms the SDK works end-to-end and demonstrates `Sentry.startSpan()` for local performance profiling:
```typescript
// scripts/verify-sentry.mjs — run: node --import ./instrument.mjs scripts/verify-sentry.mjs
import * as Sentry from '@sentry/node';
async function verify() {
const client = Sentry.getClient();
if (!client) {
console.error('Sentry SDK not initialized — run with --import ./instrument.mjs');
process.exit(1);
}
console.log('--- Sentry Dev Loop Verification ---\n');
// 1. Test captureMessage
console.log('1. Sending test message...');
Sentry.captureMessage('Dev loop verification — captureMessage', 'info');
// 2. Test captureException
console.log('2. Sending test exception...');
try {
throw new Error('Dev loop verification — captureException');
} catch (e) {
const eventId = Sentry.captureException(e);
console.log(` Event ID: ${eventId}`);
}
// 3. Test Sentry.startSpan for local performance profiling
console.log('3. Testing startSpan for performance...');
await Sentry.startSpan(
{ name: 'dev.verification.database', op: 'db.query' },
async (span) => {
// Simulate a slow database query
await new Promise((resolve) => setTimeout(resolve, 150));
// Nested span for a sub-operation
await Sentry.startSpan(
{ name: 'dev.verification.serialize', op: 'serialize' },
async () => {
await new Promise((resolve) => setTimeout(resolve, 50));
}
);
}
);
// 4. Test breadcrumb trail
console.log('4. Testing breadcrumbs...');
Sentry.addBreadcrumb({
category: 'dev',
message: 'Verification script started',
level: 'info',
});
Sentry.addBreadcrumb({
category: 'dev',
message: 'All checks passed',
level: 'info',
});
Sentry.captureMessage('Dev verification complete with breadcrumbs', 'info');
// 5. Flush — critical for scripts that exit immediately
console.log('5. Flushing events...');
const flushed = await Sentry.flush(5000);
console.log(flushed
? '\nAll events sent — check Sentry dashboard or Spotlight UI'
: '\nFlush timed out — check DSN and network'
);
}
verify();
```
Use `Sentry.startSpan()` in your application code to profile specific operations during development:
```typescript
// Profile a real endpoint handler locally
app.get('/api/search', async (req, res) => {
const results = await Sentry.startSpan(
{ name: 'search.execute', op: 'db.query', attributes: { 'search.query': req.query.q } },
async () => {
return await db.search(req.query.q);
}
);
const formatted = await Sentry.startSpan(
{ name: 'search.format', op: 'serialize' },
async () => {
return results.map(formatResult);
}
);
res.json(formatted);
});
```
### Step 3 -- Sentry Spotlight and Offline Development
Sentry Spotlight runs a local sidecar that intercepts Sentry events and displays them in a browser UI at `http://localhost:8969` (Spotlight's default port) — no network required:
```bash
# Install and run Spotlight sidecar (runs alongside your dev server)
npx @spotlightjs/spotlight
```
The `spotlight: true` option in Step 1's `Sentry.init()` routes events to the local sidecar. This gives you a full Sentry-style event viewer without sending anything to `sentry.io`.
For fully offline development or CI environments with no Sentry access:
```typescript
// Offline mode — SDK loads but sends nothing
Sentry.init({
dsn: '', // Empty DSN = all capture calls become no-ops
debug: false, // No debug output since nothing is sent
});
// All Sentry.captureException() and captureMessage() calls still work
// without throwing — your code runs without modification
```
Test source maps locally before deploying with `sentry-cli`:
```bash
# Install sentry-cli
npm install -g @sentry/cli
# Verify authentication
sentry-cli info
# Upload source maps for a test release
sentry-cli sourcemaps upload \
--org your-org \
--project your-dev-project \
--release dev-local \
./dist
# Verify source maps are correctly linked
sentry-cli sourcemaps explain \
--org your-org \
--project your-dev-project \
--release dev-local
```
Add a git pre-push hook to prevent hardcoded DSNs from leaking into the repo:
```bash
#!/bin/bash
set -e
# .git/hooks/pre-push — block commits with hardcoded DSNs
if grep -rn "ingest\.sentry\.io" --include="*.ts" --include="*.js" \
--exclude-dir=node_modules --exclude-dir=dist src/ lib/; then
echo "ERROR: Hardcoded Sentry DSN found in source. Use environment variables."
exit 1
fi
```
## Output
- Environment-aware `Sentry.init()` routing dev events to a separate Sentry project
- Debug logging printing captured events and transaction durations to the console
- Verification script confirming captureMessage, captureException, and startSpan work
- Sentry Spotlight integration for browsing events locally without network
- Source map upload and verification workflow with `sentry-cli`
- Pre-push hook preventing hardcoded DSNs from Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.