koan-api-building
EntityController<T>, custom routes, payload transformers, auth policies
Best use case
koan-api-building is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
EntityController<T>, custom routes, payload transformers, auth policies
Teams using koan-api-building should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/koan-api-building/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How koan-api-building Compares
| Feature / Agent | koan-api-building | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
EntityController<T>, custom routes, payload transformers, auth policies
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Koan API Building
## Core Principle
**EntityController<T> provides full CRUD APIs automatically.** Extend with custom routes for business operations. No manual endpoint implementation needed.
## Quick Reference
### Basic CRUD API
```csharp
[Route("api/[controller]")]
public class TodosController : EntityController<Todo>
{
// Full CRUD auto-generated:
// GET /api/todos
// GET /api/todos/{id}
// POST /api/todos
// PUT /api/todos/{id}
// DELETE /api/todos/{id}
// PATCH /api/todos/{id}
}
```
### Custom Routes
```csharp
[Route("api/[controller]")]
public class ProductsController : EntityController<Product>
{
[HttpPost("{id}/discount")]
public async Task<IActionResult> ApplyDiscount(
string id,
[FromBody] DiscountRequest request,
CancellationToken ct)
{
var product = await Product.Get(id, ct);
if (product is null) return NotFound();
await product.ApplyDiscount(request.Amount);
return Ok(product);
}
[HttpGet("overstock")]
public async Task<IActionResult> GetOverstock(CancellationToken ct)
{
var products = await Product.Query(p => p.Stock > 1000, ct);
return Ok(products);
}
}
```
### Auth Policies
```csharp
[Route("api/[controller]")]
[Authorize] // Require authentication for all endpoints
public class OrdersController : EntityController<Order>
{
[HttpGet]
public Task<List<Order>> GetMyOrders(CancellationToken ct)
{
var userEmail = User.FindFirst(ClaimTypes.Email)?.Value;
return Order.Query(o => o.CustomerEmail == userEmail, ct);
}
[HttpPost]
[Authorize(Policy = "CanCreateOrders")] // Require specific policy
public override async Task<IActionResult> Post([FromBody] Order entity)
{
entity.CustomerEmail = User.FindFirst(ClaimTypes.Email)?.Value ?? "";
return await base.Post(entity);
}
}
```
### Payload Transformers
```csharp
public class TodoTransformer : IPayloadTransformer<Todo>
{
public Task<object> TransformAsync(Todo entity)
{
return Task.FromResult<object>(new
{
entity.Id,
entity.Title,
entity.Completed,
_links = new
{
self = $"/api/todos/{entity.Id}",
user = $"/api/users/{entity.UserId}"
}
});
}
}
// Register in KoanAutoRegistrar
services.AddScoped<IPayloadTransformer<Todo>, TodoTransformer>();
```
## When This Skill Applies
- ✅ Building REST APIs
- ✅ Custom endpoints
- ✅ Authentication/authorization
- ✅ Response formatting
- ✅ Error handling
- ✅ API versioning
## Reference Documentation
- **Full Guide:** `docs/guides/building-apis.md`
- **API Conventions:** `docs/api/web-http-api.md`
- **Sample:** `samples/S1.Web/Controllers/`Related Skills
building-with-llms
Help users build effective AI applications. Use when someone is building with LLMs, writing prompts, designing AI features, implementing RAG, creating agents, running evals, or trying to improve AI output quality.
building-agents
Expert at creating and modifying Claude Code agents (subagents). Auto-invokes when the user wants to create, update, modify, enhance, validate, or standardize agents, or when modifying agent YAML frontmatter fields (especially 'model', 'tools', 'description'), needs help designing agent architecture, or wants to understand agent capabilities. Also auto-invokes proactively when Claude is about to write agent files (*/agents/*.md), create modular agent architectures, or implement tasks that involve creating agent components.
koan-ai-integration
Chat endpoints, embeddings, RAG workflows, vector search
building-ai-chat
Builds AI chat interfaces and conversational UI with streaming responses, context management, and multi-modal support. Use when creating ChatGPT-style interfaces, AI assistants, code copilots, or conversational agents. Handles streaming text, token limits, regeneration, feedback loops, tool usage visualization, and AI-specific error patterns. Provides battle-tested components from leading AI products with accessibility and performance built in.
bgo
Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.
large-data-with-dask
Specific optimization strategies for Python scripts working with larger-than-memory datasets via Dask.
langsmith-fetch
Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio. Use when debugging agent behavior, investigating errors, analyzing tool calls, checking memory operations, or examining agent performance. Automatically fetches recent traces and analyzes execution patterns. Requires langsmith-fetch CLI installed.
langchain-tool-calling
How chat models call tools - includes bind_tools, tool choice strategies, parallel tool calling, and tool message handling
langchain-notes
LangChain 框架学习笔记 - 快速查找概念、代码示例和最佳实践。包含 Core components、Middleware、Advanced usage、Multi-agent patterns、RAG retrieval、Long-term memory 等主题。当用户询问 LangChain、Agent、RAG、向量存储、工具使用、记忆系统时使用此 Skill。
langchain-js
Builds LLM-powered applications with LangChain.js for chat, agents, and RAG. Use when creating AI applications with chains, memory, tools, and retrieval-augmented generation in JavaScript.
langchain-agents
Expert guidance for building LangChain agents with proper tool binding, memory, and configuration. Use when creating agents, configuring models, or setting up tool integrations in LangConfig.
lang-python
Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when developing Python APIs, web applications, data pipelines, or writing tests.