| name | nvim-plugin |
| description | Neovim plugin development best practices and patterns. Use when planning, editing, implementing, or reviewing Neovim Lua plugin code — structuring a new plugin, writing setup/config, highlights, autocmds, keymaps, health checks, type annotations, debounce, state management, or user commands. Also use when the user asks about plugin architecture, conventions, or "how should I implement" a Neovim plugin feature. Do not use for general Lua development unrelated to Neovim plugins, Neovim configuration (init.lua), or running/debugging tests (use nvim-test).
|
Neovim Plugin Development
This skill provides patterns and best practices for Neovim plugin development.
Read the reference files below on demand based on the current task.
Reference Files
Read these on demand based on the task. Do NOT load all three at once.
Each file has a table of contents at the top with anchors for navigation.
references/RECIPES.md
Complete code examples for every plugin pattern.
- Project Structure
- Setup & Configuration
- Module Organization
- Plugin File (user commands, lazy loading)
- Highlight Groups
- Autocmds
- Keymaps
- Health Checks
- Error Handling & Notifications
- Type Annotations
- Debounce
- State Management (per-buffer cache)
- User Commands (subcommands with completion)
- Anti-Patterns
references/TYPES.md
LuaCATS type annotation reference for Neovim plugins.
- Quick Start (minimum annotations every plugin needs)
- Type Syntax Reference (primitives, compound types, Neovim-specific)
- Annotation Tags — Complete Reference (@class, @field, @type, @alias, @enum, @param, @return, @generic, @overload, @operator, @cast, visibility modifiers)
- Neovim Plugin Type Patterns (autocmd callbacks, keymaps, highlights, buffers, LSP, commands)
- Definition Files (@meta)
- Config Type Patterns (separate classes vs partial)
- Diagnostic Configuration (.luarc.json settings)
references/TESTS.md
Testing patterns for writing and implementing tests (mini.test + luassert).
For running tests and diagnosing failures, use the nvim-test skill.
- Test File Structure
- Assertions Quick Reference
- Table-Driven Tests
- Stubbing and Restoring
- Creating Test Buffers
- Testing with File Buffers
- Testing Config Changes
- Conditional Tests
- Testing Notifications
- Testing Highlights
- Testing Autocmds
- Testing Keymaps
- Test Anti-Patterns
- Advanced Testing Patterns
Working with existing plugins
When modifying an existing plugin:
- Read the existing code first — match the project's conventions
- Check
CONTRIBUTING.md and AGENTS.md for project-specific rules
- Look at existing
_spec.lua files to match testing style
- Look at existing highlight/autocmd patterns and be consistent
File locations in this project
- Plugin source:
lua/base/
- Tests:
tests/
- Plugin commands:
plugin/base.lua
- Documentation:
doc/base.txt