Assigning a role or persona to GitHub Copilot Chat at the beginning of your prompt can influence the tone, style, and focus of its responses.
Start your prompt in Copilot Chat by clearly defining the role. Combine this with specific commands or context as needed.
Examples (Use in Chat View / Inline Chat):
Act as a principal software engineer specializing in C#. Review the code in #selection
. Focus on potential race conditions, exception handling best practices, and opportunities for using modern .NET asynchronous patterns.
Explain dependency injection in ASP.NET Core like I'm a junior developer who has only worked with static classes before.
Assume the role of a QA engineer. Based on the function in #selection
, suggest 5 edge case scenarios that should be tested using the /tests
command.
You are a SQL Server DBA. Analyze the following query in #selection
and suggest optimizations for better performance on large tables. /explain
Try assigning different roles relevant to your task (e.g., "Accessibility Expert", "Technical Writer", "DevOps Engineer") to guide Copilot's output effectively.