add-api-route

add-api-route is a command for coding agents from mentilead/shopify-app-skill. It costs 0 tokens per session (525 once invoked), scanned A, original, MIT.

A coding command for creating a React Router route, which is a page or server endpoint in a web app. It adds the appropriate sign-in checks, input checks, and shop-specific access rules.

In plain words
What is it for?
Use it when adding a settings page, a CSV export endpoint, a public Shopify App Proxy route, or a webhook handler.
Why use it?
It removes repetitive setup for deciding who can access a route and how incoming data should be checked. It supports admin pages, private endpoints, public proxy pages, and webhooks.

Command

Part of the shopify-app-skill plugin — 1 skill, 10 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/mentilead/shopify-app-skill/add-api-route
Clone the repo
git clone --depth 1 https://github.com/mentilead/shopify-app-skill

Or install shopify-app-skill, the plugin that ships this one along with the rest of its 1 skill, 10 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-api-route

README.md
[![agentmods](https://agentmods.dev/badge/commands/mentilead/shopify-app-skill/add-api-route.svg)](https://agentmods.dev/commands/mentilead/shopify-app-skill/add-api-route)
Your own site
<a href="https://agentmods.dev/commands/mentilead/shopify-app-skill/add-api-route"><img src="https://agentmods.dev/badge/commands/mentilead/shopify-app-skill/add-api-route.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 525 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00525
Opus 5 $0.00000 $0.00262
Sonnet 5 $0.00000 $0.00105
Haiku 4.5 $0.00000 $0.00052

Measured 5d ago against content hash a9c64ff08343, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

add-api-route scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/add-api-route.md · 35 lines

How it starts

The opening of the file, as written. The whole thing — 35 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Add API Route

Scaffold a new React Router route with loader/action, authentication, validation, and tenant scoping.

Arguments

$ARGUMENTS = route description (e.g., "app.settings for shop settings CRUD", "api.export for CSV export endpoint")

Instructions

  1. Parse the route name and purpose from $ARGUMENTS. If empty, ask the user what route to create and whether it's an app. (authenticated admin), api. (headless), proxy. (public), or webhooks. route.
  2. Read .claude/skills/shopify-app/references/react-router-patterns.md for file naming, loader/action patterns, and revalidation.
  3. Read .claude/skills/shopify-app/references/security-patterns.md for tenant scoping and input validation.
  4. Determine the filename from the route prefix:
    • app.settingsapp/routes/app.settings.tsx (authenticated, has UI)
    • api.exportapp/routes/api.export.tsx (headless, action only)
    • proxy.applyapp/routes/proxy.apply.tsx (public, HMAC verified)
  5. Create the route file with the correct authentication pattern:
    • app.* routes: authenticate.admin(request) in loader and action
    • api.* routes: appropriate auth for the use case
    • proxy.* routes: HMAC verification via verifyProxySignature()
    • webhooks.* routes: authenticate.webhook(request)
  6. For routes with UI (app.* prefix):
    • Export loader for data fetching (scope queries by session.shop)
    • Export action for mutations (validate input, scope by session.shop)
    • Export default component with Polaris UI
    • Add shouldRevalidate if the route has POST actions
    • Read .claude/skills/shopify-app/references/polaris-ui-patterns.md for component patterns
  7. For headless routes (api.* prefix):
    • Export action only (or loader for GET endpoints)
    • Return JSON responses with proper status codes
    • Validate all input parameters
  8. Wire up to existing service functions in app/services/*.server.ts, or create new ones if needed (always with shopDomain as first parameter).
  9. If the route needs navigation, update the <s-app-nav> in app/routes/app.tsx.

Read the full file on GitHub · 35 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 35 lines · 0 tokens per session scan A a9c64ff08343

Subscribe to this mod's changes

add-api-route is a command published in the GitHub repository mentilead/shopify-app-skill (5 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 525 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.