Though they are small, mosquitoes are also sentient beings. If we whop them, we are breaking the precept of no killing. Instead of harming them, we can use mosquito nets to keep them away. We can trap cockroaches by using plastic containers (swiped with a layer of oil) and then release them outdoors. By praying, dedicating merits and communicating sincerely with them, we can help to lead them to a good place as well as reducing our own attachment and aversion to these so-called annoying creatures.
Due to our past karmic connection, we are meeting these sentient creatures now. We should use this opportunity to create positive karma, while exhausting any previous negative karma. We can practice charitable giving to the ants by giving them food, while sincerely communicating with them and asking them to move to a more suitable place outside of our home. By praying and dedicating merits to them, we can exhaust our past debts to them, practice “no killing” and refrain from creating further negative karma.
Extracted from Venerable Xue Cheng’s “Doubts and Clarifications on Buddhism”