
Forge Idiomatic Engineer
Implement Forge handlers (queries, mutations, jobs, webhooks, MCP tools) with correct macros, auth scope, and wire naming in Rust.
Overview
Forge-idiomatic-engineer is an agent skill for the Build phase that documents Forge Rust macros, handler attributes, and scaffolding for idiomatic backend and MCP tool operations.
Install
npx skills add https://github.com/isala404/forge --skill forge-idiomatic-engineerWhat is this skill?
- Reference for Forge macros: query, mutation, job, cron, workflow, daemon, webhook, mcp_tool, model, enum
- Documents #[forge::query] attributes: public, unscoped, consistent, require_role, and compile-time user scoping
- Scaffold handlers via forge new <kind> <name> with mod wiring in functions/mod.rs and main.rs
- Explains when to use public (anonymous), unscoped (authenticated shared reads), and consistent primary DB reads
- Positions handlers as the idiomatic unit for wire operations in a Forge Rust service
- 9 forge new kinds listed: query, mutation, job, cron, workflow, daemon, webhook, mcp_tool, model, enum
Adoption & trust: 921 installs on skills.sh; 82 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are adding Forge handlers but unclear which macro, auth attribute, or forge new kind to use without breaking scoping or wire names.
Who is it for?
Indie devs building a Forge-based API or agent backend who need macro and context-type lookup while coding handlers.
Skip if: Greenfield framework choice or DevOps deploy runbooks with no Forge/Rust stack in the repo.
When should I use this skill?
Implementing or reviewing Forge handlers, macro attributes, auth scoping, forge new scaffolding, or MCP tool definitions in a Forge Rust project.
What do I get? / Deliverables
You implement correctly scoped queries and mutations—and related job or MCP handlers—with attributes and module layout that match Forge conventions.
- Handler modules generated or updated with correct macro attributes
- Wire-named operations registered in functions/mod.rs
Recommended Skills
Journey fit
How it compares
In-repo macro reference for Forge services—not a generic REST OpenAPI generator skill.
Common Questions / FAQ
Who is forge-idiomatic-engineer for?
Rust developers using the Forge framework to ship queries, mutations, background jobs, webhooks, or MCP tools in one codebase.
When should I use forge-idiomatic-engineer?
During build/backend work when defining handlers, choosing public vs scoped queries, scaffolding with forge new, or wiring MCP tools and workflows.
Is forge-idiomatic-engineer safe to install?
It is documentation for code patterns; review the Security Audits panel on this Prism page before installing skills from the registry.
SKILL.md
READMESKILL.md - Forge Idiomatic Engineer
# API Reference This reference provides a comprehensive guide to Forge macros, context types, configuration options, and error variants. ## Macro Attributes Forge handlers are defined using Rust macros that generate necessary structs and registration logic. > Scaffold a new handler with `forge new <kind> <name>` (e.g. `forge new query list_invoices`). It writes the file with sane defaults, appends `pub mod <name>;` to `src/functions/mod.rs`, and inserts `mod functions;` in `src/main.rs` if missing. Kinds: `query`, `mutation`, `job`, `cron`, `workflow`, `daemon`, `webhook`, `mcp_tool`, `model`, `enum`. ### `#[forge::query]` Defines a read-only operation. The macro generates a `{PascalCase}Query` struct and implements the `ForgeQuery` trait. All private queries must explicitly filter results by the current user or owner unless the `unscoped` attribute is used. | Attribute | Description and Rationale | |---|---| | `name = "x"` | Overrides the default wire name (derived from the function name). | | `public` | Skips JWT validation entirely — anonymous callers allowed. `ctx.auth.user_id()` returns `None`. Use for login pages, public APIs, landing data. | | `unscoped` | JWT still required; skips the compile-time `user_id`/`owner_id` filter rule. Use for admin or shared data that any authenticated user may read. | | `consistent` | Forces the query to read from the primary database to ensure data consistency after a recent write. | | `require_role("x")` | Returns a 403 Forbidden error if the user lacks the specified role. | | `cache = "30s"` | Enables a per-identity cache with the specified TTL to reduce database load. | | `timeout = "30s"` | Sets the maximum execution time. Accepts duration strings: `"30s"`, `"5m"`, `"1h"`. | | `rate_limit(requests = N, per = "1m", key = "user")` | Configures rate limiting. `key` values: `"user"`, `"ip"`, `"global"`, `"tenant"`, `"user_action"`, `"custom(claim_name)"`. | | `description = "..."` | Adds a human-readable description to the function metadata. | | `log = "info"` | Sets the log level for handler execution. | | `tables("foo", "bar")` | Manually specifies table dependencies to trigger reactive cache invalidation. | ### `#[forge::mutation]` Defines a data-modifying operation. The macro generates a `{PascalCase}Mutation` struct and implements the `ForgeMutation` trait. | Attribute | Description and Rationale | |---|---| | `name = "x"` | Overrides the default wire name (derived from the function name). | | `public` | Skips JWT validation entirely — anonymous callers allowed. Use for login endpoints and unauthenticated signups. | | `unscoped` | JWT still required; skips the compile-time `user_id`/`owner_id` filter rule. Use for admin mutations that operate across all users. | | `require_role("x")` | Restricts access to users with the specified role. | | `transactional` | Wraps the entire operation in a PostgreSQL transaction. **Default: on.** Opt out with `transactional = false` for high-throughput writes that don't need atomicity. Cannot be disabled when using `dispatch_job()` or `start_workflow()`. | | `timeout = "30s"` | Sets the handler timeout. Accepts duration strings: `"30s"`, `"5m"`, `"1h"`. | | `max_size = "200mb"` | Defines the maximum allowable request body size for this mutation. | | `rate_limit(requests = N, per = "1m", key = "user")` | Configures rate limiting. `key` values: `"user"`, `"ip"`, `"global"`, `"tenant"`, `"user_action"`, `"custom(claim_name)"`. | | `description = "..."` | Adds a human-readable description to the function metadata. | | `allow_http` | Permits `ctx.http()` calls inside a transactional mutation (normally a compile error). | ### `#[forge::job]` Defines an asynchronous background task. These tasks are durable and automatically retried upon failure. **Queue model**: PG-backed (`forge_jobs` table). Workers claim with `FOR UPDATE SKIP LOCKED`, ordered `priority DESC, scheduled_at ASC`. Concurrency bounded by a semaphore (`max_concurrent`, default 8). Sy