A plug-and-play library for .NET 6+ that automatically documents complete projects including entities, properties, API endpoints, services and method call graphs. Now with beautiful Swagger UI integration! DocKiller generates comprehensive JSON documentation for AI-powered code understanding and business logic mapping.
$ dotnet add package DocKillerA plug-and-play library for .NET that automatically documents method calls using attributes. DocKiller scans decorated methods and generates JSON mapping with method names, descriptions, origin classes, and call graphs.
[MethodDoc] to include them in documentationInstall via NuGet Package Manager:
dotnet add package DocKiller
Or via Package Manager Console:
Install-Package DocKiller
Add the [MethodDoc] attribute to any method you want to document:
using DocKiller.Attributes;
public class ProductService
{
[MethodDoc("Retrieves a paginated list of products from the database")]
public async Task<List<Product>> GetPaginatedProductsAsync(int page, int pageSize)
{
// Your implementation
}
}
In your Program.cs or startup configuration, add the documentation generation:
using DocKiller.Attributes;
var builder = WebApplication.CreateBuilder(args);
// Configure DocKiller to generate documentation
var outputPath = Path.Combine(Directory.GetCurrentDirectory(), "method-docs.json");
builder.Services.AddMethodDocumentation(outputPath);
var app = builder.Build();
app.Run();
When your application starts, DocKiller will automatically generate a JSON file with all documented methods:
[
{
"method": "GetPaginatedProductsAsync",
"description": "Retrieves a paginated list of products from the database",
"originClass": "ProductService",
"calledMethods": []
}
]For async methods, use the Calls property to explicitly declare which documented methods are called:
public class ProductController : ControllerBase
{
private readonly IProductService _productService;
[MethodDoc("Returns paginated products based on filters",
Calls = new[] { "GetPaginatedProductsAsync" })]
public async Task<ActionResult<List<Product>>> GetProducts(int page, int pageSize)
{
var products = await _productService.GetPaginatedProductsAsync(page, pageSize);
return Ok(products);
}
}
public class ProductService : IProductService
{
[MethodDoc("Retrieves a paginated list of products from the database")]
public async Task<List<Product>> GetPaginatedProductsAsync(int page, int pageSize)
{
// Your implementation
}
}This generates:
[
{
"method": "GetProducts",
"description": "Returns paginated products based on filters",
"originClass": "ProductController",
"calledMethods": ["GetPaginatedProductsAsync"]
},
{
"method": "GetPaginatedProductsAsync",
"description": "Retrieves a paginated list of products from the database",
"originClass": "ProductService",
"calledMethods": []
}
]For synchronous methods, DocKiller can automatically detect calls to other documented methods via IL analysis:
public class OrderService
{
[MethodDoc("Calculates the total price of an order")]
public decimal CalculateTotal(Order order)
{
var subtotal = CalculateSubtotal(order);
var tax = CalculateTax(subtotal);
return subtotal + tax;
}
[MethodDoc("Calculates the subtotal of order items")]
public decimal CalculateSubtotal(Order order)
{
return order.Items.Sum(i => i.Price * i.Quantity);
}
[MethodDoc("Calculates tax on a given amount")]
public decimal CalculateTax(decimal amount)
{
return amount * 0.1m;
}
}DocKiller will automatically detect that CalculateTotal calls both CalculateSubtotal and CalculateTax.
You can optionally filter documentation to specific namespaces:
var outputPath = Path.Combine(Directory.GetCurrentDirectory(), "method-docs.json");
builder.Services.AddMethodDocumentation(outputPath, namespaceFilter: "MyApp.Services");[MethodDoc] attributeCalls property: Uses the provided listMIT License - feel free to use in personal and commercial projects.
Contributions are welcome! Please feel free to submit issues or pull requests.
For issues, questions, or feature requests, please open an issue on the GitHub repository.