I would really like to hear from people who have have hacked together their own code generation tools for production projects, including taking an existing tool and extending it for purpose.

Did it work well? Any lessons that others should know of?

I've built dev tooling for local deployment management and release automation and those have worked well, but the code generation piece is something I'm curious about.