@bgicli/bgicli 2.2.8 → 2.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/data/skills/anthropic-algorithmic-art/SKILL.md +405 -0
  2. package/data/skills/anthropic-canvas-design/SKILL.md +130 -0
  3. package/data/skills/anthropic-claude-api/SKILL.md +243 -0
  4. package/data/skills/anthropic-doc-coauthoring/SKILL.md +375 -0
  5. package/data/skills/anthropic-docx/SKILL.md +590 -0
  6. package/data/skills/anthropic-frontend-design/SKILL.md +42 -0
  7. package/data/skills/anthropic-internal-comms/SKILL.md +32 -0
  8. package/data/skills/anthropic-mcp-builder/SKILL.md +236 -0
  9. package/data/skills/anthropic-pdf/SKILL.md +314 -0
  10. package/data/skills/anthropic-pptx/SKILL.md +232 -0
  11. package/data/skills/anthropic-skill-creator/SKILL.md +485 -0
  12. package/data/skills/anthropic-webapp-testing/SKILL.md +96 -0
  13. package/data/skills/anthropic-xlsx/SKILL.md +292 -0
  14. package/data/skills/arxiv-database/SKILL.md +362 -0
  15. package/data/skills/astropy/SKILL.md +329 -0
  16. package/data/skills/ctx-advanced-evaluation/SKILL.md +402 -0
  17. package/data/skills/ctx-bdi-mental-states/SKILL.md +311 -0
  18. package/data/skills/ctx-context-compression/SKILL.md +272 -0
  19. package/data/skills/ctx-context-degradation/SKILL.md +206 -0
  20. package/data/skills/ctx-context-fundamentals/SKILL.md +201 -0
  21. package/data/skills/ctx-context-optimization/SKILL.md +195 -0
  22. package/data/skills/ctx-evaluation/SKILL.md +251 -0
  23. package/data/skills/ctx-filesystem-context/SKILL.md +287 -0
  24. package/data/skills/ctx-hosted-agents/SKILL.md +260 -0
  25. package/data/skills/ctx-memory-systems/SKILL.md +225 -0
  26. package/data/skills/ctx-multi-agent-patterns/SKILL.md +257 -0
  27. package/data/skills/ctx-project-development/SKILL.md +291 -0
  28. package/data/skills/ctx-tool-design/SKILL.md +271 -0
  29. package/data/skills/dhdna-profiler/SKILL.md +162 -0
  30. package/data/skills/generate-image/SKILL.md +183 -0
  31. package/data/skills/geomaster/SKILL.md +365 -0
  32. package/data/skills/get-available-resources/SKILL.md +275 -0
  33. package/data/skills/hamelsmu-build-review-interface/SKILL.md +96 -0
  34. package/data/skills/hamelsmu-error-analysis/SKILL.md +164 -0
  35. package/data/skills/hamelsmu-eval-audit/SKILL.md +183 -0
  36. package/data/skills/hamelsmu-evaluate-rag/SKILL.md +177 -0
  37. package/data/skills/hamelsmu-generate-synthetic-data/SKILL.md +131 -0
  38. package/data/skills/hamelsmu-validate-evaluator/SKILL.md +212 -0
  39. package/data/skills/hamelsmu-write-judge-prompt/SKILL.md +144 -0
  40. package/data/skills/hf-cli/SKILL.md +174 -0
  41. package/data/skills/hf-mcp/SKILL.md +178 -0
  42. package/data/skills/hugging-face-dataset-viewer/SKILL.md +121 -0
  43. package/data/skills/hugging-face-datasets/SKILL.md +542 -0
  44. package/data/skills/hugging-face-evaluation/SKILL.md +651 -0
  45. package/data/skills/hugging-face-jobs/SKILL.md +1042 -0
  46. package/data/skills/hugging-face-model-trainer/SKILL.md +717 -0
  47. package/data/skills/hugging-face-paper-pages/SKILL.md +239 -0
  48. package/data/skills/hugging-face-paper-publisher/SKILL.md +624 -0
  49. package/data/skills/hugging-face-tool-builder/SKILL.md +110 -0
  50. package/data/skills/hugging-face-trackio/SKILL.md +115 -0
  51. package/data/skills/hugging-face-vision-trainer/SKILL.md +593 -0
  52. package/data/skills/huggingface-gradio/SKILL.md +245 -0
  53. package/data/skills/matlab/SKILL.md +376 -0
  54. package/data/skills/modal/SKILL.md +381 -0
  55. package/data/skills/openai-cloudflare-deploy/SKILL.md +224 -0
  56. package/data/skills/openai-develop-web-game/SKILL.md +149 -0
  57. package/data/skills/openai-doc/SKILL.md +80 -0
  58. package/data/skills/openai-figma/SKILL.md +42 -0
  59. package/data/skills/openai-figma-implement-design/SKILL.md +264 -0
  60. package/data/skills/openai-gh-address-comments/SKILL.md +25 -0
  61. package/data/skills/openai-gh-fix-ci/SKILL.md +69 -0
  62. package/data/skills/openai-imagegen/SKILL.md +174 -0
  63. package/data/skills/openai-jupyter-notebook/SKILL.md +107 -0
  64. package/data/skills/openai-linear/SKILL.md +87 -0
  65. package/data/skills/openai-netlify-deploy/SKILL.md +247 -0
  66. package/data/skills/openai-notion-knowledge-capture/SKILL.md +56 -0
  67. package/data/skills/openai-notion-meeting-intelligence/SKILL.md +60 -0
  68. package/data/skills/openai-notion-research-documentation/SKILL.md +59 -0
  69. package/data/skills/openai-notion-spec-to-implementation/SKILL.md +58 -0
  70. package/data/skills/openai-openai-docs/SKILL.md +69 -0
  71. package/data/skills/openai-pdf/SKILL.md +67 -0
  72. package/data/skills/openai-playwright/SKILL.md +147 -0
  73. package/data/skills/openai-render-deploy/SKILL.md +479 -0
  74. package/data/skills/openai-screenshot/SKILL.md +267 -0
  75. package/data/skills/openai-security-best-practices/SKILL.md +86 -0
  76. package/data/skills/openai-security-ownership-map/SKILL.md +206 -0
  77. package/data/skills/openai-security-threat-model/SKILL.md +81 -0
  78. package/data/skills/openai-sentry/SKILL.md +123 -0
  79. package/data/skills/openai-sora/SKILL.md +178 -0
  80. package/data/skills/openai-speech/SKILL.md +144 -0
  81. package/data/skills/openai-spreadsheet/SKILL.md +145 -0
  82. package/data/skills/openai-transcribe/SKILL.md +81 -0
  83. package/data/skills/openai-vercel-deploy/SKILL.md +77 -0
  84. package/data/skills/openai-yeet/SKILL.md +28 -0
  85. package/data/skills/pennylane/SKILL.md +224 -0
  86. package/data/skills/polars-bio/SKILL.md +374 -0
  87. package/data/skills/primekg/SKILL.md +97 -0
  88. package/data/skills/pymatgen/SKILL.md +689 -0
  89. package/data/skills/qiskit/SKILL.md +273 -0
  90. package/data/skills/qutip/SKILL.md +316 -0
  91. package/data/skills/recursive-decomposition/SKILL.md +185 -0
  92. package/data/skills/rowan/SKILL.md +427 -0
  93. package/data/skills/scholar-evaluation/SKILL.md +298 -0
  94. package/data/skills/sentry-create-alert/SKILL.md +210 -0
  95. package/data/skills/sentry-fix-issues/SKILL.md +126 -0
  96. package/data/skills/sentry-pr-code-review/SKILL.md +105 -0
  97. package/data/skills/sentry-python-sdk/SKILL.md +317 -0
  98. package/data/skills/sentry-setup-ai-monitoring/SKILL.md +217 -0
  99. package/data/skills/stable-baselines3/SKILL.md +297 -0
  100. package/data/skills/sympy/SKILL.md +498 -0
  101. package/data/skills/trailofbits-ask-questions-if-underspecified/SKILL.md +85 -0
  102. package/data/skills/trailofbits-audit-context-building/SKILL.md +302 -0
  103. package/data/skills/trailofbits-differential-review/SKILL.md +220 -0
  104. package/data/skills/trailofbits-insecure-defaults/SKILL.md +117 -0
  105. package/data/skills/trailofbits-modern-python/SKILL.md +333 -0
  106. package/data/skills/trailofbits-property-based-testing/SKILL.md +123 -0
  107. package/data/skills/trailofbits-semgrep-rule-creator/SKILL.md +172 -0
  108. package/data/skills/trailofbits-sharp-edges/SKILL.md +292 -0
  109. package/data/skills/trailofbits-variant-analysis/SKILL.md +142 -0
  110. package/data/skills/transformers.js/SKILL.md +637 -0
  111. package/data/skills/writing/SKILL.md +419 -0
  112. package/dist/bgi.js +2 -2
  113. package/package.json +1 -1
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: sentry-pr-code-review
3
+ description: Review a project's PRs to check for issues detected in code review by Seer Bug Prediction. Use when asked to review or fix issues identified by Sentry in PR comments, or to find recent PRs with Sentry feedback.
4
+ license: Apache-2.0
5
+ ---
6
+
7
+ # Sentry Code Review
8
+
9
+ Review and fix issues identified by Seer (by Sentry) in GitHub PR comments.
10
+
11
+ ## Invoke This Skill When
12
+
13
+ - User asks to "review Sentry comments" or "fix Sentry issues" on a PR
14
+ - User shares a PR URL/number and mentions Sentry or Seer feedback
15
+ - User asks to "address Sentry review" or "resolve Sentry findings"
16
+ - User wants to find PRs with unresolved Sentry comments
17
+
18
+ ## Prerequisites
19
+
20
+ - `gh` CLI installed and authenticated
21
+ - Repository has the [Seer by Sentry](https://github.com/apps/seer-by-sentry) GitHub App installed
22
+
23
+ **Important:** The comment format parsed below is based on Seer's current output. This is not an API contract and may change. Always verify the actual comment structure.
24
+
25
+ ## Phase 1: Fetch Seer Comments
26
+
27
+ ```bash
28
+ gh api repos/{owner}/{repo}/pulls/{PR_NUMBER}/comments --paginate \
29
+ --jq '.[] | select(.user.login == "seer-by-sentry[bot]") | {file: .path, line: .line, body: .body}'
30
+ ```
31
+
32
+ **The bot login is `seer-by-sentry[bot]`** — not `sentry[bot]` or `sentry-io[bot]`.
33
+
34
+ If no PR number is given, find recent PRs with Seer comments:
35
+
36
+ ```bash
37
+ gh pr list --state open --json number,title --limit 20 | \
38
+ jq -r '.[].number' | while read pr; do
39
+ count=$(gh api "repos/{owner}/{repo}/pulls/$pr/comments" --paginate \
40
+ --jq '[.[] | select(.user.login == "seer-by-sentry[bot]")] | length')
41
+ [ "$count" -gt 0 ] && echo "PR #$pr: $count Seer comments"
42
+ done
43
+ ```
44
+
45
+ ## Phase 2: Parse Each Comment
46
+
47
+ Extract from the markdown body:
48
+ - **Bug description**: Line starting with `**Bug:**`
49
+ - **Severity/Confidence**: In `<sub>Severity: X | Confidence: X.XX</sub>`
50
+ - **Analysis**: Inside `<summary>🔍 <b>Detailed Analysis</b></summary>` block
51
+ - **Suggested Fix**: Inside `<summary>💡 <b>Suggested Fix</b></summary>` block
52
+ - **AI Prompt**: Inside `<summary>🤖 <b>Prompt for AI Agent</b></summary>` block
53
+
54
+ ## Phase 3: Verify & Fix
55
+
56
+ For each issue:
57
+ 1. Read the file at the specified line
58
+ 2. Confirm issue still exists in current code (not already fixed in a later commit)
59
+ 3. Review surrounding code to assess if it's an actual issue or false positive
60
+ 4. Implement fix (use suggested fix as starting point, or write your own)
61
+ 5. Consider edge cases and regression risk
62
+
63
+ ## Phase 4: Summarize and Report Results
64
+
65
+ ```markdown
66
+ ## Seer Review: PR #[number]
67
+
68
+ ### Resolved
69
+ | File:Line | Issue | Severity | Fix Applied |
70
+ |-----------|-------|----------|-------------|
71
+ | path:123 | desc | HIGH | what done |
72
+
73
+ ### Skipped (false positive or already fixed)
74
+ | File:Line | Issue | Reason |
75
+ |-----------|-------|--------|
76
+
77
+ **Summary:** X resolved, Y skipped
78
+ ```
79
+
80
+ ## Seer Review Triggers
81
+
82
+ | Trigger | When |
83
+ |---------|------|
84
+ | PR set to "Ready for Review" | Automatic error prediction |
85
+ | Commit pushed while PR is ready | Re-runs prediction |
86
+ | `@sentry review` comment | Manual trigger for full review + suggestions |
87
+ | Draft PR | Skipped — no review until marked ready |
88
+
89
+ ## Troubleshooting
90
+
91
+ | Issue | Solution |
92
+ |-------|----------|
93
+ | No Seer comments found | Verify the Seer GitHub App is installed on the repo |
94
+ | Bot name mismatch | The login is `seer-by-sentry[bot]`, not `sentry[bot]` |
95
+ | Comments not appearing on new PRs | PR must be "Ready for Review" (not draft) |
96
+ | `gh api` returns partial results | Ensure `--paginate` flag is included |
97
+
98
+ ## Common Issue Types
99
+
100
+ | Category | Examples |
101
+ |----------|----------|
102
+ | Type Safety | Missing null checks, unsafe type assertions |
103
+ | Error Handling | Swallowed errors, missing boundaries |
104
+ | Validation | Permissive inputs, missing sanitization |
105
+ | Config | Missing env vars, incorrect paths |
@@ -0,0 +1,317 @@
1
+ ---
2
+ name: sentry-python-sdk
3
+ description: Full Sentry SDK setup for Python. Use when asked to "add Sentry to Python", "install sentry-sdk", "setup Sentry in Python", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for Python applications. Supports Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, Tornado, and more.
4
+ license: Apache-2.0
5
+ ---
6
+
7
+ # Sentry Python SDK
8
+
9
+ Opinionated wizard that scans your Python project and guides you through complete Sentry setup.
10
+
11
+ ## Invoke This Skill When
12
+
13
+ - User asks to "add Sentry to Python" or "setup Sentry" in a Python app
14
+ - User wants error monitoring, tracing, profiling, logging, metrics, or crons in Python
15
+ - User mentions `sentry-sdk`, `sentry_sdk`, or Sentry + any Python framework
16
+ - User wants to monitor Django views, Flask routes, FastAPI endpoints, Celery tasks, or scheduled jobs
17
+
18
+ > **Note:** SDK versions and APIs below reflect Sentry docs at time of writing (sentry-sdk 2.x).
19
+ > Always verify against [docs.sentry.io/platforms/python/](https://docs.sentry.io/platforms/python/) before implementing.
20
+
21
+ ---
22
+
23
+ ## Phase 1: Detect
24
+
25
+ Run these commands to understand the project before making recommendations:
26
+
27
+ ```bash
28
+ # Check existing Sentry
29
+ grep -i sentry requirements.txt pyproject.toml setup.cfg setup.py 2>/dev/null
30
+
31
+ # Detect web framework
32
+ grep -rE "django|flask|fastapi|starlette|aiohttp|tornado|quart|falcon|sanic|bottle" \
33
+ requirements.txt pyproject.toml 2>/dev/null
34
+
35
+ # Detect task queues
36
+ grep -rE "celery|rq|huey|arq|dramatiq" requirements.txt pyproject.toml 2>/dev/null
37
+
38
+ # Detect logging libraries
39
+ grep -E "loguru" requirements.txt pyproject.toml 2>/dev/null
40
+
41
+ # Detect AI libraries
42
+ grep -rE "openai|anthropic|langchain|huggingface|google-genai|pydantic-ai|litellm" \
43
+ requirements.txt pyproject.toml 2>/dev/null
44
+
45
+ # Detect schedulers / crons
46
+ grep -rE "celery|apscheduler|schedule|crontab" requirements.txt pyproject.toml 2>/dev/null
47
+
48
+ # Check for companion frontend
49
+ ls frontend/ web/ client/ ui/ static/ templates/ 2>/dev/null
50
+ ```
51
+
52
+ **What to note:**
53
+ - Is `sentry-sdk` already in requirements? If yes, check if `sentry_sdk.init()` is present — may just need feature config.
54
+ - Which framework? (Determines where to place `sentry_sdk.init()`.)
55
+ - Which task queue? (Celery needs dual-process init; RQ needs a settings file.)
56
+ - AI libraries? (OpenAI, Anthropic, LangChain are auto-instrumented.)
57
+ - Companion frontend? (Triggers Phase 4 cross-link.)
58
+
59
+ ---
60
+
61
+ ## Phase 2: Recommend
62
+
63
+ Based on what you found, present a concrete proposal. Don't ask open-ended questions — lead with a recommendation:
64
+
65
+ **Always recommended (core coverage):**
66
+ - ✅ **Error Monitoring** — captures unhandled exceptions, supports `ExceptionGroup` (Python 3.11+)
67
+ - ✅ **Logging** — Python `logging` stdlib auto-captured; enhanced if Loguru detected
68
+
69
+ **Recommend when detected:**
70
+ - ✅ **Tracing** — HTTP framework detected (Django/Flask/FastAPI/etc.)
71
+ - ✅ **AI Monitoring** — OpenAI/Anthropic/LangChain/etc. detected (auto-instrumented, zero config)
72
+ - ⚡ **Profiling** — production apps where performance matters
73
+ - ⚡ **Crons** — Celery Beat, APScheduler, or cron patterns detected
74
+ - ⚡ **Metrics** — business KPIs, SLO tracking
75
+
76
+ **Recommendation matrix:**
77
+
78
+ | Feature | Recommend when... | Reference |
79
+ |---------|------------------|-----------|
80
+ | Error Monitoring | **Always** — non-negotiable baseline | `${SKILL_ROOT}/references/error-monitoring.md` |
81
+ | Tracing | Django/Flask/FastAPI/AIOHTTP/etc. detected | `${SKILL_ROOT}/references/tracing.md` |
82
+ | Profiling | Production + performance-sensitive workload | `${SKILL_ROOT}/references/profiling.md` |
83
+ | Logging | Always (stdlib); enhanced for Loguru | `${SKILL_ROOT}/references/logging.md` |
84
+ | Metrics | Business events or SLO tracking needed | `${SKILL_ROOT}/references/metrics.md` |
85
+ | Crons | Celery Beat, APScheduler, or cron patterns | `${SKILL_ROOT}/references/crons.md` |
86
+ | AI Monitoring | OpenAI/Anthropic/LangChain/etc. detected | `${SKILL_ROOT}/references/ai-monitoring.md` |
87
+
88
+ Propose: *"I recommend Error Monitoring + Tracing [+ Logging if applicable]. Want Profiling, Crons, or AI Monitoring too?"*
89
+
90
+ ---
91
+
92
+ ## Phase 3: Guide
93
+
94
+ ### Install
95
+
96
+ ```bash
97
+ # Core SDK (always required)
98
+ pip install sentry-sdk
99
+
100
+ # Optional extras (install only what matches detected framework):
101
+ pip install "sentry-sdk[django]"
102
+ pip install "sentry-sdk[flask]"
103
+ pip install "sentry-sdk[fastapi]"
104
+ pip install "sentry-sdk[celery]"
105
+ pip install "sentry-sdk[aiohttp]"
106
+ pip install "sentry-sdk[tornado]"
107
+
108
+ # Multiple extras:
109
+ pip install "sentry-sdk[django,celery]"
110
+ ```
111
+
112
+ > Extras are optional — plain `sentry-sdk` works for all frameworks. Extras install complementary packages.
113
+
114
+ ### Quick Start — Recommended Init
115
+
116
+ Full init enabling the most features with sensible defaults. Place **before** any app/framework code:
117
+
118
+ ```python
119
+ import sentry_sdk
120
+
121
+ sentry_sdk.init(
122
+ dsn=os.environ["SENTRY_DSN"],
123
+ environment=os.environ.get("SENTRY_ENVIRONMENT", "production"),
124
+ release=os.environ.get("SENTRY_RELEASE"), # e.g. "myapp@1.0.0"
125
+ send_default_pii=True,
126
+
127
+ # Tracing (lower to 0.1–0.2 in high-traffic production)
128
+ traces_sample_rate=1.0,
129
+
130
+ # Profiling — continuous, tied to active spans
131
+ profile_session_sample_rate=1.0,
132
+ profile_lifecycle="trace",
133
+
134
+ # Structured logs (SDK ≥ 2.35.0)
135
+ enable_logs=True,
136
+ )
137
+ ```
138
+
139
+ ### Where to Initialize Per Framework
140
+
141
+ | Framework | Where to call `sentry_sdk.init()` | Notes |
142
+ |-----------|-----------------------------------|-------|
143
+ | **Django** | Top of `settings.py`, before any imports | No middleware needed — Sentry patches Django internally |
144
+ | **Flask** | Before `app = Flask(__name__)` | Must precede app creation |
145
+ | **FastAPI** | Before `app = FastAPI()` | `StarletteIntegration` + `FastApiIntegration` auto-enabled together |
146
+ | **Starlette** | Before `app = Starlette(...)` | Same auto-integration as FastAPI |
147
+ | **AIOHTTP** | Module level, before `web.Application()` | |
148
+ | **Tornado** | Module level, before app setup | No integration class needed |
149
+ | **Quart** | Before `app = Quart(__name__)` | |
150
+ | **Falcon** | Module level, before `app = falcon.App()` | |
151
+ | **Sanic** | Inside `@app.listener("before_server_start")` | Sanic's lifecycle requires async init |
152
+ | **Celery** | `@signals.celeryd_init.connect` in worker AND in calling process | Dual-process init required |
153
+ | **RQ** | `mysettings.py` loaded by worker via `rq worker -c mysettings` | |
154
+ | **ARQ** | Both worker module and enqueuing process | |
155
+
156
+ **Django example** (`settings.py`):
157
+ ```python
158
+ import sentry_sdk
159
+
160
+ sentry_sdk.init(
161
+ dsn=os.environ["SENTRY_DSN"],
162
+ send_default_pii=True,
163
+ traces_sample_rate=1.0,
164
+ profile_session_sample_rate=1.0,
165
+ profile_lifecycle="trace",
166
+ enable_logs=True,
167
+ )
168
+
169
+ # rest of Django settings...
170
+ INSTALLED_APPS = [...]
171
+ ```
172
+
173
+ **FastAPI example** (`main.py`):
174
+ ```python
175
+ import sentry_sdk
176
+
177
+ sentry_sdk.init(
178
+ dsn=os.environ["SENTRY_DSN"],
179
+ send_default_pii=True,
180
+ traces_sample_rate=1.0,
181
+ profile_session_sample_rate=1.0,
182
+ profile_lifecycle="trace",
183
+ enable_logs=True,
184
+ )
185
+
186
+ from fastapi import FastAPI
187
+ app = FastAPI()
188
+ ```
189
+
190
+ ### Auto-Enabled vs Explicit Integrations
191
+
192
+ Most integrations activate automatically when their package is installed — no `integrations=[...]` needed:
193
+
194
+ | Auto-enabled | Explicit required |
195
+ |-------------|-------------------|
196
+ | Django, Flask, FastAPI, Starlette, AIOHTTP, Tornado, Quart, Falcon, Sanic, Bottle | `DramatiqIntegration` |
197
+ | Celery, RQ, Huey, ARQ | `GRPCIntegration` |
198
+ | SQLAlchemy, Redis, asyncpg, pymongo | `StrawberryIntegration` |
199
+ | Requests, HTTPX, aiohttp-client | `AsyncioIntegration` |
200
+ | OpenAI, Anthropic, LangChain, Pydantic AI, MCP | `OpenTelemetryIntegration` |
201
+ | Python `logging`, Loguru | `WSGIIntegration` / `ASGIIntegration` |
202
+
203
+ ### For Each Agreed Feature
204
+
205
+ Walk through features one at a time. Load the reference, follow its steps, verify before moving on:
206
+
207
+ | Feature | Reference file | Load when... |
208
+ |---------|---------------|-------------|
209
+ | Error Monitoring | `${SKILL_ROOT}/references/error-monitoring.md` | Always (baseline) |
210
+ | Tracing | `${SKILL_ROOT}/references/tracing.md` | HTTP handlers / distributed tracing |
211
+ | Profiling | `${SKILL_ROOT}/references/profiling.md` | Performance-sensitive production |
212
+ | Logging | `${SKILL_ROOT}/references/logging.md` | Always; enhanced for Loguru |
213
+ | Metrics | `${SKILL_ROOT}/references/metrics.md` | Business KPIs / SLO tracking |
214
+ | Crons | `${SKILL_ROOT}/references/crons.md` | Scheduler / cron patterns detected |
215
+ | AI Monitoring | `${SKILL_ROOT}/references/ai-monitoring.md` | AI library detected |
216
+
217
+ For each feature: `Read ${SKILL_ROOT}/references/<feature>.md`, follow steps exactly, verify it works.
218
+
219
+ ---
220
+
221
+ ## Configuration Reference
222
+
223
+ ### Key `sentry_sdk.init()` Options
224
+
225
+ | Option | Type | Default | Purpose |
226
+ |--------|------|---------|---------|
227
+ | `dsn` | `str` | `None` | SDK disabled if empty; env: `SENTRY_DSN` |
228
+ | `environment` | `str` | `"production"` | e.g., `"staging"`; env: `SENTRY_ENVIRONMENT` |
229
+ | `release` | `str` | `None` | e.g., `"myapp@1.0.0"`; env: `SENTRY_RELEASE` |
230
+ | `send_default_pii` | `bool` | `False` | Include IP, headers, cookies, auth user |
231
+ | `traces_sample_rate` | `float` | `None` | Transaction sample rate; `None` disables tracing |
232
+ | `traces_sampler` | `Callable` | `None` | Custom per-transaction sampling (overrides rate) |
233
+ | `profile_session_sample_rate` | `float` | `None` | Continuous profiling session rate |
234
+ | `profile_lifecycle` | `str` | `"manual"` | `"trace"` = auto-start profiler with spans |
235
+ | `profiles_sample_rate` | `float` | `None` | Transaction-based profiling rate |
236
+ | `enable_logs` | `bool` | `False` | Send logs to Sentry (SDK ≥ 2.35.0) |
237
+ | `sample_rate` | `float` | `1.0` | Error event sample rate |
238
+ | `attach_stacktrace` | `bool` | `False` | Stack traces on `capture_message()` |
239
+ | `max_breadcrumbs` | `int` | `100` | Max breadcrumbs per event |
240
+ | `debug` | `bool` | `False` | Verbose SDK debug output |
241
+ | `before_send` | `Callable` | `None` | Hook to mutate/drop error events |
242
+ | `before_send_transaction` | `Callable` | `None` | Hook to mutate/drop transaction events |
243
+ | `ignore_errors` | `list` | `[]` | Exception types or regex patterns to suppress |
244
+ | `auto_enabling_integrations` | `bool` | `True` | Set `False` to disable all auto-detection |
245
+
246
+ ### Environment Variables
247
+
248
+ | Variable | Maps to | Notes |
249
+ |----------|---------|-------|
250
+ | `SENTRY_DSN` | `dsn` | |
251
+ | `SENTRY_RELEASE` | `release` | Also auto-detected from git SHA, Heroku, CircleCI, CodeBuild, GAE |
252
+ | `SENTRY_ENVIRONMENT` | `environment` | |
253
+ | `SENTRY_DEBUG` | `debug` | |
254
+
255
+ ---
256
+
257
+ ## Verification
258
+
259
+ Test that Sentry is receiving events:
260
+
261
+ ```python
262
+ # Trigger a real error event — check dashboard within seconds
263
+ division_by_zero = 1 / 0
264
+ ```
265
+
266
+ Or for a non-crashing check:
267
+ ```python
268
+ sentry_sdk.capture_message("Sentry Python SDK test")
269
+ ```
270
+
271
+ If nothing appears:
272
+ 1. Set `debug=True` in `sentry_sdk.init()` — prints SDK internals to stdout
273
+ 2. Verify the DSN is correct
274
+ 3. Check `SENTRY_DSN` env var is set in the running process
275
+ 4. For Celery/RQ: ensure init runs in the **worker** process, not just the calling process
276
+
277
+ ---
278
+
279
+ ## Phase 4: Cross-Link
280
+
281
+ After completing Python setup, check for a companion frontend missing Sentry:
282
+
283
+ ```bash
284
+ ls frontend/ web/ client/ ui/ 2>/dev/null
285
+ cat frontend/package.json web/package.json client/package.json 2>/dev/null \
286
+ | grep -E '"react"|"svelte"|"vue"|"next"|"nuxt"'
287
+ ```
288
+
289
+ If a frontend exists without Sentry, suggest the matching skill:
290
+
291
+ | Frontend detected | Suggest skill |
292
+ |-------------------|--------------|
293
+ | React / Next.js | `sentry-react-sdk` |
294
+ | Svelte / SvelteKit | `sentry-svelte-sdk` |
295
+ | Vue / Nuxt | Use `@sentry/vue` — see [docs.sentry.io/platforms/javascript/guides/vue/](https://docs.sentry.io/platforms/javascript/guides/vue/) |
296
+ | Other JS/TS | `sentry-react-sdk` (covers generic browser JS patterns) |
297
+
298
+ ---
299
+
300
+ ## Troubleshooting
301
+
302
+ | Issue | Solution |
303
+ |-------|----------|
304
+ | Events not appearing | Set `debug=True`, verify DSN, check env vars in the running process |
305
+ | Malformed DSN error | Format: `https://<key>@o<org>.ingest.sentry.io/<project>` |
306
+ | Django exceptions not captured | Ensure `sentry_sdk.init()` is at the **top** of `settings.py` before other imports |
307
+ | Flask exceptions not captured | Init must happen **before** `app = Flask(__name__)` |
308
+ | FastAPI exceptions not captured | Init before `app = FastAPI()`; both `StarletteIntegration` and `FastApiIntegration` auto-enabled |
309
+ | Celery task errors not captured | Must call `sentry_sdk.init()` in the **worker process** via `celeryd_init` signal |
310
+ | Sanic init not working | Init must be inside `@app.listener("before_server_start")`, not module level |
311
+ | uWSGI not capturing | Add `--enable-threads --py-call-uwsgi-fork-hooks` to uWSGI command |
312
+ | No traces appearing | Verify `traces_sample_rate` is set (not `None`); check that the integration is auto-enabled |
313
+ | Profiling not starting | Requires `traces_sample_rate > 0` + either `profile_session_sample_rate` or `profiles_sample_rate` |
314
+ | `enable_logs` not working | Requires SDK ≥ 2.35.0; for direct structured logs use `sentry_sdk.logger`; for stdlib bridging use `LoggingIntegration(sentry_logs_level=...)` |
315
+ | Too many transactions | Lower `traces_sample_rate` or use `traces_sampler` to drop health checks |
316
+ | Cross-request data leaking | Don't use `get_global_scope()` for per-request data — use `get_isolation_scope()` |
317
+ | RQ worker not reporting | Pass `--sentry-dsn=""` to disable RQ's own Sentry shortcut; init via settings file instead |
@@ -0,0 +1,217 @@
1
+ ---
2
+ name: sentry-setup-ai-monitoring
3
+ description: Setup Sentry AI Agent Monitoring in any project. Use when asked to monitor LLM calls, track AI agents, or instrument OpenAI/Anthropic/Vercel AI/LangChain/Google GenAI/Pydantic AI. Detects installed AI SDKs and configures appropriate integrations.
4
+ license: Apache-2.0
5
+ ---
6
+
7
+ # Setup Sentry AI Agent Monitoring
8
+
9
+ Configure Sentry to track LLM calls, agent executions, tool usage, and token consumption.
10
+
11
+ ## Invoke This Skill When
12
+
13
+ - User asks to "monitor AI/LLM calls" or "track OpenAI/Anthropic usage"
14
+ - User wants "AI observability" or "agent monitoring"
15
+ - User asks about token usage, model latency, or AI costs
16
+
17
+ **Important:** The SDK versions, API names, and code samples below are examples. Always verify against [docs.sentry.io](https://docs.sentry.io) before implementing, as APIs and minimum versions may have changed.
18
+
19
+ ## Prerequisites
20
+
21
+ AI monitoring requires **tracing enabled** (`tracesSampleRate > 0`).
22
+
23
+ ## Data Capture Warning
24
+
25
+ **Prompt and output recording captures user content that is likely PII.** Before enabling `recordInputs`/`recordOutputs` (JS) or `include_prompts`/`send_default_pii` (Python), confirm:
26
+
27
+ - The application's privacy policy permits capturing user prompts and model responses
28
+ - Captured data complies with applicable regulations (GDPR, CCPA, etc.)
29
+ - Sentry data retention settings are appropriate for the sensitivity of the data
30
+
31
+ **Ask the user** whether they want prompt/output capture enabled. Do not enable it by default — configure it only when explicitly requested or confirmed. Use `tracesSampleRate: 1.0` only in development; in production, use a lower value or a `tracesSampler` function.
32
+
33
+ ## Detection First
34
+
35
+ **Always detect installed AI SDKs before configuring:**
36
+
37
+ ```bash
38
+ # JavaScript
39
+ grep -E '"(openai|@anthropic-ai/sdk|ai|@langchain|@google/genai)"' package.json
40
+
41
+ # Python
42
+ grep -E '(openai|anthropic|langchain|huggingface)' requirements.txt pyproject.toml 2>/dev/null
43
+ ```
44
+
45
+ ## Supported SDKs
46
+
47
+ ### JavaScript
48
+
49
+ | Package | Integration | Min Sentry SDK | Auto? |
50
+ |---------|-------------|----------------|-------|
51
+ | `openai` | `openAIIntegration()` | 10.28.0 | Yes |
52
+ | `@anthropic-ai/sdk` | `anthropicAIIntegration()` | 10.28.0 | Yes |
53
+ | `ai` (Vercel) | `vercelAIIntegration()` | 10.6.0 | Yes* |
54
+ | `@langchain/*` | `langChainIntegration()` | 10.28.0 | Yes |
55
+ | `@langchain/langgraph` | `langGraphIntegration()` | 10.28.0 | Yes |
56
+ | `@google/genai` | `googleGenAIIntegration()` | 10.28.0 | Yes |
57
+
58
+ *Vercel AI: 10.6.0+ for Node.js, Cloudflare Workers, Vercel Edge Functions, Bun. 10.12.0+ for Deno. Requires `experimental_telemetry` per-call.
59
+
60
+ ### Python
61
+
62
+ Integrations auto-enable when the AI package is installed — no explicit registration needed:
63
+
64
+ | Package | Auto? | Notes |
65
+ |---------|-------|-------|
66
+ | `openai` | Yes | Includes OpenAI Agents SDK |
67
+ | `anthropic` | Yes | |
68
+ | `langchain` / `langgraph` | Yes | |
69
+ | `huggingface_hub` | Yes | |
70
+ | `google-genai` | Yes | |
71
+ | `pydantic-ai` | Yes | |
72
+ | `litellm` | **No** | Requires explicit integration |
73
+ | `mcp` (Model Context Protocol) | Yes | |
74
+
75
+ ## JavaScript Configuration
76
+
77
+ ### Node.js — auto-enabled integrations
78
+
79
+ Just ensure tracing is enabled. Integrations auto-enable when the AI package is installed:
80
+
81
+ ```javascript
82
+ Sentry.init({
83
+ dsn: "YOUR_DSN",
84
+ tracesSampleRate: 1.0, // Lower in production (e.g., 0.1)
85
+ // OpenAI, Anthropic, Google GenAI, LangChain integrations auto-enable in Node.js
86
+ });
87
+ ```
88
+
89
+ To customize (e.g., enable prompt capture — see Data Capture Warning):
90
+
91
+ ```javascript
92
+ integrations: [
93
+ Sentry.openAIIntegration({
94
+ // recordInputs: true, // Opt-in: captures prompt content (PII)
95
+ // recordOutputs: true, // Opt-in: captures response content (PII)
96
+ }),
97
+ ],
98
+ ```
99
+
100
+ ### Browser / Next.js OpenAI (manual wrapping required)
101
+
102
+ In browser-side code or Next.js meta-framework apps, auto-instrumentation is not available. Wrap the client manually:
103
+
104
+ ```javascript
105
+ import OpenAI from "openai";
106
+ import * as Sentry from "@sentry/nextjs"; // or @sentry/react, @sentry/browser
107
+
108
+ const openai = Sentry.instrumentOpenAiClient(new OpenAI());
109
+ // Use 'openai' client as normal
110
+ ```
111
+
112
+ ### LangChain / LangGraph (auto-enabled)
113
+
114
+ ```javascript
115
+ integrations: [
116
+ Sentry.langChainIntegration({
117
+ // recordInputs: true, // Opt-in: captures prompt content (PII)
118
+ // recordOutputs: true, // Opt-in: captures response content (PII)
119
+ }),
120
+ Sentry.langGraphIntegration({
121
+ // recordInputs: true,
122
+ // recordOutputs: true,
123
+ }),
124
+ ],
125
+ ```
126
+
127
+ ### Vercel AI SDK
128
+
129
+ Add to `sentry.edge.config.ts` for Edge runtime:
130
+ ```javascript
131
+ integrations: [Sentry.vercelAIIntegration()],
132
+ ```
133
+
134
+ Enable telemetry per-call:
135
+ ```javascript
136
+ await generateText({
137
+ model: openai("gpt-4o"),
138
+ prompt: "Hello",
139
+ experimental_telemetry: {
140
+ isEnabled: true,
141
+ // recordInputs: true, // Opt-in: captures prompt content (PII)
142
+ // recordOutputs: true, // Opt-in: captures response content (PII)
143
+ },
144
+ });
145
+ ```
146
+
147
+ ## Python Configuration
148
+
149
+ Integrations auto-enable — just init with tracing. Only add explicit imports to customize options:
150
+
151
+ ```python
152
+ import sentry_sdk
153
+
154
+ sentry_sdk.init(
155
+ dsn="YOUR_DSN",
156
+ traces_sample_rate=1.0, # Lower in production (e.g., 0.1)
157
+ # send_default_pii=True, # Opt-in: required for prompt capture (sends user PII)
158
+ # Integrations auto-enable when the AI package is installed.
159
+ # Only specify explicitly to customize (e.g., include_prompts):
160
+ # integrations=[OpenAIIntegration(include_prompts=True)],
161
+ )
162
+ ```
163
+
164
+ ## Manual Instrumentation
165
+
166
+ Use when no supported SDK is detected.
167
+
168
+ ### Span Types
169
+
170
+ | `op` Value | Purpose |
171
+ |------------|---------|
172
+ | `gen_ai.request` | Individual LLM calls |
173
+ | `gen_ai.invoke_agent` | Agent execution lifecycle |
174
+ | `gen_ai.execute_tool` | Tool/function calls |
175
+ | `gen_ai.handoff` | Agent-to-agent transitions |
176
+
177
+ ### Example (JavaScript)
178
+
179
+ ```javascript
180
+ await Sentry.startSpan({
181
+ op: "gen_ai.request",
182
+ name: "LLM request gpt-4o",
183
+ attributes: { "gen_ai.request.model": "gpt-4o" },
184
+ }, async (span) => {
185
+ span.setAttribute("gen_ai.request.messages", JSON.stringify(messages));
186
+ const result = await llmClient.complete(prompt);
187
+ span.setAttribute("gen_ai.usage.input_tokens", result.inputTokens);
188
+ span.setAttribute("gen_ai.usage.output_tokens", result.outputTokens);
189
+ return result;
190
+ });
191
+ ```
192
+
193
+ ### Key Attributes
194
+
195
+ | Attribute | Description |
196
+ |-----------|-------------|
197
+ | `gen_ai.request.model` | Model identifier |
198
+ | `gen_ai.request.messages` | JSON input messages |
199
+ | `gen_ai.usage.input_tokens` | Input token count |
200
+ | `gen_ai.usage.output_tokens` | Output token count |
201
+ | `gen_ai.agent.name` | Agent identifier |
202
+ | `gen_ai.tool.name` | Tool identifier |
203
+
204
+ Enable prompt/output capture only after confirming with the user (see Data Capture Warning above).
205
+
206
+ ## Verification
207
+
208
+ After configuring, make an LLM call and check the Sentry Traces dashboard. AI spans appear with `gen_ai.*` operations showing model, token counts, and latency.
209
+
210
+ ## Troubleshooting
211
+
212
+ | Issue | Solution |
213
+ |-------|----------|
214
+ | AI spans not appearing | Verify `tracesSampleRate > 0`, check SDK version |
215
+ | Token counts missing | Some providers don't return tokens for streaming |
216
+ | Prompts not captured | Enable `recordInputs`/`include_prompts` |
217
+ | Vercel AI not working | Add `experimental_telemetry` to each call |