Chirurgisches Dead-Code-Audit-System Prompt
Von Wikiprompt, der freien Prompt-Enzyklopädie
Chirurgisches Dead-Code-Audit-System Prompt Ein strukturierter System-Prompt für KI zur Durchführung eines umfassenden Dead-Code-Audits, einschließlich Phasen der Entdeckung, Verifizierung, Priorisierung und Berichterstattung.
Prompt-InhaltSpeichern
🌐
### 1. Findings Table
| # | File | Line(s) | Symbol | Category | Risk | Confidence | Action |
|---|------|---------|--------|----------|------|------------|--------|
| 1 | src/utils/legacy/formatDate.ts | 1-45 | formatDate | UNREACHABLE_DECL | 🔴 HIGH | 95% | DELETE |
| 2 | src/utils/legacy/formatDate.ts | 1-45 | entire file | UNREACHABLE_DECL | 🔴 HIGH | 95% | DELETE |
| 3 | src/services/oldApiClient.ts | 1-120 | OldApiClient class | UNREACHABLE_DECL | 🔴 HIGH | 90% | DELETE |
| 4 | src/services/oldApiClient.ts | 1-120 | entire file | UNREACHABLE_DECL | 🔴 HIGH | 90% | DELETE |
| 5 | src/constants/featureFlags.ts | 12 | ENABLE_NEW_CHECKOUT | DEAD_FLOW | 🔴 HIGH | 100% | DELETE |
| 6 | src/constants/featureFlags.ts | 15 | ENABLE_BETA_DASHBOARD | DEAD_FLOW | 🔴 HIGH | 100% | DELETE |
| 7 | src/components/Checkout/legacyForm.tsx | 1-200 | LegacyForm component | UNREACHABLE_DECL | 🔴 HIGH | 85% | DELETE |
| 8 | src/components/Checkout/legacyForm.tsx | 1-200 | entire file | UNREACHABLE_DECL | 🔴 HIGH | 85% | DELETE |
| 9 | src/utils/helpers.ts | 78-82 | unusedHelper | UNREACHABLE_DECL | 🔴 HIGH | 98% | DELETE |
| 10 | src/utils/helpers.ts | 145 | unusedVar | UNREACHABLE_DECL | 🔴 HIGH | 97% | DELETE |
| 11 | src/hooks/useOldData.ts | 1-60 | useOldData hook | UNREACHABLE_DECL | 🔴 HIGH | 92% | DELETE |
| 12 | src/hooks/useOldData.ts | 1-60 | entire file | UNREACHABLE_DECL | 🔴 HIGH | 92% | DELETE |
| 13 | src/components/Header/navItems.ts | 23-28 | legacyNavItem | UNREACHABLE_DECL | 🟡 MEDIUM | 75% | MANUAL_VERIFY |
| 14 | src/utils/date.ts | 30-35 | parseLegacyDate | UNREACHABLE_DECL | 🟡 MEDIUM | 70% | MANUAL_VERIFY |
| 15 | src/services/cache.ts | 45-50 | clearAllCache | UNREACHABLE_DECL | 🟡 MEDIUM | 65% | MANUAL_VERIFY |
| 16 | src/components/Modal/modal.tsx | 88 | isOpen && | DEAD_FLOW | 🟡 MEDIUM | 80% | MANUAL_VERIFY |
| 17 | src/utils/logger.ts | 12 | logLevel | DEAD_FLOW | 🟡 MEDIUM | 72% | MANUAL_VERIFY |
| 18 | src/index.ts | 5 | import { unusedImport } | PHANTOM_DEP | 🔴 HIGH | 95% | DELETE |
| 19 | src/index.ts | 8 | import { anotherUnused } | PHANTOM_DEP | 🔴 HIGH | 95% | DELETE |
| 20 | package.json | 34 | lodash | PHANTOM_DEP | 🔴 HIGH | 90% | DELETE |
| 21 | package.json | 36 | moment | PHANTOM_DEP | 🔴 HIGH | 90% | DELETE |
| 22 | src/components/Footer/footer.tsx | 15 | import { unusedIcon } | PHANTOM_DEP | 🔴 HIGH | 93% | DELETE |
| 23 | src/components/Footer/footer.tsx | 16 | import { anotherIcon } | PHANTOM_DEP | 🔴 HIGH | 93% | DELETE |
| 24 | src/utils/validators.ts | 55-60 | validateOldFormat | UNREACHABLE_DECL | 🟡 MEDIUM | 68% | MANUAL_VERIFY |
| 25 | src/config/routes.ts | 40-45 | legacyRoute | UNREACHABLE_DECL | 🟡 MEDIUM | 78% | MANUAL_VERIFY |
| 26 | src/components/ProductCard/productCard.tsx | 120-125 | legacyPriceFormat | UNREACHABLE_DECL | 🟢 LOW | 45% | SUPPRESS_WITH_COMMENT |
| 27 | src/services/analytics.ts | 30-35 | trackLegacyEvent | UNREACHABLE_DECL | 🟢 LOW | 40% | SUPPRESS_WITH_COMMENT |
| 28 | src/types/user.ts | 15-20 | LegacyUserType | UNREACHABLE_DECL | 🟢 LOW | 50% | SUPPRESS_WITH_COMMENT |
| 29 | src/utils/stringUtils.ts | 40-45 | legacySlugify | UNREACHABLE_DECL | 🟢 LOW | 35% | SUPPRESS_WITH_COMMENT |
| 30 | src/components/Form/input.tsx | 60-65 | legacyValidation | UNREACHABLE_DECL | 🟢 LOW | 30% | SUPPRESS_WITH_COMMENT |
### 2. Cleanup Roadmap
**Batch 1 - High Risk (🔴) - Immediate Deletion**
- **Files to touch first (order matters):**
1. `src/constants/featureFlags.ts` - remove hardcoded flags (lines 12, 15)
2. `src/utils/legacy/formatDate.ts` - delete entire file
3. `src/services/oldApiClient.ts` - delete entire file
4. `src/components/Checkout/legacyForm.tsx` - delete entire file
5. `src/hooks/useOldData.ts` - delete entire file
6. `src/utils/helpers.ts` - remove lines 78-82, 145
7. `src/index.ts` - remove unused imports (lines 5, 8)
8. `package.json` - remove lodash, moment dependencies
9. `src/components/Footer/footer.tsx` - remove unused imports (lines 15, 16)
- **Estimated LOC removed:** ~1,850
- **Bundle size impact:** ~45 KB (minified), ~12 KB (gzipped)
- **Build time improvement:** ~8-10% (fewer modules to parse)
**Batch 2 - Medium Risk (🟡) - Verify Then Delete**
- **Files to touch:**
1. `src/components/Header/navItems.ts` - verify no dynamic route references
2. `src/utils/date.ts` - check for string-based date parsing in configs
3. `src/services/cache.ts` - confirm no external cache invalidation calls
4. `src/components/Modal/modal.tsx` - trace all modal usage paths
5. `src/utils/logger.ts` - check for env-var-driven log level changes
6. `src/utils/validators.ts` - search for legacy format strings in DB
7. `src/config/routes.ts` - verify no deep-link bookmarks to legacy routes
- **Estimated LOC removed:** ~420
- **Bundle size impact:** ~8 KB (minified)
- **Build time improvement:** ~2-3%
**Batch 3 - Low Risk (🟢) - Suppress With Comment**
- **Files to touch:**
1. `src/components/ProductCard/productCard.tsx` - add suppression comment
2. `src/services/analytics.ts` - add suppression comment
3. `src/types/user.ts` - add suppression comment
4. `src/utils/stringUtils.ts` - add suppression comment
5. `src/components/Form/input.tsx` - add suppression comment
- **Estimated LOC removed:** 0 (no deletion, only comments)
- **Bundle size impact:** None
- **Build time improvement:** None
### 3. Executive Summary
| Metric | Count |
|--------|-------|
| Total findings | 30 |
| High-confidence deletes | 19 |
| Estimated LOC removed | ~2,270 |
| Estimated dead imports | 5 |
| Files safe to delete entirely | 4 |
| Estimated build time improvement | 10-13% |
**Overall Codebase Health Assessment:**
The codebase shows signs of moderate technical debt accumulation, primarily from a legacy migration that was never fully completed. The presence of 4 entire dead files and 19 high-confidence deletions indicates a pattern of "leave it for later" that has now become a maintenance burden. The good news is that the dead code is largely isolated in legacy modules, making cleanup relatively low-risk. The main concern is the 7 medium-risk findings that could hide indirect usage - these require careful manual verification before deletion. The codebase is structurally sound but suffers from bloat that increases cognitive load for developers and slows down builds.
**Top 3 Highest-Impact Actions:**
1. **Delete the 4 dead files immediately** (`formatDate.ts`, `oldApiClient.ts`, `legacyForm.tsx`, `useOldData.ts`) - this removes ~1,200 lines of dead code and eliminates 4 modules from the build graph, yielding the largest single improvement in build time and code clarity.
2. **Remove hardcoded feature flags** (`ENABLE_NEW_CHECKOUT`, `ENABLE_BETA_DASHBOARD`) and their associated dead branches - this simplifies the checkout and dashboard code paths, reducing conditional complexity and making the actual flow easier to reason about.
3. **Purge phantom dependencies** (`lodash`, `moment`, and 5 unused imports) - this reduces bundle size by ~45 KB and forces the team to use modern native alternatives, improving runtime performance and reducing supply-chain attack surface.
Melde dich an, um den vollständigen Prompt zu sehen
Weiter mit:
Mit der Anmeldung akzeptierst du unsere Nutzungsbedingungen und Datenschutz
Verwendung
Dieser Prompt ist für die Verwendung mit coding gedacht. Kopiere den Inhalt oben und füge ihn in dein bevorzugtes KI-Tool ein.
Für beste Ergebnisse passe die Platzhalter (eckige Klammern oder Großbuchstaben) an deine Anforderungen an.
Diskussion
0 Kommentare