configure-sentry
npx skills add https://github.com/laurigates/claude-plugins --skill configure-sentry
Agent 安装分布
Skill 文档
/configure:sentry
Check and configure Sentry error tracking integration against project standards.
Context
This command validates Sentry SDK integration and configuration against project standards.
Skills referenced: sentry (MCP server for Sentry API)
Version Checking
CRITICAL: Before configuring Sentry SDKs, verify latest versions:
- @sentry/vue / @sentry/react: Check npm
- @sentry/node: Check npm
- sentry-sdk (Python): Check PyPI
- @sentry/vite-plugin: Check npm
Use WebSearch or WebFetch to verify current SDK versions before configuring Sentry.
Workflow
Phase 1: Project Type Detection
Determine project type to select appropriate SDK and configuration:
- Check for
.project-standards.yamlwithproject_typefield - If not found, auto-detect:
- frontend: Has
package.jsonwith vue/react dependencies - node: Has
package.jsonwith Node.js backend (express, fastify, etc.) - python: Has
pyproject.tomlorrequirements.txt
- frontend: Has
- Allow override via
--typeflag
Phase 2: SDK Detection
Check for Sentry SDK installation:
Frontend (Vue/React):
@sentry/vueor@sentry/reactin package.json dependencies- Check for
@sentry/vite-pluginfor source maps
Node.js Backend:
@sentry/nodein package.json dependencies- Check for
@sentry/profiling-node(recommended)
Python:
sentry-sdkin pyproject.toml or requirements.txt- Check for framework integrations (django, flask, fastapi)
Phase 3: Configuration Analysis
Environment Variable Checks:
SENTRY_DSN– Required, must be set via environmentSENTRY_ENVIRONMENT– Recommended (development, staging, production)SENTRY_RELEASE– Recommended (auto-set by build)
Frontend Configuration Checks:
| Check | Standard | Severity |
|---|---|---|
| DSN from env | import.meta.env.VITE_SENTRY_DSN |
FAIL if hardcoded |
| Source maps | Vite plugin configured | WARN if missing |
| Tracing | tracesSampleRate set |
WARN if missing |
| Session replay | Replay integration | INFO (optional) |
| Release | Auto-injected by build | WARN if missing |
Node.js Configuration Checks:
| Check | Standard | Severity |
|---|---|---|
| DSN from env | process.env.SENTRY_DSN |
FAIL if hardcoded |
| Init location | Before other imports | WARN if late |
| Tracing | tracesSampleRate set |
WARN if missing |
| Profiling | Profiling integration | INFO (optional) |
| Release | Auto-set by CI/CD | WARN if missing |
Python Configuration Checks:
| Check | Standard | Severity |
|---|---|---|
| DSN from env | os.getenv('SENTRY_DSN') |
FAIL if hardcoded |
| Framework | Correct integration enabled | WARN if missing |
| Tracing | traces_sample_rate set |
WARN if missing |
| Release | Auto-set by CI/CD | WARN if missing |
Phase 4: Security Analysis
Critical Security Checks:
- No hardcoded DSN – DSN must come from environment variables
- No DSN in git – Verify DSN not committed in source files
- No secret in client – Frontend DSN is public, but verify no auth tokens
- Sample rates – Verify production sample rates are reasonable (not 1.0)
Phase 5: Report Generation
Sentry Compliance Report
============================
Project Type: frontend (detected)
SDK: @sentry/vue v8.30.0
Installation Status:
@sentry/vue v8.30.0 â
PASS
@sentry/vite-plugin v2.22.0 â
PASS
Configuration Checks:
DSN from environment â
PASS
Source maps enabled â
PASS
Tracing configured â ï¸ WARN (sample rate 0.0)
Session replay âï¸ SKIP (optional)
Release auto-injection â
PASS
Security Checks:
No hardcoded DSN â
PASS
No DSN in git history â
PASS
Sample rates reasonable â ï¸ WARN (0.0 in production)
Missing Configuration:
- tracesSampleRate should be > 0 for tracing
Recommendations:
- Set tracesSampleRate: 0.1 for 10% sampling
Overall: 2 warnings
Phase 6: Configuration (If Requested)
If --fix flag or user confirms:
- Missing SDK: Add appropriate Sentry SDK to dependencies
- Missing Vite plugin: Add
@sentry/vite-pluginfor source maps - Missing config file: Create Sentry initialization file
- Hardcoded DSN: Replace with environment variable reference
- Missing sample rates: Add recommended sample rates
Frontend initialization template (Vue):
// src/sentry.ts
import * as Sentry from '@sentry/vue'
import type { App } from 'vue'
export function initSentry(app: App) {
Sentry.init({
app,
dsn: import.meta.env.VITE_SENTRY_DSN,
environment: import.meta.env.MODE,
release: import.meta.env.VITE_SENTRY_RELEASE,
integrations: [
Sentry.browserTracingIntegration(),
],
tracesSampleRate: import.meta.env.PROD ? 0.1 : 1.0,
})
}
Python initialization template:
# sentry_init.py
import os
import sentry_sdk
def init_sentry():
sentry_sdk.init(
dsn=os.getenv('SENTRY_DSN'),
environment=os.getenv('SENTRY_ENVIRONMENT', 'development'),
release=os.getenv('SENTRY_RELEASE'),
traces_sample_rate=0.1 if os.getenv('SENTRY_ENVIRONMENT') == 'production' else 1.0,
)
Node.js initialization template:
// instrument.js (must be first import)
import * as Sentry from '@sentry/node'
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV,
release: process.env.SENTRY_RELEASE,
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
})
Phase 7: CI/CD Integration Check
Verify Sentry integration in CI/CD:
GitHub Actions checks:
SENTRY_AUTH_TOKENsecret configured- Source map upload step in build workflow
- Release creation on deploy
Recommended workflow addition:
- name: Create Sentry Release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: your-org
SENTRY_PROJECT: your-project
with:
environment: production
sourcemaps: './dist'
Phase 8: Standards Tracking
Update or create .project-standards.yaml:
standards_version: "2025.1"
project_type: "frontend"
last_configured: "2025-11-30"
components:
sentry: "2025.1"
Flags
| Flag | Description |
|---|---|
--check-only |
Report status without offering fixes |
--fix |
Apply all fixes automatically without prompting |
--type <type> |
Override project type detection (frontend, python, node) |
Examples
# Check compliance and offer fixes
/configure:sentry
# Check only, no modifications
/configure:sentry --check-only
# Auto-fix all issues
/configure:sentry --fix
# Force Python project type
/configure:sentry --type python
Environment Variables
Required environment variables for Sentry:
| Variable | Description | Required |
|---|---|---|
SENTRY_DSN |
Sentry Data Source Name | Yes |
SENTRY_ENVIRONMENT |
Environment name | Recommended |
SENTRY_RELEASE |
Release version | Recommended |
SENTRY_AUTH_TOKEN |
Auth token for CI/CD | For source maps |
Important: Never commit DSN or auth tokens. Use environment variables or secrets management.
Error Handling
- No Sentry SDK: Offer to install appropriate SDK for project type
- Hardcoded DSN: Report as FAIL, offer to fix with env var reference
- Invalid DSN format: Report error, provide DSN format guidance
- Missing Sentry project: Report warning, provide setup instructions
See Also
/configure:all– Run all compliance checks/configure:status– Quick compliance overview/configure:workflows– GitHub Actions integrationsentryMCP server – Sentry API access for project verification