Source profileQuality 92/100Review permissions

lizhiyao/sentry-miniapp/.agents/skills/sentry-miniapp-sdk/SKILL.md

sentry-miniapp-sdk

Full Sentry SDK setup for Mini Programs — error monitoring, tracing, offline cache, source maps. Supports WeChat, Alipay, ByteDance, Baidu, QQ, DingTalk, Kuaishou and cross-platform frameworks (Taro / uni-app).

Source repository stars
677
Declared platforms
0
Static risk flags
3
Last source update
2026-08-28
Source checked
2026-08-28

Decision brief

What it does: where it fits

Set up Sentry error monitoring, performance tracing, and offline caching in mini program projects using sentry-miniapp — a community SDK built on @sentry/core v10.

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/lizhiyao/sentry-miniapp --skill ".agents/skills/sentry-miniapp-sdk"
    Safe inspection promptEditorial

    Inspect the Agent Skill "sentry-miniapp-sdk" from https://github.com/lizhiyao/sentry-miniapp/blob/cf13bb46035082d78988692af3251430e9c0ccc0/.agents/skills/sentry-miniapp-sdk/SKILL.md at commit cf13bb46035082d78988692af3251430e9c0ccc0. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      Phase 1: Detect

      Run these commands to understand the project:

      Run these commands to understand the project:
    2. 02

      Phase 2: Recommend

      Present this recommendation based on detection results:

      ✅ Error Monitoring — always. Automatic capture of onError, onUnhandledRejection, onPageNotFound, onMemoryWarning✅ Performance Tracing — always. Navigation timing, render performance, resource loading, custom spans⚡ Source Map Upload — when deploying to production. Maps minified stack traces back to source code
    3. 03

      Phase 3: Guide

      Review the “Phase 3: Guide” section in the pinned source before continuing.

      Review and apply the “Phase 3: Guide” source section.
    4. 04

      Step 1: Install

      Review the “Step 1: Install” section in the pinned source before continuing.

      Review and apply the “Step 1: Install” source section.
    5. 05

      Step 2: Initialize

      Create or modify the app entry point. Sentry.init() must be called before App().

      Create or modify the app entry point. Sentry.init() must be called before App().

    Permission review

    Static risk signals and limitations

    Runs scripts

    medium · line 103

    The documentation asks the agent to run terminal commands or scripts.

    # npm

    Runs scripts

    medium · line 104

    The documentation asks the agent to run terminal commands or scripts.

    npm install sentry-miniapp

    Network access

    medium · line 120

    The documentation includes network, browsing, or remote request actions.

    dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',

    Network access

    medium · line 137

    The documentation includes network, browsing, or remote request actions.

    dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',

    Reads files

    low · line 206

    The documentation asks the agent to read local files, directories, or repositories.

    Walk through features one at a time. Load the corresponding reference file:

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score92/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars677SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    lizhiyao/sentry-miniapp
    Skill path
    .agents/skills/sentry-miniapp-sdk/SKILL.md
    Commit
    cf13bb46035082d78988692af3251430e9c0ccc0
    License
    MIT
    Collected
    2026-08-28
    Default branch
    master
    View the original SKILL.md

    Sentry Mini Program SDK Setup

    Set up Sentry error monitoring, performance tracing, and offline caching in mini program projects using sentry-miniapp — a community SDK built on @sentry/core v10.

    Invoke This Skill When

    • User mentions mini program, miniapp, 小程序, WeChat, Alipay, ByteDance, Taro, uni-app alongside Sentry
    • User wants to add error monitoring or performance tracking to a mini program
    • User asks about Sentry support for WeChat/Alipay/ByteDance mini programs
    • User imports or references sentry-miniapp in their project

    Note: SDK versions and APIs reflect the current sentry-miniapp docs. Always verify against the sentry-miniapp README before implementing.


    Phase 1: Detect

    Run these commands to understand the project:

    # Detect mini program platform
    ls app.json project.config.json mini.project.json project.tt.json project.swan.json project.qq.json 2>/dev/null
    cat app.json 2>/dev/null | head -20
    
    # Detect framework (Taro / uni-app / native)
    cat package.json 2>/dev/null | grep -E '"@tarojs/|"@dcloudio/uni-|"sentry-miniapp"'
    
    # Check for existing Sentry SDK
    grep -r "sentry" package.json 2>/dev/null
    grep -r "Sentry.init" app.js app.ts src/app.js src/app.ts 2>/dev/null
    
    # Detect entry point
    ls app.js app.ts src/app.js src/app.ts 2>/dev/null
    
    # Detect package manager
    ls yarn.lock pnpm-lock.yaml package-lock.json 2>/dev/null
    

    What to determine:

    QuestionImpact
    Which mini program platform?Determines platform option and API differences
    Native or cross-platform framework (Taro/uni-app)?Determines init pattern and build config
    Is sentry-miniapp already installed?Skip install if present, check version
    Where is the app entry point?Determines where to place Sentry.init()
    Is there a build tool config (webpack/vite)?Needed for Source Map setup

    Platform Detection Guide

    File PresentPlatform
    project.config.jsonWeChat (微信)
    mini.project.jsonAlipay (支付宝)
    project.tt.jsonByteDance (字节跳动)
    project.swan.jsonBaidu (百度)
    project.qq.jsonQQ
    @tarojs/* in package.jsonTaro (cross-platform)
    @dcloudio/uni-* in package.jsonuni-app (cross-platform)

    DingTalk and Kuaishou do not have a stable project-file signal in this guide. Confirm them from platform globals, framework configuration, dependencies, or the user's stated target instead of guessing from a filename.


    Phase 2: Recommend

    Present this recommendation based on detection results:

    Recommended (core coverage):

    • Error Monitoring — always. Automatic capture of onError, onUnhandledRejection, onPageNotFound, onMemoryWarning
    • Performance Tracing — always. Navigation timing, render performance, resource loading, custom spans

    Recommended for production:

    • Source Map Upload — when deploying to production. Maps minified stack traces back to source code
    • Offline Cache — when users are on unreliable networks. Caches events locally, retries when connectivity returns

    Optional:

    • Distributed Tracing — when mini program calls backend APIs. Injects sentry-trace/baggage headers, and can optionally add W3C traceparent, to link frontend and backend spans
    • User Feedback — when you want to collect user-reported issues via Sentry.captureFeedback()
    FeatureRecommend when...
    Error MonitoringAlways — zero-config automatic exception capture
    Performance TracingAlways — automatic page/network/render performance
    Source MapProduction — required to read minified stack traces
    Offline CacheWeak networks — mobile users, rural areas
    Distributed TracingAPI calls — mini program talks to backend services
    User FeedbackUser-facing — collect bug reports from end users

    Phase 3: Guide

    Step 1: Install

    # npm
    npm install sentry-miniapp
    
    # yarn
    yarn add sentry-miniapp
    

    Step 2: Initialize

    Create or modify the app entry point. Sentry.init() must be called before App().

    Native Mini Program (app.js)

    const Sentry = require('sentry-miniapp');
    
    Sentry.init({
      dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',
      release: '[email protected]',
      environment: 'production',
    });
    
    App({
      // Your app config...
      // No need to manually call Sentry in onError — SDK handles it automatically
    });
    

    Taro (app.js or app.ts)

    import * as Sentry from 'sentry-miniapp';
    
    Sentry.init({
      dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',
      release: '[email protected]',
      environment: 'production',
    });
    
    // Taro App component follows...
    

    uni-app (App.vue or main.js)

    const Sentry = require('sentry-miniapp');
    
    Sentry.init({
      dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',
      release: '[email protected]',
      environment: 'production',
    });
    

    Step 3: Configure Platform (if needed)

    The SDK auto-detects the platform at runtime. When multiple platform globals are present, it uses platform-specific host names, data paths, and App IDs to disambiguate them. Set platform only when those runtime signals are unavailable, conflicting, or the detected event label still does not match the release target.

    If you need to override the event's miniapp platform label:

    Sentry.init({
      dsn: '...',
      platform: 'bytedance', // 'wechat' | 'alipay' | 'bytedance' | 'qq' | 'swan' | 'dingtalk' | 'kuaishou'
      // Note: Baidu's global object is `swan`, so use 'swan' (there is no 'baidu' value).
    });
    

    The configured value is written to contexts.miniapp.platform; it does not switch the underlying runtime API. The top-level Sentry event platform always remains the standard value javascript so stack parsing, grouping, and Source Maps follow official JavaScript SDK semantics. Error handlers, requests, and storage continue using the compatible global detected automatically.

    Step 4: Add User Context

    // After user login
    Sentry.setUser({
      id: 'user-123',
      username: 'zhang_san',
    });
    
    // Add custom tags
    Sentry.setTag('page', 'payment');
    Sentry.setContext('order', { orderId: '2024001', amount: 99.9 });
    

    Minigame (小游戏)

    WeChat / ByteDance minigames have no App() / Page() / routing, so the page-based integrations (PageBreadcrumbs, Session) cannot work there. The SDK detects minigames via crossPlatform.isMinigame() and switches to dedicated integrations — enabled by default only in a minigame runtime, and a safe no-op in a regular mini program:

    • MinigameIntegration (enableMinigameLifecycle) — reads the launch scene (scene / path / query) from getLaunchOptionsSync(), measures cold-start time (SDK init → first frame), and logs onShow / onHide foreground/background breadcrumbs.
    • FrameRateIntegration (enableMinigameFrameRate) — samples the global requestAnimationFrame to estimate FPS and jank. Mini programs use a two-thread model with no logic-layer requestAnimationFrame, so this safely no-ops there.

    No extra wiring is needed — Sentry.init() auto-enables these in a minigame. To force them on or off:

    Sentry.init({
      dsn: '...',
      enableMinigameLifecycle: true,
      enableMinigameFrameRate: true,
    });
    

    For Each Agreed Feature

    Walk through features one at a time. Load the corresponding reference file:

    FeatureReferenceLoad when...
    Error Monitoringreferences/error-monitoring.mdAlways
    Performance Tracingreferences/tracing.mdUser agreed to tracing
    Offline Cachereferences/offline-cache.mdUser agreed to offline cache
    Source Mapreferences/sourcemap.mdUser agreed to source maps

    Configuration Reference

    Key Init Options

    OptionTypeDefaultDescription
    dsnstringSentry DSN (required)
    releasestringRelease version, must match source map upload
    environmentstringEnvironment name (production, staging, etc.)
    sampleRatenumber1.0Error event sample rate (0.0–1.0)
    tracesSampleRatenumberTrace sample rate (0.0–1.0)
    tracesSamplerfunctionDynamic sampling function (overrides tracesSampleRate)
    enableSourceMapbooleantrueAuto-normalize stack trace paths for source map resolution
    stackParserStackParserminiappStackParserCustom stack parser for private runtimes or special stack formats
    enableOfflineCachebooleantrueCache events when offline, retry when back online
    offlineCacheLimitnumber30Max events to store in offline cache
    offlineCacheMaxAgenumber86400000Drop cached events older than this (ms); default 24h
    requireConsentbooleanfalseGate outbound Sentry network sends until Sentry.setConsent(true)
    consentCacheLimitnumber100Max events buffered before consent; preserves oldest cold-start data
    consentCacheMaxBytesnumber921600Max consent-buffer bytes; default ~900KB due miniapp single-key storage limits
    consentCacheMaxAgenumber86400000Drop consent-buffered events older than this (ms); default 24h
    onConsentCacheDropfunctionCalled with { reason, dropped } when consent buffer drops events
    enableTracePropagationbooleantrueInject distributed tracing headers (sentry-trace/baggage, plus optional traceparent) in outgoing requests
    enableStandaloneHttpSpansbooleantrueSend parentless API requests as standalone segment spans; set false for child-only request tracing
    tracePropagationTargetsArray[]URL allowlist for trace header injection; empty means no injection because mini programs have no reliable same-origin baseline
    propagateTraceparentbooleanfalseAlso inject W3C traceparent for OpenTelemetry / W3C Trace Context compatible backends
    enableAutoSessionTrackingbooleantrueAutomatic session lifecycle management
    enableConsoleBreadcrumbsbooleanfalseCapture console.log/warn/error as breadcrumbs
    enableLogsbooleanfalseEnable Sentry Logs via Sentry.logger.*
    traceNetworkBodybooleanfalseCapture request/response body in network breadcrumbs
    enableNavigationBreadcrumbsbooleantruePage lifecycle (navigation) breadcrumbs
    enableUserInteractionBreadcrumbsbooleantrueTap / user-interaction breadcrumbs
    enableNetworkStatusMonitoringbooleantrueReal-time network monitoring; triggers offline flush on reconnect
    allowUrlsArray<string|RegExp>Only send errors whose URL matches (others dropped)
    denyUrlsArray<string|RegExp>Drop errors whose URL matches
    ignoreErrorsArray<string|RegExp>Drop errors whose message/type matches
    transportOptionsobjectsee belowBuilt-in transport safeguards and headers
    defaultIntegrationsfalse|Integration[]all built-in default integrationsSet false to disable every default integration; a custom array replaces the default base
    integrationsIntegration[]|(defaults) => Integration[]An array appends to defaults (user instances win by name); a function receives defaults and returns the final list
    enableMinigameLifecyclebooleanminigame true / miniprogram falseMinigame cold-start + scene + show/hide breadcrumbs
    enableMinigameFrameRatebooleanminigame true / miniprogram falseMinigame FPS / jank sampling (no-op in mini program)
    beforeSendfunctionEvent processor for filtering/modifying events
    beforeSendTransactionfunctionHook to filter/modify transaction events before sending
    beforeSendLogfunctionHook to filter/modify logs before sending
    beforeBreadcrumbfunctionHook to filter/modify breadcrumbs before they are attached

    The built-in transport defaults to requestTimeout: 3000 and maxConcurrentRequests: 2 so Sentry cannot occupy all mini program network slots when the service is unavailable. Additional envelopes wait in the bounded @sentry/core buffer. A timed-out request is aborted when the host returns an abortable request task, then handed to offline caching. Keep these defaults unless real-device testing shows a need to adjust them; transportOptions.headers remains available for custom envelope headers.

    Privacy Consent Gate

    For domestic mini program / mini game privacy flows, initialize with requireConsent: true. Before the user agrees, the SDK still collects errors, breadcrumbs, and performance data, but sends no Sentry network requests; events are buffered in miniapp storage and flushed after consent.

    Sentry.init({
      dsn: '...',
      requireConsent: true,
      consentCacheLimit: 100,
    });
    
    // After the user agrees to the privacy policy
    Sentry.setConsent(true);
    
    // If consent is revoked, block outbound sends again
    Sentry.setConsent(false);
    

    requireConsent implies local buffering even when enableOfflineCache is false; custom transport functions are wrapped by the consent gate too. The current store uses one storage key, so keep consentCacheMaxBytes near the default ~900KB unless the SDK adds sharded storage in a future version.

    Platform Compatibility

    FeatureWeChatAlipayByteDanceBaiduQQDingTalkKuaishou
    Error Capture
    Performance
    Offline Cache
    Distributed Tracing
    Session Tracking
    Source Map

    ✅ = supported through the SDK's cross-platform abstraction, not a per-host on-device certification. WeChat / Alipay / ByteDance are the most battle-tested; validate less common hosts (Kuaishou, DingTalk) in your own environment before relying on them in production.


    Verification

    After setup, verify the integration:

    1. Trigger a test error:
    // In any page
    Sentry.captureException(new Error('Test error from mini program'));
    
    1. Check Sentry dashboard:

      • Go to your Sentry project → Issues
      • You should see the test error with:
        • Device info (brand, model, OS)
        • Top-level platform: javascript
        • Mini program context (host platform and host SDK version)
        • App context (app_version from miniProgram.version when available)
        • Breadcrumbs (page navigation, network requests)
    2. Verify automatic capture works:

      • Throw an unhandled error in a page — it should appear in Sentry without any manual captureException call

    Phase 4: Cross-Link

    After mini program setup, check for companion services:

    # Check for backend services in the same workspace
    ls -d ../*/package.json ../*/requirements.txt ../*/go.mod ../*/Gemfile 2>/dev/null
    
    Backend DetectedSuggest
    Node.js (package.json with server framework)Sentry Node SDK
    Python (requirements.txt)Sentry Python SDK
    Go (go.mod)Sentry Go SDK
    Ruby (Gemfile)Sentry Ruby SDK
    Java (pom.xml / build.gradle)Sentry Java SDK

    Tip: Enable distributed tracing on both mini program and backend to get end-to-end request traces across services.


    Troubleshooting

    IssueSolution
    Events not appearing in SentryCheck DSN is correct; verify Sentry domain is in mini program's trusted domain list
    sampleRate filtering all eventsEnsure sampleRate is not set to 0; default is 1.0
    Tracing spans not appearingSet tracesSampleRate > 0 (or use tracesSampler) — tracing is off until set; there is no default
    Minified stack tracesSet up Source Map upload — see references/sourcemap.md
    Duplicate error reportsDo NOT manually call Sentry.captureException in onError — SDK captures automatically
    Events lost on weak networksEnable offline cache: enableOfflineCache: true (default)
    WeChat DevTools not triggering onErrorTest on a real device; DevTools may not trigger all error handlers
    Stack trace paths don't match source mapsEnsure --url-prefix "app:///" when uploading; SDK normalizes paths to app:/// automatically

    Frequently asked questions

    What to verify before installation and use

    What does the sentry-miniapp-sdk source document cover?

    Set up Sentry error monitoring, performance tracing, and offline caching in mini program projects using sentry-miniapp — a community SDK built on @sentry/core v10.

    How do I install sentry-miniapp-sdk?

    The source record exposes this install command: npx skills add https://github.com/lizhiyao/sentry-miniapp --skill ".agents/skills/sentry-miniapp-sdk". Inspect the command and pinned source before running it.

    Which permission-related actions were detected?

    Static rules flagged exec-script, network, read-files in the source; the page lists the matching lines and excerpts.

    Alternatives

    Compare before choosing

    Computed 10045,960

    coreyhaines31/marketingskills

    ab-testing

    When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program

    Computed 10029,236

    garrytan/gbrain

    bulk-ingestion

    End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.

    Computed 10025,136

    alirezarezvani/claude-skills

    app-store-optimization

    App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist

    Computed 1005,277

    dotnet/skills

    migrate-vstest-to-mtp

    Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing