agentleFS
markrammmarkramm/pyrite/.claude/skills/extension-builder/SKILL.md

extension-builder

Skill19 starsChanged 6 days agoMITView on GitHub

Use when the user wants to scaffold a new Pyrite extension from a description. Generates the full directory structure, plugin class, entry types, validators, preset, tests, and installs in dev mode.

  • Installs packages

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 1

    1. pyrite-wiki/pyrite★ 19100% same

    Edited · 0

    None found.

    Wrote their own version · 1

    1. autohandai/community-skills★ 14same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository6 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask the user for:

    line 16
  2. Very specific:

    All list/dict fields MUST handle None → default: meta.get("field", []) or []

    line 126

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Extension Builder Skill

Scaffolds a complete Pyrite extension from a user description. Generates all required files, optionally generates hooks/tables/workflows/CLI, and verifies the plugin loads.

Announce at start: "I'm using the extension-builder skill to scaffold your extension."

Process

Step 1: Gather Requirements

Ask the user for:

  1. Extension name — kebab-case (e.g., recipe-manager). Python package becomes pyrite_recipe_manager.
  2. Description — one sentence describing what the extension does.
  3. Entry types — each with:
    • Type name (snake_case, e.g., recipe)
    • Custom fields with types (str, int, list[str], bool, etc.)
    • Required fields
  4. Optional capabilities — which of these does the extension need?
    • Hooks (before_save, after_save, before_delete, after_delete)
    • Custom DB tables
    • Workflows (state machines)
    • CLI commands
    • MCP tools
    • Relationship types

Step 2: Generate Files

Generate the full extension directory under extensions/<name>/:

Always generated:

pyproject.toml

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "pyrite-<name>"
version = "0.1.0"
description = "<description>"
requires-python = ">=3.11"
dependencies = []

[project.entry-points."pyrite.plugins"]
<snake_name> = "pyrite_<snake_name>.plugin:<ClassName>Plugin"

[tool.hatch.build.targets.wheel]
packages = ["src/pyrite_<snake_name>"]

src/pyrite_<snake_name>/__init__.py — empty

src/pyrite_<snake_name>/plugin.py — Plugin class implementing PyritePlugin Protocol. Wire up all entry types, validators, presets, and optional capabilities.

src/pyrite_<snake_name>/entry_types.py — One @dataclass class per entry type. Each MUST implement:

  • entry_type property returning the type key
  • to_frontmatter() calling super().to_frontmatter() and adding custom fields
  • from_frontmatter() classmethod with full field parsing

src/pyrite_<snake_name>/validators.py — One validate function per entry type. MUST return [] for unrelated types.

src/pyrite_<snake_name>/preset.py — KB preset dict with type definitions, policies, validation rules.

Optionally generated:

src/pyrite_<snake_name>/hooks.py — If hooks requested. Scaffold refusal-only hooks without assignments to entry fields; follow the protocol contract.

src/pyrite_<snake_name>/tables.py — If custom tables requested. Table definitions with extension-prefixed names.

src/pyrite_<snake_name>/workflows.py — If workflows requested. State machine definitions.

src/pyrite_<snake_name>/cli.py — If CLI commands requested. Typer app with subcommands.

tests/test_<snake_name>.py — ALWAYS generated. Comprehensive test file with 8-section structure:

  1. Entry type round-trip (to_frontmatter → from_frontmatter)
  2. Entry type defaults
  3. Validator accepts valid data
  4. Validator rejects invalid data
  5. Plugin registration
  6. Preset structure
  7. Entry type property
  8. Integration (if hooks/tables/workflows present)

Step 3: Install and Verify

# Install in dev mode
cd <pyrite repo root>
uv pip install --python .venv/bin/python -e extensions/<name>

# Verify plugin loads
.venv/bin/python -c "from pyrite.plugins.registry import get_registry; r = get_registry(); print(r.list_plugins())"

# Run extension tests
.venv/bin/pytest extensions/<name>/tests/ -v

Reference Files

For patterns and conventions, consult:

  • .claude/skills/pyrite-dev/extensions.md — comprehensive extension building guide
  • .claude/skills/pyrite-dev/testing.md — test patterns and conventions

For working examples, read these existing extensions:

  • extensions/zettelkasten/ — simplest (2 entry types, no hooks)
  • extensions/encyclopedia/ — medium (2 entry types and the article review workflow)
  • extensions/social/ — complex (2 entry types and the hooks, no workflow)
  • extensions/software-kb/ — full-featured (CLI, MCP tools, multiple types)

Key Rules

  1. Entry point group MUST be "pyrite.plugins" — no other group name works
  2. entry_type property MUST match the key in get_entry_types()
  3. from_frontmatter() MUST call generate_entry_id(title) when meta.get("id") is empty
  4. Validators MUST return [] for unrelated types
  5. Prefix custom DB table names with extension name
  6. before_save may raise to refuse; do not set fields in it. Follow the protocol contract.
  7. Declare capabilities for every method the plugin implements; the registry skips methods whose capability is missing
  8. All list/dict fields MUST handle None → default: meta.get("field", []) or []
  9. Tests MUST pass before claiming completion

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.