Just put code to build/src/Kotlin is not exactly plugin (you cannot apply it explicitly, for example some configuration), but work for many use cases of course
Also there are precompiled script plugins, which reduce amount of boilerplate code, also you can publish yhem