In this blog, Wendy Breiding presents five practical GitHub Copilot Chat prompts specifically designed to help .NET developers boost productivity, code quality, and security when working on Microsoft technologies.

5 Copilot Chat Prompts .NET Developers Should Use Now

Author: Wendy Breiding (SHE/HER)

Artificial intelligence is becoming a foundational part of the modern .NET developer’s workflow. GitHub Copilot Chat empowers you to boost productivity, eliminate repetitive work, and unlock your creativity—all by asking the right questions. Here are five practical prompts every .NET developer should consider using today:

1. “Explain this code and suggest optimizations.”

When working with legacy code or unfamiliar projects, comprehension can be a major challenge. Add your C# source code files to Copilot Chat and ask for both an explanation and recommendations for improving performance, readability, or maintainability. This can save time and introduce new best practices or techniques to your workflow.

2. “Write unit tests for this method/class.”

Testing can sometimes be neglected under tight deadlines. By simply highlighting a method or class and asking Copilot Chat to generate unit tests (with frameworks like xUnit, MSTest, or NUnit), you can quickly enhance code coverage and reduce the risk of missing edge cases.

3. “Convert this code to use async/await.”

For scalability and responsiveness, modern .NET applications benefit greatly from asynchronous programming. If you have synchronous code, prompt Copilot Chat to rewrite it using async/await constructs, helping to future-proof your codebase and improve user experiences.

4. “Find and fix potential security issues in this snippet.”

Security remains a fundamental responsibility, yet vulnerabilities can be easy to overlook. Ask Copilot Chat to review your source for issues such as SQL injection, cross-site scripting (XSS), or poor input validation. This can act as an additional safeguard before deployment.

5. “Generate sample data or mock objects for this model.”

Having realistic data on hand is critical during development and testing. Let Copilot Chat generate sample data or mock objects for your models, making it easier to simulate real-world scenarios and accelerate your prototyping efforts.

Conclusion

These five prompts illustrate just a few ways AI can help .NET developers, but they’re only the beginning. Experiment with Copilot Chat, refine these suggestions, and develop your own effective workflows. With thoughtful queries, you can make AI a powerful coding companion and enhance your .NET projects.

For more ideas about Copilot Chat prompts, see the Awesome GitHub Copilot Customizations repo.

What prompts are you using with Copilot Chat? Share your favorites in the comments below!

This post appeared first on “Microsoft .NET Blog”. Read the entire article here