| 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., TEAMCLAW-3 or TEAMCLAW-REACT-2G
The issue ID is passed as the skill argument. Example: /sentry-fix TEAMCLAW-3
Projects
| Project | Sentry Slug | Platform | Test Command | Lint Command |
|---|
| Rust backend | ucar-inc/teamclaw | Rust | cargo test --manifest-path src-tauri/Cargo.toml | cargo clippy --manifest-path src-tauri/Cargo.toml -- -D warnings |
| React frontend | ucar-inc/teamclaw-react | React | pnpm test:unit | pnpm typecheck && pnpm lint |
Determine which project based on the issue ID prefix:
TEAMCLAW-<suffix> (no "REACT") → Rust backend
TEAMCLAW-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/teamclaw-3 or sentry-fix/teamclaw-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.ts or .test.tsx file (create one if none exists, following existing test file patterns in the codebase). The test must verify the fix prevents the original error.
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
sentry CLI is not authenticated, prompt the user to run sentry auth login
- If
gh CLI is not authenticated, prompt the user to run gh auth login