Sterling Labs
← Back to Blog
Business Strategy·12 min read

My Technical Audit Protocol: How I Price Legacy Code Before Writing a Line

March 29, 2026

Short answer

The exact audit workflow I use to evaluate technical debt before signing a contract — tools, pricing logic, and contract clauses.

Most people would call that insanity. The client had a clear timeline, a decent budget, and an urgent need to fix their internal dashboard. They wanted me to work solo. On paper, it was the easiest money I have seen all year.

Most people would call that insanity. The client had a clear timeline, a decent budget, and an urgent need to fix their internal dashboard. They wanted me to work solo. On paper, it was the easiest money I have seen all year.

On screen, it was a disaster waiting to happen.

The codebase looked like a skeleton buried in snow. No comments, no tests, and dependencies that hadn't been touched since 2019. If I took the project at face value, I would have burned three months of my life trying to keep a train from derailing.

That is why I do not estimate projects based on feature lists anymore. In 2026, the has are irrelevant if the foundation is cracked. I run a specific audit protocol before every single contract signature. It takes me about 48 hours to complete, but it saves me thousands in scope creep and debugging.

If you are a freelancer or running a small agency, stop guessing your hourly rate based on what the client wants. Start charging for the structural integrity of their software. This article breaks down my exact audit workflow, the tools I use to validate technical debt, and how I price the cleanup before writing a single line of production code.

The Hidden Cost of Technical Debt

Clients do not understand technical debt. They see a broken button and think it takes five minutes to fix. They do not see the spaghetti logic wrapping around that button like barbed wire.

When I walk into a new engagement in 2026, my first job is not to build. It is to measure.

The market has shifted. In 2024, companies hired teams to build fast. In 2026, they hire experts to maintain stability because the AI tools that promise speed are creating more fragile code than ever. You can generate a UI in minutes, but you cannot generate maintainability without human oversight.

My protocol is built on three pillars: Static Analysis, Dependency Health, and Documentation Gap. If any of these fail, the project budget goes up. Period.

Step 1: The Static Analysis Sweep

I do not open the IDE and start typing. I run static analysis tools first. This gives me a heatmap of where the code is most likely to break.

My primary workstation runs on a Mac Mini M4 Pro. It handles the local compilation and analysis without breaking a sweat. You need raw power here because scanning a large legacy repo takes time. If you are running this on an older laptop, the process drags and you lose focus.

Check out my setup with the Mac Mini M4 Pro:

https://www.amazon.com/dp/B0DLBVHSLD?tag=juliansterlin-20

I pair this with a Studio Display to keep the terminal output and IDE side-by-side. It reduces context switching time significantly.

Https://www.amazon.com/dp/B0DZDDWSBG?tag=juliansterlin-20

The tools I run depend on the language, but the logic remains the same. For JavaScript/TypeScript projects, I use ESLint combined with a custom rule set that checks for circular dependencies. For Python, I run SonarQube locally to catch complexity cyclomatic spikes.

