skillsaw Create Plugin
Create a skillsaw rule plugin: a Python package that adds lint
rules to skillsaw. Once you build and publish to PyPI, anyone can
pip install it and skillsaw picks up the rules automatically — no config
required. Prefer this to per-repo custom-rules: files when sharing rules across repos.
Keep the terminology straight: a skillsaw plugin adds rules to the skillsaw
linter itself. Never confuse it with the Claude Code plugins that skillsaw lints.
Review this reference material while you work:
- Read the plugin guide: https://skillsaw.org/plugins/
- Follow the rule-writing guide (lint tree, block types): https://skillsaw.org/custom-rules/ and https://skillsaw.org/lint-tree/
- Read the complete working example:
examples/plugins/skillsaw-example-plugin/in the skillsaw repo
Follow each step in order, and keep the user updated on progress at each stage.
Step 1: Gather requirements
Review the following with the user:
- What should each rule check? Get concrete examples of content that should pass and content that should fail.
- Rule IDs — use kebab-case, descriptive (e.g.
no-todo-instructions).
Run skillsaw list-rules and confirm no ID collides with a builtin rule or
another installed plugin; skillsaw never loads colliding plugin rules.
- Severity — set each rule to
error(must fix),warning(should fix), orinfo(advisory). - Package name — follow the convention
skillsaw-<name>on PyPI with moduleskillsaw_<name>(e.g.skillsaw-acme-rules/skillsaw_acme_rules). - Tunable settings — set anything a user could reasonably want to adjust
(patterns, thresholds, allowlists) in config_schema; never hardcode it.
Step 2: Create the package layout
Create this layout:
skillsaw-<name>/
├── pyproject.toml
├── README.md
├── src/
│ └── skillsaw_<name>/
│ ├── __init__.py
│ └── rules.py
└── tests/
├── fixture/
│ └── CLAUDE.md # realistic fixture the rules run against
└── test_rules.py
Write pyproject.toml — the entry point is what makes it a plugin:
[build-system]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"
[project]
name = "skillsaw-<name>"
version = "0.1.0"
description = "<one line: what the rules enforce>"
readme = "README.md"
requires-python = ">=3.9"
dependencies = ["skillsaw>=0.23.0"]
[project.entry-points."skillsaw.plugins"]
<name> = "skillsaw_<name>"
[tool.setuptools.packages.find]
where = ["src"]
Set the entry point name (left of =) as the plugin's short name — it appears in
skillsaw plugins output and in plugins: {disable: [...]} config. Use it to point at the module that declares the rules.
Write src/skillsaw_<name>/__init__.py:
from .rules import MyFirstRule
SKILLSAW_RULES = [MyFirstRule]
Declare every rule class the plugin provides in SKILLSAW_RULES — the explicit list skillsaw looks for.