Back to Prompt Library
Debugging
Base44 Unused Items Audit — Find Dead Code & Stale Data
Audit your entire app for unused pages, components, hooks, entities, fields, backend functions, integrations, packages, and stale database records — with confidence levels, evidence, and a safe phased cleanup plan. Audit only, no deletions.
The prompt
You are auditing a Base44 application for unused, orphaned, duplicate, dead, or stale items. Your job is to scan the full codebase and, where possible, the Base44 database/entity layer. Do not delete or rewrite anything yet. First produce a complete audit report with confidence levels, evidence, and a safe cleanup plan. Hard rules: - Do not delete, rename, or modify anything. - Do not remove database fields or dependencies. - Do not assume something is unused just because it is not directly imported once. - Treat dynamic references, string-based references, role-based pages, automations, backend functions, and deep links as possible usage. - If unsure, mark as "Needs Review" instead of "Safe to Remove." - Every finding must include evidence, a confidence level, and rollback risk. Audit goal — find unused/stale items across: pages, routes, components, hooks, utilities, context providers, API files, backend functions, entity schemas, entity fields, collections, orphaned records, unused enum/status/role values, RLS rules, integrations, file references, env variables, package dependencies, duplicate logic, dead form fields/widgets/admin tools/templates/automations, stale test/demo data, and unreferenced generated files. PHASE 1 — INVENTORY: Scan every file. Inventory all pages, routes, components, hooks, utilities, context, layouts, API/client files, entity schemas, backend functions, integrations, config, assets, env variables, and dependencies. For each: file path, export name, import/runtime/route/entity/function references, and confidence it is used. PHASE 2 — USAGE GRAPH: Map page → components/hooks/entities/functions/integrations, component → children/hooks, function → entities/integrations/env vars, entity → fields used in frontend/backend/forms/filters/reports/permissions/automations. Don't rely only on imports — search exact names, lowercase/snake/kebab variants, string references, route paths, dynamic maps, object keys, config arrays, nav arrays, role maps, email links, automation names, webhook references. PHASE 3 — PAGES & ROUTES: Check references from router, nav, sidebar, dashboard tabs, protected wrappers, role menus, direct links, redirects, email/backend-generated links, automations, onboarding/admin flows. Classify each page (Active, Probably active, Admin-only, Role-based, Deep-link only, Duplicate, Deprecated, Unused, Needs review) with evidence and risk. PHASE 4 — COMPONENTS: Check direct imports, barrels, dynamic references, component maps, modals, admin/role flows, duplicates, components only used by unused pages. Classify and compare duplicates. PHASE 5 — HOOKS & UTILITIES: Check imports, dynamic references, duplicate logic, dead functions in active files, unused exports. PHASE 6 — ENTITIES: For each entity identify fields, enums, relationships, and usage across frontend/backend/forms/tables/reports/security/automations/integrations. Don't mark unused unless you searched EntityName, entityName, entity_name, entity-name, plural/singular forms, labels, base44.entities.EntityName, base44.asServiceRole.entities.EntityName, and string references in functions/prompts/automations. PHASE 7 — ENTITY FIELDS: For each field search create/edit forms, filters, sorting, search, columns, cards, detail views, charts, reports, exports, backend functions, automations, templates, AI prompts, validation, permissions, status workflows, integrations, CSV logic, relationship joins. Classify (Active, Write-only, Read-only, Backend-only, Analytics-only, Legacy, Empty in DB, Unused in code, Needs review). PHASE 8 — DATABASE RECORDS (if accessible): Analyze document counts, records missing required fields, null/stale fields, orphaned records, records tied to deleted users, unreferenced uploaded files, duplicates, old test records, stale status/role values. If no DB access, state that clearly. Never recommend deleting live records without no code/relationship references, clear test/demo status, no business value, and a rollback/export plan. PHASE 9 — BACKEND FUNCTIONS: Check invocation from frontend, base44.functions.invoke/fetch, API wrappers, forms, buttons, automations, webhooks, agents, scheduled jobs, other functions. Identify entities/fields/integrations/env vars used and frontend consumers. Classify accordingly. PHASE 10 — INTEGRATIONS: Find uses of InvokeLLM, SendEmail, UploadFile, GenerateImage, ExtractDataFromUploadedFile, connectors, custom integrations, external fetches. Report where used, dependencies, stored results, possible waste/credit usage. PHASE 11 — DEPENDENCIES: Review package.json and imports. Don't mark unused if used via Vite plugins, Tailwind config, shadcn/ui, PostCSS, ESLint, generated files, config files, or dynamic imports. PHASE 12 — FINAL REPORT: Return the audit with these sections: Executive Summary, Safe-To-Remove Candidates (high confidence only), Needs-Review Candidates, Duplicate/Replaced Items, Unused/Suspicious Entity Schemas, Unused/Suspicious Entity Fields, Backend Function Audit, Integration/Credit Waste Audit, Dependency Audit, Database Cleanup Notes, Cleanup Order (dead imports → unused components/pages → duplicates → disable functions → hide deprecated fields → archive records → remove dependencies last), and per-category Cleanup Prompts. Do not perform cleanup yet. Audit first.
Debugging
#audit
#cleanup
#dead code
