Many top breeders of fish like killies, Appistogramma and Corydoras use rainwater to condition their fish into breeding because it is soft, acidic, usually has fewer contaminents than tapwater, is natural and best of all is free as opposed to the next best thing which is R/O water which can be expensive to make.
To ensure your rainwater is safe firstly only collect during heavy downpours which last a few hours, start collecting after the first hour has passed. If you live in an industrial area then stick to R/O water.
Only collect your water from an inert source such as a plastic clad roof, even better set up a rain trap using plastic sheeting spread out on poles with a funnel going into a bucket.
Run the rainwater through a carbon filter for 24 hours before use to remove any trace pollutants that might still be present.