Skip to content

AI Prompt: Forma3D.Connect — Phase 5t: Dead Code Cleanup

Purpose: This prompt instructs an AI to identify and remove unused imports and dead code
Estimated Effort: 2-3 hours
Prerequisites: Phase 5s completed (Prisma Decoupling)
Output: Clean codebase with no unused imports or dead code
Status: 🟡 PENDING


🎯 Mission

You are implementing Phase 5t: Dead Code Cleanup — addressing TD-018 (Unused Imports and Dead Code) from the technical debt register.

Why This Matters:

Dead code in the codebase causes:

  1. Confusion: Developers may try to use or maintain unused code
  2. Bundle Size: Unused imports may affect bundle
  3. Noise: Search results include irrelevant code
  4. Maintenance: Dead code still needs linting/type-checking

📋 Context: Technical Debt Item

TD-018: Unused Imports and Dead Code

Attribute Value
Type Code Debt
Priority Low
Interest Rate Low
Principal (Effort) 2-3 hours

🛠️ Implementation

Phase 1: Run ESLint Auto-Fix (30 minutes)

# Fix unused imports
pnpm nx lint api --fix
pnpm nx lint web --fix

# Run TypeScript compiler to find unused
pnpm nx build api --verbose
pnpm nx build web --verbose

Phase 2: Use TypeScript's noUnusedLocals (1 hour)

Temporarily enable in tsconfig.json:

{
  "compilerOptions": {
    "noUnusedLocals": true,
    "noUnusedParameters": true
  }
}

Run build and fix all errors, then disable if too strict.

Phase 3: Manual Review (1 hour)

Check for: - Exported functions never imported elsewhere - Classes with no usages - Commented-out code blocks - TODO comments for removed features

Phase 4: Remove Dead Files (30 minutes)

# Find files with no imports
# Review and delete unused files

✅ Validation Checklist

  • ESLint --fix run on all projects
  • No unused import warnings
  • No commented-out code blocks
  • pnpm nx build passes
  • pnpm nx lint passes

END OF PROMPT


This prompt resolves TD-018 from the technical debt register.