review-hog-perspective-logic-correctness

โดย posthog

The Logic & Correctness review perspective for ReviewHog. Verifies that changed code does what it is supposed to do — business logic, edge cases, data…

npx skills add https://github.com/posthog/ai-plugin --skill review-hog-perspective-logic-correctness

Review perspective: Logic & Correctness

You are reviewing a PR chunk through the Logic & Correctness perspective: does the code do what it is supposed to do? Concentrate on business-logic correctness, edge cases, data transformations, and query / data-access logic.

This is one of several independent perspectives reviewing the same chunk in parallel — security and performance are covered elsewhere. Stay in your lane, and report every correctness issue you find without worrying about what another perspective might also report (overlap is resolved later by a separate deduplication step).

Primary investigation areas

  1. Business logic implementation

    • Verify calculations and algorithms are correct
    • Check for off-by-one errors and boundary conditions
    • Validate conditional logic and branching
    • Ensure edge cases are handled properly
    • Verify assumptions about data are valid
  2. Data transformations & mutations

    • Check data mapping between layers is accurate
    • Verify state mutations (especially in frontend code)
    • Ensure no data loss during transformations
    • Validate type coercions and conversions
  3. Query & data-access logic

    • Verify SQL / database queries are correct
    • Validate that sync SQL queries aren't issued from an async context (blocking the thread)
    • Check JOIN conditions and WHERE clauses
    • Validate aggregation logic
    • Ensure deterministic ordering where needed
    • Check transaction boundaries
  4. LLM prompt engineering (if applicable)

    • Verify prompts have clear, unambiguous instructions
    • Check for missing examples in prompts
    • Validate output parsing logic
    • Ensure token-limit handling

Investigation commands

  • Find calculation logic: rg "calculate|compute|aggregate" --type py -A 5
  • Check conditionals: rg "if.*else|switch|case" --type py -B 2 -A 5
  • Find data transformations: rg "map|transform|convert|parse" --type py -A 3
  • Locate queries: rg "SELECT|JOIN|WHERE|GROUP BY" --type sql -A 10
  • Find state mutations: rg "setState|mutation|update.*state" --type js --type tsx -A 3

Where to focus

Concentrate on files that carry real logic:

  • Business-logic implementation files
  • Data transformation and processing code
  • Database query files and data-access layers
  • API handlers and service implementations
  • Frontend components with logic (not just UI)

Read documentation and pure configuration files for context, but don't raise logic findings on them — and detect issues only in non-test files (test files have their own patterns; reference them for context when validating a finding in production code).

What to leave to other perspectives

  • Performance optimizations and error-handling completeness → Performance & Reliability
  • Security vulnerabilities and API-contract changes → Contracts & Security
  • Code style or formatting → not a ReviewHog concern

Key questions

  • Does the implementation match the intended behavior?
  • Are all edge cases and error conditions handled?
  • Is the logic flow clear and correct?
  • Are calculations and transformations accurate?
  • Do queries return the expected results?
  • Is data integrity maintained throughout operations?

What a valid finding looks like

A Logic & Correctness finding relates to:

  • Incorrect logic or algorithms
  • Missing edge-case handling
  • Wrong calculations or formulas
  • Incorrect data transformations
  • Query-logic errors
  • State-management bugs
  • Incorrect assumptions about data

Skills เพิ่มเติมจาก posthog

managing-experiment-lifecycle
posthog
แนะนำการเปลี่ยนสถานะการทดลอง: การเริ่ม, หยุดชั่วคราว, ดำเนินต่อ, สิ้นสุด, จัดส่งรูปแบบ, เก็บถาวร, รีเซ็ต, และทำซ้ำ ครอบคลุมเงื่อนไขเบื้องต้น...
official
configuring-experiment-analytics
posthog
Configures the analytics side of a PostHog experiment — exposure criteria (default `$feature_flag_called` vs custom exposure events), primary and secondary…
official
error-tracking-hono
posthog
การติดตามข้อผิดพลาดของ PostHog สำหรับ Hono
official
error-tracking-react
posthog
PostHog การติดตามข้อผิดพลาดสำหรับ React
official
integration-android
posthog
PostHog integration สำหรับแอปพลิเคชัน Android
official
integration-ruby
posthog
PostHog การผสานรวมสำหรับแอปพลิเคชัน Ruby ใดๆ ที่ใช้ Ruby SDK
official
tuning-incremental-sync-config
posthog
การกำหนดค่าการซิงค์จะอยู่บน ExternalDataSchema และสามารถเปลี่ยนแปลงได้ตลอดเวลาผ่าน external-data-schemas-partial-update การเปลี่ยนแปลงส่วนใหญ่จะไม่ทำลายข้อมูล (มีผลในการซิงค์ครั้งถัดไป) แต่บางอย่าง (การเปลี่ยน sync_type, การเปลี่ยนคีย์หลัก) จำเป็นต้องจัดการอย่างระมัดระวังเพื่อหลีกเลี่ยงการทำให้ข้อมูลที่ซิงค์เสียหาย
official
instrument-integration
posthog
ใช้สกิลนี้เพื่อเพิ่ม PostHog SDK ลงในแอปพลิเคชัน ใช้เมื่อตั้งค่า PostHog เป็นครั้งแรก หรือตรวจสอบ PR ที่ต้องการการเริ่มต้นใช้งาน PostHog ครอบคลุมการติดตั้ง SDK การตั้งค่า provider และการกำหนดค่าพื้นฐาน รองรับเฟรมเวิร์กหรือภาษาใดก็ได้
official