I think everyone feels self-doubt at some point in time. New approaches are learned, frameworks get updated, new code beomes available from third-party sources, ideas change, new learning curves to overcome, etc.
With specific regard to elitemedia’s comments, writing decent comments and using clean coding approaches on-the-fly is more a matter of self-discipline and developing good habits. This might take a bit of time as you are developing your own personal approaches to coding, but sooner or later you reach a point where it just becomes natural and less time intensive. With a decent IDE, you can pretty much automate phpdoc-style comment insertion using macros. For me, the key to making money on a consistant manner (making a decent living) is maximizing code reuse. I use my modified version of CodeIgniter for this reason and my own collection of libraries to extend the basic framework. Actually, my collection of library extensions is much lighter these days because of CodeIgniter.
I favor using the old modular spearations approach prior to Matchbox from the same author (Zacharias), so I plan out most projects as modules on-the-fly while creating the directory structures for my applications. I really don’t spend much time doing this. Most applications need a base set of modules, so I maintain a base set of CI files along with whatever extensions and modules I always use and use those files as a basis for starting anything new. I think of this as my personal framework in the sense that it eliminates a lot of the initial work I might have to repeat for any new project.
If you think in terms of modules and code modules as loosely coupled application elements, you can reuse them over and over again and use existing modules as the basis for creating new ones. Also, you can refactor the code in modules individually as time permits during low peak periods of work. I save a lot of time and maximize earning because of this. In your particular case, this might help you a lot because it might eliminate the need to start off completely from scratch. If you find yourself in a scheduling bind and release code you feel insecure about, you can always go back and update it after shipping deliverables and send the customer an update as time permits (which can work in your favor if you handle it right because it gives the customer a sense of getting added value for the money they paid out).
I have some customers who demand additional documentation such as UML diagrams or test code. As elitemedia suggests, delivering code and getting paid is of critical importance when working on your own, so I generally do that stuff as an after thought at this time mainly becuase I have not applied myself to incorporate those needs into my everyday coding approaches (something, I have been working on with minor-to-moderate success).
Lastly, those feelings you get will most likely subside after you feel better in control of programming in general. Getting to that point is more a matter of feeling self satification in whatever you are working on and how you are applying your coding skills. If you don’t feel in control of whatever you are doing, self doubt is going to enter the picture. All the while, you need to learn how to do all this quickly. What you are doing now is probably ok if you think of it as a learning experience because you’re obviously learning new approaches during each cycle.