/lyabah-docs:api-docfrom lyabah-docs
Use when writing, reviewing or updating a docs/api/<name>.yaml.md article, or when an agent should be able to call one of a repository's HTTP endpoints through lyabah-service (find_api_endpoints, call_api, prepare_api_call), or when an endpoint that already has an article changes its path, parameters, answers or the data it writes.
Ships in lyabah-docs. 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.
lyabah-service copies each repository's docs/ folder. A file
docs/api/<name>.yaml.md is an article about one subject of the API, for
example the watched resources. An agent finds it with find_api_endpoints,
reads it, picks the action that fits and calls it: at once with call_api
when the action needs no approval, otherwise with prepare_api_call, which a
person approves before anything is sent.
The file has two parts, and both must be complete:
--- lines. The service parses it
strictly: an unknown field, an unused parameter or an old-style template
makes the article unusable. The full rules are in reference/format.md.
Read it before you write the front matter.The article's name is the path under docs/api/ without .yaml.md:
docs/api/resources.yaml.md is resources.
actions. Shared parts go in actions.base. Every action has a name
that says what it does (read, update, delete): there is no default
action, and a call to the article must name the one it uses.method, path and
the rest sit at the top, next to params, and a call to it names no
action.params, with the server's
own limits (maxLength, pattern, enum, minimum…) and a description
that names the column it lands in when the names differ. Mark a parameter
with the sequence stop rule below when its value names another object.method, path ({$id} for a path segment),
required (the params this call needs), and query, headers and body
with {$param: name} where a parameter goes and constants as they are. A
rule the schema cannot hold, such as "send at least one of these", goes in
the Markdown.Authorization header and the base URL. The file never names a secret.approve_required with the rule below.draft in every action that needs approval, with the rule below,
and give the endpoint a draft mode and a checksum if it has none.
REQUIRED: building or changing the endpoint itself (the key check,
/api/ping, the draft, the checksum, its tests) follows the
api-endpoint skill.writes, with the rule below.summary and the Markdown in the shape below.An article is for calls that do something the database cannot. Agents
read data with SQL: the query_database MCP tool, guided by the
repository's schema docs (docs/db_schema.md, the map, and its articles in
docs/db_schema/). So an action that only returns rows the database already
holds (a list, a get by id, a count) is not added. The question it would
answer goes into the topic's article in docs/db_schema/ as a query instead
(the db-schema-doc skill, "Useful questions"). The same holds for data
another MCP tool already reads, such as lyabah-service's wiki (read_wiki,
list_wiki).
These get an action:
When an endpoint already has a plain read, such as GET /api/<things> for
the site's own pages, leave the endpoint as it is: only the article leaves
it out.
A call needs a person's approval unless it says approve_required: false.
The default is true, and false for GET. Set it on each action, never in
base:
false only for a call that changes nothing: a preview, a live check, a
computation (see "Which calls get an action": not a plain read of the
database). Then agents can call_api it and get the answer at once.true on a GET that does change something (it marks a message read, it
starts a job). Never leave such a GET on its default.draft is a parameter every article has without declaring it: 1 when
lyabah-service checks a call, 0 when it sends it. The agent never passes
it. Every action that needs approval must send it, because such a call is
first sent with draft=1, kept only if that answers 2xx, and shown to the
reviewer with that answer. Put it where the endpoint takes its check-only
flag:
query:
draft:
$param: draft
With draft=1 the endpoint must do everything the real call does (checks,
page reads, database writes) and answer exactly as it would, but apply
nothing. When it does not do that yet, add it to the endpoint in the same
change: run the work in a transaction and roll it back on draft=1, and refuse
any value but 0 and 1 with a 400. 0, or no draft, applies the call.
A different endpoint that only previews (it takes other input, or refuses
unknown fields) is not a draft. Make it an action of its own, often with
approve_required: false.
The draft of an action that needs approval answers with a checksum of
what the change depends on, in the X-Draft-Checksum header. A draft
without one fails, and the call cannot be approved. lyabah-service keeps the
checksum and sends it back in the same header with the approved call
(draft=0). Before it applies anything, the endpoint works the checksum out
again, in the same transaction: when it differs, it answers 412 and applies
nothing. A call without the header is not checked.
checksum_header names another header for both ways. It is rarely needed.verify_ttl is how many minutes a check stays valid before the reviewer
must run the draft again (the service's default is 30). Set it on an
action that needs approval when its state changes fast; never in base.412 in the Markdown: the call went back to the owner for
another review.In one group, a call can take a parameter from an earlier call's response
({$result: {call: 1, path: post.id}}), for example a translation that needs
the post call 1 creates. Mark a parameter sequence_stop: true when its value
names an object, by its id or its slug, that some action creates: a
parent post, the resource to delete, the order an item belongs to.
slug from call 1's answer").writes lists the fields the article is about changing, as
database.table.field. find_api_endpoints and describe_database use it to
send an agent who wants to change a field to this article. Follow each
handler down to every SQL statement it runs, helpers included, and list every
column it sets: the ones a request names and the ones set as a side effect (a
cleared pending, an updated_at). Columns only the database fills (id, a
created_at default) are not listed, and a DELETE adds no fields of its
own: the fields of the rows it removes are already listed by the calls that
set them.
Use the database's name on the shared Postgres, as docs/db_schema.md gives
it (or the service's DB_NAME when there is no such doc yet), and the real
table and column names. Leave out only counters and logs that record the call
itself (daily stats, audit rows); a row that other parts of the service read
later, such as a cache, is data. An article that changes no database has no
writes.
find_api_endpoints searches the words of the article's name, its summary,
its action names and its Markdown. Write the summary as one line in the
words a request would use ("Watched pages and feeds - start, change or stop
watching one").
# <The subject>, then a paragraph: what the calls change, what is kept,
whether a change can be undone, and what happens right after a call.update or delete
need none.[wiki-page](wiki-page.yaml.md), the schema map is
[db_schema.md](../db_schema.md), and a schema article is
[orders](../db_schema/orders.md): link the article, which has the
queries. The agent opens them with read_doc in
the same repository, so link the doc that explains something instead of
repeating it. Never link a doc by a github.com address alone.## Turning a request into parameters: bullets that map typical requests
("follow this blog") to an action and its parameter values, and say what
the article cannot do and where to go instead.## Reading the answer: how to treat each response and explain it to the
person who asked. The agent passes this on to them, and records it with
interpret_api_result, so write it for that:
changed_at is when the page's text
last changed, not when it was checked"). Say which field shows that the
call did what was asked, and which ones the person should hear about.{$param: name} or {$name}; no {{name}} is left.required, or has a default.approve_required, draft, the checksum and writes follow their rules;
every action that needs approval sends {$param: draft}, and its endpoint
answers draft=1 without applying anything, with X-Draft-Checksum, and
answers 412 to a stale checksum.Authorization, Cookie or Content-Type header (the body's type is
content_type).$param as plain data and knows none of the rules. After the file is
merged and synced:
find_api_endpoints with one of its writes finds it, and its problems
do not name it;approve_required: false: call_api it once with real
parameters and check the answer against the Markdown;doc-check-<name>
(a draft without a checksum is refused here), read back the request and
checksum it got (get_api_group), then discard_api_call it. Only
actions that need approval can be prepared.A full example: reference/example.yaml.md.
What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/api-endpointUse when adding or changing an HTTP endpoint of a lyabah service that lyabah-service calls (an action agents send with call_api or prepare for approval with prepare_api_call), or when adding the LYABAH_KEY check, GET /api/ping, a draft mode or a draft checksum to a service's API, in any language or framework./db-schema-docUse when writing, reviewing or updating a repository's docs/db_schema.md or the articles under docs/db_schema/, or when a change adds, renames or drops a table or column (a database migration) in a repository whose database lyabah-service's SQL tools read (query_database, describe_database).Other plugins' skills for the same job
npx claudepluginhub oduvan/claude-marketplace --plugin lyabah-docs