https://github.com/nonanti/codecontext.net
Analyzes C# codebases to detect patterns and generate context for AI tools
https://github.com/nonanti/codecontext.net
ai chatgpt cli code-analysis csharp developer-tools dotnet dotnet-tool github-copilot nuget pattern-detection roslyn
Last synced: 3 months ago
JSON representation
Analyzes C# codebases to detect patterns and generate context for AI tools
- Host: GitHub
- URL: https://github.com/nonanti/codecontext.net
- Owner: Nonanti
- License: mit
- Created: 2025-10-10T22:07:54.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-10-12T20:55:04.000Z (3 months ago)
- Last Synced: 2025-10-13T12:23:50.529Z (3 months ago)
- Topics: ai, chatgpt, cli, code-analysis, csharp, developer-tools, dotnet, dotnet-tool, github-copilot, nuget, pattern-detection, roslyn
- Language: C#
- Size: 742 KB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeContext.NET
[](https://github.com/Nonanti/CodeContext.NET/actions/workflows/ci.yml)
[](https://dotnet.microsoft.com)
[](LICENSE)
Ever spent hours explaining your codebase patterns to ChatGPT? Or wished GitHub Copilot understood your team's coding style? **CodeContext.NET** solves that.
## What It Does
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.
```bash
codecontext --path ./MyProject
```
That's it. You get a context file ready to paste into any AI chat.
## Real Example
Let's say you have this in your codebase:
```csharp
private readonly IUserService _userService;
public async Task> 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.
## Quick Start
Install it:
```bash
dotnet tool install --global CodeContext.CLI
```
Run it:
```bash
codecontext
```
You'll get something like:
```
✓ Found 5 patterns
✓ Found 12 packages
✓ Context saved to: codebase-context.md
```
## The Output
Here's what you actually get:
```markdown
Private fields start with underscore (_)
Async methods end with 'Async' suffix
Use Result 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.
## Options
Keep it simple:
```bash
codecontext # scan current folder
codecontext -p ../other-project # scan different folder
codecontext -f json # want JSON instead
codecontext -v # see what it's doing
```
## Why I Built This
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](https://github.com/Nonanti)
Yeah, I totally outsourced the README to our robot overlords. Thanks for Gemini