Repository navigation
Add a new-broker skill that scaffolds a fully wired messaging backend - #10
Merged
Merged
Conversation
.claude/skills/new-broker/ has a SKILL.md (check that the transport fits the Broker contract, scaffold, implement, test, verify, update the docs) and a stdlib-only scaffold.py. In one command it creates the backend module and its test file, then registers the scheme(s) in broker.py (_BACKENDS, _EXTRAS, docstring) and adds the client extra to packages/messaging and the dev group (with an optional mypy override). It also adds the extra to every app that carries broker extras, plus their Dockerfile BROKER_EXTRAS; adds the compose BROKER_EXTRAS defaults, a profile-gated server and the x-broker-depends anchor; writes brokers/<name>.env; adds the REAL_BROKERS contract-test entry; and adds a CI service container, test URL and compose-matrix entry. --dry-run prints a diff of every change. To make those edits reliable: - tests/conftest.py: the real-server brokers are now a REAL_BROKERS table (same test ids and skips as before). - The new-service scaffold reads the broker extras from packages/messaging/pyproject.toml instead of hard-coding redis/rabbitmq. - compose_smoke.sh's usage lists brokers/*.env instead of a fixed set. README and ARCHITECTURE point to the skill. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SE2PhJQLSccvNwV1Eoauuj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
new-brokerClaude Code skill for adding a messaging transport (NATS, SQS, a custom protocol, ...) topackages/messaging. It works like the existingnew-serviceskill: a script does the wiring, and the developer (or Claude) writes the transport logic, tests and docs. No service code changes..claude/skills/new-broker/SKILL.mdhas the steps:Brokercontract: each message goes to one consumer, in order per topic, andreceivestops waiting after the timeout. Includes notes on log-based systems like Kafka, and a rule not to loosen the contract tests.scripts/scaffold.py(standard library only;--dry-runprints a unified diff). In one command it:backends/<module>.py(aBrokersubclass whosepublish/receiveare stubs) andtests/test_<module>.pybroker.py(_BACKENDS,_EXTRAS, the docstring's URL list)packages/messagingand the rootdevgroup, plus an optional mypy overrideBROKER_EXTRAScompose.yaml: theBROKER_EXTRASdefaults, a server under its own profile, and thex-broker-dependsentry; and writesbrokers/<name>.envREAL_BROKERSentry, so the contract tests also run against a real server when its URL is setci.yml: a service container and test URL in thebrokersjob, and an entry in thecomposematrixSmall refactors so the script can edit files reliably
packages/messaging/tests/conftest.py: the real-server brokers are now aREAL_BROKERStable (same test ids and skips as before).new-servicescaffold reads the broker extras frompackages/messaging/pyproject.tomlinstead of hard-codingredis/rabbitmq, so new services pick up added brokers automatically. Its output is unchanged apart from one example comment.scripts/ci/compose_smoke.sh: the usage message listsbrokers/*.envinstead of a fixed set.README.mdandARCHITECTURE.mdpoint to the skill.Test plan
uv run ruff check .,ruff format --check .,mypy,pytest(81 passed, 20 skipped),uv lock --checkon this branchnats-py,nats:2-alpine). Thenuv lock, ruff, mypy and the full pytest run all passed. The generatedcompose.yamlandci.ymlparse correctly, anddocker compose --env-file brokers/nats.env configresolves only the NATS profile.MESSAGING_TEST_NATS_URLset, the contract tests run against the stub and fail as expected until it is implemented. Re-running the scaffold is refused.new-servicescaffold's dry-run output before and after the refactor differs only in the example comment.Generated by Claude Code