I had nail and skin problems since childhood along with migraines, anxiety, depression, tummy trouble, aphthous ulcers, things that would come and go but I always had something weird and doctors thought I was just anxious. Nope! I had Celiac disease, and this causes nutritional deficiencies, which affects your nails. Some nail problems do respond to tea tree oil application, but it takes months of applying the pure oil every day.
Do get blood tests for Celiac before you try stopping gluten. I know the doctors will assure you that you don't have it and you're crazy, but that's because it wasn't their idea and they are prideful.