aboutsummaryrefslogtreecommitdiff
path: root/languages/elisp/CLAUDE.md
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-04-19 11:57:23 -0500
committerCraig Jennings <c@cjennings.net>2026-04-19 11:57:23 -0500
commit18fcaf9f27d03849487078b30f667c3b574e6554 (patch)
tree67e3ede717fbf9fbfe10c46042451e15abeeb91f /languages/elisp/CLAUDE.md
parentf8c593791ae051b07dba2606c18f1deb7589825e (diff)
downloadrulesets-18fcaf9f27d03849487078b30f667c3b574e6554.tar.gz
rulesets-18fcaf9f27d03849487078b30f667c3b574e6554.zip
feat: add per-project language bundles + elisp ruleset
Introduces a second install mode alongside the existing global symlinks: per-project language bundles that copy a language-specific Claude Code setup (rules, hooks, settings, pre-commit) into a target project. Layout additions: languages/elisp/ - Emacs Lisp bundle (rules, hooks, settings, CLAUDE.md) scripts/install-lang.sh - shared install logic Makefile additions: make help - unified help text make install-lang LANG=<lang> PROJECT=<path> [FORCE=1] make install-elisp PROJECT=<path> [FORCE=1] (shortcut) make list-languages - show available bundles Elisp bundle contents: - CLAUDE.md template (seed on first install, preserved on update) - .claude/rules/elisp.md, elisp-testing.md, verification.md - .claude/hooks/validate-el.sh (check-parens, byte-compile, run matching tests) - .claude/settings.json (permission allowlist, hook wiring) - githooks/pre-commit (secret scan + staged-file paren check) - gitignore-add.txt (append .claude/settings.local.json) Hooks use \$CLAUDE_PROJECT_DIR with a script-relative fallback, so the same bundle works on any machine or clone path. Install activates git hooks via core.hooksPath=githooks automatically. Re-running install is idempotent; CLAUDE.md is never overwritten without FORCE=1.
Diffstat (limited to 'languages/elisp/CLAUDE.md')
-rw-r--r--languages/elisp/CLAUDE.md66
1 files changed, 66 insertions, 0 deletions
diff --git a/languages/elisp/CLAUDE.md b/languages/elisp/CLAUDE.md
new file mode 100644
index 0000000..9b95e4f
--- /dev/null
+++ b/languages/elisp/CLAUDE.md
@@ -0,0 +1,66 @@
+# CLAUDE.md
+
+## Project
+
+Elisp project. Customize this section with your own description, layout, and conventions.
+
+**Typical layout:**
+- `init.el`, `early-init.el` — entry points (Emacs config projects)
+- `modules/*.el` — feature modules
+- `tests/test-*.el` — ERT unit tests
+- `tests/testutil-*.el` — shared test fixtures and mocks
+
+## Build & Test Commands
+
+If the project has a Makefile, document targets here. Common pattern:
+
+```bash
+make test # All tests
+make test-file FILE=tests/test-foo.el # One file
+make test-name TEST=pattern # Match test names
+make validate-parens # Balanced parens in modules
+make validate-modules # Load all modules to verify they compile
+make compile # Byte-compile (writes .elc)
+make lint # checkdoc + package-lint + elisp-lint
+```
+
+Alternative build tools: `eldev`, `cask`, or direct `emacs --batch` invocations.
+
+## Language Rules
+
+See rule files in `.claude/rules/`:
+- `elisp.md` — code style and patterns
+- `elisp-testing.md` — ERT conventions
+- `verification.md` — verify-before-claim-done discipline
+
+## Git Workflow
+
+- Conventional commit prefixes: `feat:`, `fix:`, `refactor:`, `test:`, `docs:`, `chore:`
+- Pre-commit hook in `githooks/` scans for secrets and runs `check-parens` on staged `.el` files
+- Activate on fresh clone: `git config core.hooksPath githooks`
+
+## Problem-Solving Approach
+
+Investigate before fixing. When diagnosing a bug:
+1. Read the relevant module and trace what actually happens
+2. Identify the root cause, not a surface symptom
+3. Write a failing test that captures the correct behavior
+4. Fix, then re-run tests
+
+## Testing Discipline
+
+TDD is the default: write a failing test before any implementation. If you can't write the test, you don't yet understand the change. Details in `.claude/rules/elisp-testing.md`.
+
+## Editing Discipline
+
+A PostToolUse hook runs `check-parens` + `byte-compile-file` on every `.el` file after Edit/Write/MultiEdit. Byte-compile warnings (free variables, wrong argument counts) are signal — read them.
+
+Prefer Write over cumulative Edits for nontrivial new code. Small functions (under 15 lines) are near-impossible to get wrong; deeply nested code is where paren errors hide.
+
+## What Not to Do
+
+- Don't add features beyond what was asked
+- Don't refactor surrounding code when fixing a bug
+- Don't add comments to code you didn't change
+- Don't create abstractions for one-time operations
+- Don't commit `.env` files, credentials, or API keys — pre-commit hook catches common patterns but isn't a substitute for care