Module 1 · Prompting Foundations · Lesson 1 of 26
How to Use This Guide
This guide is designed as a practical copy/paste prompt library for a .NET developer. It is not about magic wording. It is about giving an AI assistant the same engineering context you would give a senior teammate: stack, goal, code, constraints, expected behavior, actual behavior, and the quality bar.
The core idea
A strong developer prompt usually follows this shape: Context + Task + Relevant Code + Constraints + Expected Output. The more precise the engineering context, the less guessing the AI has to do.
- Use templates when you are stuck. Pick the closest prompt, replace the placeholders, and paste your code/error.
- Be specific about quality. Ask for production-ready code, tests, validation, logging, performance notes, and trade-offs.
- Treat AI as a pair programmer. It can accelerate thinking, but you still need to compile, test, review security, and verify behavior.
- Iterate. After the first answer, ask follow-up prompts such as “make this more testable,” “reduce allocations,” or “explain the trade-off.”
Use case and best section
| Use case | Best section |
|---|---|
| Starting every coding chat | Master Prompt |
| Creating APIs or features | ASP.NET Core API Endpoint Template |
| Fixing runtime errors | Debugging Prompt |
| Improving slow EF Core code | EF Core Performance Prompt |
| Preparing a PR | Code Review and PR Prompt |
| Learning existing code | Explain Existing Code Prompt |
| Preventing bad output | Do's, Don'ts, and Quality Checklist |
The Developer Prompt Formula
For software work, vague prompts produce generic answers because the model has to guess your framework version, architecture, database, coding standards, and hidden constraints. The fix is to provide the smallest useful amount of real context.
| Prompt part | What to include | .NET example |
|---|---|---|
| Role | Tell the model what engineering lens to use. | Act as a senior ASP.NET Core backend engineer and code reviewer. |
| Task | Describe what you want built, fixed, reviewed, or explained. | Create POST /api/orders with validation and EF Core persistence. |
| Stack | Give app type, .NET version, database, ORM, testing tools. | .NET 9 Web API, EF Core, SQL Server, xUnit, FluentAssertions. |
| Architecture | State the current project style. | Clean Architecture: Api, Application, Domain, Infrastructure. |
| Relevant code | Paste only the code that matters. | Controller, service method, DbContext, entity, error stack trace. |
| Constraints | Make hidden rules explicit. | No extra packages, async I/O, no entity exposure, preserve response shape. |
| Prompt part | What to include | .NET example |
|---|---|---|
| Output format | Tell it exactly what to return. | Files by name, tests, edge cases, trade-offs, security notes. |
Accuracy tip
Do not ask the AI to “create something in .NET” when you actually need an ASP.NET Core endpoint, an EF Core query, a service-layer method, or an xUnit test. Name the exact layer and artifact.