cl-macro-design

Enforce hygienic macros with gensym-safe bindings in Common Lisp.

1|Updated Dec 8, 2025
One-click install
npx skills add https://github.com/cxxxr/.claude --skill cl-macro-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cl-macro-design
Source: https://github.com/cxxxr/.claude/tree/main/skills/cl-macro-design
Command: npx skills add https://github.com/cxxxr/.claude --skill cl-macro-design

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

マクロ設計のベストプラクティスを適用することで、再利用性・保守性・安全性を高め、複雑なコードをより理解しやすくします。

Core Features & Use Cases

  • 衛生的マクロの推奨: 変数捕捉を防ぐ安全なマクロ設計
  • パターンの活用: CALL-WITH スタイル、with-open などの設計パターン
  • 展開検証: macroexpand-1/完全展開、SLIMEでの展開確認
  • 設計パターンの整理: プロトコル、ミックスイン、ビジター、シングルトンの実装例

Quick Start

Google style ガイドを参照しつつ、簡易なマクロを作成して安全性・拡張性を検証します(references ディレクトリのガイドを参照)。

Frequently Asked Questions about cl-macro-design

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

FAQPage Schema
How do I prevent variable capture when writing Common Lisp macros?

Hygienic macros prevent variable capture by using gensym to generate unique symbols that won't collide with user code. This Skill enforces hygienic macro construction techniques in Common Lisp to ensure safe, reusable macro designs that avoid unintended variable bindings.

What are the best practices for designing macros that evaluate arguments safely?

Best practices include single-evaluation argument handling—ensuring macro arguments are evaluated exactly once—and using established patterns like with-open and call-with styles. This Skill covers macro-design patterns, expansion verification, and templates that prevent multiple evaluations and unsafe argument handling.

How do I verify that my Common Lisp macro expands correctly?

Macro expansion verification uses macroexpand-1 for single-step expansion and full expansion checking, with SLIME integration for interactive verification. This Skill provides workflows to inspect and validate macro expansions before deployment.

Can I use design patterns like with-open-database and define-api-endpoint as macro templates?

Yes. This Skill provides documented macro-design pattern templates—including with-open-database, do-lines, and define-api-endpoint—that enforce hygienic construction and gensym-safe bindings for reliable, reusable macro abstractions in Common Lisp projects.

What makes a macro design unsafe, and how do I fix it?

Unsafe macro design stems from variable capture, multiple evaluation of arguments, and uncontrolled code generation. This Skill identifies and resolves these problems through hygienic macro enforcement, single-evaluation patterns, and documented design workflows following Google-style macro guidelines.