К основному содержанию
скилл CX Codex

investigating-replay — скилл для Claude Code: функции и запуск

Скилл собирает метаданные записи сессии PostHog, профиль пользователя, события и ошибки в один связный отчёт. Пригодится при расследовании сбоев по идентификатору сессии.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add PostHog/skills --skill investigating-replay -a claude-code
Открыть на GitHub

Что делает investigating-replay

Скилл автоматизирует разбор пользовательских сессий в PostHog. Вместо ручного вызова отдельных инструментов агент выполняет пошаговый сценарий. Сначала он запрашивает параметры записи через posthog:session-recording-get и профиль клиента через posthog:persons-retrieve. Затем через SQL-запрос posthog:execute-sql извлекает хронологию действий, кликов и исключений, а также находит связанные тикеты в отслеживании ошибок.

Если события в базе не содержат нужного $session_id, скилл ищет кандидатов по person_id с интервалом в 100 секунд до и после сессии. При необходимости агент запрашивает готовый отчёт Replay Vision или создаёт новый через posthog:vision-scanners-inline-scan. Для работы скилла нужны подключённые инструменты PostHog, иначе запросы завершатся сбоем.

Какие задачи решает

  • выяснить хронологию действий пользователя по ID сессии PostHog
  • связать ошибки консоли и исключения с задачами трекинга сбоев
  • найти профиль клиента и свойства его устройства для проблемной сессии
  • восстановить потерянный идентификатор сессии при сбоях разметки событий

Примеры запросов агенту

  • Разбери сессию b28f3a12 и расскажи, почему пользователь столкнулся с ошибкой
  • Посмотри запись сессии 49a1c8df: какие страницы открывал клиент и какие были клики?
  • Что произошло в сессии 77c01b2e? Собери профиль пользователя, стек ошибок и отчёт Replay Vision

Как установить investigating-replay

1Через Skills CLI (Vercel)

npx skills add PostHog/skills --skill investigating-replay -a claude-code

2Вручную: положить файлы

~/.claude/skills/investigating-replay/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/investigating-replay/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о investigating-replay

Как установить investigating-replay в Claude Code?

Выполните в терминале команду npx skills add PostHog/skills --skill investigating-replay -a claude-code.

Что делает investigating-replay?

Скилл принимает идентификатор сессии PostHog и объединяет метаданные плеера, свойства пользователя, последовательность действий и связанные ошибки в один структурированный отчёт.

Что происходит, если SQL-запрос событий по ID сессии вернул пустой результат?

Скилл запускает резервный SQL-запрос, который ищет события пользователя по person_id в диапазоне времени записи с запасом в 100 секунд.

Исходный текст

SKILL.md · MIT
---
name: investigating-replay
description: >
  Investigates a session recording by gathering metadata, person profile,
  same-session events, and linked error tracking issues in one pass.
  Use when a user provides a recording or session ID and wants to understand
  what happened — who the user was, what they did, what errors occurred,
  and whether there are related error tracking issues. Replaces the manual
  chain of session-recording-get, persons-retrieve, execute-sql, and
  query-error-tracking-issues-list.
---

# Investigating a session recording

When a user asks "what happened in this session?" or provides a recording/session ID
to investigate, gather all relevant context in parallel rather than making them
ask for each piece.

## Available tools

| Tool                                       | Purpose                                                    |
| ------------------------------------------ | ---------------------------------------------------------- |
| `posthog:session-recording-get`            | Recording metadata (duration, counts, status)              |
| `posthog:persons-retrieve`                 | Person profile (properties, distinct IDs)                  |
| `posthog:execute-sql`                      | Query events, errors, and page views in session            |
| `posthog:query-error-tracking-issues-list` | Find error tracking issues linked to the session           |
| `posthog:vision-observations-list`         | Check for an existing Replay Vision AI summary             |
| `posthog:vision-observations-get`          | Read one observation in full (`scanner_result`)            |
| `posthog:vision-scanners-inline-scan`      | Generate an AI summary of the session (slow, optional)     |
| `posthog:vision-scanners-list`             | Find saved summarizer scanners (`scanner_type=summarizer`) |
| `posthog:vision-scanners-scan-session`     | Run a saved summarizer scanner on the session (slow)       |

## Workflow

### Step 1 — Get recording metadata and person profile

Start with the recording to get metadata and the person's distinct ID:

```json
posthog:session-recording-get
{
  "id": "<session_id>"
}
```

The recording `id` and the event `$session_id` are the same value. It selects the
recording here and the same-session events in Step 2. The response includes
`distinct_id`, `person`, `start_time`, `end_time`, duration, interaction counts,
console error counts, and viewing status. Use the `distinct_id` to fetch
the full person profile:

