It is best to compost the coffee grounds first before using as the bacteria present in the compost pile will break down the grounds and release nitrogen and other nutrients that are present in the grounds. so that your plants can better utilize the nutrients. That makes the grounds more beneficial to the plants it is being used around. I have composted hundreds of pounds of spent coffee grounds over the years to use in my gardens and have not had any issues. Here is a scientific article which may help you in your journey to using coffee grounds in your gardens,
https://www.researchgate.net/p...