Skip to content

chore: add data-fetching-perf-audit skill#519

Open
zacjones93 wants to merge 1 commit into
mainfrom
skill/data-fetching-perf-audit
Open

chore: add data-fetching-perf-audit skill#519
zacjones93 wants to merge 1 commit into
mainfrom
skill/data-fetching-perf-audit

Conversation

@zacjones93

@zacjones93 zacjones93 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

speed

Summary

Adds a Claude Code skill, data-fetching-perf-audit, that encodes the data-fetching performance methodology proven in two prior PRs:

It turns those one-off optimizations into a repeatable audit another agent can run on any slow route or route group.

What's in the skill

  • SKILL.md — the audit workflow (scope → trace loader→server-fn→query chains → classify → fix → verify), a 9-row anti-pattern quick-reference table, the three stack facts that drive every decision (server fn = HTTP round trip; mysql2 serializes per connection; push-based DB workflow), and a verification checklist.
  • references/anti-patterns.md — full catalog with detect/fix and real before/after code: loader waterfalls, N+1 server-fn calls, sequential independent awaits, fake parallelism, over-fetching, scan-to-check, missing hot-path indexes, dead queries, deferring off the critical path.
  • references/stack-gotchas.md — the traps that silently undo the work: mysql2 single-connection serialization, cloudflare:workers leaking into the client bundle, push-based index workflow, loader-shape stability, and the IDOR / draft-exposure security holes surfaced while tracing fetches.

All examples cite real symbols from the codebase (getPublicCompetitionPageDataFn, getScoreAccessMapFn, getCompetitionLeaderboard, etc.).

Changes

  • .claude/skills/data-fetching-perf-audit/SKILL.md (new)
  • .claude/skills/data-fetching-perf-audit/references/anti-patterns.md (new)
  • .claude/skills/data-fetching-perf-audit/references/stack-gotchas.md (new)

Notes

  • .claude/ is gitignored (.gitignore:72); like the other tracked skills, these files were added with git add -f.
  • Validated and packaged with skill-creator (package-skill.ts → "Skill is valid"). lat check passes. No application code changed.

🤖 Generated with Claude Code


Summary by cubic

Adds the data-fetching-perf-audit skill to standardize data‑fetching performance audits across loaders, server fns, and queries. Encodes the approach from #502 and #512; no application code changed.

  • New Features
    • SKILL.md: audit workflow, quick anti‑pattern table, stack facts, verification checklist.
    • references/anti-patterns.md: 9 patterns with detect/fix and real before/after (waterfalls, N+1, fake parallelism, over‑fetching, scan‑to‑check, missing indexes, dead queries, deferrals).
    • references/stack-gotchas.md: mysql2 single‑connection serialization, cloudflare:workers client‑bundle leak, push‑based indexes, loader‑shape stability, auth checks.

Written for commit 136d305. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Documentation
    • Added comprehensive performance audit methodology and reference guides for optimizing data fetching workflows, including anti-pattern detection and framework-specific considerations.

Encodes the data-fetching performance audit methodology from PRs #502
(batch N+1 across organizer routes) and #512 (eliminate waterfalls on
public compete pages):

- SKILL.md: audit workflow, anti-pattern quick-reference table, the
  three stack facts (server fn = round trip; mysql2 serializes per
  connection; push-based DB workflow), verification checklist
- references/anti-patterns.md: 9-pattern catalog with detect/fix and
  real before/after code (waterfalls, N+1, fake parallelism, etc.)
- references/stack-gotchas.md: mysql2 serialization, cloudflare:workers
  client-bundle leak, push-based indexes, security holes found while
  optimizing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: b9d1dedc0a41
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Three new Markdown files are added under .claude/skills/data-fetching-perf-audit/. SKILL.md defines the top-level audit methodology, workflow, anti-pattern summary table, security checks, and verification checklist. references/anti-patterns.md catalogs nine specific loader/DB inefficiency patterns with code examples. references/stack-gotchas.md documents seven codebase-specific pitfalls that can silently break builds or negate performance fixes.

Changes

Data-Fetching Perf Audit Claude Skill

Layer / File(s) Summary
SKILL.md: audit workflow, catalog table, security, and checklist
.claude/skills/data-fetching-perf-audit/SKILL.md
Defines skill metadata, audit goal, three foundational facts (loader→server-fn round trips, getDb()/mysql2 parallelism, pnpm db:push workflow), end-to-end audit steps, a summary anti-pattern table, a security section covering IDOR and draft-data exposure, and a verification checklist including type-check, build bundle-leak checks, and parallel-branch getDb() validation.
anti-patterns.md: nine-pattern reference catalog
.claude/skills/data-fetching-perf-audit/references/anti-patterns.md
Catalogs nine anti-patterns — loader waterfall, N+1 server-fn calls, sequential independent awaits, fake parallelism, over-fetching, scan-to-check existence, missing hot-path index, dead queries, and per-item critical-path deferral — each with detection guidance and before/after TypeScript/SQL examples.
stack-gotchas.md: seven codebase-specific pitfalls
.claude/skills/data-fetching-perf-audit/references/stack-gotchas.md
Documents seven pitfalls: mysql2 single-connection serialization requiring separate getDb() instances, Cloudflare worker imports leaking into client bundles, push-only DB schema/index workflow, loader data-shape preservation rules, in-process vs HTTP server-fn composition, IDOR and draft-exposure security findings with required fixes, and caching scope exclusion from structural audits.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐇 Hop along the query trail,
No N+1s shall prevail!
Promise.all with care, my friend —
Each getDb() branch its own to tend.
Draft data hides from anonymous eyes,
And indexes keep the slow scans from rise.
✨ This rabbit audits, swift and wise!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: add data-fetching-perf-audit skill' accurately and specifically describes the main change—adding a new Claude skill for data-fetching performance auditing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch skill/data-fetching-perf-audit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.claude/skills/data-fetching-perf-audit/SKILL.md (1)

18-18: 💤 Low value

Consider conciseness: "almost never" → "rarely" or "seldom".

Line 18 uses "almost never" where a single-word alternative ("rarely" or "seldom") would be more direct without changing meaning.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/data-fetching-perf-audit/SKILL.md at line 18, The phrase
"almost never" in the documentation is unnecessarily verbose and can be replaced
with a more concise single-word alternative. In the SKILL.md file where "almost
never" appears in the context of describing query performance wins, replace
"almost never" with either "rarely" or "seldom" to improve conciseness while
maintaining the same meaning and clarity.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.claude/skills/data-fetching-perf-audit/SKILL.md:
- Line 18: The phrase "almost never" in the documentation is unnecessarily
verbose and can be replaced with a more concise single-word alternative. In the
SKILL.md file where "almost never" appears in the context of describing query
performance wins, replace "almost never" with either "rarely" or "seldom" to
improve conciseness while maintaining the same meaning and clarity.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d48bd64e-7820-4c16-ad6c-557ced84ae95

📥 Commits

Reviewing files that changed from the base of the PR and between cd37de1 and 136d305.

📒 Files selected for processing (3)
  • .claude/skills/data-fetching-perf-audit/SKILL.md
  • .claude/skills/data-fetching-perf-audit/references/anti-patterns.md
  • .claude/skills/data-fetching-perf-audit/references/stack-gotchas.md

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant