Howto: MQTT autodiscovery?

As I see here [OH3] Tasmota via MQTT Autodiscovery there’s a possibility to “autodiscover” MQTT things and their channels.
Is there a documentation somewhere on how to achieve this, if you have total control over how the topics and messages are built (writing my own scripts for sensors and stuff).

For MQTT autodiscovery there are multiple options.


OpenHAB supports both of them.