Add rule and pattern