Back to the catalog

bug-fixing-autoreport

Adds structured error logging, a secure /api/errors endpoint, and a /bug-report command to any Laravel or Node/Express project. Enables Clau

Open source Open in the app JSON README (API)

About

Adds structured error logging, a secure /api/errors endpoint, and a /bug-report command to any Laravel or Node/Express project. Enables Claude to fetch production errors, analyze root causes, and propose fixes.

Details

Kind
Plugins
Topic
No topic detected
Publisher
maxirodr
Origin
marketplace
Category
ferramentas
Last push
2026-03-07T05:10:29Z
Repository state
ativo
Language
PHP
Added
2026-08-30 01:48:58
Updated
2026-08-30 01:48:58
Origin id
maxirodr/bug-fixing-autoreport/bug-fixing-autoreport

README

# bug-fixing-autoreport

A Claude Code plugin that installs a complete error reporting system into any Laravel or Node/Express project.

## What it does

- Adds structured exception/error logging with rich context (URL, user, IP, user agent, input, stack trace)
- Creates a secure `GET /api/errors` endpoint with token auth, throttling, and IP banning
- Installs a `/bug-report` command that fetches production errors, analyzes root causes, and proposes fixes

## Installation

```bash
claude plugin add /path/to/bug-fixing-autoreport
```

## Usage

After installing the plugin, run the slash command inside your project:

```
/install-bug-reporting
```

Claude will:

1. Detect your stack (Laravel or Node/Express)
2. Add exception handling with structured logging
3. Create the `/api/errors` endpoint
4. Configure log channels (daily rotation, 30-day retention)
5. Add the `SafeErrorResponse` trait (Laravel only)
6. Set up `ERRORS_TOKEN` configuration
7. Optionally install frontend utilities (image compression, upload error messages)
8. Install the `/bug-report` command in your project

## What gets installed

### Backend

| Component | Laravel | Node/Express |
|-----------|---------|-------------|
| Error handler | `bootstrap/app.php` patch | `errorHandler.js` middleware |
| Log channel | `config/logging.php` channel | winston + daily-rotate-file |
| API endpoint | `ErrorLogController.php` + route | `errorsRoute.js` |
| Helper trait | `SafeErrorResponse.php` | N/A |

### Frontend (optional)

- `compressImage.ts` — compresses phone camera images (5-15MB) via Canvas API
- `uploadErrorMessages.ts` — maps upload error codes to user-friendly messages

### Commands

- `/bug-report` — installed in the project's `.claude/commands/` directory

## Using `/bug-report`

After installation, set these in your `.env`:

```
ERRORS_API_URL=https://your-domain.com/api/errors
ERRORS_TOKEN=your-secret-token
```

Then run:

```
/bug-report                          # today's errors
/bug-report date:2026-03-04          # specific date
/bug-report search:ValidationError   # filter by keyword
```

Claude will fetch the errors, find the relevant code in your codebase, analyze root causes, and offer to apply fixes.

## Security

- **Token auth**: Endpoint requires `ERRORS_TOKEN` via Bearer header or query param
- **Throttling**: Max 10 requests/hour per IP
- **IP banning**: Auto-ban for 24h after exceeding throttle limit
- **Input sanitization**: Passwords, tokens, and secrets are stripped from logs
- **No auth middleware**: Token validated in the controller, no user session needed

## Supported stacks

- **Laravel** 11+ (with `bootstrap/app.php` configuration style)
- **Node/Express** with CommonJS (ES modules: adjust imports as needed)
- **Frontend**: React, Vue, or any framework using TypeScript

## Generating a token

```bash
openssl rand -hex 32
```

Set the output as `ERRORS_TOKEN` in your production `.env`.

More