Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính41k · #6977

suggesting-path-cleaning-rules

Skill này làm gì

Skill này giải thích các gợi ý hằng tuần của PostHog để gom các địa chỉ trang tương tự và cách xem xét chúng. Skill dành cho các nhóm muốn xem gợi ý quy tắc trước khi có bất cứ điều gì thay đổi báo cáo của họ.

Khi nào nên dùng

  • ✓Khi bạn muốn xem các gợi ý tự động về địa chỉ trang của đội mình.
  • ✓Khi bạn muốn xem lại và áp dụng các quy tắc được gợi ý.
  • ✓Khi bạn cần kiểm tra xem việc gợi ý có đang hoạt động đúng không.

Liên kết skill

https://github.com/PostHog/posthog/blob/master/products/web_analytics/skills/suggesting-path-cleaning-rules/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/PostHog/posthog/blob/master/products/web_analytics/skills/suggesting-path-cleaning-rules/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể xem các gợi ý làm gọn địa chỉ trang mà PostHog đưa ra cho website của chúng tôi và giải thích những gợi ý nào đáng áp dụng không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Mỗi tuần PostHog lấy mẫu các địa chỉ trang thật, yêu cầu một mô hình AI đề xuất quy tắc gom nhóm, rồi kiểm tra từng quy tắc trên dữ liệu của chính đội. Agent xem lại các gợi ý, và chúng chỉ được áp dụng khi có người quyết định.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.py
    • sample_pathnames / count_distinct_pathnames — top $pathname by views via HogQL.
    • call_llm_for_rules — one-shot call through the LLM gateway (get_llm_client(product="web_analytics", team_id=...), model WEB_ANALYTICS_PATH_CLEANING_SUGGESTIONS_MODEL, default claude-haiku-4-5).
    • validate_and_annotate_rules — compiles each regex with re2 (the engine ClickHouse replaceRegexpAll uses) and test-applies it to the sampled paths. Rules that don't compile or match nothing are dropped; survivors get a dense order, a match_count, and in-memory before/after examples (printed by the management command, never stored — health-issue payloads are readable with just health_issue:read and 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 into path_cleaning_filters, never overwrites (dedupes by regex, continues order).
  • Storage: a path_cleaning_suggestions health issue (HealthIssue, severity info) — no dedicated model. One active issue per team (hash_keys=[]); payload carries rules, model, sampled_path_count, distinct_path_count. Applying (or hand-configuring rules) resolves the issue on the next check run; dismissal is the health-issue dismissed flag.
  • 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 list WEB_ANALYTICS_LAZY_PRECOMPUTE_TEAM_IDS.

Gating (why a team is skipped)

generate_suggestions_for_team returns a status:

  • skipped_inactive — team sent no $pageview within visited_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 with include_configured).
  • skipped_low_cardinality — fewer distinct paths than min_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: PathCleaningSuggestionsBanner on /settings/project#path_cleaning shows the latest suggested row as regex → alias previews with match counts; "Apply all" (project admins only) merges the rules, the close button dismisses. Driven by pathCleaningSuggestionsLogic.
  • Onboarding step: OnboardingWebAnalyticsPathCleaningStep (stepKey path_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
Câu hỏi thường gặp

PostHog có tự động áp dụng các gợi ý không?

Không. Nó chỉ gợi ý quy tắc, vì áp dụng chúng sẽ viết lại các con số trong biểu đồ của quá khứ.

Ai áp dụng các quy tắc?

Một người áp dụng, hoặc trong màn hình cài đặt hoặc bằng tùy chọn áp dụng sau khi xem lại.

Tôi có thể tự viết quy tắc thay thế không?

Có. Một skill riêng bao quát việc viết, kiểm tra và áp dụng quy tắc bằng tay.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
41k
Vị trí xếp hạng
#6977
Giấy phép
—
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự