m04-zero-cost — for Claude Code m04-zero-cost, rust-photo-lib, community, for Claude Code, ide skills, fn foo<T: Trait>(), fn foo(x: &dyn Trait), impl Trait, Box<dyn Trait>, Zero-Cost

v1.0.0

このスキルについて

適した場面: Ideal for AI agents that need zero-cost abstraction. ローカライズされた概要: This is a rust lib for processing photos. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

機能

Zero-Cost Abstraction
Layer 1: Language Mechanics
Do we need compile-time or runtime polymorphism?
Before choosing between generics and trait objects:
Is the type known at compile time?

# 主なトピック

shaoyuanyu shaoyuanyu
[2]
[1]
更新日: 4/1/2026

Skill Overview

Start with fit, limitations, and setup before diving into the repository.

適した場面: Ideal for AI agents that need zero-cost abstraction. ローカライズされた概要: This is a rust lib for processing photos. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

このスキルを使用する理由

推奨ポイント: m04-zero-cost helps agents zero-cost abstraction. This is a rust lib for processing photos. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

おすすめ

適した場面: Ideal for AI agents that need zero-cost abstraction.

実現可能なユースケース for m04-zero-cost

ユースケース: Applying Zero-Cost Abstraction
ユースケース: Applying Layer 1: Language Mechanics
ユースケース: Applying Do we need compile-time or runtime polymorphism

! セキュリティと制限

  • 制約事項: Do we need compile-time or runtime polymorphism?
  • 制約事項: Error Don't Just Say Ask Instead
  • 制約事項: E0038 "Make object-safe" Do we really need dynamic dispatch?

About The Source

The section below comes from the upstream repository. Use it as supporting material alongside the fit, use-case, and installation summary on this page.

Labs デモ

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

FAQ とインストール手順

These questions and steps mirror the structured data on this page for better search understanding.

? よくある質問

m04-zero-cost とは何ですか?

適した場面: Ideal for AI agents that need zero-cost abstraction. ローカライズされた概要: This is a rust lib for processing photos. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

m04-zero-cost はどうやって導入しますか?

次のコマンドを実行してください: npx killer-skills add shaoyuanyu/rust-photo-lib。Cursor、Windsurf、VS Code、Claude Code など19以上のIDEで使えます。

m04-zero-cost の主な用途は?

主な用途は次のとおりです: ユースケース: Applying Zero-Cost Abstraction, ユースケース: Applying Layer 1: Language Mechanics, ユースケース: Applying Do we need compile-time or runtime polymorphism。

m04-zero-cost に対応するIDEは?

このスキルは Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer に対応しています。統一された導入には Killer-Skills CLI を使えます。

m04-zero-cost に制限はありますか?

制約事項: Do we need compile-time or runtime polymorphism?. 制約事項: Error Don't Just Say Ask Instead. 制約事項: E0038 "Make object-safe" Do we really need dynamic dispatch?.

このスキルの導入方法

  1. 1. ターミナルを開く

    プロジェクトディレクトリでターミナルまたはコマンドラインを開きます。

  2. 2. インストールコマンドを実行

    npx killer-skills add shaoyuanyu/rust-photo-lib を実行してください。CLI がIDEまたはエージェントを自動検出し、スキルを設定します。

  3. 3. スキルを使い始める

    このスキルはすぐに有効になります。現在のプロジェクトで m04-zero-cost をすぐ使えます。

! Source Notes

This page is still useful for installation and source reference. Before using it, compare the fit, limitations, and upstream repository notes above.

Upstream Repository Material

The section below comes from the upstream repository. Use it as supporting material alongside the fit, use-case, and installation summary on this page.

Upstream Source

m04-zero-cost

This is a rust lib for processing photos. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows. Zero-Cost Abstraction

SKILL.md
Readonly
Upstream Repository Material
The section below comes from the upstream repository. Use it as supporting material alongside the fit, use-case, and installation summary on this page.
Upstream Source

Zero-Cost Abstraction

Layer 1: Language Mechanics

Core Question

Do we need compile-time or runtime polymorphism?

Before choosing between generics and trait objects:

  • Is the type known at compile time?
  • Is a heterogeneous collection needed?
  • What's the performance priority?

Error → Design Question

ErrorDon't Just SayAsk Instead
E0277"Add trait bound"Is this abstraction at the right level?
E0308"Fix the type"Should types be unified or distinct?
E0599"Import the trait"Is the trait the right abstraction?
E0038"Make object-safe"Do we really need dynamic dispatch?

