Agent Skills › langwatch/langwatch › analyticssim

analyticssim

GitHub

用于拦截和检查 PostHog 及 Customer.io 分析调用的模拟服务,支持在测试中验证追踪事件是否触发,提供记录查询、断言及故障注入功能。

.claude/skills/analyticssim/SKILL.md langwatch/langwatch

Trigger Scenarios

验证追踪事件是否触发 检查 PostHog 或 Customer.io 调用 在测试中断言分析数据 排查应用发送的分析内容

Install

npx skills add langwatch/langwatch --skill analyticssim -g -y
More Options

Non-standard path

npx skills add https://github.com/langwatch/langwatch/tree/main/.claude/skills/analyticssim -g -y

Use without installing

npx skills use langwatch/langwatch@analyticssim

指定 Agent (Claude Code)

npx skills add langwatch/langwatch --skill analyticssim -a claude-code -g -y

安装 repo 全部 skill

npx skills add langwatch/langwatch --all -g -y

预览 repo 内 skill

npx skills add langwatch/langwatch --list

SKILL.md

Frontmatter
{
    "name": "analyticssim",
    "description": "Catch and inspect PostHog and Customer.io calls with analyticssim, haven's product-analytics stand-in. Use when someone says 'haven analytics', 'did the tracking event fire', 'posthog events', 'customer.io identify', 'analyticssim', 'nurturing calls', 'haven sim analytics', 'haven up +analytics', 'what did the app send to analytics', or needs to assert on analytics in a test.",
    "user-invocable": true
}

analyticssim

Fakes PostHog (posthog-node /batch/, posthog-js /e/, /flags/) and Customer.io (CDP /v1/*, Track API). Every call becomes one normalized record in memory. Keys are accepted and never checked: a dev shim, never expose it. Code: services/sims/analyticssim, console apps/sims/src/analytics.

Run it

  • Opt-in: haven up +analytics (sticky). Runs in the go lane by default (see sims).
  • Console and ingest base URL: https://analytics.<slug>.langwatch.localhost; haven status shows the loopback port.
  • The overlay points the PostHog host and Customer.io base at it with dummy keys where none is set. Standalone: make service svc=analyticssim (:5596).

Inspect and assert

GET    /_sim/api/records?provider=posthog|customerio&kind=event|identify|alias|group&id=&name=
GET    /_sim/api/status
DELETE /_sim/api/records
GET|PUT /_sim/api/settings   {"forcedError": 0|4xx|5xx}: capture calls (PostHog, Customer.io) answer that status

Records carry provider, kind, distinctId, name, properties, receivedAt and raw. Newest first. Assert: trigger the action, then filter by id and name.

Seed and reset

  • ANALYTICSSIM_SEED=1 (haven sets it) loads sample PostHog and Customer.io records.
  • Reset with DELETE /_sim/api/records; a restart also empties it (nothing persists).

Tests and load

  • Post PostHog batches or Customer.io calls at the loopback port; 16 MiB body cap.
  • The store is a fixed ring: adding is O(1). ANALYTICSSIM_MAX_RECORDS (default 5000), ANALYTICSSIM_MAX_RAW_BYTES (default 65536; bigger raw bodies become a size marker). Benchmark: go test -bench . -benchmem ./services/sims/analyticssim.

From a terminal or agent

--json on every read; non-zero exit on failure; --stack <slug> reads another worktree.

haven sim analytics status        # record count + activity (last 5 min, distinct ids, last call)
haven sim analytics list [--provider] [--kind] [--event|--name] [--id] | clear
haven sim analytics record <id>   # one record: properties, raw call (no public `get` yet: the CLI's internal spelling)
haven sim analytics fault <4xx|5xx|off>        # the next capture calls fail with that status; off clears it
haven sim analytics wait --event <name> [--provider] [--kind] [--id] [--timeout 30s]   # exit 66 on timeout

The console shows the same: an Activity panel, provider tabs, kind and search filters, and "Records for this id" on a record narrows the list to that distinct id.

Version History

  • c0c14dc Current 2026-10-19 19:31

Same Skill Collection

.claude/skills/browser-pair/SKILL.md
.claude/skills/browser-test/SKILL.md
.claude/skills/chakra-ui-builder/SKILL.md
.claude/skills/chakra-ui-refactor/SKILL.md
.claude/skills/code-review/SKILL.md
.claude/skills/code-search/SKILL.md
.claude/skills/feature-map/SKILL.md
.claude/skills/githubsim/SKILL.md
.claude/skills/haven-auth/SKILL.md
.claude/skills/haven-db/SKILL.md
.claude/skills/haven-orb/SKILL.md
.claude/skills/haven-play/SKILL.md
.claude/skills/haven-seed/SKILL.md
.claude/skills/haven-setup/SKILL.md
.claude/skills/idpsim/SKILL.md
.claude/skills/lambdasim/SKILL.md
.claude/skills/langwatch-kanban/SKILL.md
.claude/skills/llmsim/SKILL.md
.claude/skills/mailsim/SKILL.md
.claude/skills/module/SKILL.md
.claude/skills/outboundsim/SKILL.md
.claude/skills/ownership/SKILL.md
.claude/skills/repo-tree/SKILL.md
.claude/skills/storagesim/SKILL.md
.claude/skills/voicesim/SKILL.md
plugins/langwatch/skills/langwatch/SKILL.md
services/langy-agent/skills/github/SKILL.md
skills/_compiled/native/agent-best-practices/SKILL.md
skills/_compiled/native/agent-performance/SKILL.md
skills/_compiled/native/automations/SKILL.md
skills/_compiled/native/code-changes/SKILL.md
skills/_compiled/native/context-sweet-spot/SKILL.md
skills/_compiled/native/daily-insights/SKILL.md
skills/_compiled/native/dashboard-widgets/SKILL.md
skills/_compiled/native/datasets/SKILL.md
skills/_compiled/native/debug-instrumentation/SKILL.md
skills/_compiled/native/debug-with-langwatch/SKILL.md
skills/_compiled/native/drive-the-ui/SKILL.md
skills/_compiled/native/eval-triage/SKILL.md
skills/_compiled/native/evaluate-multimodal/SKILL.md
skills/_compiled/native/evaluations/SKILL.md
skills/_compiled/native/experiments/SKILL.md
skills/_compiled/native/find-traces/SKILL.md
skills/_compiled/native/generate-rag-dataset/SKILL.md
skills/_compiled/native/github/SKILL.md
skills/_compiled/native/guided-onboarding/SKILL.md
skills/_compiled/native/level-up/SKILL.md
skills/_compiled/native/lwql-charts/SKILL.md
skills/_compiled/native/online-evaluations/SKILL.md

Metadata

Files
0
Version
c0c14dc
Hash
9ddb5845
Indexed
2026-10-19 19:31

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-20 07:49
浙ICP备14020137号-1