Publish an add-on
Added in 2.1
This guide builds a collection acme with one add-on, release, and installs it from the directory to try it. To install someone else's add-on, see Share chains with add-ons.
Before you start
- A running Kraft server, and
git. - A git repository to publish the collection from, if other machines are to install it.
- The instance defines every harness and
agent profile the add-on requires. The
example needs the shipped
claudeharness andstrongprofile.
Publish a collection
1. Lay out the collection
A collection is a directory with .kraft/collection.json at its root and one
directory per add-on:
acme-kraft/
.kraft/collection.json
addons/
release/
.kraft/addon.json
library.yaml
chains/ship.yaml
skills/release-notes/SKILL.md
collection.json names the collection and lists its add-ons:
{
"$schema": "https://kraft-sdlc.dev/schemas/collection.schema.json",
"name": "acme",
"description": "ACME's Kraft chains and review methods",
"owner": { "name": "ACME Platform", "email": "platform@acme.dev" },
"addons": [
{ "name": "release", "source": "./addons/release", "description": "Release chains" }
]
}
addon.json names the add-on, its version and what it needs from an
instance. "kraft": "2" means any Kraft 2.x:
{
"$schema": "https://kraft-sdlc.dev/schemas/addon.schema.json",
"name": "release",
"version": "1.0.0",
"description": "Release chains",
"requires": { "kraft": "2", "harnesses": ["claude"], "profiles": ["strong"] }
}
2. Write the add-on's files
The files have the same shape as the ones in your own config/. Inside an
add-on, a bare extends:, steering: or skill: names the add-on's own
declaration. A bare harness: or profile: names the instance's.
An add-on holds only the files it uses. One chain, or one skill, is a valid
add-on. An add-on with none of library.yaml, chains/, skills/ and
profiles.yaml is refused.
A chain is named by its id, or by its file name when it has none, so the chain
below is release:ship once installed. A file name is a lowercase letter, then
lowercase letters, digits, _ or -. Kraft ignores chains/Ship.yaml, and
validate warns about it.
tasks:
implementer:
kind: agent
harness: claude
profile: strong
prompt: Implement the approved plan, then write the release notes.
skill: release-notes
policy:
time_cap_minutes: 90
test_changed_scopes:
kind: builtin
ref: kraft.verify_changed_test_scopes
scope: each_repository
id: ship
description: Implement, write release notes, run the tests for what changed.
nodes:
- id: implementation
kind: exec
tasks:
- id: implement
extends: implementer
- id: verify
kind: exec
tasks:
- id: test_changed_scopes
extends: test_changed_scopes
---
name: release-notes
description: Write release notes for the change in this worktree.
---
Add one line to `RELEASES.md` for each user-visible change, newest first.
An add-on can't use a component of your local library, or of any add-on but
the one it builds on (Build on another add-on): it
carries or inherits everything its chains extend. It also can't carry a
subprocess task or a permission. What an add-on may set
has the list.
3. Validate it
kraft admin addon validate ./acme-kraft
release 1.0.0 sha256:f915f6266d319e9c0bc2bb2483683d74f307839138258901919e7d071fd37da4
validate runs the checks an install runs and installs nothing. It prints one
line per add-on, then:
- each problem as
error: <file>: <message>. Any problem makes it exit 1. - each file or manifest key Kraft ignores as
warning: <message>. A warning doesn't change the exit code. - when the config directory has no
library.yaml, as in CI, askipped:line that names the checks it left out.
When the config directory has a library.yaml, validate also checks the
add-on against that instance: its requires, its namespace, and your own
chains.
Add-on problems lists each message and its fix.
4. Try it from the directory
Add the directory itself as a collection, and install from it:
kraft admin addon collection add ./acme-kraft
kraft admin addon install release@acme
An add-on from a directory collection has an update whenever its files change,
whatever its version. Edit a file, then run kraft admin addon update and
accept the review. Before you add the published collection
(Install an add-on), remove this one:
kraft admin addon uninstall release@acme, then
kraft admin addon collection remove acme.
A directory collection exists on one machine only, and never auto-updates.
5. Publish it
Commit the collection and push it to a git host. To release a change later,
raise version in addon.json and push. An installed instance sees an update
only when the version changes, so a push without a new version changes nothing
for the people who installed it.
Tell people the collection's address and the add-on's ID. They add and install it with the commands under Install an add-on.
A private repository works when git on the machine that runs the Kraft server can clone it without a prompt: an SSH key, or a credential helper, that a server run as a service can reach. Put no credentials in the URL; Kraft refuses one that has them.
Run validate in CI
Run validate on every push to the collection. validate needs no server and
no config directory, so CI only installs Kraft and runs it. The job fails when
validate exits 1. For GitHub Actions:
name: validate
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx run --spec kraft-sdlc kraft admin addon validate .
Build on another add-on
Added in 2.3
An add-on can name one parent add-on and inherit its whole library: chains,
tasks, steps, nodes, steering profiles, skills and agent profiles. A company
publishes company, a department's platform-dept builds on it, and a team's
team-payments builds on the department's. Each level changes what it needs,
and a team's repositories name only team-payments:….
Name the parent
Add requires.addons to the child's addon.json:
{
"$schema": "https://kraft-sdlc.dev/schemas/addon.schema.json",
"name": "team-payments",
"version": "1.4.0",
"requires": {
"kraft": "2.3",
"harnesses": ["claude"],
"addons": { "platform-dept@platform": "2.0" }
}
}
- The key is the parent's ID,
<addon>@<collection>, with thenamefrom its collection'scollection.json. The parent can live in any collection. - The value is a range with the form and rule of
requires.kraft:"2.0"is 2.0.0 or later, below 3.0.0, and"2"is any 2.x. Only the release part of the parent's version counts, so a pre-release of 2.3.0 satisfies"2.0". - Kraft refuses more than one parent, the add-on's own name, a cycle, a tree deeper than 8 add-ons, and an ancestor with the same name as a descendant.
Change what you inherit
Everything the child inherits is named under its own namespace:
team-payments:default is the department's default. In the child's files, the
parent's name means the entry as the parent has it, so
platform-dept:security_scan is the inherited security_scan.
- Override. Declare an entry with an inherited name, in the same section. It replaces the inherited one.
- Extend. Name the inherited entry with the parent's name to build on it.
Tasks, steps and nodes take
extends:, chains take chain extension. Steering profiles, skills and agent profiles have noextends:; an override replaces them whole. - Remove. List inherited names under
remove:inlibrary.yaml. - Add. Declare any name the parent doesn't have, as usual.
tasks:
security_scan:
extends: platform-dept:security_scan
prompt: Scan the change for security problems, PCI scope included.
pci_review:
kind: agent
harness: claude
prompt: Check the change against the team's PCI scope.
remove:
chains: [hotfix]
extends: platform-dept:default
add:
- after: verification
node:
id: pci_review
kind: exec
tasks:
- id: pci_review
extends: pci_review
An inherited chain runs the child's overrides. The nodes team-payments:default
inherits run team-payments:security_scan, the team's version, not the
department's. Only a reference written with the parent's name, such as the
extends: above, reads the inherited entry.
remove: takes the sections chains, tasks, steps, nodes, steering,
skills and profiles. validate, install and update refuse a name the parent
doesn't have, so a typo fails instead of doing nothing:
library.yaml: remove.chains: hotfx is not inherited from platform-dept. A
server that loads such an add-on only records it.
Kraft also refuses removing an entry that something left in the library still
uses. Only an add-on with a parent may have remove:; anywhere else, in another
add-on, a repo library or your own library.yaml, Kraft refuses it with
`remove:` is for an add-on that builds on another.
The child writes its parent's name, never the namespace an instance installed
it under, so platform-dept:security_scan works where the department's add-on
was installed with --as plat. The child can name its parent and no other
add-on, the grandparent included: what the grandparent ships reaches the child
through the parent.
A repo library, or any other library, names an inherited skill or agent profile
under the child's name, such as team-payments:deploy-review, and Kraft serves
the file of the ancestor that ships it. A name the child removes isn't found there.
A reference to any other add-on is refused with an add-on reaches no add-on but its parent (platform-dept@platform).
Validate it against the parent
validate judges a child together with its parent, and the parent's parent. It
looks for each one in PATH, then in each --with directory in the order given,
then among the add-ons installed on this instance, then in the current version
of the collection of that name the instance has added. A parent from another
collection needs a checkout of that collection:
kraft admin addon validate ./payments-kraft --with ../platform-kraft --with ../corp-kraft
--with takes a collection or an add-on directory and may be repeated. A
directory that holds neither collection.json nor .kraft/addon.json is a
problem.
When no place has the parent, validate exits 1 with its parent platform-dept@platform could not be found in PATH, --with or this instance; pass its collection with --with. It still runs the checks that need only the child's
own files, and a cycle or a tree deeper than 8 add-ons is reported the same way.
In CI, check out the parent's collection beside yours and pass it the same way.
What installing and updating do with the tree
- Install fetches the parent. A parent that isn't installed is installed
with the child, from its collection, in one review. A parent whose collection
the instance hasn't added is refused, naming the
kraft admin addon collection addto run. A disabled parent is refused withenable it first: kraft admin addon enable platform-dept@platform. - A range holds a move, not the tree. An update that would leave a child outside its parent's range, or the reverse, is held while the rest moves. Installing a child whose parent is outside its range is refused. The fixes are in An update is held by a range.
- A parent's review shows its children. When a parent moves, its review
lists how each installed child's chains change, under the chain's name, such
as
team-payments:default.nodes[approve]: gate removed. A name the child now shadows carries the child's ID, such asteam-payments@payments: its task pci_review now overrides platform-dept@platform's new task pci_review, and so do a staleremove:entry, shown as a warning, and a child whose files can't be read.
Or share from the repository itself
A collection suits chains many repositories share. For one repository's own
chains, commit them in the repository and skip the collection: a
repo library is read from the repository's
.kraft/ folder on its default branch, with no manifest and no install.
- Put
library.yaml,profiles.yaml,chains/<name>.yamlorskills/<name>/SKILL.mddirectly in.kraft/, commit them, and merge to the default branch. - A teammate runs
kraft repo connectin a terminal. Connect prints a review of the library and asks whether to take it. - Items filed in that repo run
.kraft/chains/default.yamlwith no further setup, and--chain my-repo:hotfixselects another. A later change waits until someone runskraft repo libraryand takes it. The first accept asks whether later text changes may be taken automatically; see Automatic updates.
The repository's id in repos.yaml is the namespace, and an instance checks
every change against the same rules as an add-on. Unlike an add-on, the library
is visible only to that repository's items: another repository, your own chains
and harnesses.yaml can't name it.
Repo libraries has the facts.
Serve Claude Code from the same directory
An add-on directory can also be a Claude Code plugin. Kraft reads .kraft/,
library.yaml, profiles.yaml, chains/ and skills/, and nothing else in
the directory:
addons/release/
.kraft/addon.json
.claude-plugin/plugin.json
library.yaml
chains/ship.yaml
skills/release-notes/SKILL.md
hooks/hooks.json
.mcp.json
skills/has the layout Claude Code uses, so both tools read the sameSKILL.md. The skill isrelease:release-notesin both..claude-plugin/,hooks/and.mcp.jsonnever reach Kraft. It doesn't install the Claude Code half: do that in Claude Code.- An alias changes the name on Kraft's side only. An add-on installed with
--as acme-releasehasacme-release:release-notesin Kraft andrelease:release-notesin Claude Code. - A chain of yours that already says
skill: release:<name>hands that skill to the agent. Once an add-on holds the namespacerelease, Kraft reads the skill from the add-on, and the install review lists each such reference.
Next steps
- Share chains with add-ons: install an add-on from a collection, use what it ships, and keep it current.
- Add-ons and collections: every manifest field,
addons.yaml, the lock, and when an add-on loads. - Add-on verbs: every
kraft admin addonverb and flag. - Add-on problems: the message
validateprinted, and its fix. - Write your own chain: the chain and library keys an add-on's files use.