mcpField
S
salla-app-functions-design

salla-app-functions-design

github.com/sallaappDevelopment278 installsUpdated 4d ago
Repository

About salla-app-functions-design

salla-app-functions-design is a developer skill for choosing Salla app function triggers and execution types before implementation. It guides event-contract verification and distinguishes blocking synchronous actions from asynchronous events, including their timeout limits.

Key features

  1. 01Browse and verify trigger definitions
  2. 02Confirm event payload fields
  3. 03Choose synchronous or asynchronous execution
  4. 04Understand timeout budgets
  5. 05Route security work to related skills

Use cases

  1. 01Selecting a trigger for a Salla app function
  2. 02Checking payload fields before relying on them
  3. 03Deciding whether an action should block an operation
  4. 04Planning within execution timeout limits

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/sallaapp/salla-partners-agent-kit --skill salla-app-functions-design

After installing, type/salla-app-functions-designin Claude Code to confirm it loaded.

Bundled filesreferences/event-contexts.md

Details

From the project README

App Functions — Design the Trigger & Execution Type

Decide what runs and when before you write any code.

Step 1 — Confirm the event contract

The doc-grounded event catalog — every trigger grouped Merchant vs Customer, its sync/async type, and its documented payload.data shape — lives in references/event-contexts.md. Use it to pick the trigger and read the context shape; never assume a payload.

Sources of truth: salla_functions action=list_triggers (no app_id needed) for live trigger names and categories; salla_functions action=get for a trigger's authoritative .d.ts. Customer-event docs ship illustrative payloads — confirm those field names via action=get or the schema doc before relying on them.

Gate: "Do you have the confirmed payload.data field names for this event?"

Step 2 — Choose the execution type

TypeTimingBlocks user?TimeoutReturn value effect
Asynchronous eventAfter the operationNo30 sFire-and-forget: logged, does not affect the flow.
Synchronous actionBefore the operationYes5 s totalBlocking: can modify parameters or reject/block the operation.
  • Sync actions are exactly the merchant_actions category — shipment.creating and shipment.cancelling (confirm the category via salla_functions action=list_triggers rather than the verb form). They intercept the lifecycle before it completes: erroring cancels the operation, succeeding can modify its data. shipment.creating is the documented sync example and returns a Shipment ((context: Shipments): Promise<Shipment>), not a plain Resp — it sets the shipment number/label. Builder mechanics → salla-app-functions-handler.
  • Async events (e.g. order.created, product.added) run out-of-band; return a valid success/error result so it's recorded in logs.
Timeout budget
TypeTotal timeoutPer internal async call
Sync5 s hard limit, < 500 ms target< 2 s, bound with AbortController
Async30 sbound with AbortController

The merchant is blocked during a sync action, so treat < 500 ms as the goal and 5 s as the ceiling. Bounding each fetch / awaited I/O keeps one slow upstream from blowing the budget (AbortController mechanics → salla-app-functions-handler). An overrun blocks (sync) or drops (async) the run.

Gate: "Sync or async decided, and the timeout budget understood?"

Security & data hand-offs

When the handler touches tokens, merchant authentication, or outbound calls, route those out: token storage / OAuth / merchant access tokens → salla-app-auth; webhook signature verification & idempotency → salla-webhooks. Full hand-off list → references/event-contexts.md.

Next: write it in salla-app-functions-handler.

Comments

Markdown supported