The question isn't whether it makes a difference, the question is whether the model you're working with / the platform you're working with it on already does that. All of the major commercial models have their own system prompts that are quite detailed, and then the interfaces for using the models typically also have their own system prompts (Cursor, Claude Code, Codex, Warp, etc).
It's highly likely that if you're working with one of the commercial models that has been tuned for code tasks, in one of the commercial platforms that is marketed to SWEs, that instructions similar to the effect of "you're an expert/experienced engineer" will already be part of the context window.
How has it ever worked. I have thousands of threads with various LLMs, none have that role play cue, yet the responses always sound authoritative and similar to what one would find in literature written by experts in the field.
What does work is to provide clues for the agent to impersonate a clueless idiot on a subject, or a bad writer. It will at least sound like it in the responses.
Those models have been heavily trained with RLHF, if anything today's LLMs are even more likely to throw authoritative predictions, if not in accuracy, at least in tone.
I also don't tell CC to think like expert engineer, but I do tell it to think like a marketer when it's helping me build out things like landing pages that should be optimized for conversions, not beauty. It'll throw in some good ideas I may miss. Also when I'm hesitant to give something complex to CC, I tell that silly SOB to ultrathink.
I'm still not sure if specifying a role made a difference or not in terms of performance. Different but similar instance, when I tried to create an agent in Claude to play a specific role (frontend / design engineer expert), I found that this seemed to perform worse vs. just using default Claude, but this is all very anecdotal.
Maybe it is cargo culting at this point, idk. When I first started experimenting with this, about two generations of models back, the role play prompt made a noticeable difference.
Example: with early Claude (pre-Claude Code) if you asked for a Rust program you’d get something that only resembled Rust syntax but was a mix of different languages. “You are a senior software engineer that develops solely with the Rust programming language” or something like this made it generate syntactically correct Rust.
Similar prompts led to better, more focused tests. I find that such prompts are not as necessary anymore, but anecdotally I’ve still felt a difference.