agentsclimarketplace

Taleemabad pr reviewer

Skill codebyshoaib/pr-review-skill/skills/taleemabad-pr-reviewer

Review GitHub PRs against Taleemabad's golden rules and anti-patterns across six axes: correctness, multi-tenancy & security, test coverage, CLAUDE.md conventions, offline-sync safety, and generic code correctness. Uses a deterministic pre-pass to compute exact comment positions and pull related-file context, then posts inline code comments on specific lines and auto-approves clean PRs. Use this whenever you need to review a Taleemabad PR for golden rule violations, anti-patterns, test coverage gaps, generic bugs, or CLAUDE.md rule breaches. Analyzes the diff line-by-line with surrounding context and posts targeted peer-review-style comments, not generic bot messages.From its SKILL.md

Install
npx -y skills add codebyshoaib/pr-review-skill --skill taleemabad-pr-reviewer

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

19.8 KB, as published. Nobody here has run it

Taleemabad PR Reviewer — Six-Axis Review

Reviews GitHub pull requests against Taleemabad's documented standards across six review axes. A deterministic pre-pass (no LLM) computes exact comment positions and bundles related-file context before any analysis. Posts inline code comments on specific lines. Auto-approves clean PRs.

Architecture — hybrid deterministic + agent (the part ocr does well):

  • Deterministic layer (scripts/diff_tools.py, pure Python, no LLM): parses each file's patch into exact (line → GitHub position) maps, computes which lines are legally commentable, and resolves related files worth reading for context. This is the mechanical work the model gets wrong when asked to do it in-prompt (hand-counting hunk lines silently mis-attaches comments).
  • Agent layer (this skill, model-driven): the six-axis judgment — what's actually a bug, which fix to suggest — where the LLM's strength matters.

How It Works

  1. Deterministic pre-pass — diff_tools.py positions gives exact line→position maps; diff_tools.py context pulls related files (the models a view imports, the sibling test, the Dexie schema)
  2. Load review axes — six focused checklists from references/golden-rules-summary.md, references/generic-correctness-axis.md, and the project's CLAUDE.md
  3. Six-axis analysis — each axis runs independently over the diff, reasoning with the bundled context
  4. Post inline comments on specific lines for high-confidence findings only, using deterministic positions
  5. Auto-approve if no issues are found across all six axes

Input

/taleemabad-pr-reviewer https://github.com/Taleemabad/taleemabad-core/pull/123

Prerequisites

  • GitHub MCP server connected (mcp__github__* tools available in session)
  • Valid GitHub PR URL
  • MCP server authenticated to the repository
  • GITHUB_TOKEN env var with repo scope (used by the deterministic pre-pass scripts)
  • python3 + requests available (the pre-pass scripts use only stdlib + requests)

Step 0a: Deterministic pre-pass (run BEFORE any analysis)

This is the engineering layer. Run two read-only scripts and keep their JSON — they remove the two things the model does badly in-prompt: hand-counting hunk lines (which silently mis-attaches comments) and guessing surrounding context.

1. Exact comment positions + commentable-line sets:

GITHUB_TOKEN=$GITHUB_TOKEN python3 scripts/diff_tools.py positions <PR_URL>

Returns head_sha and, per file: commentable ({RIGHT:[...], LEFT:[...]}), line_positions ({"RIGHT:<line>": <position>}), and added_lines. When you later post a comment, you MUST:

  • only target a line present in that file's commentable set, and
  • pass the matching position from line_positions (or line + side).

Never hand-count hunk lines. If a finding's line isn't in commentable, re-anchor it to the nearest commentable line in the same hunk and say so in the comment, or drop it — do not post to an invalid line (GitHub 422s it and the comment vanishes silently).

2. Related-file context bundling:

GITHUB_TOKEN=$GITHUB_TOKEN python3 scripts/diff_tools.py context <PR_URL>

Returns related_by_file (which files each changed file pulls in) and related_contents (their full text at the PR head). Read these as context for every axis — e.g. a views.py change is judged with its models.py, serializers.py, and sibling test file in view, so Axis 2/3 findings are grounded in the real surrounding code, not the diff in isolation. Bundling is capped at 6 files per changed file to bound the context window.

If a script fails (token/network), fall back to the MCP-only flow in Step 0b and note in the review body that the deterministic pre-pass was unavailable — positions were computed from the patch directly and may be approximate.


Step 0b: Fetch PR Data

Parse the PR URL to extract owner, repo, and pull_number.

Fetch PR metadata using mcp__github__get_pull_request:

  • owner, repo, pull_number from the URL
  • Captures: PR title, head SHA (commit_id needed for the review), base branch, author

