SuperAPI AI Directory

optimize

Coding & development

View repository

Updated 10-28 20:13

About this skill

TARGET:

  • Optimize code/queries/features based on ACTUAL usage, not assumptions
  • Remove everything that's not needed
  • Question every field, query, feature, and piece of complexity

ALGORITHM:

  1. Audit actual usage:

    • Grep/search codebase for each field/query/feature usage
    • Check UI components - what fields are actually rendered?
    • Check queries - what fields are actually selected?
    • Check APIs - what data is actually returned?
  2. Remove aggressively:

    • Delete unused fields from SELECT queries
    • Remove expensive aggregations if not displayed
    • Drop unused exports, functions, components
    • Eliminate unnecessary JOINs, GROUP BYs, subqueries
  1. Optimize for reality:

    • Base SELECT on actual UI needs (not "might need later")
    • Use scalar subqueries instead of JOINs when possible
    • Remove fields only used for filtering (keep in WHERE, remove from SELECT)
    • Cache only what's actually accessed frequently
  2. Simplify ruthlessly:

    • If it's expensive and not used → remove it
    • If it's "nice to have" → remove it
    • If it adds complexity without clear benefit → remove it
    • Question: "Would users notice if this disappeared?" If no → remove
  3. Conclusion:

    • When modifying a file, improve code quality in the surrounding area
    • Apply consistent patterns (e.g., error handling, naming conventions)
    • Extract duplicated logic if it appears 3+ times
    • Fix obvious issues (unused imports, inconsistent formatting)
    • Update related tests/types to match changes
    • Keep refactors small and focused - don't rewrite entire files
    • Verify UI still works as expected
    • Document breaking changes if any

Example: Query optimization - removed unused aggregate fields and dropped SELECT columns that were only needed for WHERE, kept only fields actually displayed in UI.