Ever spent hours explaining your codebase patterns to ChatGPT? Or wished GitHub Copilot understood your team's coding style? CodeContext.NET solves that.
This tool scans your C# project and creates a context file that tells AI assistants how your code works. No more explaining your patterns over and over.
New: Now detects and maps all your API endpoints automatically.
codecontext --path ./MyProject
That's it. You get a context file ready to paste into any AI chat.
Let's say you have this in your codebase:
private readonly IUserService _userService; public async Task<Result<User>> GetUserAsync(int id) { // your implementation }
CodeContext detects:
- You use underscore for private fields
- Your async methods end with "Async"
- You prefer Result over exceptions
- All your API endpoints with routes and auth info
Next time you ask AI for help, it writes code YOUR way, not some generic tutorial style.
Install it:
dotnet tool install --global CodeContext.CLI
Run it:
codecontext
You'll get something like:
✓ Found 5 patterns
✓ Found 12 packages
✓ Context saved to: codebase-context.md
Here's what you actually get:
Private fields start with underscore (_) Async methods end with 'Async' suffix Use Result<T> pattern for error handling Dependencies injected through constructor API Endpoints: - GET /api/users → GetAllUsers() [Authorize] - POST /api/users → CreateUser(UserDto dto) [Admin] - DELETE /api/users/{id} → DeleteUser(int id) [Authorize]
Just copy this into ChatGPT/Claude/Copilot before asking for code.
Keep it simple:
codecontext # scan current folder codecontext -p ../other-project # scan different folder codecontext -f json # want JSON instead codecontext -v # see what it's doing
Got tired of ChatGPT writing Java-style C# code. Wanted it to match my style without a 10-paragraph prompt every time.
Built by @Nonanti
Yeah, I totally outsourced the README to our robot overlords. Thanks for Gemini