sentry-fix
GitHub自动修复Sentry报错,支持Rust后端与React前端。流程涵盖上下文分析、根因确认、代码修复、回归测试及PR创建,确保问题闭环解决。
Trigger Scenarios
Install
npx skills add different-ai-studio/teamclu --skill sentry-fix -g -y
SKILL.md
Frontmatter
{
"name": "sentry-fix",
"description": "Use when the user wants to fix a Sentry issue, auto-repair a bug from Sentry, or create a fix PR for a Sentry error. Triggers on \"修复 sentry\", \"fix sentry issue\", \"sentry 修复\", \"sentry fix\"."
}
Sentry Fix — Auto-Fix Issue with Test and PR
Fix a specific Sentry issue: gather context, confirm with user, implement fix, write regression test, verify, and create PR.
Arguments
<ISSUE-ID>(required): Sentry issue short ID, e.g.,TEAMCLU-3orTEAMCLU-REACT-2G
The issue ID is passed as the skill argument. Example: /sentry-fix TEAMCLU-3
Projects
| Project | Sentry Slug | Platform | Test Command | Lint Command |
|---|---|---|---|---|
| Rust backend | ucar-inc/teamclu |
Rust | cargo test --manifest-path src-tauri/Cargo.toml |
cargo clippy --manifest-path src-tauri/Cargo.toml -- -D warnings |
| React frontend | ucar-inc/teamclu-react |
React | pnpm test:unit |
pnpm typecheck && pnpm lint |
Determine which project based on the issue ID prefix:
TEAMCLU-<suffix>(no "REACT") → Rust backendTEAMCLU-REACT-<suffix>→ React frontend
Execution Steps
Phase 1: Gather Context
- Fetch issue details with stack trace:
sentry issue view <ISSUE-ID> --json
-
From the stack trace and error message, identify the relevant source files and functions in the codebase.
-
Read those source files to understand the code context around the crash/error site.
-
Perform local root cause analysis based on the stack trace + source code. Produce a clear root cause summary.
If the stack trace is insufficient to identify the root cause: Stop and ask the user for additional context about the issue before proceeding. Do NOT guess.
Phase 2: Confirm with User
Present a fix plan to the user in the terminal. The plan MUST include:
- Root cause — one-paragraph summary from local analysis
- Files to modify — exact file paths and what changes in each
- Proposed fix — description of the code changes
- Regression test plan — what test will be added and what it verifies
- Verification commands — which commands will be run to validate
STOP HERE and wait for user confirmation. Do NOT proceed until the user says yes.
Phase 3: Implement Fix
- Create a new branch from current HEAD:
git checkout -b sentry-fix/<issue-id-lowercase>
Example: sentry-fix/teamclu-3 or sentry-fix/teamclu-react-2g
-
Implement the fix:
- Follow existing code patterns and style
- Only modify files directly related to the issue
- No gratuitous refactoring
-
Write a regression test:
- Rust issues: Add
#[test]in the relevant module's test section, or create a test file in the same directory. The test must reproduce the scenario that caused the original error. - React issues: Add a vitest test in the corresponding
.test.tsor.test.tsxfile (create one if none exists, following existing test file patterns in the codebase). The test must verify the fix prevents the original error.
- Rust issues: Add
Phase 4: Verify
Run the verification suite for the relevant platform:
Rust backend:
cargo clippy --manifest-path src-tauri/Cargo.toml -- -D warnings
React frontend:
pnpm test:unit && pnpm typecheck && pnpm lint
If verification fails:
- Read the error output
- Fix the issue
- Re-run verification
- Maximum 2 retry rounds. If still failing after 2 retries, stop and report the failure to the user.
Phase 5: Submit
- Stage and commit:
git add <changed-files>
git commit -m "fix(<scope>): <description> (Sentry <ISSUE-ID>)"
Where <scope> is the module/component name (e.g., rag, p2p, settings, editor).
- Push the branch:
git push -u origin sentry-fix/<issue-id-lowercase>
- Create the PR:
gh pr create --title "fix(<scope>): <short description>" --body "$(cat <<'PREOF'
## Sentry Issue
Fixes [<ISSUE-ID>](<sentry-issue-permalink>)
## Root Cause
<root cause summary from local analysis>
## Fix
<description of code changes>
## Test Coverage
<description of regression test added>
## Verification
- [ ] cargo clippy / pnpm lint passes
- [ ] Tests pass including new regression test
PREOF
)"
- Print the PR URL for the user.
Constraints
- NEVER modify code before user confirms the fix plan (Phase 2)
- NEVER modify files unrelated to the issue
- ALWAYS write a regression test — no exceptions
- If
sentryCLI is not authenticated, prompt the user to runsentry auth login - If
ghCLI is not authenticated, prompt the user to rungh auth login
Version History
-
12cfa21
Current 2026-08-19 21:32
将Sentry技能指向重命名后的项目(teamclaw改为teamclu)
- a93ca1d 2026-07-24 21:03


