$npx -y skills add catalystbyzoho/agent-skills --skill catalyst-functionsCatalyst serverless functions — all 7 types (Basic I/O, Advanced I/O, Event, Cron, Job, Integration, Browser Logic), handler signatures, catalyst-config.json, Security Rules, API Gateway routing, file uploads, busboy, Express middleware, environment variables, function URL, and f
| 1 | ## How It Works |
| 2 | |
| 3 | 1. **Verify local scaffold — both `catalyst init` and `functions:add` support non-interactive mode (CLI v1.27.0+).** |
| 4 | Check whether `.catalystrc` and `catalyst.json` exist. If missing, use MCP tools to get the org ID and project ID, then run: |
| 5 | ```bash |
| 6 | catalyst init --org <orgId> -p <projectId> -ni |
| 7 | ``` |
| 8 | Never ask the user to run `catalyst init` interactively. NI mode can only link an existing project — if none exists, tell the user to create one in the console first. Once initialized, add functions non-interactively: |
| 9 | ```bash |
| 10 | catalyst functions:add --name <name> --type <type> --stack <stack> -ni |
| 11 | # e.g. catalyst functions:add --name api --type aio --stack node20 -ni |
| 12 | ``` |
| 13 | |
| 14 | 2. **Identify the function type** — Basic I/O for simple request/response, Advanced I/O for raw HTTP control, Event for trigger-based, Cron/Job for scheduled, Integration for Zoho service events, Browser Logic for Puppeteer. |
| 15 | 3. **Load `references/functions-basics.md`** — for the matching handler signature, `catalyst-config.json` keys, SDK init pattern, and CORS setup. |
| 16 | 4. **Load `references/functions-advanced.md`** — for file uploads (busboy), streaming responses, error handling, or chaining functions. |
| 17 | 5. **Load `references/api-gateway.md`** — for routing rules, rate limiting, or gateway-level CORS. |
| 18 | 6. **Validate config** — Confirm `catalyst-config.json` uses `deployment` + `execution` keys only. Never use `function` or `entry_point`. |
| 19 | |
| 20 | ## Security Checklist |
| 21 | |
| 22 | - **Functions are publicly accessible by default.** Security Rules sets `authentication` to `optional` when a function is created — its URL is globally accessible to everyone with no restrictions. Set `"authentication": "required"` in the Security Rules JSON for any function that reads or writes user data or sensitive resources. |
| 23 | - **API Gateway replaces Security Rules — do not use both.** Enabling API Gateway automatically disables Security Rules. Pick one auth/routing layer per function. |
| 24 | |
| 25 | ## Triggers |
| 26 | |
| 27 | Use this skill for: "write a function", "catalyst function", "Basic I/O", "Advanced I/O", "Event function", "Cron function", "Browser Logic", `catalyst-config.json`, "function handler", "API Gateway", "rate limiting", "busboy", "file upload in function", `catalyst deploy --only functions:<function-name>`, `catalyst functions:add`, "function CORS", or any function type or function configuration question. |
| 28 | |
| 29 | Deployment command note: |
| 30 | - Use `catalyst deploy --only functions:<function-name>` to deploy one function (where `functions:<name>` targets the function by its folder name). |
| 31 | - Use `catalyst deploy --only functions` to deploy all functions at once. |
| 32 | |
| 33 | ## References |
| 34 | |
| 35 | | Reference | Load when the query is about… | |
| 36 | |-----------|-------------------------------| |
| 37 | | `references/functions-basics.md` | **Start here for any function question.** Function type selection, Basic I/O and Advanced I/O handler signatures, `catalyst-config.json`, user-scope vs admin-scope, CORS, Security Rules, execution limits | |
| 38 | | `references/functions-advanced.md` | **Advanced I/O patterns only.** Express vs raw-http template differences, file uploads (busboy), streaming files from Stratus, error handling patterns, CORS for local dev, local testing, function chaining, ZCQL result unwrapping, HTTP payload limits | |
| 39 | | `references/functions-templates.md` | **Event, Cron, Job, or Integration functions.** Handler templates for all background/scheduled types, SDK component reference, retry behavior, cold start data, and the full common errors table | |
| 40 | | `references/api-gateway.md` | **API Gateway config only.** Enable/disable gateway, routing rules, rate limiting, CORS via gateway | |