Killing a yakkha not parajika offence
I might be off topic but let me explain my family experience in the way we deal with them.
You Don't have to kill a yakkha. You don't kill sentient beings.
(In Islam they are known as genie and in Christians the anti-Christ ... etc as they categorise them into one category only)
Yakkha does not really bother people unless people bother them knowingly or unknowingly or they have been order to bother human.
To keep them at bay you can report them or banish them (send them away) as all yakkha have to live within in their own societal rule set.
You report them to their superior etc or the yakkha in charged if you know where the yakkha comes from. Their society is hierarchical and rules are strict but you do get some bad ones, like human, that will break the rules then face the consequences. Their punishment is severe and very long as they have very long lifespan.
You can also banish them by reciting verse. My understanding is recitation is a form of explaining or reminding them the consequences of their actions and a form of enhancing your "energy" level (improve your concentration ... am still researching this). Or you can reason with them if you are truly mindful. i.e. if you are "clean" or as person who have not sinned (never break precepts).
Just like the logic of karma if they break the rules they too will incur the karma "retribution".
The following are the possibilities that you have to confront a yakkha ...
1. Both of you have met in the past lives and one of you (you or yakkha) is not letting go and continue to seek revenge without knowing.
2. The yakkha succumbs to temptation by carrying out deeds order by someone (most likely human).
3. You have unknowingly offended the yakka.
4. The yakka is being yakka to bother you because you are weak. (like the behaviour of a bully)
Of all the above 4 possibilities 3 and 4 are easier to deal with, while 2 can be rather hard as the yakkha is under order to target you. If you have 1 then you just have to bear with it by generating more good merit in the hope that the yakkha will go away.
If I am not mistaken if you encounter category 1 nobody can help you as that is your karma without you knowing.
Category 2 tend to be people that want to harm you in this current life and these people are persistence in ordering the yakkha to cause problems to you. The problems you will get tend to be health, livelihood, relationship etc. Their motives are usually related to greed, jealousy, lust and envy. The person ordering such deeds will face severe karmic repercussion as is the yakkha but they don't know yet as they are lost as they are blinded by their power.