The gift of rightly discerning scripture is only given by God to certain people, such as the shepherds. The rest of us sheep including yourself don't have that gift, that's why God appointed shepherds to lead the flock of sheep.
First, if your pastor taught you this, let the dust fly from your feet as you run from that church; it's a cult in the making.
Second, if you came up with it yourself, how can you possibly know that it's true? It is inherently self-defeating.
Third, if you accept it as true, and you as a non-shepherd don't have the "gift of rightly discerning Scripture" you can
never know for sure whether what your pastor is teaching is sound doctrine.
Fourth, I challenge you to support your assertion with Scripture. There is no "gift of rightly discerning Scripture" described, or even suggested, in the Bible.
Fifth, that is the reasoning of the Catholic Church, which insists on following the wisdom of "mother Church" and discourages its adherents from thinking for themselves. It makes for a deeply-misguided church.
Sixth, nowhere in Scripture are we encouraged to park our brains at the door of the church on the way in; quite the opposite.
Seventh, you have no idea whether I'm a "shepherd" or not. Stop making assertions from ignorance. It does you no credit.
The problem arises when the sheep try to assume their own authority, and they are quickly get lost in their own carnal wisdom. The ability to recite scriptures is useless unless you have the gift of rightly discerning them.
God gives each of us the ability and authority to think for ourselves. Abdication of that capacity leads to folly, error, and sin. Use the brain God gave you.