Lean is about increasing productivity by removing the obstructions to productivity. Flow bottlenecks in a work step of the development system get cleared by increasing the capacity of that step. You do that by shifting resources. If you've departmentalized your development system by fixed or specialized roles, you're going to have a hard time following through on dealing with flow bottlenecks.
It's amazing to me that the software development industry has allowed itself to believe that doing work and proving that the work is right is a job for two different people. This is itself a tremendously wasteful approach to development and is a good example of the things that we do that create productivity loss and the preconditions for bottlenecks.
You shouldn't be in-pursuit of perfect of pure generalists, but local generalization is one of the necessities of Lean productivity. If you want to achieve it, you might not want to start at role definitions, but rather look into the skills you need on your team and the skills that you have access to, and shape your process to strengthen the weaknesses. Just having the same old departmentalization of developers and testers is nothing more than the same old over-specialization that leads us to the waterfall conclusion.
Team size don't matter as much as Designing the Work, and doing so to support the reduction of the amount of work that is waiting between work steps. Chose a team size that doesn't itself create more lost productivity, and change it when it needs to be changed and can be changed for the better. The purpose of the team is to get work done. The conditions of the work will change constantly. Don't lock your time size or structure into an orthodoxy that you can't change when it's time to change.
Set all the preconceptions of methodological orthodoxy aside and focus on principles and values. This is what Lean development is, and it will make a number of the considerations that are common of Scrum and XP simply seem unnecessary.