optimize
Use this skill when the user's app feels slow, the codebase feels bloated, or after significant development work. Also use when the user says 'my app is slow,' 'clean up my code,' 'reduce bundle size,' 'my hosting bill is too high,' or 'everything feels sluggish.' Optimizes across four dimensions: Speed (page load, API response), Code (unused files, dead code), Database (orphaned data, schema hygiene), and Dependencies (package bloat, bundle size).
Best use case
optimize is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use this skill when the user's app feels slow, the codebase feels bloated, or after significant development work. Also use when the user says 'my app is slow,' 'clean up my code,' 'reduce bundle size,' 'my hosting bill is too high,' or 'everything feels sluggish.' Optimizes across four dimensions: Speed (page load, API response), Code (unused files, dead code), Database (orphaned data, schema hygiene), and Dependencies (package bloat, bundle size).
Teams using optimize should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/optimize/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How optimize Compares
| Feature / Agent | optimize | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use this skill when the user's app feels slow, the codebase feels bloated, or after significant development work. Also use when the user says 'my app is slow,' 'clean up my code,' 'reduce bundle size,' 'my hosting bill is too high,' or 'everything feels sluggish.' Optimizes across four dimensions: Speed (page load, API response), Code (unused files, dead code), Database (orphaned data, schema hygiene), and Dependencies (package bloat, bundle size).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# Optimize Reduce waste and improve efficiency. **Only optimize after you have real users and real problems** — premature optimization is the most common waste of founder time. **This skill is for making existing things faster and leaner.** For building features, use **build**. For fixing bugs, use **debug**. For monitoring performance in production, use **monitor**. For database schema design, use **database**. ## Workflow ``` Optimize your app: - [ ] Measure first — get actual numbers (page load, API speed, bundle size) - [ ] Speed — fix the slowest page or API endpoint - [ ] Dependencies — update packages, remove unused ones - [ ] Database — clean orphaned data, optimize slow queries - [ ] Code — remove dead code and unused files - [ ] Re-measure — verify improvements with numbers ``` ## When to Optimize (and When NOT To) **Don't optimize when:** - Building your MVP - Fewer than ~100 active users - Everything works fine - You haven't measured the problem **Optimize when:** - Users complain about slowness (Speed) - Bundle size warnings or security alerts appear (Dependencies) - App noticeably slower than when you launched (Speed/Database) - You're paying for hosting you shouldn't need (Speed/Database) **Rule:** Make it work → get users → measure → THEN make it lean. --- ## Priority Order When multiple things need work: 1. **Speed** — Users feel this immediately. Slow = churn. 2. **Dependencies** — Security vulnerabilities are urgent. Bundle bloat affects speed. 3. **Database** — Affects long-term performance and hosting costs. 4. **Code** — Affects maintainability. Lowest user impact. --- ## Speed Optimization ### Targets | Metric | Good | Bad | |--------|------|-----| | Page load | < 3s | > 5s | | API response | < 500ms | > 1s | | Time to interactive | < 5s | > 8s | ### Step 1: Measure **Claude Code** (can measure directly): ``` Audit app performance: - Measure page load times for the 3 most important pages - Log API response times for the 5 most-used endpoints - Identify the slowest database queries - Check total bundle size Report findings with specific numbers. ``` **Lovable / Replit / Cursor** (measure manually first): 1. Open your app in Chrome → Right-click → Inspect → Network tab → Reload 2. Note the "Load" time at the bottom — that's your page load time 3. Click a button that calls your API — note the request time in Network tab 4. Then paste findings into chat: ``` My app's performance numbers: - Homepage loads in [X] seconds - [Main feature] API takes [X] seconds - [Other page] loads in [X] seconds What's slow and how do I fix it? ``` ### Step 2: Fix **Tell AI:** ``` Optimize these performance issues: [paste audit findings] Apply fixes in this order: 1. Add caching for slow API calls 2. Add database indexes for slow queries 3. Optimize and lazy-load images 4. Code split large bundles Run build and tests after each fix. ``` ### Step 3: Prevent **Tell AI:** ``` Add performance monitoring: - Log API calls > 500ms - Log database queries > 100ms - Alert if page load > 3s ``` See [PERFORMANCE-CHECKS.md](PERFORMANCE-CHECKS.md) for detailed testing methods. --- ## Dependencies Optimization The most relevant optimization at any stage — even pre-launch. ### Signs You Need This - Security vulnerability warnings when you run `npm install` - Bundle size > 500KB - "What does this package do?" ### Audit **Tell AI:** ``` Audit dependencies: - List packages not imported anywhere in code - List packages with security vulnerabilities - Analyze bundle size by package - Find packages with lighter alternatives Report: package name, size impact, and recommendation. ``` ### Fix **Tell AI:** ``` Clean up dependencies: [paste audit findings] Steps: - Remove unused packages from package.json - Update packages with security vulnerabilities - Replace heavy packages with lighter alternatives After changes: delete node_modules, fresh npm install, run build and tests. ``` **Common replacements:** | Heavy | Light Alternative | |-------|-------------------| | moment.js | date-fns or dayjs | | lodash (full) | lodash-es (tree-shakeable) | | axios | fetch (built-in) | ### Prevent **Tell AI:** ``` Set up dependency hygiene: - Add npm audit to CI pipeline - Configure Dependabot for automatic security updates ``` See [DEPENDENCIES.md](DEPENDENCIES.md) for detailed patterns. --- ## Database Optimization **When this matters:** After months of real usage, when queries slow down or hosting costs climb. ### Signs You Need This - Pages that were fast are now slow - Database hosting costs increasing - Queries timing out under load ### Audit and Fix **Tell AI:** ``` Audit database for optimization opportunities: - Find missing indexes on frequently queried columns - Find slow queries (> 100ms) - Find orphaned records (foreign keys pointing to deleted rows) - Find tables with no recent reads/writes For each issue, apply the fix: - Add indexes for slow queries - Set up ON DELETE CASCADE for dependent records - Create cleanup job for orphaned/soft-deleted records (> 90 days) Always backup before making schema changes. ``` --- ## Code Cleanup **When this matters:** After your codebase has grown significantly through AI-assisted iteration. Multiple rounds of "build feature, rebuild feature" leave dead code. ### Signs You Need This - Files you don't recognize - Components that aren't used anywhere - "I'm afraid to delete this" ### Audit and Fix **Tell AI:** ``` Audit codebase for unused code: - Find components not imported anywhere - Find functions never called - Find commented-out code blocks For each: verify nothing references it, then remove it. For duplicate/similar code, use **dry** — it covers deduplication across UI, database, and logic. Run build and tests after cleanup. ``` **Safety rule:** If unsure, comment out first and test. Delete after confirming nothing breaks. --- ## Common Mistakes | Mistake | Fix | |---------|-----| | Optimizing before measuring | AUDIT first, always | | Optimizing during MVP | Ship first, optimize when users complain | | Updating all packages at once | Update one at a time, test each | | Deleting code without verifying | Check imports/references before removing | | Dropping database columns in production | Test migrations on staging first | --- ## Success Looks Like After optimization, you should see: - Pages load < 3 seconds - Zero security vulnerabilities in dependencies - No obviously unused packages - Database queries respond < 100ms - Automated checks catch future regressions --- ## Related Skills - **monitor** — Track performance in production after optimizing - **debug** — Fix broken things (optimize fixes slow things) - **deploy** — Hosting configuration affects performance - **database** — Schema design and query optimization - **dry** — Find and eliminate code duplication across UI, database, and logic - **build** — Feature development (optimize after building, not during)
Related Skills
validate
Use this skill when the user needs to validate a business idea, test demand before building, run a smoke test, create an MVP experiment, or decide whether an idea is worth pursuing. Covers demand validation, smoke tests, fake-door tests, landing page experiments, and go/no-go decision frameworks for bootstrapped founders.
ux-design
Use this skill when flows feel clunky, users are confused, navigation needs planning, onboarding needs design, or accessibility needs implementation. Covers information architecture, user flows, interaction patterns, progressive disclosure, and error handling UX.
ui-patterns
Use this skill when the user needs to build a dashboard, settings page, data table, or any page layout. Also use when choosing component libraries, implementing responsive design, dark mode, or handling UI states (loading, empty, error). Covers component selection, page composition, and responsive implementation.
translate
Use this skill when the user is a domain expert (lawyer, doctor, contractor, accountant, etc.) who wants to turn their professional knowledge into a software product. Also use when the user says 'I have an idea for my industry,' 'I know this problem exists,' 'I want to build something for [profession],' or is struggling to describe what they want the software to do. Helps identify which professional pain is worth building for, then translates it into requirements AI tools can execute.
test
Use this skill when the user needs to test features before deployment, create test scenarios, find edge cases, or verify bug fixes. Covers manual testing workflows, cross-browser testing, edge case identification, and testing checklists for non-technical founders.
technical-seo
Use this skill to implement technical SEO optimizations in code — meta tags, schema markup, Core Web Vitals, crawlability, robots.txt, sitemaps, and GEO (Generative Engine Optimization) for AI search engines. This is the implementation skill — for strategy see seo, for content writing see seo-content, for auditing see seo-audit.
support
Use this skill when the user needs to create help docs, build a knowledge base, set up self-serve support, or reduce support tickets. Covers documentation strategy, help center structure, support tone, and scaling support without hiring.
social-media
Use this skill when the user needs to grow a social media presence, create content for Twitter/X, LinkedIn, or other platforms, build a founder brand, or use social media as a distribution channel. Covers platform strategy, content frameworks, posting cadence, and audience building for bootstrapped SaaS founders.
seo
Use this skill when the user needs to plan SEO content, do keyword research, build a content calendar, map search intent to page types, or create an internal linking strategy. Also use when the user says 'how do I rank higher,' 'what should I write about for SEO,' 'SEO plan,' 'what keywords should I target,' or 'how to get organic traffic.' This is the strategy and planning skill — for writing content see seo-content, for technical implementation see technical-seo, for auditing see seo-audit.
seo-content
Use this skill when the user needs to write SEO content — blog posts, landing pages, feature pages, comparison pages, how-to guides, or any content meant to rank in search and get cited by AI. Covers content briefs, humanized writing that avoids AI detection, SERP feature targeting, entity optimization, content refresh, and quality self-checks. This is the writing skill — for strategy see seo, for technical implementation see technical-seo, for auditing see seo-audit.
seo-audit
Audit a codebase for SEO and AI-answer visibility, then produce a prioritized fix-it plan. Use this skill whenever a user says things like "audit my SEO", "check my site for search visibility", "how do I rank better", "optimize for Google", "optimize for AI answers", "SEO review", "GEO audit", "run the SEO agent", or anything about improving organic traffic or search rankings. Also trigger when someone mentions wanting visibility in AI-generated answers (ChatGPT, Gemini, Perplexity, Claude). Works on any web project — static sites, Next.js, Astro, Hugo, WordPress themes, or anything that outputs HTML.
secure
Use this skill when the user needs to secure their SaaS app, implement authentication, protect user data, secure APIs, or check for vulnerabilities. Also use when the user says 'is my app secure,' 'security check,' 'I'm worried about hackers,' 'how do I protect user data,' or 'security before launch.' Covers OWASP Top 10, auth best practices, data protection, and security checklists for apps built with AI tools.