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 project | Debugging a specific Sentry issue or alert (use Sentry MCP server) |
| Checking Sentry SDK installation and configuration compliance | Querying Sentry events or performance data (use Sentry API/MCP) |
| Fixing hardcoded DSNs or missing environment variable references | Managing Sentry project settings in the Sentry dashboard |
| Adding source map upload and release tracking to CI/CD | Configuring Sentry alerting rules or notification channels |
| Verifying Sentry configuration across frontend, Node.js, or Python projects | Installing 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: (MCP server for Sentry API)
sentry- 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 API的MCP server)
sentryParameters
参数
Parse these from :
$ARGUMENTS| Flag | Description |
|---|---|
| Report status without offering fixes |
| Apply all fixes automatically without prompting |
| Override project type detection ( |
从中解析以下参数:
$ARGUMENTS| 标志 | 描述 |
|---|---|
| 仅报告状态,不提供修复方案 |
| 自动应用所有修复,无需提示 |
| 覆盖项目类型检测结果( |
Version Checking
版本检查
Execution
执行流程
Execute this Sentry compliance check:
执行以下Sentry合规性检查:
Step 1: Detect project type
步骤1:检测项目类型
Determine the project type to select the appropriate SDK and configuration:
- Read for
.project-standards.yamlfieldproject_type - If not found, auto-detect:
- frontend: Has with vue/react dependencies
package.json - node: Has with Node.js backend (express, fastify, etc.)
package.json - python: Has or
pyproject.tomlrequirements.txt
- frontend: Has
- If flag is provided, use that value instead
--type
确定项目类型,以选择合适的SDK和配置:
- 读取中的
.project-standards.yaml字段project_type - 如果未找到,自动检测:
- frontend: 包含带有vue/react依赖的
package.json - node: 包含带有Node.js后端依赖(express、fastify等)的
package.json - python: 包含或
pyproject.tomlrequirements.txt
- frontend: 包含带有vue/react依赖的
- 如果提供了标志,则使用该值
--type
Step 2: Check SDK installation
步骤2:检查SDK安装情况
Check for Sentry SDK based on detected project type:
Frontend (Vue/React):
- or
@sentry/vuein package.json dependencies@sentry/react - for source maps
@sentry/vite-plugin
Node.js Backend:
- in package.json dependencies
@sentry/node - (recommended)
@sentry/profiling-node
Python:
- in pyproject.toml or requirements.txt
sentry-sdk - 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.txtsentry-sdk - 框架集成(django、flask、fastapi)
Step 3: Analyze configuration
步骤3:分析配置
Read the Sentry initialization files and check against the compliance tables in REFERENCE.md. Validate:
- DSN comes from environment variables (not hardcoded)
- Tracing sample rate is configured
- Source maps are enabled (frontend)
- Init location is correct (Node.js: before other imports)
- Framework integration is enabled (Python)
读取Sentry初始化文件,并对照REFERENCE.md中的合规性表格进行检查。验证:
- DSN来自环境变量(而非硬编码)
- 已配置追踪采样率
- 已启用source maps(前端)
- 初始化位置正确(Node.js:在其他导入之前)
- 已启用框架集成(Python)
Step 4: Run security checks
步骤4:运行安全检查
- Verify no hardcoded DSN in any source files
- Check that DSN is not committed in git-tracked files
- Verify no auth tokens in frontend code
- Check production sample rates are reasonable (not 1.0)
- 验证所有源文件中没有硬编码的DSN
- 检查DSN未提交到git追踪文件中
- 验证前端代码中没有认证令牌
- 检查生产环境采样率合理(不为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 , stop here.
--check-only打印合规性报告,包含:
- 项目类型(检测到的或覆盖的)
- SDK版本和安装状态
- 配置检查结果(通过/警告/失败)
- 安全检查结果
- 缺失的配置项
- 建议
如果使用,在此步骤停止。
--check-onlyStep 6: Apply fixes (if --fix or user confirms)
步骤6:应用修复(如果使用--fix或用户确认)
- Missing SDK: Add appropriate Sentry SDK to dependencies
- Missing Vite plugin: Add for source maps
@sentry/vite-plugin - Missing config file: Create Sentry initialization file using templates from REFERENCE.md
- Hardcoded DSN: Replace with environment variable reference
- Missing sample rates: Add recommended sample rates
- 缺失Sentry SDK: 提供为项目类型安装合适SDK的选项
- 缺失Vite插件: 添加用于source map
@sentry/vite-plugin - 缺失配置文件: 使用REFERENCE.md中的模板创建Sentry初始化文件
- 硬编码DSN: 替换为环境变量引用
- 缺失采样率: 添加推荐的采样率
Step 7: Check CI/CD integration
步骤7:检查CI/CD集成
Verify Sentry integration in CI/CD:
- secret configured
SENTRY_AUTH_TOKEN - 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.yamlyaml
standards_version: "2025.1"
project_type: "<detected>"
last_configured: "<timestamp>"
components:
sentry: "2025.1"更新或创建:
.project-standards.yamlyaml
standards_version: "2025.1"
project_type: "<detected>"
last_configured: "<timestamp>"
components:
sentry: "2025.1"Environment Variables
环境变量
| Variable | Description | Required |
|---|---|---|
| Sentry Data Source Name | Yes |
| Environment name | Recommended |
| Release version | Recommended |
| Auth token for CI/CD | For 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数据源名称 | 是 |
| 环境名称 | 推荐 |
| 版本号 | 推荐 |
| 用于CI/CD的认证令牌 | 用于source map |
切勿提交DSN或认证令牌。使用环境变量或密钥管理工具。
有关详细的配置检查表、初始化模板和CI/CD工作流示例,请参阅REFERENCE.md。
Agentic Optimizations
智能优化
| Context | Command |
|---|---|
| Quick compliance check | |
| Auto-fix all issues | |
| Frontend project only | |
| Python project only | |
| Node.js project only | |
| Check for hardcoded DSNs | |
| 场景 | 命令 |
|---|---|
| 快速合规性检查 | |
| 自动修复所有问题 | |
| 仅限前端项目 | |
| 仅限Python项目 | |
| 仅限Node.js项目 | |
| 检查硬编码DSN | |
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
另请参阅
- - Run all compliance checks
/configure:all - - Quick compliance overview
/configure:status - - GitHub Actions integration
/configure:workflows - MCP server - Sentry API access for project verification
sentry
- - 运行所有合规性检查
/configure:all - - 快速合规性概览
/configure:status - - GitHub Actions集成
/configure:workflows - MCP server - 用于项目验证的Sentry API访问
sentry