Hmmm. I'm not certain any sort of electric system would work for really motivated rats. But if you were to reduce their motivation (possibly the chickenfeed?) and can manage the maintenance for keeping electric from shorting out, mesh electric fencing might work. Friends in Oregon keep their ducks out of their garden that way, with a short mesh electric fence all around the garden.
Turns out it's called "Net electric fencing". Like this:
Here's a seller of it:
PermaNet electric mesh net fencing
And note they say:
Weeds must be controlled for PermaNet to remain effective... If you can’t do this, PermaNet may not be the right fence for you.
But a note- if you were in a very dry region, like a desert, electric fencing won't work well because the animal doesn't have a strong enough electrical connection to the dry ground. That company, Premier, is the one who told me this issue and they recommended against my using electric fencing because of this problem.
We have terrible native rat problems here, packrats will take almost everything in our garden if they don't have access to enough food otherwise. So it's a challenge to get your garden started, and very difficult to have a winter garden.
In my experience, the first and most important thing to do is to deal with the chickenfeed. That's likely the high-value stuff that is attracting them in the first place. Fencing the coop better is good for other reasons,
but you can also spray the chicken food with homemade cayenne pepper spray. The birds can't taste it, but the rats can't tolerate it. And it's medicinal for the birds. It's such a simple fix, but it does take doing it. Some people leave the bottle outside by the place you feed them, and spray each time.
Next, we have to just keep trapping rats and removing them. In our case we use live traps. There are a lot of really cool animals here in the desert that you can accidentally kill, and we don't want to do that. Back in Oregon, when neighbors accidentally imported a load of city (Norway) rats to our previously rat-free country location, we did use snap traps. Same when we lived in a small town. But here, being diligent with the live traps also works.
Cayenne spray as a deterrent can also work if you find specific pathways the rats are taking. It's cheap and simple, too.
Hope others see this and have more ideas for you!