To write generic code for all versions, use the mystery-mod-addon as source set for that. If you want to use version specific code, then use the version module.
To get started simply run the Setup run configuration or the setup gradle task. IMPORTANT: Rightclick all the "jars" modules in IntelliJ's gradle window and click "Ignore Gradle projects" (otherwise you're going to have duplicate content roots)
You will find in every version module example configurations for a mixin.
To Debug an Addon, you can run the Minecraft run configuration and all will be done for you.