```json
posthog:persons-retrieve
{
  "id": "<person_uuid_from_recording>"
}
```

### Step 2 — Query same-session events

Use the recording `id` from Step 1 as the `$session_id` value. Get the timeline
of what the user did during the session:

```sql
posthog:execute-sql
SELECT
    timestamp,
    event,
    properties.$current_url AS url,
    properties.$browser AS browser,
    properties.$os AS os,
    properties.$device_type AS device_type,
    properties.$screen_width AS screen_width
FROM events
WHERE $session_id = '<session_id>'
ORDER BY timestamp ASC
LIMIT 200
```

For sessions with many events, focus on the most informative ones:

```sql
posthog:execute-sql
SELECT
    timestamp,
    event,
    properties.$current_url AS url,
    if(event = '$exception', properties.$exception_values[1], null) AS exception_message,
    if(event = '$exception', properties.$exception_types[1], null) AS exception_type
FROM events
WHERE $session_id = '<session_id>'
    AND event IN ('$pageview', '$pageleave', '$autocapture', '$exception', '$rageclick')
ORDER BY timestamp ASC
LIMIT 100
```

#### No rows? Recover the event session ID

The recording `id` is the session ID. No rows means the session's events were
ingested without it. Find candidates from the person's events in the recording
window, padded by 100 seconds like the replay events query. `person_id` covers
all of the person's distinct IDs:

```sql
posthog:execute-sql
SELECT
    properties.$session_id AS session_id,
    count() AS event_count,
    min(timestamp) AS first_seen,
    max(timestamp) AS last_seen
FROM events
WHERE person_id = '<person_uuid>'
    AND timestamp >= toDateTime('<start_time>') - INTERVAL 100 SECOND
    AND timestamp <= toDateTime('<end_time>') + INTERVAL 100 SECOND
    AND properties.$session_id IS NOT NULL
GROUP BY session_id
ORDER BY event_count DESC
LIMIT 10
```

Continue only when one session ID clearly matches. Use it for the Step 2 and
Step 3 queries only. The replay URL and all Replay Vision calls take the
recording `id`.

### Step 3 — Check for linked error tracking issues

If the recording has console errors or exceptions, find related error tracking issues:

```sql
posthog:execute-sql
SELECT DISTINCT
    properties.$exception_fingerprint AS fingerprint,
    properties.$exception_types[1] AS type,
    properties.$exception_values[1] AS message,
    count() AS occurrences
FROM events
WHERE $session_id = '<session_id>'
    AND event = '$exception'
GROUP BY fingerprint, type, message
ORDER BY occurrences DESC
LIMIT 10
```

If fingerprints are found, search for the corresponding error tracking issues
to provide links and status:

```json
posthog:query-error-tracking-issues-list
{
  "searchQuery": "<exception_type or message>"
}
```

### Step 4 — Synthesize the investigation

Present the findings as a coherent narrative:

1. **Who** — person properties (name, email, country, plan, etc.)
2. **What** — sequence of pages visited and key actions taken
3. **Problems** — exceptions, console errors, rage clicks, and their frequency
4. **Related issues** — linked error tracking issues with their status (active/resolved)
5. **Context** — session duration, device/browser, activity score

### Optional: AI summary via Replay Vision

If the user wants a deeper analysis without reading through events manually,
offer a Replay Vision summary. Follow "check-then-scan" — don't scan blindly,
a scanner can only observe a given session once.

1. **Check for an existing summary.** A scheduled scanner may already have one:

   ```json
   posthog:vision-observations-list
   {
     "session_id": "<session_id>"
   }
   ```

   The rows come back narrowed to `id`, `session_id`, `status`, `summary_line` and
   `scanner_id`. Look for one whose `status` is `succeeded`, then read it in full with
   `vision-observations-get` for that `id`: its `scanner_snapshot.scanner_type`
   tells you whether it is a `summarizer`, and `scanner_result.model_output` carries
   `title`, `summary`, `intent`, `outcome`, `friction_points` and `keywords`. If you
   find one, you are done — no new scan needed.

2. **Generate one** with an inline scan of the built-in summary. It runs the same scan as
   the player's Summarize button, so a summary either of you started is shared, while a
   prompt of your own mints a separate scanner and a separate summary.

   ```json
   posthog:vision-scanners-inline-scan
   {
     "session_ids": ["<session_id>"],
     "built_in": "summarize_recording"
   }
   ```

   Leave `model` out so the server default applies. Warn the user this is async and
   takes several minutes (rasterize + LLM). Nothing is scheduled and there is
   nothing to clean up: the scanner an inline scan mints never sweeps on its own. A
   400 here usually means the organization has not approved AI data processing yet.

