The Kotlin Symbol Processing API (KSP) allows to write code that is executed when compiling a Kotlin application. Use this tag in questions about the Kotlin Symbol Processing API and writing symbol processors.
The documentation describes the Kotlin Symbol Processing like this:
Kotlin Symbol Processing (KSP) is an API that you can use to develop lightweight compiler plugins. KSP provides a simplified compiler plugin API that leverages the power of Kotlin while keeping the learning curve at a minimum.
See the quickstart guide and the official documentation for information on how to write symbol processors.
A sample project can be found here.