Fetch changed files using mcp__github__get_pull_request_files:

  • Returns each file with: filename, status (added/modified/deleted), patch (unified diff of that file), additions, deletions
  • This is the primary input for the six-axis analysis — the patch field per file replaces reading a monolithic diff
  • The deterministic positions output from Step 0a is authoritative for line→position mapping; this MCP call is the fallback if that script was unavailable

Fetch CLAUDE.md using mcp__github__get_file_contents:

  • path: "CLAUDE.md", no branch needed (defaults to repo default)
  • Use the decoded content for Axis 4 convention checks
  • If 404 / not found: skip CLAUDE.md checks in Axis 4, note "No CLAUDE.md in repo"

The Six Review Axes

Process the diff through all six axes, reasoning with the related-file context bundled in Step 0a. For each finding, record:

  • File path and line number in the diff
  • Axis that caught it
  • Severity: CRITICAL | HIGH | MEDIUM
  • Confidence: 1–10 (only surface 7+ in comments)
  • Fix suggestion

Only post comments for confidence ≥ 7. High-confidence means: rule is documented, violation is clear, not style-based opinion.

De-dup precedence: Axes 1–5 (Taleemabad-specific) own their lines. If a line is flagged by a specific axis AND by Axis 6 (generic), keep only the specific-axis finding — it carries the better, incident-grounded fix. Axis 6 fires only on issues the specific axes don't already own.


Axis 1: Correctness & Logic

What to check against the diff:

  • Soft-delete violations — Does any code call .delete() on a model instance? Should always be is_active = False; save(). Flag every .delete() call on a model.
  • Hard-coded tenant IDs — Any literal tenant ID in queries or logic is a bug.
  • Missing is_active=True filter — QuerySets that should filter active records but don't.
  • Scope creep on model saves — save() called without specifying update_fields when only partial update intended (can overwrite concurrent changes).
  • Missing null checks before attribute access — Especially on optional FK relationships.
  • Incorrect sync status transitions — Dexie records stamped Synced when they should be deleted (see offline-sync rule below — covered in Axis 5 but flag here if it's a logic error, not a sync error).

Severity guide:

  • CRITICAL: .delete() on model (data loss), missing is_active filter on security-sensitive query
  • HIGH: Logic error that causes wrong data to be returned
  • MEDIUM: Potential null pointer, missing validation

Axis 2: Multi-Tenancy & Security

What to check:

  • Unscoped QuerySets — Any .objects.all() or .objects.filter(...) that does NOT include tenant_id=request.user.tenant_id (or equivalent tenant scope). This is a CRITICAL finding — data leak across tenants.
  • Trusting request.data['tenant_id'] — Any endpoint that reads tenant_id from user-submitted data instead of request.user.tenant_id. Flag with suggestion to use request.user.tenant_id.
  • Missing permission checks — New views that don't call self.check_permissions() or inherit from a permission mixin.
  • Hardcoded secrets — Any string that looks like a key, token, or password in non-test code.
  • Shell injection — subprocess or os.system calls with user-controlled input.
  • S3 presigned URL signature contract — If generate_presigned_url is modified and ContentType is removed from Params, that's CRITICAL (breaks mobile uploads). See .claude/rules/s3-presigned-urls.md.
  • Console logging of raw objects — console.log(response), console.log(err), console.log(record) — Capacitor Android bridge OOM. Flag and suggest tlLogger.* from @taleemabad/shared.

Severity guide:

  • CRITICAL: Unscoped QuerySet (tenant data leak), trusting request.data tenant_id, hardcoded secrets
  • HIGH: Missing permission check on new endpoint
  • MEDIUM: Potentially dangerous pattern that needs context to confirm

Axis 3: Test Coverage

What to check:

  • New function without unit test — A new function in models.py, views.py, serializers.py, or a .ts utility file added without a corresponding test. Flag the function, suggest the test path.
  • New endpoint without integration test — A new URL route or view added without an API test.
  • Test file over 150 lines — SonarQube gate. Flag with "split into focused test files".
  • No tenant isolation test — A new backend endpoint that handles multi-tenant data but the test doesn't verify tenant A can't see tenant B's data.
  • Mock database in integration tests — Integration tests should hit a real DB, not mock it.
  • const db = makeX() inside it() blocks — SonarQube duplication gate. Should be in beforeEach.
  • Arrow function nesting > 3 levels in test fakes — SonarQube S2004.
  • RED phase missing — If a PR adds a new feature with tests, check that the tests aren't clearly written after-the-fact (i.e., they only test the happy path and obviously weren't written first). This is lower confidence — flag only if clearly post-hoc.

