Measure against the whole system
The IRS evaluates repairs against the entire relevant building system (the roof, HVAC, plumbing, and similar), so replacing a small fraction of a large system is more likely a deductible repair, while replacing most or all of it is more likely a capitalized improvement.
