There is no absolute way to tell, no spell that says "he's level 10/10 HD." You have to go with context clues and observation instead. That leads us to a two-part answer.
DM Description and Observation
Observe more closely and the DM should be more forthcoming with details. In many cases, higher level NPCs/monsters look different - think World of Warcraft, you can tell a high level person because of their crazy pimp looking gear and purple energy coming off them and stuff. Maybe he has ioun stones whizzing about his head, etc. Judicious use of detect magic, detect evil, etc. can tell you strength of auras. A DM should also think through setting up context clues per How can DMs effectively telegraph specific dangers in D&D? - like maybe someone powerful comes to mess with him and gets disintegrated while he's chatting amiably with the PCs.
Many high level characters are obvious - a gnome in a robe of the archmagi riding a dinosaur with all kinds of magical protection glimmering around him is obviously bad news. If all your gear is platinum and adamantite it means you're bad ass enough to keep a hold of it from random bandits and/or adventurers. Your DM should be conveying this detail, as long as you pause to take a look.
In some cases (monsters, undead) skill use may let you get a better read on what it is you're facing. In 3.X this was sadly routine (I will roll and you will tell me exactly what this is), in 5e this isn't as guaranteed a method of knowing exactly what's up and there's more DM discretion, but at least asking for a roll and getting hints might help.
It definitely sounds like your DM needs to be thinking through this more and giving more context. "Hey this dead guy looks a lot like that statue of Archmage Xulibraz back at the Acadamae..."
Play Smart
In some cases, a high level person isn't going to look/detect different from a low level person. This should be more rare unless your DM is a dink, though there are exceptions. A high level monk in rags looks like anyone else and a king might have super pimp gear despite being level 1 just because of daddy's money. Now, if you see the monk fight it should be like watching Jet Li and you should get the clear impression he could snap your neck and isn't some random yokel. But this is where the onus shifts to you. If you decide to just roll up on someone without knowing much about them, there's a good chance you're going to get owned one day. You have to be smart.
Observe folks. Ideally, use time prior to the actual encounter. If you know about them way ahead of time then there's divination spells or sage research or "asking around on the street." See if you can observe them fight someone or cast a spell or use a skill to where you would see "holy crap they are about 500% better at that than I am." Have a backup plan. If you just kick down doors and attack people, 1 in 10 times you're going to bite off more than you can chew and you'll need a fallback. That floating thing could be a beholder or a gas spore. That undead could be a zombie or a lich. Knowing that there is that range of foes, it's up to you to decide whether you want to be all reckless and maybe die one day or whether you want to be super cautious with everything or where you want to fall in between - just like real life.
Conclusion
You have just learned a valuable lesson, and learned it without dying! Congratulations. The world is dangerous and it's not always neatly labeled or level appropriate. Let this inspire you to think about how to suss out your foes both from afar and when in direct contact with them. It'll keep you alive more than a fistful of plusses.
There are a few corpse references we can look at that might help you make an informed decision.
First is the Animate Dead spell, PHB pg.212;
Choose a pile of bones or a corpse of a Medium or Small humanoid within range. [...] The
target becomes a skeleton if you chose bones or a zombie if you chose a corpse.
In this case, a pile of bones does not qualify as a corpse for the purpose of reanimation and the two terms are not interchangeable.
Next is the Create Undead spell (PHB, pg.229) which uses the corpses of humanoids to create ghouls, ghasts, wights, or mummies. Each of which is generally depicted as being more than just a pile of bones. Since it doesn't say that a pile of bones (or skeleton) can be used to create these creatures, we can infer that once again just the bones don't qualfy as a corpse.
As such I would conclude that the Speak with Dead spell cannot be used on a skeleton. But hey, if you want it to work than as the DM you have the power to make it work.
Best Answer
The rules don't specify operating senses
This is a decent case for relying on "spells do what they say they do" and keeping the interaction simple. Here is what the spell will do.
The corpse is not alive, it has "the semblance of life" and Intelligence. Intelligence is described as being the key attribute for memory.
Memory being required to recall what it knew in life fits Intelligence being magically activated.
The magic allows the otherwise dead corpse to answer your questions. Beyond that, the spell description doesn't activate, nor reanimate, anything else.
Your ruling was correct
You are the DM (per your comment). You ruled that the corpse could not read the scroll; your ruling captured the spell's powers correctly. If you want go beyond that at your table, it's your call.
Rules as Fun...