Earlier in my career I used to take a skeptical view of people who never stayed in the same gig for more than a few months; my concern was perhaps they couldn't. Later in my career, I started taking a skeptical view of people who never left their jobs; my concern was perhaps they couldn't. Since I've interviewed tons of candidates (and have interviewed for jobs at a couple of companies where many people "never" leave), I can find plenty of supporting evidence for both positions, but realistically, it's actually very hard to predict how people will react.
In software, however, many people are quite used to people doing a string of contract gigs. If you aren't working on a 1099 basis, but through agencies, you may want to be more explicit about the contract nature (FooCorp via BarAgency) so that it doesn't raise any hackles by people who might just assume you're quitting whenever your code starts to have consequences. If you're working on a 1099 basis, I recommend using your company as the employer, with "Engaged at XCorp on Project Y. Delivered Q solution to..." as bullet points instead of showing each project as a different "job".
The biggest risk you might have as a contractor is that people will worry about candidates who have never been working on a project long enough to have to think about maintenance considerations, because they won't have suffered enough from their own previous design decisions.
My current contract gig has actually lasted longer than my last two full time arrangements; I left those jobs because it was clear that either the company was about to implode or that I would stop learning things that would allow me to progress professionally. If anyone asks, I just answer honestly and tactfully. They rarely ask.
Your biggest risk is the pre-interview filtering that may happen. You won't know if you're being tossed out of the pile of resumes because of your career history, but you also won't know if it's because you share the last name of the hiring manager's psychotic ex-girlfriend or because they don't want generalists, or don't want specialists.
The best thing you can do for your career prospects is to build a reputation of acting professionally, working smart, and solving problems. The tech job market is small enough that you're likely to work with someone you've worked with before, and as long as the wake you leave resulted in mostly positive impressions, you'll be able to find future gigs without much of a struggle.