Who are you writing for? Preschoolers? School-agers? Tweens? Teens? Quite obviously, they are not the same beast. Do you know any actual children currently dwelling within the age range for which you're writing? Don't rely solely on your own memories of what you were like at 4 or 14-years old. I guarantee you're misremembering some things and not remembering most things about the age.
And don't rely on knowing only one or two children. You may know the exceptions to the developmental rules. I have a 4-year old in class this year who is a whiz at history. Keegan has meaningful knowledge of historical events way beyond his years. He's fascinated with World War II, and his current passion is the H.M.S. Hood. The other day, he organized two of his classmates to reenact the sinking of the Hood by the Bismark. He only wanted two people to play with him because only three men survived the sinking.
Am I going to write a book aimed at 4-year olds with a gifted 4-year old character who reenacts great battles of World War II? Nope. I'm pretty sure that Keegan is one of the few 4-year olds on the planet who could appreciate such a book. I know he's the only 4-year old I've had in 30 years of teaching who wanted me to find Johnny Horton on the internet so he could listen to him sing The Battle of New Orleans.
If Keegan was older, say 11 or 12, and I was writing a book for 11 or 12 year olds, I could certainly put him in that book as a gifted character. These older kids, even if they don't have firsthand knowledge of the sinking of the Hood, have been in life long enough to have gained enough understanding of the world that they could appreciate such a story. (Not that the 11-year old is playacting the sinking of the Hood, but that the 11-year old is a history whiz kid.)
All this doesn't mean you can't create a gifted or precocious 4-year old character for a story aimed at 4-year olds. Of course you can. You just have to be sure that there is enough 4-year old in your 4-year old for your readers to relate to.
How do you do that? Learn everything you can about the ages you are writing about and for. What can you do if you aren't able to access large numbers of kids in your target age group? Read within your genre. (You should be doing this anyway!) If you write picture books, read picture books. If you write young adult, read young adult.
Read about child development. Most children develop predictably, and there is a ton of information on the internet and at the library on developmental norms. You can get started by checking out these articles on child development at Education.com.