3. **Read `results[0].scan_outcome` before polling.** `started` means poll
   `vision-observations-list` (step 1) until the new observation reaches `succeeded`.
   `already_scanned` means a terminal observation already exists — read it via step 1,
   and if its status is `failed` or `ineligible` say so rather than polling. A null
   `scan_id` or `skipped_quota` means nothing ran: report the quota, do not poll.

### The project already has a summarizer scanner

Use an inline scan for a one-off summary even then. Only reach for a saved scanner
when the user wants that scanner's own prompt rather than the built-in one:

```json
posthog:vision-scanners-list
{
  "scanner_type": "summarizer"
}
```

Show the user the scanners (name + prompt), ask which to use, then run it against
the session and poll `vision-observations-list` until the observation reaches
`succeeded`:

```json
posthog:vision-scanners-scan-session
{
  "id": "<scanner_id>",
  "session_id": "<session_id>"
}
```

Never create a scanner to answer a single question — `vision-scanners-create`
leaves a scheduled sweep behind that the inline scan does not.

## Tips

- Run steps 1-3 in parallel when possible — they're independent queries.
- If the recording has very few events, the session was likely very short.
  Note this rather than suggesting something is broken.
- Console error count from the recording metadata is a good signal for whether
  to dig into exceptions. If it's 0, skip step 3.
- The `start_url` from the recording tells you where the user's journey began —
  use this to frame the narrative.
- If `person` is null on the recording, the user was anonymous.
  Person properties won't be available, but events still are.

## Related skills

- **`finding-sessions-to-watch`** — choose which sessions are worth investigating in the first place
- **`finding-replay-for-issue`** — start from an error tracking issue and find its linked recordings
- **`diagnosing-missing-recordings`** — when a recording that should exist doesn't
- **`creating-replay-vision-scanners`** — automate this kind of watching as a scheduled scanner

© PostHog · MIT · PostHog/skills

Похожие скиллы

Все скиллы по теме «Настройка агента: память, контекст, субагенты» →
subtext fullstorydev Плагин подключает к агенту записанные сессии вашего приложения: агент смотрит, что делал пользователь, и находит поломки. ★ 79звёзд репо logrocket LogRocket Подключает Claude к LogRocket: агент сам находит сессии, разбирает сетевые запросы и ищет причины ошибок по вашим данным. ★ 2звёзд репо browser-replay ruvnet Прогоняет записанную сессию браузера заново — на том же адресе или на изменённом варианте. Пригодится для регресс-тестов после деплоя. CX Codex +1 720установок agent-observability-replay-trace datadog-labs Перезапускает один LLM Obs-трейс на локальном коде и показывает разницу между старым и новым результатом. Нужен для итераций над неудачным выводом. CX Codex +1 399установок investigating-incidents-with-aws-devops-agent aws Запускает глубокий поиск первопричины инцидента в AWS DevOps Agent и стримит прогресс, пока агент копается в логах и трейсах. CX Codex +1 1 500установок Feedbacks Softinator-TechLabs Feedbacks собирает скриншоты, записи сессий и обсуждения по проблемам сайта, чтобы разработчик и ИИ-агент могли сверить замечания и результат исправления. CX Codex +1 ★ 36звёзд репо

Из того же набора48

signals Скилл учит агента писать HogQL-запросы к таблице document_embeddings в PostHog для поиска сырых сигналов продукта и их векторных эмбеддингов. CX Codex +1 398установок creating-experiments Ведёт агента через создание A/B-теста: читает настройки проекта, формулирует гипотезу, выбирает раскатку и метрики, а в отчёте помечает догадки. CX Codex +1 398установок diagnosing-missing-recordings Помогает понять, почему PostHog не записал сессию пользователя. Скилл проверяет SDK-сигналы через SQL и находит точную причину неполадки. CX Codex +1 397установок configuring-experiment-analytics Настраивает метрики и критерии экспозиции в экспериментах PostHog. Пригодится, когда нужно понять, кто попал в анализ и как измерять эффект. CX Codex +1 394установок configuring-experiment-rollout Скилл помогает агенту настроить разбивку вариантов и процент роллаута в экспериментах PostHog, а также разобрать неоднозначные запросы вроде «раскатить на 25%». CX Codex +1 389установок exploring-llm-costs Скилл разбирает траты на LLM в PostHog: общую сумму, разбивку по моделям, пользователям и трейсам, экономику кэша. CX Codex +1 385установок feature-usage-feed Собирает типовые сценарии использования фичи PostHog через LLM-судью и шлёт их в Slack. Нужен, когда трейсов сотни и вручную их не разобрать. CX Codex +1 381установок managing-experiment-lifecycle Скилл ведёт эксперименты PostHog по состояниям: запуск, пауза, заморозка показа, завершение, архивация и перенос старого эксперимента в новый движок. CX Codex +1 379установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой