agentleFS
conectlensconectlens/lenserfight/.agents/skills/repo-performance-guard/SKILL.md

repo-performance-guard

Skill18 starsChanged 6 months agoMITView on GitHub

Enforce performance-safe query and rendering patterns across this Nx monorepo. Use when working on Vite freezes, Supabase overfetching, pagination, caching, CPU hotspots, memory pressure, or large seeded datasets.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 13 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never allow unbounded list reads.

    line 17
  2. Distinctive:

    Every list query must have a hard limit.

    line 18
  3. Distinctive:

    Every feed must paginate or use cursor-based incremental loading.

    line 19
  4. Distinctive:

    Never select more columns than the screen needs.

    line 20
  5. Distinctive:

    Never fetch child relations eagerly by default on list pages.

    line 21
  6. Distinctive:

    Never rely on frontend filtering to reduce large result sets after fetch.

    line 22
  7. Distinctive:

    Prefer keyset/cursor pagination for large feeds.

    line 24
  8. Distinctive:

    Treat “load all rows” as a defect.

    line 26
  9. Distinctive:

    If a Supabase view or RPC returns oversized payloads, prefer shrinking it or replacing it with narrower REST-compatible access patterns.

    line 33
  10. Distinctive:

    Do not fix frontend freezes by only hiding UI.

    line 34
  11. Distinctive:

    Add or fix hard limit and pagination.

    line 52
  12. Distinctive:

    If still slow, inspect joins, RPC/view payload size, and client rerender count.

    line 54
  13. Distinctive:

    Do not finalize until the screen can survive large local seed volumes without trying to hold massive arrays in memory.

    line 55
  14. Very specific:

    Read references/performance-checklist.md for review criteria.

    line 59
  15. Very specific:

    Read references/supabase-query-rules.md when changing repository or Supabase access code.

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Repo Performance Guard

Apply this skill when editing any app or library that reads large datasets from Supabase or renders lists in Vite apps.

Core goal

Prevent the frontend from freezing or crashing when local Supabase contains large seeded datasets.

Non-negotiable rules

  1. Never allow unbounded list reads.
  2. Every list query must have a hard limit.
  3. Every feed must paginate or use cursor-based incremental loading.
  4. Never select more columns than the screen needs.
  5. Never fetch child relations eagerly by default on list pages.
  6. Never rely on frontend filtering to reduce large result sets after fetch.
  7. Push filtering, sorting, and limiting into Supabase queries.
  8. Prefer keyset/cursor pagination for large feeds.
  9. Cache only stable and bounded datasets.
  10. Treat “load all rows” as a defect.

Repo-specific gotchas

  • Large local seeds in supabase/seeds/11_* through 21_* can make naive queries destroy Vite responsiveness.
  • apps/web is the highest-risk frontend for overfetching because threads, prompts, replies, tags, reactions, and multilingual data all compound payload size.
  • libs/data/repositories and libs/data/supabase are likely the central places where unsafe query shapes should be fixed first.
  • If a Supabase view or RPC returns oversized payloads, prefer shrinking it or replacing it with narrower REST-compatible access patterns.
  • Do not fix frontend freezes by only hiding UI. Reduce the query size and retained state size.

Required workflow

  • Inspect the screen entrypoint and identify the exact query path
  • Find the repository/data access function
  • Verify select list, filters, order, and hard limit
  • Verify pagination strategy
  • Verify relation loading strategy
  • Check for duplicate fetches and init waterfalls
  • Check render loops, expensive mapping, and retained arrays in React state
  • Run validation before finalizing

Validation loop

  1. Identify the largest list on the affected screen.
  2. Record current query shape and page size.
  3. Reduce payload to the minimum viable columns.
  4. Add or fix hard limit and pagination.
  5. Re-test initial render, navigation, and incremental loading.
  6. If still slow, inspect joins, RPC/view payload size, and client rerender count.
  7. Do not finalize until the screen can survive large local seed volumes without trying to hold massive arrays in memory.

Additional resources

  • Read references/performance-checklist.md for review criteria.
  • Read references/supabase-query-rules.md when changing repository or Supabase access code.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.