We stayed for a week.
Best thing for me was the food, massages, and other things (excursions) which were super cheap. I remember paying $30 per person for day trips to James Bond island which includes food. Massages were ten bucks.
I would definitely do a cooking class. We did one in Ubud I think and it was awesome, they take you to the market and buy the ingredients and teach you how to make amazing curry.
We went to Bangkok, Ko Samui, Ko Phi Phi, and Ubud (with a stop in Cambodia) and I definitely wouldn’t miss Ubud because it was the only non beach city in Thailand and was different and cool.
Frankly I could have done without Bangkok but there are some cool temples there. Boardmail me and I’ll give you more details.