This is a great tutorial. A lot of people use Frigate and these make great candidates for the marketplace. The rules and the widgets could be simply installed from the Add-on store instead of copy/paste/edit.
The widgets can be posted as is (one post per widget) but the rule would need to be converted to a rule template. See How and Why to Write a Rule Template (revisited) for details on that if it’s something you are interested in doing.
You could merge your two rules into one by checking to see which type of trigger caused the rule to run and running the cleanup if it wasn’t triggered by the Channel event.
I’d love it if we could have more than one rule per template but until that happens, using tricks like this to put it all in one rule makes it much easier for the end users to use.