Agent skill

Common Lisp Ecosystem

This skill should be used when the user asks to "write common lisp", "CLOS", "ASDF", "defpackage", "defsystem", or works with Common Lisp, SBCL, or Coalton. Provides comprehensive Common Lisp ecosystem patterns and best practices.

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/product/common-lisp-ecosystem

SKILL.md

<common_lisp_fundamentals> Code and data share the same syntax (homoiconicity). Enables powerful macro systems for code transformation.

(defmethod greet ((p person)) (format t "Hello, a!%" (person-name p))) <decision_tree name="when_to_use"> Do you need polymorphic behavior based on multiple types? <if_yes>Use defgeneric and defmethod for multiple dispatch</if_yes> <if_no>Use regular functions for single implementation</if_no> </decision_tree>

(defmethod greet :around ((p person)) (format t "[Start]%") (call-next-method) (format t "[End]%"))

;; In my-project/main.lisp: (defpackage #:my-project/main (:use #:cl) (:import-from #:my-project/utils #:helper)) <decision_tree name="when_to_use"> Do you want automatic dependency inference from package definitions? <if_yes>Use package-inferred-system for modern projects</if_yes> <if_no>Use traditional defsystem with explicit component dependencies</if_no> </decision_tree>

(sb-ext:save-lisp-and-die "my-app" :toplevel #'main :executable t :compression t)

(let ((thread (sb-thread:make-thread (lambda () (setf result (heavy-computation))) :name "worker"))) (sb-thread:join-thread thread))

;; Mutex (defvar lock (sb-thread:make-mutex)) (sb-thread:with-mutex (lock) (critical-section))

(strlen "hello") ; => 5

;; Execute external programs (sb-ext:run-program "/bin/ls" '("-l"))

;; Trigger garbage collection (sb-ext:gc)

;; POSIX interface: sb-posix ;; Network sockets: sb-bsd-sockets

(declare safe-div (Integer -> Integer -> (Maybe Integer))) (define (safe-div x y) (if (== y 0) None (Some (/ x y)))))

(define-instance (Printable Integer) (define (print-it x) (into x))))

<context7_libraries> Available Context7 documentation libraries for Common Lisp ecosystem.

<common_patterns> Resource management with unwind-protect for cleanup. (defmacro with-open-socket ((var host port) &body body) `(let ((,var (make-socket ,host ,port))) (unwind-protect (progn ,@body) (close-socket ,var))))

<best_practices> Use *earmuffs* for special variables Use +plus-signs+ for constants Prefer functional style, minimize mutation Provide restarts for recoverable situations Document exported symbols Use appropriate condition types, not just error Use check-type for argument validation Prefer ASDF package-inferred-system for new projects Consider Qlot for per-project dependency management Use Roswell for portable script execution </best_practices>

<modern_tooling> Per-project dependency manager (like bundler/npm) <use_case>Install dependencies from qlfile</use_case> <use_case>Run commands with project dependencies</use_case> qlot install qlot exec ros run

<anti_patterns> Global mutable state makes code harder to test and reason about. Pass state explicitly or use closures to encapsulate mutable state.

<error_escalation> Style inconsistency Fix formatting, follow project conventions Compilation warning or type error Fix issue, add type declarations if needed Macro expansion error Debug with macroexpand, present options to user Reader macro conflict Block operation, require careful namespace management </error_escalation>

<related_agents> CLOS hierarchy design, system architecture, and package structure planning Common Lisp implementation with proper condition handling and ASDF systems Ensure idiomatic Common Lisp patterns and proper documentation </related_agents>

<related_skills> Navigate CLOS hierarchies, generic functions, and symbol definitions Access ASDF, SBCL, and Common Lisp library documentation Debug condition handling, macro expansion, and SBCL-specific issues </related_skills>

Didn't find tool you were looking for?

Be as detailed as possible for better results