<h1 align="center">
<a href="https://prompts.chat">
Automated bug fixing using Claude Code and Sentry MCP integration. This GitLab CI template periodically fetches unresolved issues from Sentry, uses AI to analyze and fix them, and creates merge requests automatically.
Sign in to like and favorite skills
Automated bug fixing using Claude Code and Sentry MCP integration. This GitLab CI template periodically fetches unresolved issues from Sentry, uses AI to analyze and fix them, and creates merge requests automatically.
In your GitLab Group settings: Settings → CI/CD → Variables
| Variable | Type | Description |
|---|---|---|
| Regular | GCP Workload Identity Provider resource name |
| Regular | GCP Service Account email for Vertex AI |
| Regular | GCP Project ID with Vertex AI enabled |
| Regular | Vertex AI region (default: ) |
| Masked, Protected | Sentry access token with read permissions |
| Regular | Your Sentry organization slug |
Set up OIDC trust between GitLab and GCP:
aiplatform.user role for Vertex AIAdd to your project's
.gitlab-ci.yml:
stages: - build - test - bugfix # Add this stage include: - project: 'your-group/sentry-bugfixer' file: '/bugfixer.yml' ref: main sentry-bugfix: extends: .sentry-bugfix
In your project: CI/CD → Schedules → New schedule
| Setting | Value |
|---|---|
| Description | Sentry Bug Fixer |
| Interval | (every 6 hours) |
| Target branch | main |
Override these variables in your project's job definition:
| Variable | Default | Description |
|---|---|---|
| | Sentry project to query (defaults to GitLab project name) |
| | Maximum issues to process per run |
sentry-bugfix: extends: .sentry-bugfix variables: SENTRY_PROJECT_SLUG: "my-custom-sentry-project" MAX_ISSUES: "3"
Create a
CLAUDE.md file in your project root to provide context:
# Project Context ## Tech Stack - Language: TypeScript - Framework: Next.js - Testing: Jest + React Testing Library ## Code Standards - Use TypeScript strict mode - Follow existing patterns in the codebase - Add tests for bug fixes when possible ## Build & Test Commands - Run tests: `npm test` - Type check: `npm run typecheck` - Lint: `npm run lint`
The system prevents duplicate MRs through:
bugfix/sentry-{ISSUE_ID} pattern| Issue | Solution |
|---|---|
| Job times out | Reduce or increase timeout |
| Claude can't access Sentry | Check is valid and masked |
| MRs not being created | Ensure runner has git push permissions |
| Fixes don't compile | Add CLAUDE.md with build/test instructions |
| Too many MRs | Reduce schedule frequency or |
MAX_ISSUES=1 to test, then increaseYou can manually trigger the bugfix job from:
schedule or web (manual) triggersinclude with project)MIT