Files
getsentry__sentry-for-ai/README.md
Daniel Griesser a76958d8cd feat: add sentry-php-sdk skill (PHP, Laravel, Symfony) (#22)
* feat(php-sdk): add sentry-php-sdk main SKILL.md wizard

Add the primary wizard skill for PHP SDK setup covering plain PHP, Laravel, and
Symfony in a single skill following the one-skill-per-language pattern used by
Python, Ruby, and .NET skills.

The wizard follows the standard 4-phase structure:
- Phase 1 (Detect): composer.json inspection, filesystem markers (artisan /
  bin/console), framework and queue detection
- Phase 2 (Recommend): concrete proposal matrix for Error Monitoring, Tracing,
  Profiling, Logging, Metrics, and Crons
- Phase 3 (Guide): framework-branched installation and initialization — plain
  PHP uses \Sentry\init(), Laravel uses artisan sentry:publish + Integration::handles(),
  Symfony uses YAML bundle config
- Phase 4 (Cross-Link): detects companion frontend (React, Svelte, Vue) and
  suggests the matching frontend SDK skill

Key design decisions:
- No wizard CLI (php/laravel/symfony not supported by @sentry/wizard)
- Laravel artisan sentry:publish --dsn= documented as the closest equivalent
- Profiling clearly marked as requiring the excimer PECL extension (Linux/macOS only)
- Metrics marked as beta using the TraceMetrics API
- Framework-specific deep dives deferred to references/laravel.md and references/symfony.md

Creates the references/ directory (populated in subsequent commits).

Co-Authored-By: Claude Sonnet 4.5 (Anthropic)

* feat(php-sdk): add profiling, logging, metrics, and crons reference files

Add four reference files to skills/sentry-php-sdk/references/ covering the
full set of PHP SDK observability features:

- profiling.md: Excimer extension prerequisites, version requirements per
  framework (PHP ≥3.15, Laravel ≥3.3, Symfony ≥4.7), profiles_sample_rate
  semantics (relative to traces_sample_rate), FastCGI latency mitigation,
  and Relay proxy setup

- logging.md: Structured Sentry Logs feature (enable_logs: true), direct
  logger API (\Sentry\logger()), Monolog bridge, Laravel sentry_logs channel
  setup via .env and config/logging.php, Symfony LogsHandler + monolog.yaml
  wiring, before_send_log filtering (closure for PHP/Laravel, service ID for
  Symfony), auto-added attributes table, flush semantics per runtime context

- metrics.md: TraceMetrics API (count/distribution/gauge), deprecation notice
  for old \Sentry\metrics() API, unit enum reference, ring buffer flush
  behavior (cap 1000), before_send_metric filtering, auto-added attributes,
  Symfony YAML configuration

- crons.md: withMonitor() wrapper, manual captureCheckIn() pattern, heartbeat
  pattern, programmatic MonitorConfig upsert (crontab + interval schedules),
  Laravel sentryMonitor() macro with full parameter reference, Symfony direct
  SDK usage (no framework-specific integration), CheckInStatus/MonitorSchedule
  references, rate limits (6/min per monitor-environment), alerts setup

All files follow the structure established by the sentry-python-sdk references.

Co-Authored-By: Claude Sonnet 4.6 (Anthropic)

* feat(php-sdk): add Laravel and Symfony framework reference deep-dives

Adds two comprehensive framework-specific reference files for the sentry-php-sdk skill:

- references/laravel.md (~496 lines): Full deep dive covering installation (Laravel 11+ vs 10 exception handler patterns), all config/sentry.php options including breadcrumb and tracing sub-arrays with ENV variable names, auto-instrumented operations table (11+ operations), filesystem disk opt-in instrumentation, auto-registered middleware, both log channel drivers (sentry vs sentry_logs), full queue distributed tracing with payload keys, sentryMonitor() macro with all parameters, Artisan commands, closures-and-config-cache gotcha with static callable workaround, Lumen support, Laravel Octane scope isolation warning, and Pennant feature flags integration.

- references/symfony.md (~531 lines): Full deep dive covering Flex auto-registration vs manual bundle setup, complete sentry.yaml schema with all top-level/options/messenger/tracing sub-nodes, Symfony-specific defaults (kernel.environment, PrettyVersions release, in_app_exclude auto-includes), bundle-level options table, DIC callable pattern with full service factory example (critical Symfony gotcha — YAML can't hold closures), auto-instrumented operations table (Doctrine DBAL, Twig, Cache, HTTP Client), structured logs via LogsHandler Monolog service, traditional Monolog handler with buffer support, Messenger integration (error-capture only, no tracing spans), cron monitoring using base PHP SDK functions, console command tracing config, all auto-registered event listeners, and automatic distributed tracing header handling.

These are loaded conditionally by the main SKILL.md when Laravel or Symfony is detected in the project's composer.json.

Co-Authored-By: Claude claude.ai/code

* docs(sentry-php-sdk): add error monitoring and tracing reference files

Add two comprehensive reference documents for the PHP SDK skill:

- references/error-monitoring.md — covers all capture APIs (captureException,
  captureMessage, captureEvent, captureLastError), Hub/Scope management
  (configureScope, withScope, withContext, push/pop), context enrichment (tags,
  UserDataBag, Breadcrumb TYPE_* and LEVEL_* constants, setContext), before_send
  and before_breadcrumb hooks with exact callback signatures, EventHint and
  ExceptionMechanism for handled/unhandled distinction, exception chaining,
  fingerprinting via Scope and before_send, and framework-specific integration
  notes for plain PHP, Laravel, and Symfony. Includes a 5-row troubleshooting
  table.

- references/tracing.md — covers traces_sample_rate / traces_sampler config
  (including Symfony service-factory pattern for closures), the full custom
  span API (TransactionContext, SpanContext, startChild, Sentry\trace() helper,
  safe manual pattern), auto-instrumentation matrix for Laravel (15+ operations)
  and Symfony (12+ operations), distributed tracing with sentry-trace + baggage
  headers (Guzzle middleware, continueTrace(), queue worker pattern), HTML meta
  tag injection for frontend/backend stitching, profiling with Excimer extension,
  a span ops cheat-sheet table, and an 8-row troubleshooting table.

Both files mirror the structure of the sentry-python-sdk reference files
(config table → code examples → best practices / framework notes → troubleshooting).

Co-Authored-By: claude-sonnet-4-5 <claude-sonnet-4-5@anthropic.com>

* docs(php-sdk): register sentry-php-sdk in router, skill tree, and README

Add sentry-php-sdk to all skill registry locations:
- sentry-sdk-setup/SKILL.md: add PHP row to routing table and detection
  instruction for composer.json with laravel/framework or symfony/framework-bundle
- SKILL_TREE.md: regenerated via build-skill-tree.sh with PHP entry
- AGENTS.md: add sentry-php-sdk to SDK Skills table
- README.md: add PHP (Laravel, Symfony) to SDK skills listing
- Remove stale .gitkeep from references/ (replaced by actual reference files)

Co-Authored-By: Claude Sonnet 4.5 (Anthropic)

* fix(php-sdk): address review findings — remove fabricated APIs, fix routing

Three P1 bugs and five P2 issues resolved:

P1 — Router step numbering: The PHP detection rule was numbered 6 but
appeared before the fallback step 5, creating sequence 1,2,3,4,6,5.
Corrected to 1,2,3,4,5,6 so LLMs process rules in the right priority order.

P1 — Fabricated \Sentry\withContext() API: This function does not exist
in sentry-php 4.x. Removed from the scope API table, code example, plain
PHP notes, and Octane troubleshooting row. Replaced with the correct
pushScope()/popScope() pattern throughout error-monitoring.md.

P1 — continueTrace() return value discarded: The 'Extracting incoming
trace context' example called continueTrace() without capturing its
TransactionContext return value, then created a fresh context — meaning
the transaction would never be linked to the upstream trace. Fixed to
assign the return value and use it directly, matching the correct pattern
already shown in the queue consumer example.

P2 — error_types default inconsistent: error-monitoring.md said E_ALL;
SKILL.md and the SDK research both say null/error_reporting(). Updated
the reference to error_reporting() for consistency with the SDK source.

P2 — Phantom 'never' value for max_request_body_size: Removed the
undocumented 'never' option. Valid values are none/small/medium/always.

P2 — Package name sentry/sentry-php vs sentry/sentry: All reference file
headers used sentry/sentry-php (the GitHub repo name) instead of
sentry/sentry (the Packagist package). Fixed across crons.md,
error-monitoring.md, logging.md, metrics.md, profiling.md, and tracing.md.

P2 — Tracing header mixed profiling version noise: Simplified the
tracing.md header to just SDK minimums; profiling version details already
live in profiling.md where they belong.

Co-Authored-By: Claude Sonnet 4.5 (Anthropic)

* chore: remove review artifacts from tracked files

---------

Co-authored-by: claude-sonnet-4-5 <claude-sonnet-4-5@anthropic.com>
2026-03-03 21:21:30 +01:00

4.5 KiB

Sentry for AI

Your AI coding assistant already knows how to write code. This plugin teaches it Sentry — how to set it up, how to find and fix production issues, and how to get the most out of every feature.

Whether you're adding Sentry to a new project, debugging a spike in errors, or configuring alerts, just ask. The plugin gives your assistant the context it needs to do it right.

Supports Claude Code and Cursor.

What You Can Do

Set up Sentry in any project — SDK setup wizards that detect your stack, recommend the right features, and walk through the full installation. No copy-pasting from docs.

Add Sentry to my Next.js app
Set up Sentry in my Rails project
Add error monitoring to my iOS app

Find and fix production issues — Query your Sentry environment, triage errors, and fix them in place.

/seer What are the top errors in the last 24 hours?
/seer Which issues are affecting the most users?
Fix the recent Sentry errors

Review code with Sentry context — Automatically resolve bugs that Sentry or Seer flag in pull request comments.

Review PR #118 and fix the Sentry comments

Configure monitoring — Set up alerts, instrument AI/LLM calls, connect OpenTelemetry pipelines.

Create a Slack alert for new high-priority issues
Monitor my OpenAI calls with Sentry
Set up OTel Collector with Sentry exporter

Installation

Claude Code

/install-plugin sentry

Restart Claude Code to activate, then verify:

/help           # Should show /seer command
/mcp            # Should show sentry MCP server

Cursor

Search for Sentry in Cursor Settings > Extensions and install.

From Source

git clone https://github.com/getsentry/sentry-for-ai.git

# Claude Code
/install-plugin file:///path/to/sentry-for-ai

# Cursor
# Add the plugin path in Cursor Settings > Extensions > Install from path

Skills

SDK Setup Wizards

Full platform bundles that scan your project, recommend features, and guide you through setup — error monitoring, tracing, profiling, session replay, logging, and more.

Skill Platforms
sentry-android-sdk Android (Jetpack Compose, Views, OkHttp, Room, Fragment, Timber)
sentry-cocoa-sdk iOS, macOS, tvOS, watchOS, visionOS (Swift, UIKit, SwiftUI)
sentry-dotnet-sdk ASP.NET Core, MAUI, WPF, WinForms, Azure Functions, Blazor, gRPC
sentry-go-sdk Go (net/http, Gin, Echo, Fiber)
sentry-nestjs-sdk NestJS (Express, Fastify, GraphQL, Microservices, WebSocket)
sentry-nextjs-sdk Next.js App Router + Pages Router, Vercel
sentry-node-sdk Node.js, Bun, Deno (Express, Fastify, Koa, Hapi, NestJS, Connect, Bun.serve, Deno.serve)
sentry-php-sdk PHP (Laravel, Symfony)
sentry-python-sdk Python (Django, Flask, FastAPI, Celery, Starlette, AIOHTTP)
sentry-react-native-sdk React Native, Expo managed/bare
sentry-react-sdk React 16+, React Router v5-v7, TanStack Router, Redux
sentry-ruby-sdk Ruby, Rails, Sinatra, Rack, Sidekiq
sentry-svelte-sdk Svelte, SvelteKit

Feature Setup

Skill Description
sentry-setup-ai-monitoring Instrument OpenAI, Anthropic, LangChain, Vercel AI, Google GenAI
sentry-otel-exporter-setup Configure OTel Collector with Sentry Exporter for multi-project routing

Workflow

Skill Description
sentry-code-review Fix bugs detected by Sentry in GitHub PR comments
sentry-pr-code-review Resolve issues flagged by Seer Bug Prediction
sentry-fix-issues Find and fix Sentry issues using MCP
sentry-create-alert Create alerts using the Sentry workflow engine API

Slash Commands

Command Description
/seer <query> Ask questions about your Sentry environment in natural language

Prerequisites

The plugin configures the Sentry MCP server automatically on install. No extra setup needed.

Some workflow skills require the GitHub CLI:

brew install gh    # macOS
gh auth login

Contributing

Skills follow the Agent Skills specification. Each skill is a directory with a SKILL.md file containing YAML frontmatter and markdown instructions. SDK bundles include a references/ directory for feature-specific deep dives.

Use the sentry-sdk-skill-creator skill to scaffold new SDK bundles — it handles research, writing, and validation.

License

MIT