/osprey:build-appfrom osprey
Scaffolds and extends OSPREY apps: panels, backends (FastAPI), tool servers, skills, and subagents declared in app.yml. Use when creating, fixing, or adding routes/tools to an OSPREY app.
Ships in osprey. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
An app is any of five parts, at least one: a backend container (FastAPI)
that holds the state and talks to the machine, a panel the operator sees, a
tool server the agent calls, skills and subagents. A panel needs the backend, and
so does a write tool on a login that writes; without one the tool server only
reads or computes, keeps nothing between calls and opens no data store of the
deployment. app.yml declares every part (an empty one is refused); osprey build reads nothing else about the app. The scaffold is the full shape.
This skill carries what does not change from release to release: the order of work, the product rules, what to verify and the mistakes to avoid. The facts that do change (manifest keys, rule names, SDK names, command options) are printed by a script from the OSPREY you are building against. Trust the script's output over any key or name written here.
Run from the directory you will work in (the deployment repo, or the OSPREY checkout), with the Python that has OSPREY:
python3 <this skill's directory>/scripts/app_contract.py
In a uv project, uv run python <...>/scripts/app_contract.py. It reads source
only (standard library, no network, about a second) and finds OSPREY in this
order: a checkout around the working directory, the interpreter's installed
package, the package behind the osprey command on PATH. --root <dir>
names one explicitly.
The first block is the verdict:
--root; do not
build from the snapshot alone.The rest is the live contract: every app.yml key with type and default,
every rule name with its message, the importable modules, the SDK's names, the
osprey app commands, the design-system classes, the scaffold's files. Keep
it; steps 3 to 6 refer to it as the summary. --drift-only and
--summary-only print one half.
These are decisions, not conventions. Each says what the checker enforces today and what is left to you.
/panel/<app>/<route>).
Enforced in part: the import rule keeps app code off OSPREY internals, and
the door reaches only the routes panel.agent_routes declares. Nothing
stops a tool from opening a file. Do not.skills: in app.yml defaults to
empty. The check refuses only a listed skill whose
skills/<name>/SKILL.md is missing, and a skill name two apps share. The
scaffold ships one; keep it when tool docstrings alone do not tell the
agent the order of work or what a refusal means, drop it (directory and
skills: entry together) when they do. A subagent is optional too:
agents: lists each agents/<name>.md, installed where the app is shown.
The check refuses a listed agent with no file, a name two apps share, a
name of one of OSPREY's own agents, a model, hooks, permissionMode or
mcpServers key in its frontmatter, an mcp__<app>__<tool> the app does
not declare, a delegates tool the agent does not hold, delegates
without {delegated_tools} in its delegation note, and the placeholder
with no delegates.index.html links the terminal's
tokens.css, base.css and primitives.css, and uses osprey-* classes
for buttons, chips, cards, toggles. osprey app check refuses a panel
that omits a sheet and any class with no rule in the panel's or the linked
sheets. It does not notice a hand-rolled button where a primitive exists;
look in the summary's class list first.owner_from_header,
owner_target) and never picks a machine from config. A hardware write is
a tool under tools.approval, checked with check_approved_call, sent to
the approved target, and written by the connector's
write_channel_checked under bind_owner. The connector applies limits,
the write verdict and the audit record. Any other route to hardware (a raw
EPICS client, a subprocess) bypasses all of that; the import rule refuses
the obvious ones.osprey app check refuses a hooks key in app.yml,
a hooks/ directory at the app root, a .claude/ directory anywhere under
the app, and hooks in a listed skill's or agent's frontmatter, each with rule
no_hooks; a listed skill whose frontmatter does not parse as a YAML
mapping, or does not close on a line that is exactly ---, is refused with
rule skill_frontmatter. Approval is declared, and
OSPREY's own hook reads the rendered declaration; it never runs app code.containers:.read tool even when it is a POST. A route that writes a channel backs
an approval tool.bind in the manifest and a re-check in the backend.apps.<name>.config in profile.yml, never in code.An app lives in a deployment repo (one with profile.yml). In a facility
repo that is where you are. In an OSPREY checkout, make a scratch one outside
the tree: osprey init <dir> --preset demo --no-git.
osprey app new <name> # lower-case letters, digits, dashes
osprey app check # the scaffold passes as copied
new copies the scaffold to apps/<name>/, renames the app and its Python
package, lists it under apps: in profile.yml (listing turns it on) and
git-ignores fetched panel files. A name an installed package already gives an
application is refused. Read the copied files before changing them:
they are the reference implementation of every pattern below. The summary
ends with the path of a larger worked example (several routes and tools, a
panel that writes).
Give it its config:
apps:
<name>:
config:
channel: <a channel of this facility>
The block is free-form; the build writes it to the file named by
OSPREY_APP_CONFIG, which the backend reads at start. An app with no
container has nothing to read it, so its config: is refused.
Edit app.yml last-to-first as you add things, but understand it first: a
route the tools call must be in panel.agent_routes; a tool must be under
tools.read or tools.approval; the backend container that writes needs
drives_target: true. Take keys and defaults from the summary.
<package>/server.py)GET) answers the whole screen in the panel's terms,
including why a control is disabled. The panel and the read tool both show
exactly this.create_app(connector_for=..., config=...) takes a fake connector and a
config, so routes are testable without a machine.<package>/tools.py)register. The docstring is the description
the agent reads: what it does, each argument in the facility's terms, what
it answers._panel_call. It imports nothing from
the backend module.check_approved_call and sends the backend the
values that returned (bound.approved_target, bound.state_fields), never
the agent's own. Its approved_* parameters default to None; the hook
fills them.make_error (unreachable) and ApprovalRefused (refused), so
the agent gets the manifest's errors sentences.panel/, tests/)api/state), since
the page is served under /panel/<id>/; the panel's files are served from
static/.index.html carries
<html data-page-ready="pending">, and the script imports markPageReady
from /design-system/js/page-ready.js and calls it once the first refresh
has drawn, error or not. osprey app check refuses a panel that never
imports it; whatever drives the panel waits for that mark.panel.css holds only the app's own layout, on design
tokens (var(--space-2)), with a rule for every class you introduce.tests/*.test.js (Vitest, DOM). The test builds its own DOM, so a new
field goes into the test's markup too.vendor entry (exact version, SHA-256), not
a committed file.When kept: write it from the parity table. Which tool for which request, each
tool's panel equivalent, the order (read, tell the operator, then write), what
each refusal means, and that approved_* arguments are left unset. Update the
table whenever a tool or panel element changes.
A subagent instead, when the task reads a lot to answer a little: one file
agents/<name>.md with name, description, tools (explicit, no
wildcard), delegation (the brief's note) and optionally delegates (the
app's tools the main agent is told to leave to it, named where
{delegated_tools} stands). The body is copied as written; the build adds the
model: line.
osprey app check # every change
osprey build && osprey up -d # to see it in the terminal
osprey health
check is done when it prints the pass line and exits 0. It needs Node and
npm for the panel's lint and tests; the first run installs a pinned toolchain
into the user cache and needs network once. Then in the terminal: the panel
shows state for the session's machine and follows the control-target chip;
the read tool answers what the panel shows; the write tool is refused with
writes off, shows a card with your prompt at asked, and is denied on a
read-only login. Walk the parity table once more against the running panel.
One tools.approval entry per write tool. prompt is the card's text, with
{{ input.<arg> }} for call arguments and {{ state.<key> }} for the answer
of state_path. bind.state_fields copies state values into the call as
approved_* fields (a dotted key, step.digest, is a path into nested
state); bind.input_digests binds the arguments themselves;
require names the fields a call must carry. Three places then check one
declaration: OSPREY's approval hook, the tool (check_approved_call), and the
backend against its current state.
Hold to these, and take their exact rule names from the summary:
state_path is a GET route listed in agent_routes.approved_*; approved_target is recorded by the
approval itself and only needs requiring.require.all_of; a one_of group holds
state-field names only.deny_in_jobs: true when no tool of the app should.asked or allowed;
write routes and the launch token exist only there.tools.py). It drifts from the panel within a week.apps.<name>.config and the owner's target.agent_routes (the door
refuses the call), or a new tool missing from tools.read / tools.approval./api/state): works on the bare port, breaks
behind the terminal.osprey.<anything else> or an underscore-prefixed name. The
allowed modules are in the summary; if the SDK lacks what you need, that is
a request to OSPREY, not a reason to reach in.name, the directory, the package, the panel id
and the tool server share the name; make a new one with osprey app new
and move the code.volumes, ports) into app.yml. They are
refused with the place they belong.Orientation only, as of the OSPREY this skill was reviewed against (step 0 names it, and says when this has moved). The summary is the authority.
name: <name> # = directory = panel id = tool server name
summary: <one sentence>
containers: # optional; a panel and armed write tools need one
<name>:
runtime: osprey # or image: with a compose fragment
command: [python, -m, <package>.server]
health: /health
drives_target: true # the container reaches the control system
state: var/<name> # kept across restarts
panel:
label: <sidebar text>
icon: <glyph> # optional, from the icon set; so are description: (tooltip) and help: (page)
container: <name>
launch_token: true # write routes demand the terminal's token
agent_routes: # what the tools may call; non-GET = write route
- [GET, /api/state]
- [POST, /api/write]
tools:
module: <package>.tools
read: [<tool>, ...]
approval:
- tool: <write tool>
prompt: Set {{ state.channel }} to {{ input.value }}, now {{ state.readback }}.
state_path: /api/state
bind: {state_fields: [{field: approved_readback, key: readback}]}
require: {all_of: [approved_target, approved_readback]}
errors: {unreachable: <sentence>, refused: <sentence>}
skills: [<name>] # optional
agents: [<name>] # optional, each agents/<name>.md
Files of an app: app.yml, pyproject.toml, <package>/{__init__,server,tools}.py,
panel/{index.html,panel.js,panel.css}, tests/panel.test.js,
skills/<name>/SKILL.md, agents/<name>.md. Application code imports osprey.apps.sdk,
osprey.facility.kinds and osprey_connectors, nothing else of OSPREY.
The narrative version of all this, with the worked example, is the documentation's How-to: Apps section (Build Your Own App).
contract-fingerprint.json records a hash of each file the contract lives in
(the list is WATCHED in the script). When one changes in the OSPREY
repository, tests/plugins/test_build_app_contract.py fails and names it.
Re-read this file against the change, correct what it made wrong, then record
the review:
uv run python plugins/osprey/skills/build-app/scripts/app_contract.py --refresh
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub als-apg/osprey --plugin osprey12 skills in this plugin
/contributeGuides a contributor through the OSPREY GitHub Flow contribution journey from a working-tree change to a merged PR on main. Use when someone says "I want to contribute X to osprey", "help me commit/push this", "prep this branch for a PR", "open a PR", "my CI is failing on this branch", "rebase onto main", or wants help following the contributing workflow. Auto-detects whether they have push access to als-apg/osprey or are contributing from a fork. Composes with /osprey:pre-commit and /osprey:release, and with the external commit-organize skill when it is installed — invoke this whenever someone is contributing code to OSPREY, even if they haven't named the workflow explicitly.
/design-philosophyOSPREY's design and architecture principles — the rules that define how OSPREY code should be structured, and the anti-pattern each one prevents. Consult before designing, adding, or reviewing any feature (connectors, MCP servers, providers, capabilities, CLI, registry, runtime, config), and when redirecting work that is drifting from these principles. Trigger when the user says "is this the right direction", "does this fit OSPREY", "this feels wrong", "check the design philosophy", or points an agent at how OSPREY code should look. Apply before adding a config knob, a new abstraction, a new subsystem, or anything touching hardware-write safety./doc-syncUse when a maintainer wants to know where a page under docs/source says something the code no longer does — before cutting a release, after a long stretch of merges, or when one page is suspected of describing a flag, key, default, or procedure that has moved on. Triggers: "run doc-sync", "sync the docs", "do the docs match the code", "is this page still right", "check the how-to guides", "validate the docs", "doc drift", "audit the docs", "which pages went stale". Prefer it over reading a page and forming an opinion whenever the question is "is what this page says still true". Config comments, shipped prompts, runtime messages, and pinned versions are not doc pages; those are osprey:housekeeping.
/facility-reviewResolves what the OSPREY facility build flags, with the person who maintains the facility repository: runs `osprey facility validate`, investigates every stop and warning it prints, groups the ones that share a cause, asks one evidence-backed question per group, writes each confirmed answer into `fixes.yaml` or `policy.yaml` (or proposes a diff to an authored facility file), rebuilds, and shows the finding gone. Use whenever a facility build stops or warns, whenever someone pastes a `facility: <kind>: ...` line, after `osprey facility import` brings in a cable schedule, rack layout, MML export or channel list, and when someone says "review my facility", "clean up the facility warnings", "two sources disagree", "contested relations", "layer-conflict", "which source wins", or asks why a relation is contested or superseded, even if they do not name this skill.
/housekeepingUse when a maintainer wants to know where OSPREY tells its users something that is no longer true — before cutting a release, after a long stretch of merges without one, or when the generated project, a shipped skill, a runtime message, or a pinned version is suspected of having fallen behind the code — or when the shipped presets, which are supposed to agree (hello-world and demo), may have drifted apart. Triggers: "run housekeeping", "check for drift", "what has rotted", "is anything stale", "housekeeping report", "sweep the repo", "preset parity", "do the presets still agree", "what maintainer chores are outstanding", "pre-release drift check". Prefer it over ad-hoc grepping whenever the question is "has anything drifted" rather than "fix this one thing". Doc-page prose is not this skill's job; that is osprey:doc-sync.
/panelAuthor a new OSPREY web-terminal panel — a self-contained, themed HTML mini-app the terminal mounts beside the chat. Use whenever someone wants to create, author, add, scaffold, or build an OSPREY panel, a design-system panel, or a standalone themed surface for the web terminal. Produces a token-only panel that passes the panel validator.
Other plugins' skills for the same job