configure-sentry

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/configure:sentry

/configure:sentry

Check and configure Sentry error tracking integration against project standards.
按照项目标准检查并配置Sentry错误追踪集成。

When to Use This Skill

何时使用此Skill

Use this skill when...Use another approach when...
Setting up Sentry error tracking for a new projectDebugging a specific Sentry issue or alert (use Sentry MCP server)
Checking Sentry SDK installation and configuration complianceQuerying Sentry events or performance data (use Sentry API/MCP)
Fixing hardcoded DSNs or missing environment variable referencesManaging Sentry project settings in the Sentry dashboard
Adding source map upload and release tracking to CI/CDConfiguring Sentry alerting rules or notification channels
Verifying Sentry configuration across frontend, Node.js, or Python projectsInstalling a different error tracking tool (e.g., Bugsnag, Rollbar)
何时使用此Skill...何时使用其他方法...
为新项目设置Sentry错误追踪调试特定的Sentry问题或告警(使用Sentry MCP server)
检查Sentry SDK安装和配置合规性查询Sentry事件或性能数据(使用Sentry API/MCP)
修复硬编码DSN或缺失的环境变量引用在Sentry控制台中管理Sentry项目设置
为CI/CD添加source map上传和版本追踪配置Sentry告警规则或通知渠道
验证前端、Node.js或Python项目中的Sentry配置安装其他错误追踪工具(如Bugsnag、Rollbar)

Context

上下文

  • Package.json: !
    find . -maxdepth 1 -name \'package.json\' 2>/dev/null
  • Pyproject.toml: !
    find . -maxdepth 1 -name \'pyproject.toml\' 2>/dev/null
  • Requirements.txt: !
    find . -maxdepth 1 -name \'requirements.txt\' 2>/dev/null
  • Project standards: !
    head -20 .project-standards.yaml 2>/dev/null
  • Sentry in package.json: !
    grep -o '"@sentry/[^"]*"' package.json 2>/dev/null
  • Sentry in pyproject.toml: !
    grep 'sentry' pyproject.toml 2>/dev/null
  • Sentry init files: !
    find . -maxdepth 3 -name "*sentry*" -type f 2>/dev/null
  • Env files referencing DSN: !
    grep -rl 'SENTRY_DSN' .env* .github/workflows/ 2>/dev/null
  • CI workflows: !
    find .github/workflows -maxdepth 1 -name '*.yml' 2>/dev/null
Skills referenced:
sentry
(MCP server for Sentry API)
  • Package.json: !
    find . -maxdepth 1 -name \'package.json\' 2>/dev/null
  • Pyproject.toml: !
    find . -maxdepth 1 -name \'pyproject.toml\' 2>/dev/null
  • Requirements.txt: !
    find . -maxdepth 1 -name \'requirements.txt\' 2>/dev/null
  • 项目标准: !
    head -20 .project-standards.yaml 2>/dev/null
  • Sentry in package.json: !
    grep -o '"@sentry/[^"]*"' package.json 2>/dev/null
  • Sentry in pyproject.toml: !
    grep 'sentry' pyproject.toml 2>/dev/null
  • Sentry初始化文件: !
    find . -maxdepth 3 -name "*sentry*" -type f 2>/dev/null
  • 引用DSN的环境文件: !
    grep -rl 'SENTRY_DSN' .env* .github/workflows/ 2>/dev/null
  • CI工作流: !
    find .github/workflows -maxdepth 1 -name '*.yml' 2>/dev/null
引用的Skills:
sentry
(用于Sentry API的MCP server)

Parameters

参数

