Deductions & credits

Acquisition debt is "a mortgage that you took out to buy, build, or substantially improve your principal residence and that is secured by that residence."

The key term is "substantial improvement."  The IRS defines this as

"An improvement is substantial if it:
Adds to the value of your home,
Prolongs your home's useful life, or
Adapts your home to new uses.
Repairs that maintain your home in good condition, such as repainting your home, are not substantial improvements. However, if you paint your home as part of a renovation that substantially improves your qualified home, you can include the painting costs in the cost of the improvements."

An improvement is something that extends the useful life of the property or increases its value.  Also known as a "betterment" in some documents.  Contrasted with a repair, which restores property to an as-was condition, or maintenance, that maintains the property in as-is condition.

Painting is a repair or maintenance and is not a substantial improvement (although obviously, if you build an addition, painting will be part of the cost.)

Fence and deck might be a repair or an improvement depending on the nature of the work.  A new retaining wall would be an improvement, but not repairs to maintain an existing retaining wall.

Then, once you know if you have an improvement, you have to decide if it is "substantial."  The definition above, which comes from IRS publication 963, is very broad.  The actual internal revenue code doesn't define "substantial" at all.  Elsewhere in the federal code, a "substantial improvement" for purposes of the flood insurance program must cost at least 50% of the value of the home before the work started.

As you determine how the money you borrow is spent for maintenance, repairs, and "substantial improvements", be sure to keep records for as long as you own the house plus 7 years after you sell.