A Hollywood screenwriter wants to buy a house. He tells his agent that he needs to have a separate room or a bungalow in the backyard where he can write.

Another client wants to know if local zoning laws will permit her to either convert the garage into a home office or build a structure on the rear of the lot where she can operate her business. An architect wants a home that will permit him to design the home office of his dreams.

The number of home offices has grown at an annual rate of 10 percent since 1988 as benefits of telecommuting and ranks of entrepreneurs expand.

How many people have home offices? Nearly one-third of America’s work force earns extra or full-time income out of spare bedrooms, attics, converted garages and kitchens, according to Link Resources, which conducts an annual work-at-home survey.

For homeowners who have offices in their houses, one of the supposed great benefits has always been the tax deductions associated with running a business from home. Besides the cost of home office furniture, computers and supplies, the law allows deductions for part of the insurance, utilities and repair bills in addition to depreciation of the part of the home that is used exclusively for business.

And that’s where many homeowners get into trouble, experts say: If you aren’t careful about how you use your home office deduction, you could wind up paying a hefty chunk of capital gains tax when you sell your home.

Who can take a home office deduction?

“You must meet a three-part test,” said Susan Jacksack, a tax attorney and author of several tax manuals published by CCH Inc., based in Riverwoods, Ill. “Is this your principal place of business? Do you meet clients or customers there on a fairly regular basis, meaning more than once a month? Is the office connected to our principal dwelling?”

Jacksack said the most important IRS test for a home office is regular and exclusive use of the space for business.

“That’s a tough rule because most business property, like your car, may be used for both business and home. but the office must be exclusively used for business. If you use your home office for playing computer games, you can violate the home office deduction law,” she said.

It’s tough for folks who are salaried to claim a home office deduction, said Chicago accountant Phil Ravid. Before the tax laws were changed in the mid-1980s, a stock broker could have claimed a deduction for a home office in which he read the Wall Street Journal and made his stock picks.

But an IRS case concerning a doctor who worked at various hospitals and claimed he didn’t have an office at any of them and so deserved a home office deduction changed all that. The change in the law made it clear that the home office must be the principal place of doing business. The doctor saw his patients at the hospital, left their records there, and essentially used his home office for catching up on paperwork.

It wasn’t enough to meet the IRS definition.