Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

emacs-lisp

БесплатноБез исполняемых скриптовНе проверен

Expert guidance for writing professional Emacs Lisp code following the community-driven Emacs Lisp Style Guide by Bozhidar Batsov. Covers layout, naming…

jkitchinот jkitchin★ 45 звёзд на GitHub19 установок в других каталогах

Об этом скилле

Emacs Lisp Style Guide Skill

This skill provides expert guidance for writing professional, maintainable Emacs Lisp code following the community-driven Emacs Lisp Style Guide.

When to Use This Skill

Use this skill when:

  • Writing Emacs configuration files (~/.emacs.d/init.el)
  • Creating Emacs packages or libraries
  • Developing major or minor modes
  • Writing interactive commands and functions
  • Creating keybindings and hooks
  • Refactoring existing Emacs Lisp code
  • Setting up package metadata and autoloads
  • Writing Emacs Lisp macros
  • Creating custom variables and faces

Core Principles

1. Source Code Layout

Indentation and Spacing

Use Spaces, Never Tabs:

;; Good - spaces for indentation
(defun my-function (arg1 arg2)
  (let ((result (+ arg1 arg2)))
    (message "Result: %s" result)))

;; Bad - mixing tabs and spaces (never do this)

Align Function Arguments Vertically:

;; Good - arguments aligned
(defun long-function-name (arg1
                           arg2
                           arg3)
  (body))

;; Good - first arg on new line, aligned with function name
(defun long-function-name
    (arg1 arg2 arg3)
  (body))

;; Bad - inconsistent alignment
(defun long-function-name (arg1
    arg2
  arg3)
  (body))

Special Form Indentation:

;; Special forms use 4-space indent for special arguments,
;; 2-space for body

;; Good - if with proper indentation
(if some-condition
    (do-something)  ; 4 spaces for then-clause
  (do-else))        ; 2 spaces for else-clause

;; Good - let bindings
(let ((var1 value1)
      (var2 value2))  ; 4 spaces for bindings
  (body-form-1)       ; 2 spaces for body
  (body-form-2))

;; Good - when (no special argument)
(when condition
  (do-something)
  (do-more))

Maximum Line Length:

;; Aim for 80 characters per line where reasonable
;; Break long lines logically

;; Good
(defun my-function ()
  "Short description."
  (let ((long-variable-name
         (some-function-that-returns-value)))
    long-variable-name))

;; Acceptable for long strings
(message "This is a very long message that exceeds 80 characters but is kept on one line for readability")

Parentheses:

;; Good - space between text and opening paren
(defun my-function (arg)
  (list arg))

;; Bad - no space after function name
(defun my-function(arg)
  (list arg))

;; Good - all closing parens on same line
(defun my-function ()
  (when condition
    (let ((x 1))
      (+ x 2))))

;; Bad - closing parens on separate lines
(defun my-function ()
  (when condition
    (let ((x 1))
      (+ x 2)
    )
  )
)

Vertical Whitespace:

;; Good - empty line between top-level forms
(defvar my-var1 "value1")

(defvar my-var2 "value2")

(defun my-function ()
  "Do something.")

;; Exception: related definitions can be grouped
(defvar my-var1 "value1")
(defvar my-var2 "value2")
(defvar my-var3 "value3")

2. Syntax and Idioms

Prefer Higher-Level Constructs

Use when Instead of Single-Branch if:

;; Good
(when condition
  (do-something)
  (do-more))

;; Bad
(if condition
    (progn
      (do-something)
      (do-more)))

Use unless for Negated Conditions:

;; Good
(unless condition
  (do-something))

;; Bad
(when (not condition)
  (do-something))

;; Bad
(if (not condition)
    (do-something))

Use not Instead of null:

;; Good - checking for nil/false
(not value)

;; Good - checking for empty list specifically
(null my-list)

;; Bad - using null for general nil check
(null value)

Leverage Comparison Functions:

;; Good - direct comparison
(< 5 x 10)

;; Bad - nested conditions
(and (> x 5) (< x 10))

;; Good - multiple comparisons
(= x y z)

;; Bad - nested comparisons
(and (= x y) (= y z))

Use cond with t as Catch-All:

;; Good
(cond
 ((eq x 'foo) (handle-foo))
 ((eq x 'bar) (handle-bar))
 (t (handle-default)))

;; Bad - else at the end
(cond
 ((eq x 'foo) (handle-foo))
 ((eq x 'bar) (handle-bar))
 (else (handle-default)))

Increment and Decrement:

;; Good
(1+ x)
(1- x)

;; Bad
(+ x 1)
(- x 1)

Prefer with-eval-after-load:

;; Good - modern approach
(with-eval-after-load 'company
  (setq company-idle-delay 0.2))

;; Acceptable but older
(eval-after-load 'company
  '(setq company-idle-delay 0.2))

3. Naming Conventions

General Naming Rules

Use Kebab-Case (Lisp-Case):

;; Good
(defun my-function-name ()
  (let ((my-variable 10))
    my-variable))

;; Bad - using snake_case
(defun my_function_name ()
  (let ((my_variable 10))
    my_variable))

;; Bad - using camelCase
(defun myFunctionName ()
  (let ((myVariable 10))
    myVariable))

Library Name Prefixes:

;; For a library named 'my-package', prefix all public symbols
(defun my-package-do-something ()
  "Public function.")

(defvar my-package-option t
  "Public variable.")

;; Private funct
Полный SKILL.md на GitHub

Установить emacs-lisp в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Edit
Write
Bash
Grep
Glob

Вложенные файлы

QUICK_REFERENCE.mdREADME.mdexamples/library-functions.elexamples/major-mode.elexamples/minor-mode.elexamples/package-template.el

FAQ

Что делает скилл emacs-lisp?

Expert guidance for writing professional Emacs Lisp code following the community-driven Emacs Lisp Style Guide by Bozhidar Batsov. Covers layout, naming conventions, syntax preferences, macros, documentation, and best practices. Use this skill when writing Emacs configuration, creating Emacs packages, writing interactive commands, developing major/minor modes, or refactoring Emacs Lisp code. Emphasizes: lexical binding, proper naming, documentation standards, autoloading, and community conventions.

Как установить скилл emacs-lisp?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл emacs-lisp запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить emacs-lisp с