This adjustable dado fixture is my adaptation of various designs on YouTube and other places on the Internet. Designed to be used with a standard router, it can be set to the exact thickness of your shelf and then used to precisely rout a matching groove of just the right width. In use, the jaws of the fixture - which you've already cut with a select straight bit to match YOUR particular router - clamp on the shelf. When you remove the shelf, the jaws are separated by the exact width of the shelf. Then your workpiece goes underneath, is clamped in place (use a C-clamp or other method) and when you run your router back and forth down the length of the fixture, your router's base indexes along the thicker reference surface of the fixture, and the width of the groove you rout will match the separation of the jaws, which of course exactly matches the thickness of your shelf.
Most of the designs on the internet use a table saw to get a straight reference surface, but not having a table saw (or room for one) I wondered how to get a long surface sufficiently straight to be a reference with a simple jigsaw. So . . . I didn't; instead, I chose some 1" laminate shelving from a home improvement store - a straightedge verified it WAS straight - and attached that to some 3/8" plywood for the "jaws" of the fixture. The jigsaw cuts I made were all on "non critical" edges.
I used the same laminate material (doubled up) for the cross pieces, and took some effort to be sure they were as perpendicular to the reference surfaces as possible. Crosspieces were slotted for adjustability, of course.