Severity guide:

  • HIGH: New API endpoint with no test at all
  • HIGH: New business logic function with no test
  • MEDIUM: Missing tenant isolation test for multi-tenant endpoint
  • MEDIUM: SonarQube gate violation (test file >150 lines, duplication patterns)

Axis 4: CLAUDE.md Conventions

What to check against /tmp/repo_claude_md.txt and the bundled rules:

  • API versioning — Breaking changes to existing API versions (field renamed/removed from v1/v2 response). Existing consumers break silently. Flag with: "This changes v{N} response shape. Create v{N+1} instead."
  • Migration safety — New migration without backwards function in RunPython operations. Or not null column added to existing table without null=True first (table lock on large tables).
  • Git branch naming — If this PR's branch doesn't match [A-Za-z][A-Za-z0-9]*-[0-9]+-[A-Za-z0-9], flag it. (Can detect from PR source branch in metadata.)
  • Docs guardian — If backend files (models.py, views.py, serializers.py) were modified but no docs update in the diff — informational, not blocking.
  • docker-first rule — If there's a script or workflow that runs python manage.py or pytest directly (not via make or docker compose), flag it.
  • No hard-coded settings.DEBUG — Feature flags should use the config system, not DEBUG.

Severity guide:

  • CRITICAL: Breaking change to published API version without version bump
  • HIGH: Irreversible migration (no backward function)
  • MEDIUM: Branch naming violation, missing docs update for public API change

Axis 5: Offline-Sync Safety

