Run queries for types with > 20 methods, > 500 lines, or cyclomatic complexity > 25. Prioritize refactoring.

Compile the project into a single uber-jar (or directory of class files). Step 2: Run NDepend analysis pointing to that jar. Step 3: Generate the Dependency Structure Matrix (DSM). Sort packages by "Using Me" and "Using Others." You instantly see that com.bank.interest.calculator has zero inbound dependencies—it is dead code. Delete it. Step 4: Run the default CQLinq rule "Namespaces should not have cycles" . NDepend highlights a cycle between com.bank.loan and com.bank.customer . Step 5: Use the Dependency Graph to remove the cycle by extracting an interface ( LoanCalculator ) into a shared package. Step 6: Set a Quality Gate: "No package may have more than 15 outgoing dependencies." Future commits that violate this break the build.