elixir-meta-programming

Installation
SKILL.md

Elixir Metaprogramming & DSLs

How to build Elixir macros and declarative DSLs correctly — for the case where a macro is genuinely warranted and a plain function won't do. Each rule corrects a specific wrong default a capable model makes once it starts writing quote/unquote, __using__, and @before_compile; nothing here restates macro basics the model already knows.

First: is a macro actually warranted?

The default answer is no — reach for a higher-order function, a behaviour, or data-plus-an-interpreter first. That gate is not this skill's job; it lives in the sibling skills and you should apply it before opening this one:

  • staff-level-elixirdata-functions-over-macros (solve it with a function first)
  • adversarial-elixirmeta-functions-not-macro-dsl, meta-use-is-not-import, meta-no-compile-time-coupling

A macro earns its place only when you need something a function cannot give — new syntax, control over whether/when arguments evaluate, or code that must exist at compile time (compiling a schema, generating clauses from a declaration list). Once you've crossed that threshold, this skill is how you do it right.

When to Apply

Installs
21
GitHub Stars
191
First Seen
Jul 6, 2026
elixir-meta-programming — pproenca/dot-skills