How does codex usually generate shared functions/modules?

In my experience it will do exactly that, create common functions that are used by others. If it doesn’t you can tell it to adhere to principles of code reuse, abstraction and inheritance