mesh-traits

Manage Mesh trait interfaces, implementation blocks, and deriving macros.

2|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/snowdamiz/mesh-lang --skill mesh-traits
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mesh-traits
Source: https://github.com/snowdamiz/mesh-lang/tree/main/tools/skill/mesh/skills/traits
Command: npx skills add https://github.com/snowdamiz/mesh-lang --skill mesh-traits

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies defining and implementing shared behavior across different data types in Mesh, enabling code reuse and polymorphism through interfaces and automatic protocol implementations.

Core Features & Use Cases

  • Interface Definitions: Define contracts for methods and associated types.
  • Implementation Blocks: Provide concrete implementations of interfaces for specific types.
  • Deriving Macros: Automatically generate implementations for common protocols like Json, Row, Display, Eq, and Ord.
  • Use Case: Define a Printable interface and implement it for both User and Product structs, allowing you to print any of them uniformly.

Quick Start

Implement the Container interface for a MyList struct with Item as String.

Frequently Asked Questions about mesh-traits

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement shared behavior and polymorphism across different Mesh data types?

To achieve polymorphism in Mesh, you define interface contracts for methods and associated types, then use implementation blocks to provide concrete behavior for specific structs. This enables uniform code reuse across different data types.

Can I automatically generate implementations for common protocols like Json and Display in Mesh?

You can automatically generate implementations for common protocols like Json, Row, Display, Eq, and Ord in Mesh by using deriving macros. This eliminates the need to manually write boilerplate code for standard protocol behavior.

How do I use associated types when defining interfaces for generic programming in Mesh?

Mesh interfaces support associated types for generic programming by allowing you to define placeholder types within the interface contract. You provide concrete types for these placeholders in the implementation block for specific structs.

What is the best way to define a Printable interface and apply it to multiple structs in Mesh?

Define a Printable interface specifying the required methods, then write implementation blocks for each target struct like User or Product. This allows you to handle different structs uniformly through the shared interface.

Does the Mesh trait system support defining contracts for both methods and associated types?

The Mesh trait system fully supports defining contracts for both methods and associated types within interface definitions. This allows you to create complex generic behaviors and enforce structural rules across implementing types.