suggesting-path-cleaning-rules
できること
このスキルは、PostHogが毎週出す、似たページアドレスをまとめるための提案と、その確認方法を説明します。レポートを変更する前に、提案されたルールを確認したいチーム向けです。
使う場面
- ✓チーム向けの自動的なページアドレスの提案を確認したいとき。
- ✓提案されたルールを確認して適用したいとき。
- ✓提案の確認が正しく動いているかをチェックしたいとき。
スキルのリンク
https://github.com/PostHog/posthog/blob/master/products/web_analytics/skills/suggesting-path-cleaning-rules/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“PostHogがサイト向けに出したパスの整理の提案を確認し、どれを適用する価値があるか説明してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
PostHogは毎週、実際のページアドレスをサンプリングし、AIモデルにグループ化のルールを依頼して、各ルールをチームの自分のデータで検証します。エージェントが提案を確認し、人が決めた場合にのみ適用されます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Suggesting path-cleaning rules
Many teams never configure path cleaning, so their Web analytics breakdowns fragment across
thousands of near-identical URLs. This feature proactively suggests cleaning rules for the
web-analytics precompute cohort: weekly, for each team, it samples real paths, asks the LLM for
{regex, alias} rules, validates them against the team's own paths, and stores them for review.
It only suggests — it never auto-applies. Applying rewrites historical numbers in every cleaned
chart, so that stays a human decision (the existing settings UI, or the --apply flag below after
review). To hand-author or directly apply rules, use the managing-path-cleaning-rules skill.
Architecture
- Core:
products/web_analytics/backend/path_cleaning_suggestions/service.pysample_pathnames/count_distinct_pathnames— top$pathnameby views via HogQL.call_llm_for_rules— one-shot call through the LLM gateway (get_llm_client(product="web_analytics", team_id=...), modelWEB_ANALYTICS_PATH_CLEANING_SUGGESTIONS_MODEL, defaultclaude-haiku-4-5).validate_and_annotate_rules— compiles each regex with re2 (the engine ClickHousereplaceRegexpAlluses) and test-applies it to the sampled paths. Rules that don't compile or match nothing are dropped; survivors get a denseorder, amatch_count, and in-memory before/afterexamples(printed by the management command, never stored — health-issue payloads are readable with justhealth_issue:readand must not leak real paths). This is the skill's "test before saving" step, automated.generate_suggestions_for_team— orchestrates the above with gating (see below); pure generation, no storage.apply_suggestions_to_team— merges rules intopath_cleaning_filters, never overwrites (dedupes by regex, continuesorder).
- Storage: a
path_cleaning_suggestionshealth issue (HealthIssue, severityinfo) — no dedicated model. One active issue per team (hash_keys=[]);payloadcarriesrules,model,sampled_path_count,distinct_path_count. Applying (or hand-configuring rules) resolves the issue on the next check run; dismissal is the health-issuedismissedflag. - Schedule:
PathCleaningSuggestionsCheck(products/web_analytics/backend/temporal/health_checks/path_cleaning_suggestions.py), a health check on the shared health-check framework, weekly (Mon 06:23 UTC), small sequential batches because each eligible team costs an LLM call. Teams with an existing active suggestion are re-emitted without a fresh LLM round trip. - Cohort:
WEB_ANALYTICS_PATH_CLEANING_SUGGESTIONS_TEAM_IDS, defaulting to the precompute enrollment listWEB_ANALYTICS_LAZY_PRECOMPUTE_TEAM_IDS.
Gating (why a team is skipped)
generate_suggestions_for_team returns a status:
skipped_inactive— team sent no$pageviewwithinvisited_within_days(default 30); we only suggest for teams actively using web analytics. Bypass with--ignore-visit-gate.skipped_configured— team already has path cleaning rules (override withinclude_configured).skipped_low_cardinality— fewer distinct paths thanmin_distinct_paths(default 50); cleaning adds no value, so we don't spend tokens.skipped_no_paths— no pageviews in the window.generated— rules produced (may be an empty list if paths are already clean; empty generations are never stored, so they can't shadow an actionable suggestion).error— sampling/LLM failed; captured per-team, never aborts the cohort sweep.
How users see and apply suggestions
- Settings banner:
PathCleaningSuggestionsBanneron/settings/project#path_cleaningshows the latestsuggestedrow as regex → alias previews with match counts; "Apply all" (project admins only) merges the rules, the close button dismisses. Driven bypathCleaningSuggestionsLogic. - Onboarding step:
OnboardingWebAnalyticsPathCleaningStep(stepKeypath_cleaning) surfaces the same banner during Web analytics onboarding. - API (
products/web_analytics/backend/api/web_analytics_path_cleaning_suggestions.py):POST /api/projects/:id/web_analytics_path_cleaning_suggestions/generate/produces and stores a fresh suggestion on demand;GET .../{issue_id}/preview/applies the rules to a fresh sample of the team's top paths and returns before/after pairs (read scope, computed on demand, never store
よくある質問
PostHogは提案を自動で適用しますか?
いいえ。提案するだけです。ルールを適用すると、過去のグラフの数値が書き換えられるためです。
誰がルールを適用しますか?
人が適用します。設定画面で、または確認後に適用のオプションを使って行います。
代わりに自分でルールを書けますか?
はい。別のスキルで、ルールを手作業で書き、テストし、適用する方法を扱います。
詳細
作者による元の説明
Runs and reasons about the automated AI health check that suggests path-cleaning rules for web-analytics teams. Use when asked to generate path-cleaning suggestions for a team or cohort, to run the suggestion check, to review/apply AI-suggested rules, to inspect path_cleaning_suggestions health issues, or to extend the suggestion pipeline. Covers the suggest_path_cleaning_rules management command, the path_cleaning_suggestions health check, the cohort gating (precompute teams), and how suggestions are validated against real paths before storage. For hand-authoring or applying rules directly, u
repo: PostHog/posthog
人気
- GitHubのスター
- 41k
- ランキング
- #6977
- ライセンス
- —
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
depot-ci
41kエージェントが、GitHub Actionsの代替であるDepot CIのワークフローを設定し実行できるよう支援します。既存のワークフローの移行や、実行ログの確認も含みます。
depot-container-builds
41kエージェントが、Depotのリモート・ビルダーでDockerイメージを作れるよう支援します。マルチプラットフォームのイメージ、レジストリへのプッシュ、ビルド失敗の修正を含みます。
depot-github-runners
41kエージェントが、GitHub Actionsのジョブを Depot が管理するランナーに移し、ランナーのサイズとラベルを選び、ランナー設定の問題を解決できるよう支援します。
editing-agents-md
41kエージェントが、AGENTS.mdとCLAUDE.mdのどちらにルールを書くべきかを判断し、ファイルを膨らませずに守られやすい形で書けるよう支援します。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。