appflare-handlers

Write Appflare query, mutation, scheduler, cron, and storageManager handlers for Cloudflare Workers backends.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/Imtiajrex/appflare-skills --skill appflare-handlers-imtiajrex
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: appflare-handlers
Source: https://github.com/Imtiajrex/appflare-skills/tree/main/skills/appflare-handlers
Command: npx skills add https://github.com/Imtiajrex/appflare-skills --skill appflare-handlers-imtiajrex

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires zod, and includes references (resource) components.

What problem does it solve? Building backend endpoints in an Appflare project requires knowing the exact handler conventions: which helper to use, how file paths map to routes and client names, how Zod args are validated, and how auth, errors, background jobs, and R2 storage rules behave. This Skill encodes those conventions so generated handlers are discovered correctly and behave as expected. ## Core Features & Use Cases - Endpoint authoring: Create query (GET) and mutation (POST) handlers with Zod args, authRequired, middleware role checks, and ctx.error responses that map cleanly to HTTP status codes. - Background and scheduled work: Define scheduler tasks enqueued via ctx.scheduler.enqueue with optional delays, and cron handlers with literal cron triggers, including naming rules and no-retry semantics. - Storage authorization: Write storageManager rules that gate R2 access for ctx.storage calls and the generated /storage/* routes, which are denied by default. - Use Case: You need a new endpoint that lets admins list a project's tasks and a nightly job that cleans expired sessions. The Skill guides you to export listTasks = query({...}) in the right file, add a cron handler with a literal trigger, and run bun appflare dev to confirm discovery. ## Quick Start Ask the agent to create an Appflare query handler that lists a project's tasks with auth required, then run bun appflare dev to verify it is discovered.

Frequently Asked Questions about appflare-handlers

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

FAQPage Schema
How do I create a query or mutation endpoint in Appflare?▼

Export a const using the query or mutation helper from the relative _generated/handlers module, with a raw Zod shape as args and an async handler. The file path under scanDir becomes the route and client path, and only export const declarations are discovered.

How do I run background jobs and cron tasks in Appflare?▼

Define a scheduler handler and enqueue it with ctx.scheduler.enqueue, optionally with delaySeconds, or define a cron handler with a literal cronTrigger string. Scheduler and cron contexts have null user and session, and failures are logged without retries.

Why is my Appflare handler missing from the generated client?▼

Handlers are only discovered when written as export const name = query(...) or similar. export default, export function, re-exports, wrapped helpers, test files, and excluded globs are ignored, so check the export form and file location.

How does authentication and role checking work in Appflare handlers?▼

Set authRequired: true to return 401 without a session, or guard manually with ctx.user. Use the middleware option for shared role checks, which runs after the auth check and before the handler, calling ctx.error(403) to reject.

Why do I get 403 Storage access denied in Appflare?▼

R2 storage is denied by default. Without at least one storageManager handler returning true for the path and method, even ctx.storage calls inside your own handlers receive a 403, so define storage rules first.

What are the limitations of Appflare scheduler and cron handlers?▼

Task names use only the last directory, so identically named files in different trees collide. cronTrigger must be a string literal parsed from source, payloads failing Zod validation are dropped without retry, and ctx.user is always null.