Thinking Prompt

Before adding trait bounds:

  1. What abstraction is needed?

    • Same behavior, different types → trait
    • Different behavior, same type → enum
    • No abstraction needed → concrete type
  2. When is type known?

    • Compile time → generics (static dispatch)
    • Runtime → trait objects (dynamic dispatch)
  3. What's the trade-off priority?

    • Performance → generics
    • Compile time → trait objects
    • Flexibility → depends

Trace Up ↑

When type system fights back:

E0277 (trait bound not satisfied)
    ↑ Ask: Is the abstraction level correct?
    ↑ Check: m09-domain (what behavior is being abstracted?)
    ↑ Check: m05-type-driven (should use newtype?)
Persistent ErrorTrace ToQuestion
Complex trait boundsm09-domainIs the abstraction right?
Object safety issuesm05-type-drivenCan typestate help?
Type explosionm10-performanceAccept dyn overhead?

Trace Down ↓

From design to implementation:

"Need to abstract over types with same behavior"
    ↓ Types known at compile time → impl Trait or generics
    ↓ Types determined at runtime → dyn Trait

"Need collection of different types"
    ↓ Closed set → enum
    ↓ Open set → Vec<Box<dyn Trait>>

"Need to return different types"
    ↓ Same type → impl Trait
    ↓ Different types → Box<dyn Trait>

Quick Reference

PatternDispatchCode SizeRuntime Cost
fn foo<T: Trait>()Static+bloatZero
fn foo(x: &dyn Trait)DynamicMinimalvtable lookup
impl Trait returnStatic+bloatZero
Box<dyn Trait>DynamicMinimalAllocation + vtable

Syntax Comparison

rust
1// Static dispatch - type known at compile time 2fn process(x: impl Display) { } // argument position 3fn process<T: Display>(x: T) { } // explicit generic 4fn get() -> impl Display { } // return position 5 6// Dynamic dispatch - type determined at runtime 7fn process(x: &dyn Display) { } // reference 8fn process(x: Box<dyn Display>) { } // owned

Error Code Reference

ErrorCauseQuick Fix
E0277Type doesn't impl traitAdd impl or change bound
E0308Type mismatchCheck generic params
E0599No method foundImport trait with use
E0038Trait not object-safeUse generics or redesign

Decision Guide

ScenarioChooseWhy
Performance criticalGenericsZero runtime cost
Heterogeneous collectiondyn TraitDifferent types at runtime
Plugin architecturedyn TraitUnknown types at compile
Reduce compile timedyn TraitLess monomorphization
Small, known type setenumNo indirection

Object Safety

A trait is object-safe if it:

  • Doesn't have Self: Sized bound
  • Doesn't return Self
  • Doesn't have generic methods
  • Uses where Self: Sized for non-object-safe methods

Anti-Patterns

Anti-PatternWhy BadBetter
Over-generic everythingCompile time, complexityConcrete types when possible
dyn for known typesUnnecessary indirectionGenerics
Complex trait hierarchiesHard to understandSimpler design
Ignore object safetyLimits flexibilityPlan for dyn if needed

WhenSee
Type-driven designm05-type-driven
Domain abstractionm09-domain
Performance concernsm10-performance
Send/Sync boundsm07-concurrency

関連スキル

Looking for an alternative to m04-zero-cost or another community skill for your workflow? Explore these related open-source skills.

すべて表示

openclaw-release-maintainer

Logo of openclaw
openclaw

ローカライズされた概要: 🦞 # OpenClaw Release Maintainer Use this skill for release and publish-time workflow. It covers ai, assistant, crustacean workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

333.8k
0
AI

widget-generator

Logo of f
f

ローカライズされた概要: Generate customizable widget plugins for the prompts.chat feed system # Widget Generator Skill This skill guides creation of widget plugins for prompts.chat . It covers ai, artificial-intelligence, awesome-list workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf

149.6k
0
AI

flags

Logo of vercel
vercel

ローカライズされた概要: The React Framework # Feature Flags Use this skill when adding or changing framework feature flags in Next.js internals. It covers blog, browser, compiler workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

138.4k
0
ブラウザ

pr-review

Logo of pytorch
pytorch

ローカライズされた概要: Usage Modes No Argument If the user invokes /pr-review with no arguments, do not perform a review . It covers autograd, deep-learning, gpu workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

98.6k
0
開発者