Is there a reason to still build ships smaller than your largest available size?
Solution 1:
Corvette have innate evasion % built in. Which makes ship with terrible tracking weapons have more trouble with corvettes. Corvette has 60%, destroyer has 25%, cruiser has 10%, battleship has 5%. Some weapons can negate the evasion advantage and some can't.
An entire fleet of corvette can move MUCH faster than destroyer etc... In-system travel-wise not FTL. For battleship you need afterburner and other tech to make them match speed with a non-upgraded corvette.
Corvette has a dedicated hull to mount torpedo which does lot of damage especially if the enemy doesn't have any PD whatsoever. Sure you can use a cruiser to mount a torpedo but it has less evasion and more weapons can hit cruiser evasion-wise.
You can also build swarm of corvette that can take overkill hits from missile, missile and PD mechanically-wise are iffy right now in 1.4 and 1.5 may change that, saving your super-expensive battleship from dying.
Right now there isn't an easy way to collect your enemy's ship design and figure a way to counter-build. IE if your enemy uses lot of missile that is easy to tell and you build more PDs. Not as easy to tell if your enemy is using anti-armor weapon or anti-shield. Should you shift to have more armor or shield?
So keep that in mind.
Solution 2:
As it currently is a fleet of naked corvettes (the standard corvette with no modifications) beats any other fleet of the same strength, or even slightly stronger ones (10%-20% depending on the fleet, I'd say. I beat a 37k fleet with my 30k corvette fleet). Simply because of their numbers. Additionally naked corvettes have a much much lower ship upkeep cost, build cost and build time, which makes them actually so valuable. Have 10-15 ports constantly build a line of corvettes and the enemy can barely destroy them as fast as you reproduce. It's really crazy seeing 50+ single corvette fleets rushing over your galaxy to join your main fleet.
The problem in Stellaris is that every ship/weapon upgrade costs more than it is valuable. The prices and upkeep costs increase by a much larger amount than the damage/hullpoints/shield benefits they get. I hope there will be a solution to this "problem" one day. I could imagine that a fleet of battleships with heavy AA weapons (maybe even fighter wings?) and a lot of shielding/armor could beat a same strength naked corvette fleet but that's speculation on my side and the AI never tries to counter-build a corvette only fleet.
So currently the only downside to the naked corvette approach is that it only works well up to a certain amount of ships as your PC won't be able to calculate the battle well beyond that. I couldn't watch my fleet of 1033 corvettes (which took up the whole length of a star system) fight the enemy as it was laggy as hell. I had to go to the galaxy screen and not watch the battle for it to properly work. I hovered over the fleet icons to see their strength decimate.
please note that this answer only applies to versions before 1.8.* as major rebalancing eliminated this strategy