This is a free, MIT-licensed Cursor rules file for building AI agents in .NET the way AIML.chat does — it keeps your AI editor using Microsoft.Extensions.AI abstractions, keeping providers swappable, and grounding answers safely. Drop it in .cursorrules for idiomatic, portable agent code.
What these rules do
.NET AI projects drift when they bind directly to one vendor's SDK or scatter prompt logic everywhere. These rules teach your AI editor to program against IChatClient and IEmbeddingGenerator from Microsoft.Extensions.AI so the provider stays swappable, to keep retrieval-grounded answers and citations as the default, and to treat tool calls that mutate data as requiring confirmation. They also encourage the conventions that keep a codebase clean — async all the way, configuration over hardcoding, and structured logging without leaking secrets. The result is agent code that's portable and safe.
The rules
# .NET AI agent development (AIML.chat style)
- Program against IChatClient / IEmbeddingGenerator (M.E.AI), not a vendor SDK.
- Keep the model/provider config-driven and swappable.
- Default to retrieval-grounded answers with citations.
- Treat any data-changing tool call as requiring confirmation.
- Async all the way; no blocking calls on the request path.
- Configuration over hardcoding; never log secrets or keys.
How to use it
Save the block as .cursorrules at the repo root of your .NET project, and your AI assistant applies it. It pairs with the RAG pipeline rules for retrieval and the MCP server rules for tools. The developer tools use case explains where this fits.
Ready to build? Start free, wire your agent, and ship it — see pricing for limits.
Why use Microsoft.Extensions.AI abstractions?+
Programming against IChatClient and IEmbeddingGenerator keeps your model and provider swappable instead of locked to one SDK.
Where do I put the file?+
Save it as .cursorrules at the repo root of your .NET project; your AI assistant applies it automatically.
Are the rules free?+
Yes — they are MIT-licensed and free to copy. Using the agent counts toward your plan's limits; see pricing.