The Conversation has an interesting article about research into the evolution of feathers. Feathers were originally used for display and thermoregulation. It was only later when they were co-opted for flight. A new paper "Cellular structure of dinosaur scales reveals retention of reptile-type skin during the evolutionary transition of feathers", published in the journal Nature, looked a fossilized skin from a new specimen of Psittacosaurus, a horned dinosaur with bristle-like feathers on its tail, which lived in the early Cretaceous period (about 130 million years ago). The specimen had preserved soft tissues visible only under ultraviolet light. This enabled the researchers to determine the skin had scales very similar to a modern crocodile.
The skin of birds today is soft and evolved for the support, control, growth and pigmentation of feathers, unlike the scaly skin of reptiles.
Fossils of dinosaur skin are more common than you think. To date, however, only a handful of dinosaur skin fossils have been examined on a microscopic level. These studies, for example a 2018 study of four fossils with preserved skin, showed that the skin of early birds and their close dinosaur relatives (the coelurosaurs) was already very much like the skin of birds today. Bird-like skin evolved before bird-like dinosaurs came around.
So to understand how bird-like skin evolved, we need to study the dinosaurs that branched off earlier in the evolutionary tree.
Our study shows that at least some feathered dinosaurs still had scaly skin, like reptiles today. This evidence comes from a new specimen of Psittacosaurus, a horned dinosaur with bristle-like feathers on its tail. Psittacosaurus lived in the early Cretaceous period (about 130 million years ago), but its clan, the ornithischian dinosaurs, diverged from other dinosaurs much earlier, in the Triassic period (about 240 million years ago).