> I worry that if I start taking fixed-fee projects the incentive to make good software will be gone (the faster I deliver, the better). There's no incentive for documenting things, writing tests, creating a CI/CD pipeline or any of that. These things simply become nice-to-haves that will not matter once you deliver the project and cash yourself out.
The things you listed sound more like deliverables that the customer either does or doesn't want. If, as you say, most of your customers don't want them, then you shouldn't do them or bill for them. For example, if the customer doesn't even know what CI is, and they don't already use it, then if you do provide it, it likely will be ignored: it isn't part of their culture and they aren't likely to adopt it as part of their development practice just because you delivered it with your project. If they are paying you to educate them about CI, why it's important, how it works, etc., that's obviously different.
IMO, a fixed contract (I've worked both ways for large corps) doesn't mean you will produce "bad" software. But it does prevent you from futzing around too much with unimportant details like code formatting, giving variables better names, changing 10 lines of code to remove 2 duplicate lines, etc. These are the kind of things that programmers routinely do to make their code "better" (I do it myself), and as a personal project, that's great; I think it makes you a better programmer, and the next time, maybe you'll come up with better variable names the first time. But a paying customer probably doesn't care whether you name a variable n or nrows, so billing extra hours to write "good" software is not worth it. If it works and is not a maintenance nightmare, then it is "good enough" for commercial work. Another way to look at this: if you asked the customer "I need to spend 5 more hours to change the names of some variables to make the logic more clear, and need to reformat a few functions", are they likely to tell you to go ahead and be glad to pay for that or "that's not important for this project"?
Edit: I didn't write that very well. The main distinction I was trying to make is between paid-for commercial work for clients vs "craftsman" quality work that you personally care a lot about, not about hourly vs fixed.