MCP HubMCP Hub
スキル一覧に戻る

koan-performance

sylin-org
更新日 Today
69 閲覧
2
1
2
GitHubで表示
その他general

について

koan-performanceスキルは、データ集約型アプリケーションを大規模に最適化するための戦略を提供します。これには、大規模データセットのストリーミング、効率的なページネーションの実装、バルク操作の実行、適切なカウント戦略の選択に関するパターンが含まれます。パフォーマンスを維持しながら大量のデータを処理する必要があるアプリケーションを構築する際に、このスキルをご利用ください。

クイックインストール

Claude Code

推奨
プラグインコマンド推奨
/plugin add https://github.com/sylin-org/koan-framework
Git クローン代替
git clone https://github.com/sylin-org/koan-framework.git ~/.claude/skills/koan-performance

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

Koan Performance

Core Principle

Optimize for scale from day one. Use streaming for large datasets, batch operations for bulk changes, fast counts for UI, and pagination for web APIs.

Performance Patterns

Streaming (Large Datasets)

// ❌ WRONG: Load everything into memory
var allTodos = await Todo.All(); // 1 million records!

// ✅ CORRECT: Stream in batches
await foreach (var todo in Todo.AllStream(batchSize: 1000))
{
    await ProcessTodo(todo);
}

Count Strategies

// Fast count (metadata estimate - 1000x+ faster)
var fast = await Todo.Count.Fast(ct); // ~5ms for 10M rows

// Exact count (guaranteed accuracy)
var exact = await Todo.Count.Exact(ct); // ~25s for 10M rows

// Optimized (framework chooses)
var optimized = await Todo.Count; // Uses Fast if available

Use Fast for: Pagination UI, dashboards, estimates Use Exact for: Critical business logic, reports, inventory

Bulk Operations

// Bulk create
var todos = Enumerable.Range(1, 1000)
    .Select(i => new Todo { Title = $"Task {i}" })
    .ToList();
await todos.Save(); // Single operation

// Bulk removal
await Todo.RemoveAll(RemoveStrategy.Fast); // TRUNCATE/DROP (225x faster)

Batch Retrieval

// ❌ WRONG: N queries
foreach (var id in ids)
{
    var todo = await Todo.Get(id);
}

// ✅ CORRECT: 1 query
var todos = await Todo.Get(ids);

Pagination

public async Task<IActionResult> GetTodos(
    int page = 1,
    int pageSize = 20,
    CancellationToken ct = default)
{
    var result = await Todo.QueryWithCount(
        t => !t.Completed,
        new DataQueryOptions { OrderBy = nameof(Todo.Created), Descending = true },
        ct);

    Response.Headers["X-Total-Count"] = result.TotalCount.ToString();
    return Ok(result.Items);
}

Performance Benchmarks

OperationInefficientEfficientSpeedup
Bulk Remove (1M)DELETE loop ~45sTRUNCATE ~200ms225x
Count (10M)Full scan ~25sMetadata ~5ms5000x
Batch Get (100)100 queries1 query100x
Stream (1M)Load all (OOM)Stream batchesMemory safe

When This Skill Applies

  • ✅ Performance tuning
  • ✅ Large datasets
  • ✅ Optimization
  • ✅ Production readiness
  • ✅ Memory issues
  • ✅ Query optimization

Reference Documentation

  • Example Code: .claude/skills/entity-first/examples/batch-operations.cs
  • Guide: docs/guides/performance.md
  • Sample: samples/S14.AdapterBench/ (Performance benchmarks)

GitHub リポジトリ

sylin-org/koan-framework
パス: .claude/skills/performance

関連スキル

algorithmic-art

メタ

This Claude Skill creates original algorithmic art using p5.js with seeded randomness and interactive parameters. It generates .md files for algorithmic philosophies, plus .html and .js files for interactive generative art implementations. Use it when developers need to create flow fields, particle systems, or other computational art while avoiding copyright issues.

スキルを見る

subagent-driven-development

開発

This skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.

スキルを見る

executing-plans

デザイン

Use the executing-plans skill when you have a complete implementation plan to execute in controlled batches with review checkpoints. It loads and critically reviews the plan, then executes tasks in small batches (default 3 tasks) while reporting progress between each batch for architect review. This ensures systematic implementation with built-in quality control checkpoints.

スキルを見る

cost-optimization

その他

This Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.

スキルを見る