PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
Chat - (gpt-5.6)
Token size
2,580
Example input
[CODEBASE_STRUCTURE]: ecommerce-platform/ β”œβ”€β”€ apps/ β”‚ β”œβ”€β”€ api/ β”‚ β”œβ”€β”€ worker/ β”‚ └── admin/ β”œβ”€β”€ packages/ β”‚ β”œβ”€β”€ auth/ β”‚ β”œβ”€β”€ payments/ β”‚ β”œβ”€β”€ notifications/ β”‚ β”œβ”€β”€ legacy-payment/ β”‚ └── utils/ β”œβ”€β”€ scripts/ β”œβ”€β”€ tests/ └── config/ [SOURCE_CODE_OR_REPOSITORY_DATA]: packages/utils/formatLegacyDate() has no direct references. - packages/utils/formatCurrency() is used by payments and admin. - packages/legacy-payment/StripeV1Adapter is referenced only by an old migration script. - packages/notifications/EmailNotifier is used by worker. - packages/payments/PaymentService has a dynamic provider loader: loadProvider(process.env.PAYMENT_PROVIDER) [DEPENDENCY_MANIFESTS_AND_LOCKFILES]: Production: - express - stripe - nodemailer - lodash Dev: - jest - eslint Possible issue: - moment appears in package.json but no obvious source import exists. [TESTS_AND_COVERAGE_DATA]: Payments: 92% coverage - Notifications: 86% - Utils: 71% - Legacy payment: 15% - No tests specifically cover dynamic payment-provider loading. [KNOWN_CONSTRAINTS_AND_CRITICAL_COMPONENTS]: Payment processing is business-critical. - Do not remove payment providers without rollback capability. - Migration scripts must remain available until migration completion is confirmed. - Zero production payment downtime allowed.
Example output
πŸ” Phase 1 β€” Codebase Inventory Component Type Production Criticality API Application πŸ”΄ Critical Worker Background service 🟠 High Payments Library/module πŸ”΄ Critical Notifications Library/module 🟠 High Utils Shared library 🟑 Medium Legacy Payment Compatibility module 🟑 Medium Admin Application 🟑 Medium Finding: Payment functionality is the highest-risk cleanup area. --- πŸ”Ž Phase 2 β€” Entry-Point Analysis Identified roots: API startup ↓ PaymentService ↓ Dynamic Provider Loader ↓ Stripe Provider And: Worker ↓ Notification Job ↓ EmailNotifier Important: StripeV1Adapter cannot be considered dead simply because it has few references because migration scripts can execute it. --- 🧩 Phase 3 β€” Dead-Code Findings Candidate 1: formatLegacyDate() Evidence: No direct source references. No runtime usage in 90-day telemetry. Not used by known entry points. No configuration reference discovered. Utility has no known registration mechanism. Classification: 🟒 Likely unused Confidence: 95% Risk: 🟒 Low Recommendation: REMOVE Required validation 1. Repository-wide search 2. TypeScript/compiler validation 3. Utils test suite 4. API/admin build 5. Application smoke test --- πŸ“¦ Phase 4 β€” Dependency Audit moment Evidence: Present in dependency manifest. No obvious application imports. No production runtime usage found. Need to check build scripts, configuration and transitive assumptions. Classification: 🟑 Possibly unused Confidence: 80% Recommendation: VALIDATE FIRST Do not immediately remove it. Required checks: npm/yarn/pnpm dependency analysis Build plugin inspection Configuration search Test/build execution Lockfile regeneration Application startup test --- 🧩 Phase 5 β€” Hidden Dependency Analysis Payment Provider The code contains: loadProvider(process.env.PAYMENT_PROVIDER) Therefore static references may not reveal the complete dependency graph. Configuration currently contains: PAYMENT_PROVIDER=stripe but an old staging configuration contains: PAYMENT_PROVIDER=paypal Finding: PayPal appears unused in production, but its runtime capability cannot yet be classified as removable. Classification: 🟑 Validate First Risk: πŸ”΄ Critical Reason: Configuration-driven dynamic loading can bypass static dependency analysis. --- πŸ•°οΈ Phase 6 β€” Legacy Component Analysis StripeV1Adapter Evidence: Only referenced by migration tooling. No production calls in 90 days. Migration scripts are not part of normal deployment. Migration completion status is not explicitly provided. Classification: 🟑 Potentially obsolete Confidence: 75% Recommendation: DEFER / VALIDATE Do not remove yet. Required evidence: - Confirm migration completion - Confirm no remaining data requires migration - Execute migration test in isolated environment - Verify rollback procedure - Search CI/CD for migration execution --- πŸ”„ Phase 7 β€” Redundant Implementation Analysis Suppose the audit discovers: packages/utils/formatCurrency() packages/payments/formatPaymentAmount() Both appear to perform currency formatting. Comparison: Factor formatCurrency formatPaymentAmount Consumers 8 1 Tests High Low Production use High High Behavior Generic Payment-specific Risk Low Medium Recommendation: KEEP formatCurrency() MIGRATE formatPaymentAmount() Then remove the second implementation only after regression tests pass. --- ⚠️ Phase 8 β€” Blast-Radius Assessment Candidate Risk Action formatLegacyDate() 🟒 Low Remove moment 🟑 Medium Validate StripeV1Adapter 🟠 High Validate migration PayPal provider πŸ”΄ Critical Preserve until proven unnecessary PaymentService πŸ”΄ Critical Do not remove EmailNotifier 🟠 High Preserve --- πŸ§ͺ Phase 9 β€” Verification Tests Before Removal - Repository-wide reference scan - Dependency graph analysis - Build validation - Relevant unit tests - Configuration search - Runtime telemetry review During Removal For formatLegacyDate(): 1. Delete function. 2. Run utility tests. 3. Run API build. 4. Run admin build. 5. Run integration tests. After Removal - Deploy to staging - Execute application smoke tests - Verify API health - Verify worker startup - Monitor errors - Compare runtime behavior --- πŸͺœ Phase 10 β€” Safe Removal Order Step 1 β€” Remove formatLegacyDate() Reason: Isolated No known consumers No runtime usage Low blast radius Step 2 β€” Validate moment Determine whether it is genuinely unused. If validation confirms no usage: Remove moment ↓ Regenerate lockfile ↓ Build ↓ Run tests ↓ Deploy staging Step 3 β€” Consolidate duplicate utilities Migrate consumers first. formatPaymentAmount() ↓ formatCurrency() ↓ remove old implementation Step 4 β€” Validate StripeV1Adapter Only remove after migration completion is proven. Step 5 β€” Reassess PayPal Require evidence that: Production = no usage Staging = no required usage Config = obsolete Migration = complete Rollback = unnecessary Only then consider removing it. --- πŸ“Š Final Cleanup Priority Matrix Candidate Dead-Code Confidence Risk Priority Recommendation formatLegacyDate() 95% Low πŸ”₯ Remove First REMOVE moment 80% Medium πŸ“Œ Validate First VALIDATE Duplicate formatter 90% Medium πŸš€ High MIGRATE + REMOVE StripeV1Adapter 75% High πŸ• Defer VALIDATE PayPal provider 60% Critical πŸ›‘ Do Not Remove PRESERVE PaymentService 0% Critical πŸ›‘ Do Not Remove PRESERVE EmailNotifier 0% High πŸ›‘ Do Not Remove PRESERVE --- πŸ›£οΈ Cleanup Roadmap Phase A β€” Low-Risk Cleanup Target: formatLegacyDate() Action: Remove Verification: Unit + build + smoke tests Risk: 🟒 Low Rollback: Git revert --- Phase B β€” Dependency Cleanup Target: moment Prerequisite: Confirm no dynamic/build/config usage Action: Remove dependency and regenerate lockfile Risk: 🟑 Medium Rollback: Restore manifest + lockfile --- Phase C β€” Redundancy Reduction Target: Duplicate currency formatter Prerequisite: Consumer migration Action: Migrate β†’ test β†’ remove duplicate Risk: 🟑 Medium --- Phase D β€” Legacy Removal Target: StripeV1Adapter Prerequisite: Migration completion evidence Action: Remove migration-only adapter Risk: 🟠 High Rollback: Restore adapter from version control --- Phase E β€” Architectural Cleanup Target: Dynamic provider architecture Action: Simplify provider registration only after proving which providers are genuinely required. Risk: πŸ”΄ Critical Recommendation: Perform last. --- πŸ“ˆ Expected Benefits These are estimates based only on the sample data, not measured results: Lines of code: Small reduction initially Dependencies: Potentially 1 fewer production dependency Maintenance: Reduced legacy utility and duplicate implementation burden Build complexity: Potentially lower after dependency cleanup Upgrade benefits: Fewer obsolete packages to maintain Operational benefits: Simpler code paths and fewer legacy components Final Audit Verdict The safest strategy is not to aggressively delete everything that looks unused. The recommended sequence is: formatLegacyDate ↓ moment validation ↓ duplicate formatter migration ↓ StripeV1Adapter migration validation ↓ PayPal/provider reassessment ↓ high-risk architectural cleanup Key lesson from this test: static reference absence is evidence of possible dead code, not proof of dead code. Dynamic loading, migration scripts, configuration, plugins, and runtime behavior must be checked before removal.
πŸ€– GPT

Codebase Dead Code Dependency Cleanup

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
GPT-5.6
Tested icon
Guide icon
4 examples icon
Free credits icon
Large codebases accumulate unused functions, unreachable code, obsolete dependencies, and redundant modules that increase maintenance cost and hidden breakage risk. πŸ” Find dead & unreachable code πŸ“¦ Detect obsolete and unused dependencies 🧩 Identify redundant modules ⚠️ Discover hidden dependency risks πŸ›‘οΈ Assess potential cleanup breakage πŸ§ͺ Design verification tests πŸ›£οΈ Generate a safe removal roadmap Turn messy legacy code into a safer, prioritized cleanup plan. πŸš€
...more
Added 1 week ago
Report
Browse Marketplace