Custom capabilities can be used in different integration types, their creation process doesn’t depend on which integration you’re developing.
With this in mind, here’s a tutorial where a custom capability is created based on a custom attribute/command defined in a DTH:
After you finish creating that custom capability, you need to add it to your device profile, and in the driver, you can make reference to it with this line:
local waterFlowRate = capabilities["capabilityID"]
Note: The capabilityID is formed by a randomly created namespace and the capability name in camelCase. Something like: commonsmall09402.waterFlowRate