test-driven-development

Encode Emacs Lisp behavior as ERT tests before coding.

28|1|Updated Feb 7, 2026
One-click install
npx skills add https://github.com/Jamie-Cui/magent --skill test-driven-development-jamie-cui
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Jamie-Cui/magent/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/Jamie-Cui/magent --skill test-driven-development-jamie-cui

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TDD helps you define expected behavior upfront, reducing defects and guiding design decisions.

Core Features & Use Cases

  • Establish a red → green cycle to incrementally prove behavior.
  • Use ERT for Emacs Lisp tests to validate code paths and edge cases.
  • Promote safe refactoring by keeping tests green after changes.

Quick Start

Write a failing test that describes the desired behavior, then implement only enough code to make the test pass.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I start test-driven development in Emacs Lisp?

Write a failing ERT test that describes the desired behavior, then implement only enough code to make it pass. Iterate this red-green-refactor cycle to incrementally prove behavior and guide robust Elisp.

What is the red-green-refactor cycle for Elisp unit testing?

The red-green-refactor cycle for Elisp unit testing involves writing a failing ERT test, implementing minimal code to pass it, and refactoring safely while keeping tests green. This process prevents defects by defining expected behavior upfront.

Can I use ERT to validate edge cases in my Emacs Lisp package?

Yes, you can use ERT to validate code paths and edge cases in Emacs Lisp. By encoding expected behavior as tests before coding, you ensure features and bugfixes remain robust throughout iterative refactoring.

Does test-driven development work for fixing bugs in Emacs Lisp?

Test-driven development works for bugfixes in Emacs Lisp by first writing an ERT test that captures the expected behavior and fails with the current bug, then implementing the fix to make the test pass.

When should I not use a test suite for Emacs Lisp development?

You should avoid enforcing a test suite for trivial Emacs Lisp scripts where setup overhead outweighs the benefit, but TDD remains essential for complex packages requiring safe refactoring and edge case validation.