一键导入
koan-quickstart
Zero to first Koan app in under 10 minutes (S0 + S1 patterns)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Zero to first Koan app in under 10 minutes (S0 + S1 patterns)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | koan-quickstart |
| description | Zero to first Koan app in under 10 minutes (S0 + S1 patterns) |
Get productive in under 10 minutes. Create entities, save data, expose APIs with minimal code.
dotnet new web -n MyKoanApp
cd MyKoanApp
dotnet add package Koan.Core --version 0.6.3
dotnet add package Koan.Data.Core --version 0.6.3
dotnet add package Koan.Data.Connector.Json --version 0.6.3
dotnet add package Koan.Web --version 0.6.3
using Koan.Core;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddKoan();
var app = builder.Build();
app.Run();
// Models/Todo.cs
using Koan.Data.Core;
public class Todo : Entity<Todo>
{
public string Title { get; set; } = "";
public bool Completed { get; set; }
}
// Controllers/TodosController.cs
using Koan.Web;
using Microsoft.AspNetCore.Mvc;
[Route("api/[controller]")]
public class TodosController : EntityController<Todo>
{
// Full CRUD API auto-generated!
}
dotnet run
# Test endpoints:
curl http://localhost:5000/api/todos
curl -X POST http://localhost:5000/api/todos \
-H "Content-Type: application/json" \
-d '{"title":"First task","completed":false}'
Done! You now have a working CRUD API with:
public class User : Entity<User>
{
public string Name { get; set; } = "";
}
public class Todo : Entity<Todo>
{
public string Title { get; set; } = "";
public string UserId { get; set; } = "";
public Task<User?> GetUser(CancellationToken ct = default) =>
User.Get(UserId, ct);
}
# Add PostgreSQL
dotnet add package Koan.Data.Connector.Postgres
# Update appsettings.json
{
"Koan": {
"Data": {
"Sources": {
"Default": {
"Adapter": "postgres",
"ConnectionString": "Host=localhost;Database=myapp;Username=koan;Password=dev"
}
}
}
}
}
# Entity code unchanged! Provider transparency.
samples/S0.ConsoleJsonRepo/ (Minimal 20-line example)samples/S1.Web/ (Full web app with relationships)docs/getting-started/overview.mdAuto-registration via KoanAutoRegistrar, minimal Program.cs, "Reference = Intent" pattern
Chat endpoints, embeddings, RAG workflows, vector search
Aggregate boundaries, relationships, lifecycle hooks, value objects
Entity<T> patterns, GUID v7 auto-generation, static methods vs manual repositories
Transparent L1/L2 caching for Entity<T>, [Cacheable] attribute, cross-node coherence, per-request opt-out
Run a mandatory pre-implementation exploration workflow before writing production code in Koan (.NET/C#). Use when a task requires code changes and Codex must first map concerns/layers, read relevant files and docs, check existing constants and types, identify the closest existing pattern, plan exact code placement, and confirm architectural guardrails.