jac-sv-endpoints

Implement Jac server endpoints using walker and function routes with typed responses.

Updated Jul 26, 2026
Ready to run
npx skills add https://github.com/nihalnihalani/jachacks-sf-2026 --skill jac-sv-endpoints-nihalnihalani
πŸ’¬ Prompt for ChatGPT / Claude Chatβ–Ό
Please help me install this Agent Skill.
Skill: jac-sv-endpoints
Source: https://github.com/nihalnihalani/jachacks-sf-2026/tree/main/plugins/jac-codex/skills/jac-sv-endpoints
Command: npx skills add https://github.com/nihalnihalani/jachacks-sf-2026 --skill jac-sv-endpoints-nihalnihalani

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing and implementing the right endpoint shape in a Jac server is error-prone: developers misuse walker:pub for simple RPC calls, hit 404/405 errors from missing imports, or return untyped payloads that break clients. This Skill provides the decision rules and code patterns for building correct REST and RPC endpoints in Jac. ## Core Features & Use Cases - Endpoint shape selection: Decide between def:pub functions (RPC style, typed returns) and walker:pub (REST style, graph traversal) based on whether the endpoint actually walks the graph. - Custom REST routes: Use @restspec to define custom HTTP methods, paths, path/query parameters, and file uploads with UploadFile. - Response envelopes and pitfalls: Understand the standard {ok, data, error} envelope, _jac_id volatility, auth visibility rules (:pub vs :priv), and common failures like stale persisted anchors. - Use Case: You are building a Jac API service consumed over raw REST and need a GET /users/{user_id}/orders endpoint with query filters and a typed JSON response. ## Quick Start Ask the agent to add a public Jac endpoint that lists items and a walker endpoint that traverses the graph, following the jac-sv-endpoints patterns.

Frequently Asked Questions about jac-sv-endpoints

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a REST endpoint in Jac?β–Ό

Define a `walker:pub` with `has` fields as the request body and use `report` for the response, or define a `def:pub` function whose typed return value becomes the wire format. Call walkers at `POST /walker/<name>` and functions at `POST /function/<name>`.

When should I use walker:pub versus def:pub in Jac?β–Ό

Use `def:pub` when the endpoint does not traverse the graph: status probes, single-node CRUD, list queries, and job kick-offs. Reserve `walker:pub` for endpoints that spawn, visit edges, accumulate results, and report once.

How do I add custom routes and GET methods to Jac endpoints?β–Ό

Apply `@restspec(method=HTTPMethod.GET, path="/users/{user_id}/orders")` to a walker or function. Parameters matching `{...}` in the path become path parameters, `UploadFile` fields become file uploads, and remaining fields become query or body parameters.

Why does my new Jac endpoint return 404 or 405?β–Ό

The endpoint name is missing from the entry module's import list. Adding a `def:pub` to an already-imported module still fails until the new name is explicitly imported in the entry module.

How do I handle file uploads in a Jac server endpoint?β–Ό

Import `UploadFile` from `http`, declare a `has file: UploadFile` field on the walker, and it is classified as a multipart file parameter. Use the ambient `store()` builtin to save the file to local disk or S3 backends.

Why do Jac responses contain changing _jac_id values?β–Ό

The runtime assigns a fresh `_jac_id` to the walker instance and every freshly-constructed report object on each response, while persistent node jids stay stable. Strip `_jac_id` before hashing, caching, or diffing responses.