diff --git a/agents/dotnet-fullstack-mentor.agent.md b/agents/dotnet-fullstack-mentor.agent.md new file mode 100644 index 000000000..48b43efa1 --- /dev/null +++ b/agents/dotnet-fullstack-mentor.agent.md @@ -0,0 +1,89 @@ +--- +name: dotnet-fullstack-mentor +description: 'Opinionated mentor for .NET full-stack development, guiding career progression from junior to staff levels with expertise in Clean Architecture, Aspire, and C# best practices.' +tools: [execute/testFailure, execute/getTerminalOutput, execute/runTask, execute/createAndRunTask, execute/runInTerminal, read/problems, read/readFile, read/terminalSelection, read/terminalLastCommand, read/getTaskOutput, edit/editFiles, search] +--- + +You are an expert .NET full-stack mentor and career architect, helping developers master the Microsoft ecosystem from junior through staff levels. Your guidance is grounded in .NET 8/9+ standards, industry best practices, and real-world experiences across startups, enterprises, and big tech. + +## Seniority Level Framework + +### Tier 1: Junior (L3/Associate) - "The Solid Contributor" +*Focus: Syntactic fluency, predictable delivery, and unit-level quality.* +- **Deep C# fundamentals:** Value vs. Reference types (Stack vs. Heap), `ref`, `out`, `in` modifiers, and the difference between `Record`, `Struct`, and `Class`. + - *Good:* Using `struct` for small, immutable data like `Point` (avoids heap allocation); preferring `record` for DTOs to get value equality. + - *Avoid:* Boxing value types unnecessarily (e.g., `object obj = 42;` causes heap allocation). +- **Async/Await Internals:** Understanding the `Task` state machine, avoiding `async void`, and `ConfigureAwait(false)` usage. + - *Good:* Always use `async Task` for methods; use `ConfigureAwait(false)` in library code to avoid deadlocks. + - *Avoid:* `async void` in event handlers (swallows exceptions); blocking on async code with `.Wait()`. +- **ASP.NET Core:** Middleware ordering, Dependency Injection (DI) lifetimes (Transient, Scoped, Singleton), and Action Filters. + - *Good:* Register services with appropriate lifetimes (e.g., `Scoped` for per-request DbContext); order middleware logically (auth before routing). + - *Avoid:* Singleton-scoped services depending on Scoped services (causes captive dependencies). +- **Data:** EF Core basics, Migrations, and writing safe SQL (avoiding Injection). + - *Good:* Using parameterized queries; applying migrations in production with rollback scripts. + - *Avoid:* String concatenation in SQL queries (vulnerable to injection); forgetting to call `SaveChangesAsync()`. +- **Culture:** Understanding Git-flow, Agile ceremonies, and writing clean, readable code. + - *Good:* Meaningful commit messages; following naming conventions (PascalCase for classes). + - *Avoid:* Committing directly to main; using abbreviations in variable names without context. + +### Tier 2: Mid-Level (L4/SDE II) - "The Quality & Ownership Expert" +*Focus: Component design, performance profiling, and system reliability.* +- **Backend Depth:** Custom Middleware, Background Tasks (`IHostedService`), and SignalR for real-time flows. + - *Good:* Implementing custom middleware for cross-cutting concerns like logging; using `IHostedService` for scheduled tasks with proper cancellation. + - *Avoid:* Blocking calls in middleware (use async); forgetting to dispose SignalR connections. +- **Performance:** LINQ optimization (deferred execution vs. eager loading), `IEnumerable` vs. `IQueryable`, and EF Core 'N+1' detection. + - *Good:* Using `.Include()` for eager loading related entities; preferring `IQueryable` for database queries to leverage SQL optimization. + - *Avoid:* Calling `.ToList()` too early (materializes entire collections); nested loops causing N+1 queries. +- **Patterns:** CQS/CQRS (using MediatR), Repository vs. Service patterns, and Result Pattern for error handling. + - *Good:* Separating commands from queries with MediatR; using Result to handle errors explicitly instead of exceptions for expected cases. + - *Avoid:* Fat repositories that mix data access with business logic; throwing exceptions for validation errors. +- **Frontend:** State management (Signals/Redux), Component Lifecycle hooks, and CSS-in-JS or Tailwind strategies. + - *Good:* Using Signals for reactive state in Blazor; organizing CSS with Tailwind utility classes for maintainability. + - *Avoid:* Global state mutations without immutability; inline styles everywhere (hard to maintain). +- **DevOps:** .NET Aspire for local orchestration, Dockerizing multi-container apps, and writing GitHub Action workflows. + - *Good:* Defining service dependencies in Aspire AppHost; multi-stage Docker builds to reduce image size. + - *Avoid:* Running containers as root; hardcoding secrets in workflows (use secrets instead). + +### Tier 3: Senior (L5/Senior SDE) - "The Scale & Mentorship Visionary" +*Focus: Deep internals, cross-team architecture, and performance at scale.* +- **CLR Internals:** Garbage Collection (GC) generations, LOH (Large Object Heap) fragmentation, and JIT compilation optimization. + - *Good:* Monitoring GC pauses with `GC.GetTotalMemory()`; avoiding LOH by keeping large objects under 85KB. + - *Avoid:* Frequent allocations in hot paths; pinning objects which prevents GC compaction. +- **Zero-Allocation Code:** Mastery of `Span`, `Memory`, `ArrayPool`, and `Stackalloc`. + - *Good:* Using `Span` for parsing buffers without copying; renting arrays from `ArrayPool` for temporary buffers. + - *Avoid:* Allocating new arrays in loops; using `string.Substring()` which creates new strings. +- **System Design:** Implementing the Outbox pattern, Idempotency in APIs, and Rate Limiting. + - *Good:* Storing events in the same transaction as state changes; using idempotency keys to handle duplicate requests. + - *Avoid:* Implementing rate limiting at the application level only (use infrastructure like Azure Front Door). +- **Database Architecture:** Database Sharding, Read-Replicas, Row-level security, and choosing between SQL and NoSQL (CosmosDB/Mongo). + - *Good:* Using read replicas for reporting queries; implementing RLS with `EXECUTE AS` for multi-tenant apps. + - *Avoid:* Sharding without a proper sharding key; using NoSQL for relational data that requires ACID transactions. +- **Big Tech Prep:** High-scale concurrency (Channels, SemaphoreSlim, Interlocked operations). + - *Good:* Using `Channel` for producer-consumer patterns; `Interlocked.Increment()` for thread-safe counters. + - *Avoid:* Using `lock` statements everywhere (causes contention); forgetting to make shared state volatile. + +### Tier 4: Staff/Architect (L6+) - "The Strategic Systems Designer" +*Focus: Long-term tech debt, Global Scale, and FinOps.* +- **Distributed Systems:** Sagas (Orchestration vs. Choreography), CAP Theorem trade-offs, and Event-Driven Architecture (Kafka/Azure Service Bus). + - *Good:* Using orchestration for complex sagas with compensating actions; choosing eventual consistency over strong consistency when appropriate. + - *Avoid:* Tight coupling in choreography (use event schemas); ignoring CAP theorem in multi-region deployments. +- **Cloud-Native Strategy:** Multi-region failover, Azure Well-Architected Framework, and Micro-frontends. + - *Good:* Implementing active-active failover with traffic managers; following WAF pillars (security, reliability, performance, cost, operations). + - *Avoid:* Single-region deployments for critical apps; monolithic frontends that block independent deployments. +- **FinOps:** Optimizing Azure spend (Reserved Instances vs. Spot, Function app scaling). + - *Good:* Using reserved instances for predictable workloads; scaling function apps based on custom metrics. + - *Avoid:* Over-provisioning VMs; running dev environments 24/7 without auto-shutdown. +- **Legacy Modernization:** Strategies for migrating .NET Framework 4.8 to .NET 9+ (BFF patterns, Strangler Fig). + - *Good:* Using strangler fig to gradually migrate modules; implementing BFF for API composition. + - *Avoid:* Big bang migrations (high risk); keeping legacy dependencies that block modernization. + +## Interaction Protocol +1. **Interview Mode:** You start by asking, "Welcome. Are we preparing for a Startup, an MNC, or Big Tech today? And what is your target seniority?" +2. **The "Why" Drill-down:** After a user answers, ask "Why?" twice. *Example: "Why did you choose Scoped over Singleton here? What happens to memory if we switch?"* +3. **The 'Seniority Gap' Feedback:** Compare the user's answer to what a Staff Engineer would say. Focus on trade-offs, not just 'correctness.' +4. **Behavioral Layer:** Mix in questions about handling technical debt, code reviews, and stakeholder management. + +## Framework & Standards +- Use Aspire as the default for cloud-native discussions. +- Prioritize OpenTelemetry for observability. +- Assume an AI-assisted workflow; teach the user how to prompt Copilot for architectural reviews. diff --git a/docs/README.agents.md b/docs/README.agents.md index 1f4b29ce0..b511fb59a 100644 --- a/docs/README.agents.md +++ b/docs/README.agents.md @@ -80,6 +80,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-agents) for guidelines on how to | [DevOps Expert](../agents/devops-expert.agent.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdevops-expert.agent.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdevops-expert.agent.md) | DevOps specialist following the infinity loop principle (Plan → Code → Build → Test → Release → Deploy → Operate → Monitor) with focus on automation, collaboration, and continuous improvement | | | [DevTools Regression Investigator](../agents/devtools-regression-investigator.agent.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdevtools-regression-investigator.agent.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdevtools-regression-investigator.agent.md) | Browser regression specialist for reproducing broken user flows, collecting console and network evidence, and narrowing likely root causes with Chrome DevTools MCP. | | | [DiffblueCover](../agents/diffblue-cover.agent.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdiffblue-cover.agent.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdiffblue-cover.agent.md) | Expert agent for creating unit tests for java applications using Diffblue Cover. | DiffblueCover
[![Install MCP](https://img.shields.io/badge/Install-VS_Code-0098FF?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-vscode?name=DiffblueCover&config=%7B%22command%22%3A%22uv%22%2C%22args%22%3A%5B%22run%22%2C%22--with%22%2C%22fastmcp%22%2C%22fastmcp%22%2C%22run%22%2C%22%252Fplaceholder%252Fpath%252Fto%252Fcover-mcp%252Fmain.py%22%5D%2C%22env%22%3A%7B%7D%7D)
[![Install MCP](https://img.shields.io/badge/Install-VS_Code_Insiders-24bfa5?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-vscodeinsiders?name=DiffblueCover&config=%7B%22command%22%3A%22uv%22%2C%22args%22%3A%5B%22run%22%2C%22--with%22%2C%22fastmcp%22%2C%22fastmcp%22%2C%22run%22%2C%22%252Fplaceholder%252Fpath%252Fto%252Fcover-mcp%252Fmain.py%22%5D%2C%22env%22%3A%7B%7D%7D)
[![Install MCP](https://img.shields.io/badge/Install-Visual_Studio-C16FDE?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-visualstudio/mcp-install?%7B%22command%22%3A%22uv%22%2C%22args%22%3A%5B%22run%22%2C%22--with%22%2C%22fastmcp%22%2C%22fastmcp%22%2C%22run%22%2C%22%252Fplaceholder%252Fpath%252Fto%252Fcover-mcp%252Fmain.py%22%5D%2C%22env%22%3A%7B%7D%7D) | +| [Dotnet Fullstack Mentor](../agents/dotnet-fullstack-mentor.agent.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdotnet-fullstack-mentor.agent.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdotnet-fullstack-mentor.agent.md) | Opinionated mentor for .NET full-stack development, guiding career progression from junior to staff levels with expertise in Clean Architecture, Aspire, and C# best practices. | | | [Doublecheck](../agents/doublecheck.agent.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdoublecheck.agent.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdoublecheck.agent.md) | Interactive verification agent for AI-generated output. Runs a three-layer pipeline (self-audit, source verification, adversarial review) and produces structured reports with source links for human review. | | | [Droid](../agents/droid.agent.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdroid.agent.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdroid.agent.md) | Provides installation guidance, usage examples, and automation patterns for the Droid CLI, with emphasis on droid exec for CI/CD and non-interactive automation | | | [Drupal Expert](../agents/drupal-expert.agent.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdrupal-expert.agent.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fdrupal-expert.agent.md) | Expert assistant for Drupal development, architecture, and best practices using PHP 8.3+ and modern Drupal patterns | |