metalama-<version>

Document Metalama aspects, templates, fabrics, and validation for C# metaprogramming.

2|2|Updated Jul 22, 2021
One-click install
npx skills add https://github.com/metalama/Metalama.Documentation --skill metalama-version
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: metalama-<version>
Source: https://github.com/metalama/Metalama.Documentation/tree/main/claude
Command: npx skills add https://github.com/metalama/Metalama.Documentation --skill metalama-version

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides comprehensive documentation and guidance for using Metalama, a powerful C# compile-time metaprogramming framework, enabling developers to write cleaner, more maintainable, and more powerful code through Aspect-Oriented Programming (AOP).

Core Features & Use Cases

  • Conceptual Understanding: Deep dives into aspects, templates (T#), fabrics, validation, and the Metalama code model.
  • API Reference: Detailed documentation for all Metalama namespaces and types.
  • Practical Examples: Working code snippets and pattern libraries for common AOP tasks like caching, contracts, and observability.
  • Use Case: A developer needs to implement a custom logging aspect for all methods in a service layer. They can use this Skill to find the correct base class (OverrideMethodAspect), understand how to implement the logging logic in a template, and learn how to apply the aspect efficiently using a fabric.

Quick Start

Use the metalama skill to find the documentation for creating custom aspects.

Frequently Asked Questions about metalama-<version>

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

FAQPage Schema
How do I implement aspect-oriented programming in C# to add logging to methods?

Aspect-oriented programming in C# uses Metalama to add cross-cutting concerns like logging without modifying business logic. You create a custom aspect by inheriting from `OverrideMethodAspect` and defining a T# template to inject the logging code at compile time.

What is a Metalama fabric and when should I use it to apply aspects?

A Metalama fabric is a compile-time class that programmatically applies aspects across a codebase. You should use fabrics to enforce architectural policies or bulk-apply aspects like caching and validation to entire namespaces or types without manually decorating every method.

Can I use Metalama to validate method parameters and enforce contracts in C#?

Yes, Metalama uses compile-time aspects to validate method parameters and enforce contracts. By applying specific validation aspects, you can automatically inject precondition checks and throw exceptions for invalid arguments before the method executes.

How do I debug a Metalama aspect that is not transforming code as expected?

To debug a Metalama aspect, use the Metalama.Debugging namespace and compile-time diagnostics. You can inspect the transformed code model, add warnings or errors to the build output, and review common pitfalls documented in the API reference.

Does Metalama support compile-time metaprogramming for existing C# projects without runtime dependencies?

Metalama performs compile-time metaprogramming by generating C# code during the build process. It allows you to implement aspects, templates, and fabrics that modify your codebase at compile time, ensuring there are no runtime penalties or external dependencies required.