Writing a custom precondition

Hi,

can someone help me to write a custom precondition ?

Thanks in advance

Alessio