Introduce skipRefs and onlyRefs to limit the scope of the hook

We may want to extend this to some glob or regexp matching in the future,
but for now, this fits my need perfectly so let's keep it simple.