skillsaw-create-plugin
Skill68 starsChanged 4 months agoApache-2.0View on GitHub
Create a skillsaw rule plugin — a pip-installable Python package that adds custom lint rules to skillsaw. Walks through scaffolding the package, writing rules against the lint tree, testing, and publishing to PyPI. Use when a user wants to share skillsaw rules across repositories or publish them for others.
- Installs packages
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/development.mdcCursor rule
- .cursor/rules/python.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- skillsaw-create-pluginSkill
- skillsaw-ecosystem-scoutSkill
- skillsaw-fixSkill
- skillsaw-issueSkill
- skillsaw-issue-solverSkill
- skillsaw-issue-triageSkill
- skillsaw-lintSkill
- skillsaw-maintenanceSkill
- skillsaw-onboardSkill
- skillsaw-pr-followupSkill
- skillsaw-release-readySkill
- skillsaw-releaseSkill
- skillsaw-review-panelSkill
- skillsaw-updateSkill
- skillsaw-create-pluginSkill
- skillsaw-ecosystem-scoutSkill
- skillsaw-fixSkill
- skillsaw-issueSkill
- skillsaw-issue-solverSkill
- skillsaw-issue-triageSkill
- skillsaw-lintSkill
- skillsaw-maintenanceSkill
- skillsaw-onboardSkill
- skillsaw-pr-followupSkill
- skillsaw-release-readySkill
- skillsaw-releaseSkill
- skillsaw-review-panelSkill
- skillsaw-updateSkill
- skillsaw-fixSkill
- skillsaw-issueSkill
- skillsaw-lintSkill
- skillsaw-onboardSkill
- skillsaw-updateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
24 rules. About 0 are common, 7 are distinctive, and 17 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
17
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Create a skillsaw rule plugin: a Python package that adds lint rules to skillsaw.
- Very specific: line 18
Keep the terminology straight: a *skillsaw plugin* adds rules to the skillsaw linter itself.
- Very specific: line 23
Read the plugin guide: https://skillsaw.org/plugins/
- Very specific: line 24
Follow the rule-writing guide (lint tree, block types): https://skillsaw.org/custom-rules/ and https://skillsaw.org/lint-tree/
- Very specific: line 25
Read the complete working example: examples/plugins/skillsaw-example-plugin/ in the skillsaw repo
- Distinctive: line 27
Follow each step in order, and keep the user updated on progress at each stage.
- Very specific: line 35
Run skillsaw list-rules and confirm no ID collides with a builtin rule or another installed plugin.
- Very specific: line 60
Write pyproject.toml — the entry point is what makes it a plugin:
- Very specific: line 97
Read references/rule-authoring.md in this skill's directory for the full rule template, the requirements every rule must meet (lint tree …
- Very specific: line 111
Read references/extensions.md when the plugin needs any of:
- Very specific: line 122
Write tests in tests/test_rules.py that cover at minimum:
- Distinctive: line 124
Verify the rule fires on the fixture with the expected message and line number.
- Distinctive: line 125
Check that clean content produces no violations.
- Very specific: line 126
Verify config_schema settings change behavior.
- Distinctive: line 127
If the rule has autofix: check the fix removes only the flagged lines, re-checking fixed content finds nothing, and fixing twice is a no-op.
- Distinctive: line 132
Keep the fixture realistic — a CLAUDE.md that looks like a real project's, not a one-line stub.
- Very specific: line 146
Run skillsaw plugins — the plugin appears with its rules and no ERROR lines.
- Very specific: line 147
Run skillsaw lint <repo-with-violations> — the rule fires, and the violation's source is plugin:<name> in --format json output.
- Very specific: line 149
Run skillsaw explain <rule-id> — it shows the rule's description and config.
- Very specific: line 150
If it has autofix: run skillsaw fix --rule <rule-id> to apply it.
- Very specific: line 152
Run skillsaw lint --no-plugins — the rule disappears, confirming it loads via the entry point and never some other path.
- Distinctive: line 157
Write the plugin's README.md, documenting:
- Distinctive: line 166
Ask the user whether to publish now.
- Very specific: line 178
After publishing, verify a fresh pip install from PyPI works in a clean environment:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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). Runskillsaw list-rulesand 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.pyWrite 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.21.1"]
[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.
Step 3: Write the rules
Read references/rule-authoring.md in this skill's directory for the full
rule template, the requirements every rule must meet (lint tree discovery,
line numbers, config_schema, repo_types, default_enabled, YAML and
markdown parsing rules), and the deterministic-autofix template with its
scoping and idempotency requirements. Follow it exactly — the requirements
match what skillsaw's own review process enforces.
Implement each rule as a subclass of skillsaw.Rule in
src/skillsaw_<name>/rules.py: use context.lint_tree.find(NodeType) to find
files, add violations via self.violation(message, block=block, line=i), and
set tunable settings through config_schema.
Add optional capabilities
Read references/extensions.md when the plugin needs any of:
- A CLI subcommand — add a
skillsaw-<name>console script, dispatched asskillsaw <name> [args...](registered plugins only). - A custom repo type — declare a detector in
SKILLSAW_REPO_TYPES; detected types scope rules (string entries inrepo_types) and pull the type'scontent_pathsinto content linting. - Lint tree nodes — use
SKILLSAW_TREE_CONTRIBUTORSto attach plugin-defined blocks (ContentBlockfor prose,JsonConfigBlockfor machine config), and let rules read them withlint_tree.find().
Step 4: Write tests
<!-- skillsaw-disable-next-line content-unlinked-internal-reference -->Write tests in tests/test_rules.py that cover at minimum:
- Verify the rule fires on the fixture with the expected message and line number.
- Check that clean content produces no violations.
- Verify
config_schemasettings change behavior. - If the rule has autofix: check the fix removes only the flagged lines, re-checking
fixed content finds nothing, and fixing twice is a no-op. Call
invalidate_read_caches()(fromskillsaw.rules.builtin.utils) — always call it before you re-check, since skillsaw caches file reads within a process.
Keep the fixture realistic — a CLAUDE.md that looks like a real project's, not a one-line stub. Follow the example plugin's tests for the full pattern.
Run the tests:
$ python -m venv .venv && .venv/bin/pip install -e . pytest
$ .venv/bin/pytestStep 5: Verify the plugin end-to-end
Install the package with pip install -e . in the same environment as skillsaw:
- Run
skillsaw plugins— the plugin appears with its rules and no ERROR lines. - Run
skillsaw lint <repo-with-violations>— the rule fires, and the violation'ssourceisplugin:<name>in--format jsonoutput; verify it. - Run
skillsaw explain <rule-id>— it shows the rule's description and config. - If it has autofix: run
skillsaw fix --rule <rule-id>to apply it; a second run changes nothing. - Run
skillsaw lint --no-plugins— the rule disappears, confirming it loads via the entry point and never some other path.
Step 6: Write the README
Write the plugin's README.md, documenting:
- Include what the rules enforce and why, with a violating and a passing example.
- Install instructions (
pip install skillsaw-<name>). - Include each rule's ID, default severity, and
config_schemaoptions with a.skillsaw.yamlsnippet. - Include how to disable:
plugins: {disable: [<name>]}or per-ruleenabled: false.
Step 7: Build and publish to PyPI
Ask the user whether to publish now; if yes, run:
$ pip install build twine
$ python -m build
$ twine upload dist/*For a GitHub-hosted plugin, offer to set up trusted publishing with a release workflow instead of long-lived API tokens; always pin action SHAs.
After publishing, verify a fresh pip install from PyPI works in a clean environment:
$ pip install skillsaw-<name>
$ skillsaw pluginsStep 8: Wrap up
Report to the user:
- Package name, module, and entry point name
- Rules created (ID, severity, autofix support, config options)
- Test results
- Where it was published (or how to publish later)
- How users consume it:
pip install skillsaw-<name>next to skillsaw, then rules run automatically; configure per rule ID in.skillsaw.yaml
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

