Skip to content

Add agent plugin system for custom agent creation#95

Merged
PAMulligan merged 20 commits into
mainfrom
9-agent-plugin-system-for-custom-agent-creation
May 28, 2026
Merged

Add agent plugin system for custom agent creation#95
PAMulligan merged 20 commits into
mainfrom
9-agent-plugin-system-for-custom-agent-creation

Conversation

@PAMulligan
Copy link
Copy Markdown
Collaborator

Summary

Implements a plugin architecture for authoring, validating, dependency-resolving, installing, and testing custom Claude Code agents as versioned plugins. A plugin lives under .claude/agent-plugins/<name>/ (plugin.json + agent.md + optional hooks/ + tests/); installing copies the agent into .claude/agents/ where Claude Code reads it.

Delivers all four pieces from the issue:

  • Plugin API spec.claude/agent-plugin.schema.json (strict JSON Schema 2020) + structural rules in the validator.
  • Scaffolding CLIcreate-agent-plugin.js generates a valid plugin skeleton (house-style agent.md, default tests, optional hook stubs).
  • Registry + dependency resolutionagent-registry.js resolves the transitive agent-dependency graph (semver, topological order, missing/version/cycle detection), installs/uninstalls with management-lifecycle hooks, and records state in installed.json. Skills/tools deps are existence-checked.
  • Validation + testing frameworkvalidate-agent-plugin.js (schema + structural checks) and test-agent-plugin.js (deterministic static assertions; no Claude invocation, unknown assertions fail loudly).

All four CLIs share agent-plugin-lib.js (frontmatter/manifest parsing, catalog, semver, resolver, dir listing), use --json + exit codes 0/1/2, and a --plugins-root/--root override for testing.

Notes

  • Lifecycle hooks attach to the plugin-management lifecycle (install/uninstall) — Claude Code has no per-agent runtime hooks.
  • Wired into verify-all.sh as a conditional agent-plugins check (no-op when no plugins exist).
  • Docs: docs/guides/agent-plugins.md; design + plan under docs/plans/2026-05-27-agent-plugin-system*.md.
  • Built TDD with two-stage review (spec + code quality) per task; a final holistic review caught and fixed two integration gaps (git-tracking of plugin sources; install-time validation).

Test plan

  • pnpm vitest run scripts/__tests__/agent-plugin-*.test.js scripts/__tests__/{validate,agent-registry,create,test}-agent-plugin.test.js scripts/__tests__/verify-all.test.js — 82 tests pass
  • End-to-end smoke: create → validate → test → install → uninstall against a temp root
  • bash scripts/verify-all.sh --include agent-plugins skips cleanly (no plugins in repo)
  • ESLint + Prettier clean on all new/changed files

Closes #9

🤖 Generated with Claude Code

Paul Mulligan and others added 20 commits May 27, 2026 22:07
Approved design for a Markdown + Node tooling layer that lets users
author, validate, install, and dependency-resolve custom Claude Code
agents. Covers manifest schema, registry, scaffolding CLI, and a
static-assertion testing framework.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bite-sized, TDD-ordered plan for the Markdown + Node tooling layer:
shared lib, manifest schema, validator, registry with dependency
resolution and lifecycle hooks, scaffolding CLI, and static-assertion
test runner. Each task has complete code, exact paths, and expected
commands. References superpowers:executing-plans to run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nd schema error detail

buildCatalog now skips unreadable/malformed plugin.json entries so one
bad plugin can't abort an --all scan. The validator seeds its catalog
from sibling plugins in --dir mode (no false-positive missing-dep
errors), adds a --plugins-root override, rejects --dir+--all, and
surfaces the offending property in schema errors via formatSchemaError.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add docs/guides/agent-plugins.md (authoring guide: layout, manifest
reference, the four CLIs, dependency model, lifecycle hooks, assertion
catalog), and wire the commands into scripts/README.md and CLAUDE.md.
Bump the documented script count to reflect the new tooling.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add an `agent-plugins` check that runs validate-agent-plugin.js --all
and test-agent-plugin.js --all via verify-agent-plugins.sh. It skips
(like bundle-size) when no plugins exist under .claude/agent-plugins/,
so it is a no-op on repos without plugins.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Un-ignore .claude/agent-plugins/ so authored plugins (and installed.json)
are version-controlled — the "versioned plugins" premise was broken
because .claude/* ignored the whole tree. Also validate each plugin
before copying its agent.md into .claude/agents/, so a structurally
invalid agent can no longer install with exit 0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@PAMulligan PAMulligan linked an issue May 28, 2026 that may be closed by this pull request
@PAMulligan PAMulligan self-assigned this May 28, 2026
@PAMulligan PAMulligan added enhancement New feature or request javascript Pull requests that update javascript code pipeline Figma/Canva-to-React conversion pipeline labels May 28, 2026
@PAMulligan PAMulligan moved this from Todo to Done in PMDS Open Source Roadmap May 28, 2026
@PAMulligan PAMulligan added this to the v2.0.0 milestone May 28, 2026
@PAMulligan PAMulligan merged commit 4526665 into main May 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request javascript Pull requests that update javascript code pipeline Figma/Canva-to-React conversion pipeline

Projects

Development

Successfully merging this pull request may close these issues.

Agent plugin system for custom agent creation

1 participant