I look for specific metrics:

  • Cyclomatic Complexity greater than 15 per function.
  • Code duplication exceeding 5%.
  • Missing type definitions in a TypeScript codebase.
  • If I find more than three critical violations per file, that is a red flag. It means the original developer was guessing at the architecture. I document every violation in a spreadsheet. This becomes part of the contract scope later.

    Step 2: Dependency Health Check

    A project with dead dependencies is a project that will break in six months. The client thinks they are buying software. They are actually buying maintenance contracts.

    I run npm audit or pip check immediately after pulling the repo. In 2026, security vulnerabilities are not just a risk; they are a liability. If the client has no patching process in place, I need to build it into the initial payment.

    I also check for abandoned libraries. If a package has not been updated in two years and the last commit message says "fix typo", I flag it for replacement. This is non-negotiable.

    Some dependencies require rewriting the logic they wrap. That costs time. I calculate that cost upfront. If a library is critical but abandoned, I factor in the risk of it breaking during an OS update.

    You need to track this financial risk. I use Ledg for my personal and project budgeting because it is offline-first and requires no bank linking. It keeps the data local while I track project costs against my hourly rate.

    Download Ledg from the App Store to manage your own budget privacy:

    https://apps.apple.com/us/app/ledg-budget-tracker/id6759926606

    Ledg does not have AI categorization or cloud sync, which is exactly why I use it. It forces me to be honest about where the money goes without algorithms guessing my spending habits.

    Https://apps.apple.com/us/app/ledg-budget-tracker/id6759926606

    Step 3: Documentation Gap Analysis

    This is where most freelancers get burned. The client asks for documentation as an afterthought. Then they blame you when the code is unmaintainable later.

    I scan for inline comments and JSDoc blocks. In a healthy codebase, every exported function has an explanation of what it does and why it exists. In legacy code, the comments are often outdated or non-existent.

    I create a "Documentation Gap Score". If more than 40% of the core logic lacks documentation, I charge for a refactoring phase before touching the feature list.

    I also check for API documentation. If they use an internal API without Swagger or OpenAPI specs, I add the cost of generating those to the proposal. This prevents future integration headaches when they bring on another developer.

    Step 4: The Time Estimation Logic

    Once I have the data, I convert it into hours. This is not a guess. It is a formula.

    1. Baseline Hours: Standard time for the requested features.

    2. Debt Factor: I add 30% to baseline for every critical violation found in Step 1.

    3. Risk Buffer: I add another 20% for each outdated dependency identified in Step 2.

    4. Documentation Load: I charge $100 per hour for the time required to write and review documentation.

    I track profit margins on these engagements using Ledg. It helps me see if I am overpricing or underpricing specific types of legacy work.

    This logic forces the client to acknowledge the debt. They cannot argue with a spreadsheet that shows where the risk lies.

    Step 5: The Contract Clause

    The audit is useless if you do not bind it to the contract. I include a specific clause that states:

    "Client acknowledges technical debt as identified in Appendix A. Any changes to the core architecture required by this debt are billed at $X per hour, not covered under the fixed-fee scope."

    This protects me from feature creep disguised as bug fixes. If a "bug" is actually a consequence of the debt, it becomes a paid task.

    I also require that all new code follows my linting standards from day one. If they try to push code without passing the audit, it goes back in review. This shifts the culture from "ship fast" to "ship clean".

    The Hardware That Makes It Possible

    You cannot run this protocol on a slow machine. I need to compile, scan, and test simultaneously.

    I use the Logitech MX Keys S Combo for typing long reports and scripts without wrist pain. It connects via Bluetooth or a USB dongle, which means I am never tethered to the desk.

    Https://www.amazon.com/dp/B0BKVY4WKT?tag=juliansterlin-20

    For mouse control, I use the MX Master 3S. The scroll wheel is magnetic and smooth. It helps me navigate large codebases quickly without lifting my hand from the base.

    Https://www.amazon.com/dp/B0C6YRL6GN?tag=juliansterlin-20

    I also use an Elgato Stream Deck MK.2 to automate my terminal commands. I map npm run audit or git status to a physical button. It reduces friction when switching between tasks.

    Https://www.amazon.com/dp/B09738CV2G?tag=juliansterlin-20

    I connect everything through a CalDigit TS4 Dock. It handles all the USB-C connections without daisy-chaining multiple hubs that cause latency issues.

    Https://www.amazon.com/dp/B09GK8LBWS?tag=juliansterlin-20

    The VIVO Monitor Arm holds the screen at eye level. Eye strain kills productivity, and productivity costs money in billing terms.

    Https://www.amazon.com/dp/B009S750LA?tag=juliansterlin-20

    For audio, I use the Elgato Wave:3 Mic. It filters out keyboard clicks so my voice is clear during client calls about the audit results.

    Https://www.amazon.com/dp/B088HHWC47?tag=juliansterlin-20

    This setup is not about gaming. It is about reducing the friction between my brain and the terminal. Every second saved on setup adds up over a 48-hour audit window.

    Pricing the Cleanup

    I do not give discounts for legacy code. I charge a premium for it.

    When the client sees the audit report, they understand why the price is higher than a greenfield project. The AI hype in 2026 has made them think coding is easy. I need to remind them that fixing it is hard work.

    The audit report becomes a sales tool. It proves I know what I am doing before we sign. It filters out clients who want cheap fixes and attracts those who value stability.

    I track my profit margins on these projects using Ledg. Since it is offline-first, I do not worry about client data leaking into a cloud dashboard. The budget tracker handles my income and expenses without requiring bank linking or syncing to iCloud.

    You can get Ledg for free, upgrade to $4.99 a month, or pay $39.99 for the year.99 if you want to own the data forever.

    Https://apps.apple.com/us/app/ledg-budget-tracker/id6759926606

    The Result: Predictable Revenue

    I have been running this protocol throughout 2026. The results speak for themselves.

    The clients who accept the audit process are better partners. They understand that software engineering is not magic. It is accounting for logic and risk management.

    The ones who reject it? They usually do not sign the contract anyway. That saves me time I would have wasted on a failing engagement.

    Why You Need This in 2026

    The market is saturated with junior developers who do not know how to read a stack trace. They write code that works today and breaks tomorrow.

    They do not audit their work because they lack the tools or the discipline. They rely on AI to write the code for them, but AI cannot fix a broken architecture.

    You need to position yourself as the expert who fixes the foundation, not just the painter on the walls.

    My protocol forces you to be technical and business-minded at the same time. It ties the code quality directly to your revenue.

    If you are running Sterling Labs, this is how I operate. Every engagement starts with the audit. If the debt is too high, I refer them to a team that can handle the migration. I do not take the liability on my shoulders if it is not worth the cost.

    Final Stack Summary

    Here is the hardware and software stack I rely on for these audits:

  • Mac Mini M4 Pro: Local compilation and analysis engine.
  • Studio Display: Dual-window workflow for code and docs.
  • Logitech MX Keys S Combo: Input precision during long sessions.
  • MX Master 3S: Navigation through large file trees.
  • Elgato Stream Deck MK.2: Terminal command automation.
  • CalDigit TS4 Dock: Peripheral hub for stable connections.
  • VIVO Monitor Arm: Ergonomic screen positioning.
  • Elgato Wave:3 Mic: Clear communication during client calls.
  • This is not a list of gear for the sake of it. It is the ecosystem that allows me to run 48-hour audits without fatigue.

    The Bottom Line

    Do not accept a contract based on a feature list alone. Demand access to the codebase first. Run the audit. Show them the debt.

    If they cannot afford to fix it, they will not be a good client for maintenance work anyway.

    I have helped hundreds of clients stabilize their systems, but I only take on the ones who respect the process.

    If you need help implementing this protocol in your own business, visit Sterling Labs at jsterlinglabs.com. I offer consulting for teams who want to move away from churn and toward stability.

    For your personal finances, or project-specific budgeting that does not leak data to the cloud, use Ledg. It is privacy-first and built for developers who value control over their data.

    Https://apps.apple.com/us/app/ledg-budget-tracker/id6759926606

    The code is not the product. The stability of the code is the product. Treat it that way or you will be working for free when things break.

    In 2026, the winners are not those who ship fastest. They are those who build last longest.


    *Julian Sterling is the founder of Sterling Labs. He operates out of a local-first workflow with no cloud dependencies.*

    Want this built for you?

    Sterling Labs builds automation systems like the ones described in this post. Tell us what you need.