What to check (frontend TypeScript / Dexie changes):

  • Dexie schema version not incremented — If db.version(N).stores(...) is modified but N is the same as an existing version, flag as CRITICAL (existing users' IndexedDB will break on upgrade).
  • Non-atomic Dexie writes — Two or more await db.<table>.add/put/update() calls in sequence without wrapping in db.transaction('rw', ...). If either write fails, the DB is left in an inconsistent state.
  • Deleted records stamped Synced — In updateRecordsSyncStatus or similar: if deleted IDs are passed through the same path as created/updated IDs and stamped Synced, that's CRITICAL (BUG-005 resurrection pattern). They must be hard-deleted from Dexie.
  • getProfileToBeSynced called at flush time for actor identity — Click-time actor must be stored in Dexie fields at click time, not re-read from active profile at flush (MC20-18337).
  • Raw console.log(response) / console.log(err) / console.log(record) — Also covered in Axis 2. Capacitor Android OOM. Double-flag if both axes catch it.
  • Network-first writes — await api.post(...) followed by await db.<table>.add(...). Should always be local write first, async sync second.
  • Scary blocking upload messages — "Please do not close the app" messaging. Should say "You can leave this page — we'll continue saving".
  • Missing sync_status field on new Dexie models — Every syncable record needs sync_status field.

Severity guide:

  • CRITICAL: Dexie version not incremented on schema change, deleted records stamped Synced
  • HIGH: Non-atomic Dexie writes, network-first writes, missing sync_status
  • MEDIUM: Messaging issues, missing actor identity storage

Axis 6: Generic Correctness & Code Health

The language-agnostic engineering expertise (the kind ocr ships with) that Axes 1–5 don't cover — null derefs, swallowed errors, races, resource leaks, N+1 queries, injection, dead code, contract drift.

Load the full checklist from references/generic-correctness-axis.md and apply it. Key rules:

  • Same confidence gate (≥ 7) — this axis over-fires easily; when in doubt, drop it.
  • De-dup: never re-flag a line already owned by Axes 1–5 (precedence rule above).
  • Use the bundled related-file context to confirm a caller actually breaks, a value really can be null, an error is genuinely swallowed — don't speculate.

Severity guide:

  • CRITICAL: SQL injection, eval/exec/pickle on untrusted input, race on money/counters
  • HIGH: null deref on a request path, swallowed error on a write/sync path, resource/listener leak, N+1 on a list endpoint
  • MEDIUM: null deref off the hot path, awaitable-in-loop perf, dead code

Step 1: Run All Six Axes

For each file returned by get_pull_request_files, read its patch field (unified diff) together with its bundled related-file context from Step 0a. For each + line (added/modified), apply all six axes.

Build a findings list:

findings = [
  {
    "path": "apps/coaching/views.py",
    "line": 47,          # line number — taken from the Step 0a positions output
    "position": 12,      # GitHub diff position — from line_positions, NOT counted by hand
    "side": "RIGHT",     # RIGHT (added/context) or LEFT (removed)
    "axis": "Axis 2: Multi-Tenancy & Security",
    "severity": "CRITICAL",
    "confidence": 9,
    "body": "...",       # formatted comment text (see format below)
  },
  ...
]

Only include findings with confidence >= 7, and after applying the Axis 6 de-dup precedence.

Line numbers come from the deterministic pre-pass — do NOT hand-count hunks. For any line you want to comment on, look it up in that file's line_positions map ("RIGHT:<line>" / "LEFT:<line>") from Step 0a and use the returned position. Verify the line is in the file's commentable set first. Hand- counting @@ -old +new @@ hunks is the exact failure mode this pre-pass exists to eliminate — it silently posts comments on the wrong line.


Step 2 & 3: Post Review (one MCP call)

Use mcp__github__create_pull_request_review — this posts all inline comments and the approve/request-changes decision in a single call.

Parameters:

  • owner, repo, pull_number — from the PR URL
  • commit_id — the head SHA from get_pull_request (required for inline comments to attach correctly)
  • event — "APPROVE", "REQUEST_CHANGES", or "COMMENT" (see decision logic below)
  • body — the review summary (see format below)
  • comments — array of inline comment objects, one per finding. Prefer position (from Step 0a) for unambiguous attachment; line + side also works on the current API. Only emit comments whose line is in that file's commentable set.
    {
      "path": "apps/coaching/views.py",
      "position": 12,         # from line_positions in Step 0a — exact, never hand-counted
      "body": "<formatted comment>"
    }
    

Event decision logic

Findingsevent
No findings (confidence ≥ 7)"APPROVE"
Any CRITICAL or HIGH findings"REQUEST_CHANGES"
Only MEDIUM findings"COMMENT" — informational, does not block merge

Inline comment format

{EMOJI} **[Axis N: Name]** — {SEVERITY}

{Clear description. Name the specific rule violated.}

**Why it matters:** {One sentence — data leak, crash, test gap, OOM.}

**Fix:**
```suggestion
{corrected code snippet if applicable}

See: {.claude/rules/relevant-rule.md}


Severity emojis: CRITICAL → 🚨  HIGH → ⚠️  MEDIUM → 💡

**Example inline comment body:**

🚨 [Axis 2: Multi-Tenancy & Security] — CRITICAL

CoachingObservation.objects.filter(...) is missing .filter(tenant_id=request.user.tenant_id). This returns data from ALL tenants.

Why it matters: Tenant A users can silently read Tenant B's coaching observations. No error is raised.

Fix:

CoachingObservation.objects.filter(
    tenant_id=request.user.tenant_id,
    is_active=True,
)

See: .claude/rules/multi-tenancy.md


### Review body format

**APPROVE:**

✅ Six-axis review passed — no violations found.

Axes checked: Correctness & Logic · Multi-Tenancy & Security · Test Coverage · CLAUDE.md Conventions · Offline-Sync Safety · Generic Correctness Files reviewed: {N}


**REQUEST_CHANGES / COMMENT:**

Six-Axis Review — {N} issue(s) found

Axis🚨 Critical⚠️ High💡 Medium
Axis 1: Correctness & LogicNNN
Axis 2: Multi-Tenancy & SecurityNNN
Axis 3: Test CoverageNNN
Axis 4: CLAUDE.md ConventionsNNN
Axis 5: Offline-Sync SafetyNNN
Axis 6: Generic CorrectnessNNN

Inline comments posted on each finding. Address 🚨 CRITICAL and ⚠️ HIGH issues before merging.


---

## What Doesn't Get Flagged

- Formatting, whitespace, naming style (unless CLAUDE.md specifies it)
- Docstring or comment quality
- Subjective code organization preferences
- Speculative issues (confidence < 7)
- Non-functional whitespace-only changes

---

## References

- `scripts/diff_tools.py` — deterministic pre-pass: `positions` (exact line→position maps + commentable sets) and `context` (related-file bundling). Pure parsing layer is unit-tested in `scripts/test_diff_tools.py` (`python3 scripts/test_diff_tools.py`).
- `references/golden-rules-summary.md` — Taleemabad five-axis golden rules reference
- `references/generic-correctness-axis.md` — Axis 6 generic-correctness checklist
- `.claude/rules/multi-tenancy.md` — Multi-tenancy query patterns
- `.claude/rules/soft-delete.md` — Soft-delete requirements
- `.claude/rules/testing.md` — TDD and test organization rules
- `.claude/rules/offline-sync-safety.md` — Dexie sync patterns
- `.claude/rules/migration-safety.md` — Migration reversibility
- `.claude/rules/console-logging-safety.md` — Console logging + Capacitor OOM
- `.claude/rules/s3-presigned-urls.md` — S3 signature contract
- `.claude/rules/api-versioning.md` — API version stability

## Dependencies

- GitHub MCP server connected in Claude Code session (`claude mcp add github -e GITHUB_TOKEN=<token> -- npx -y @modelcontextprotocol/server-github`)
- Token needs `repo` scope (read PR contents + write reviews)

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.