An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# CodeContext.NET

[![CI](https://github.com/Nonanti/CodeContext.NET/actions/workflows/ci.yml/badge.svg)](https://github.com/Nonanti/CodeContext.NET/actions/workflows/ci.yml)
[![.NET](https://img.shields.io/badge/.NET-9.0-512BD4)](https://dotnet.microsoft.com)
[![License](https://img.shields.io/badge/license-MIT-blue)](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