Parse these from
$ARGUMENTS
:
FlagDescription
--check-only
Report status without offering fixes
--fix
Apply all fixes automatically without prompting
--type <type>
Override project type detection (
frontend
,
python
,
node
)
$ARGUMENTS
中解析以下参数:
标志描述
--check-only
仅报告状态,不提供修复方案
--fix
自动应用所有修复,无需提示
--type <type>
覆盖项目类型检测结果(
frontend
python
node

Version Checking

版本检查

CRITICAL: Before configuring Sentry SDKs, verify latest versions:
  1. @sentry/vue / @sentry/react: Check npm
  2. @sentry/node: Check npm
  3. sentry-sdk (Python): Check PyPI
  4. @sentry/vite-plugin: Check npm
Use WebSearch or WebFetch to verify current SDK versions before configuring Sentry.
关键提示: 在配置Sentry SDK之前,验证最新版本:
  1. @sentry/vue / @sentry/react: 查看npm
  2. @sentry/node: 查看npm
  3. sentry-sdk (Python): 查看PyPI
  4. @sentry/vite-plugin: 查看npm
在配置Sentry之前,使用WebSearch或WebFetch验证当前SDK版本。

Execution

执行流程

Execute this Sentry compliance check:
执行以下Sentry合规性检查:

Step 1: Detect project type

步骤1:检测项目类型

Determine the project type to select the appropriate SDK and configuration:
  1. Read
    .project-standards.yaml
    for
    project_type
    field
  2. If not found, auto-detect:
    • frontend: Has
      package.json
      with vue/react dependencies
    • node: Has
      package.json
      with Node.js backend (express, fastify, etc.)
    • python: Has
      pyproject.toml
      or
      requirements.txt
  3. If
    --type
    flag is provided, use that value instead
确定项目类型,以选择合适的SDK和配置:
  1. 读取
    .project-standards.yaml
    中的
    project_type
    字段
  2. 如果未找到,自动检测:
    • frontend: 包含带有vue/react依赖的
      package.json
    • node: 包含带有Node.js后端依赖(express、fastify等)的
      package.json
    • python: 包含
      pyproject.toml
      requirements.txt
  3. 如果提供了
    --type
    标志,则使用该值

Step 2: Check SDK installation

步骤2:检查SDK安装情况

Check for Sentry SDK based on detected project type:
Frontend (Vue/React):
  • @sentry/vue
    or
    @sentry/react
    in package.json dependencies
  • @sentry/vite-plugin
    for source maps
Node.js Backend:
  • @sentry/node
    in package.json dependencies
  • @sentry/profiling-node
    (recommended)
Python:
  • sentry-sdk
    in pyproject.toml or requirements.txt
  • Framework integrations (django, flask, fastapi)
根据检测到的项目类型检查Sentry SDK:
前端(Vue/React):
  • package.json
    依赖中包含
    @sentry/vue
    @sentry/react
  • 用于source map的
    @sentry/vite-plugin
Node.js后端:
  • package.json
    依赖中包含
    @sentry/node
  • @sentry/profiling-node
    (推荐)
Python:
  • pyproject.toml
    requirements.txt
    中包含
    sentry-sdk
  • 框架集成(django、flask、fastapi)

Step 3: Analyze configuration

步骤3:分析配置

Read the Sentry initialization files and check against the compliance tables in REFERENCE.md. Validate:
  1. DSN comes from environment variables (not hardcoded)
  2. Tracing sample rate is configured
  3. Source maps are enabled (frontend)
  4. Init location is correct (Node.js: before other imports)
  5. Framework integration is enabled (Python)
读取Sentry初始化文件,并对照REFERENCE.md中的合规性表格进行检查。验证:
  1. DSN来自环境变量(而非硬编码)
  2. 已配置追踪采样率
  3. 已启用source maps(前端)
  4. 初始化位置正确(Node.js:在其他导入之前)
  5. 已启用框架集成(Python)

Step 4: Run security checks

步骤4:运行安全检查

  1. Verify no hardcoded DSN in any source files
  2. Check that DSN is not committed in git-tracked files
  3. Verify no auth tokens in frontend code
  4. Check production sample rates are reasonable (not 1.0)
  1. 验证所有源文件中没有硬编码的DSN
  2. 检查DSN未提交到git追踪文件中
  3. 验证前端代码中没有认证令牌
  4. 检查生产环境采样率合理(不为1.0)

Step 5: Report results

步骤5:报告结果

Print a compliance report with:
  • Project type (detected or overridden)
  • SDK version and installation status
  • Configuration check results (PASS/WARN/FAIL)
  • Security check results
  • Missing configuration items
  • Recommendations
If
--check-only
, stop here.
打印合规性报告,包含:
  • 项目类型(检测到的或覆盖的)
  • SDK版本和安装状态
  • 配置检查结果(通过/警告/失败)
  • 安全检查结果
  • 缺失的配置项
  • 建议
如果使用
--check-only
,在此步骤停止。

Step 6: Apply fixes (if --fix or user confirms)

步骤6:应用修复(如果使用--fix或用户确认)

  1. Missing SDK: Add appropriate Sentry SDK to dependencies
  2. Missing Vite plugin: Add
    @sentry/vite-plugin
    for source maps
  3. Missing config file: Create Sentry initialization file using templates from REFERENCE.md
  4. Hardcoded DSN: Replace with environment variable reference
  5. Missing sample rates: Add recommended sample rates
  1. 缺失Sentry SDK: 提供为项目类型安装合适SDK的选项
  2. 缺失Vite插件: 添加
    @sentry/vite-plugin
    用于source map
  3. 缺失配置文件: 使用REFERENCE.md中的模板创建Sentry初始化文件
  4. 硬编码DSN: 替换为环境变量引用
  5. 缺失采样率: 添加推荐的采样率

Step 7: Check CI/CD integration

步骤7:检查CI/CD集成

Verify Sentry integration in CI/CD:
  • SENTRY_AUTH_TOKEN
    secret configured
  • Source map upload step in build workflow
  • Release creation on deploy
If missing, offer to add the recommended workflow steps from REFERENCE.md.
验证CI/CD中的Sentry集成:
  • 已配置
    SENTRY_AUTH_TOKEN
    密钥
  • 构建工作流中包含source map上传步骤
  • 部署时创建版本记录
如果缺失,提供从REFERENCE.md添加推荐工作流步骤的选项。

Step 8: Update standards tracking

步骤8:更新标准追踪

Update or create
.project-standards.yaml
:
yaml
standards_version: "2025.1"
project_type: "<detected>"
last_configured: "<timestamp>"
components:
  sentry: "2025.1"
更新或创建
.project-standards.yaml
yaml
standards_version: "2025.1"
project_type: "<detected>"
last_configured: "<timestamp>"
components:
  sentry: "2025.1"

Environment Variables

环境变量

VariableDescriptionRequired
SENTRY_DSN
Sentry Data Source NameYes
SENTRY_ENVIRONMENT
Environment nameRecommended
SENTRY_RELEASE
Release versionRecommended
SENTRY_AUTH_TOKEN
Auth token for CI/CDFor source maps
Never commit DSN or auth tokens. Use environment variables or secrets management.
For detailed configuration check tables, initialization templates, and CI/CD workflow examples, see REFERENCE.md.
变量描述是否必填
SENTRY_DSN
Sentry数据源名称
SENTRY_ENVIRONMENT
环境名称推荐
SENTRY_RELEASE
版本号推荐
SENTRY_AUTH_TOKEN
用于CI/CD的认证令牌用于source map
切勿提交DSN或认证令牌。使用环境变量或密钥管理工具。
有关详细的配置检查表、初始化模板和CI/CD工作流示例,请参阅REFERENCE.md

Agentic Optimizations

智能优化

ContextCommand
Quick compliance check
/configure:sentry --check-only
Auto-fix all issues
/configure:sentry --fix
Frontend project only
/configure:sentry --type frontend
Python project only
/configure:sentry --type python
Node.js project only
/configure:sentry --type node
Check for hardcoded DSNs
rg -l 'https://[a-f0-9]*@.*sentry\.io' --type-not env
场景命令
快速合规性检查
/configure:sentry --check-only
自动修复所有问题
/configure:sentry --fix
仅限前端项目
/configure:sentry --type frontend
仅限Python项目
/configure:sentry --type python
仅限Node.js项目
/configure:sentry --type node
检查硬编码DSN
rg -l 'https://[a-f0-9]*@.*sentry\.io' --type-not env

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
  • 无Sentry SDK: 提供为项目类型安装合适SDK的选项
  • 硬编码DSN: 标记为失败,提供替换为环境变量引用的修复选项
  • 无效DSN格式: 报告错误,提供DSN格式指导
  • 缺失Sentry项目: 报告警告,提供设置说明

See Also

另请参阅

  • /configure:all
    - Run all compliance checks
  • /configure:status
    - Quick compliance overview
  • /configure:workflows
    - GitHub Actions integration
  • sentry
    MCP server - Sentry API access for project verification
  • /configure:all
    - 运行所有合规性检查
  • /configure:status
    - 快速合规性概览
  • /configure:workflows
    - GitHub Actions集成
  • sentry
    MCP server - 用于项目验证的Sentry API访问