- •Write atomic, focused functions. When tempted to add a comment explaining code, refactor it into a function with a clear intention, so that the comment is no longer necessary. Functions should generally be only a few lines long.
- •Never insert empty lines within a function.
- •Put helper functions after the function that calls them, not before.
- •Docstrings should document all arguments, capitalized.
- •Fill all docstrings to 80 characters.
- •The first line of the docstring should be a single-sentence summary.
- •When writing multiline docstrings, do not leave a newline between the first and second lines. But do leave a newline between all successive paragraphs.
- •Do not end error messages with a period.
- •Only add comments if truly necessary to understand the code. Avoid commenting every detail.
- •Never create "fallbacks" to handle problems silently: always choose errors over silent unexpected behavior.
elisp-conventions
Emacs Lisp 编码规范。适用于编写或审查 Elisp 代码时使用。
SKILL.md
--- frontmattername: elisp-conventions description: Emacs Lisp coding conventions. Use when writing or reviewing Elisp code. user-invocable: false