Defines development conventions and architectural patterns for Shopify application backends.

Install

mkdir -p .claude/skills/dev-api && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13264" && unzip -o skill.zip -d .claude/skills/dev-api && rm skill.zip

Installs to .claude/skills/dev-api

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Backend API patterns for Shopify app. Auto-apply when writing webhooks, Prisma models, background jobs, API routes, authentication, or server-side code in app/models/ or app/services/.
184 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Ensure idempotency for webhook operations
  • Handle heavy work asynchronously via DB-based queue
  • Access database using Prisma typed queries
  • Verify webhook HMAC before processing
  • Return structured error responses

How it works

The skill applies conventions for Shopify app backend development, focusing on input validation, idempotency, asynchronous processing, type-safe database access, and secure API practices.

Inputs & outputs

You give it
Backend API development task (webhooks, Prisma models, API routes)
You get back
Backend code adhering to Shopify app conventions, including validation and error handling

When to use dev-api

  • Building shopify webhooks
  • Writing prisma models
  • Developing api routes

About this skill

Shopify App Backend — Development Conventions

Áp dụng conventions này khi develop backend code: API routes, webhooks, database, background jobs, authentication.

Tech Stack

LayerTechnologyNotes
RuntimeNode.jsLTS version
FrameworkRemix (server-side)Loaders/actions = API endpoints
ORMPrismaType-safe DB access
DatabaseSQLite → PostgreSQLSQLite for start, PostgreSQL when scaling
QueueDB-based queueLightweight, no Redis dependency
Cronnode-cronIn-process scheduled tasks
ValidationZodRuntime type validation
AuthShopify OAuthVia @shopify/shopify-app-remix

Core Principles

  1. Validate at boundaries: Zod validate mọi input (request body, query params, webhook payload)
  2. Idempotent operations: Webhooks có thể gửi nhiều lần → handler phải idempotent
  3. Fail gracefully: Return proper HTTP status codes, structured error responses
  4. Background heavy work: Webhook handlers respond 200 ngay, xử lý async qua DB-based queue
  5. Type-safe DB: Luôn dùng Prisma typed queries, KHÔNG raw SQL trừ performance-critical
  6. Secure by default: HMAC validation, rate limiting, input sanitization

Directory Structure

app/
├── models/              # Prisma helper functions (data access layer)
│   ├── product.server.ts
│   ├── order.server.ts
│   └── setting.server.ts
├── services/            # Business logic layer
│   ├── order-processing.server.ts
│   ├── sync.server.ts
│   └── notification.server.ts
├── jobs/                # Background job definitions
│   ├── queue.server.ts       # DB-based queue setup
│   ├── cron.server.ts        # Scheduled tasks (node-cron)
│   ├── processOrder.ts
│   └── syncInventory.ts
├── utils/
│   ├── validation.server.ts  # Zod schemas
│   └── errors.server.ts      # Custom error classes
└── webhooks/            # Webhook handlers
    ├── orders-create.ts
    ├── app-uninstalled.ts
    └── index.ts              # Webhook registry

Naming Conventions

  • .server.ts suffix cho server-only code (Remix tree-shakes client bundles)
  • Model files = data access (thin, no business logic)
  • Service files = business logic (orchestration)
  • Job files = async processing

Code Patterns

Xem chi tiết tại patterns.md bao gồm:

  • Prisma model helper pattern
  • Webhook handler pattern (HMAC + idempotency)
  • DB-based queue pattern (lightweight, no Redis)
  • Cron job pattern (node-cron)
  • API response pattern (structured errors)
  • Zod validation pattern
  • Rate limiting pattern (in-memory, no Redis)
  • App Proxy endpoint pattern
  • Transaction pattern (Prisma)
  • Structured logging pattern
  • Health check pattern (monitoring endpoint)

Prisma Schema Conventions

// Naming: PascalCase models, camelCase fields
// Mọi model có timestamps
// Soft delete qua deletedAt
// Shop relation bắt buộc (multi-tenant)

model Resource {
  id          String    @id @default(cuid())
  shop        String    // Shopify shop domain (tenant key)
  name        String
  slug        String
  status      ResourceStatus @default(DRAFT)
  description String?

  // Relations
  items       Item[]

  // Timestamps
  createdAt   DateTime  @default(now())
  updatedAt   DateTime  @updatedAt
  deletedAt   DateTime? // Soft delete

  // Indexes
  @@unique([shop, slug])
  @@index([shop, status])
  @@index([deletedAt])
}

enum ResourceStatus {
  DRAFT
  ACTIVE
  PAUSED
  ARCHIVED
}

Do's and Don'ts

DO

  • Dùng .server.ts suffix cho tất cả server-only code
  • Validate input bằng Zod trước khi xử lý
  • Return structured errors: { error: { code, message, details } }
  • Dùng Prisma transactions cho multi-step operations
  • Log structured JSON (không console.log plain text)
  • Verify webhook HMAC trước khi process
  • Respond 200 to webhooks ngay, queue heavy processing
  • Dùng cuid() hoặc ulid() cho IDs (không auto-increment)
  • Index columns dùng trong WHERE clauses
  • Soft delete cho business-critical data

DON'T

  • KHÔNG expose internal errors ra client (security risk)
  • KHÔNG raw SQL trừ khi Prisma query quá chậm (document lý do)
  • KHÔNG xử lý heavy logic trong webhook handler (queue nó)
  • KHÔNG trust client-side data — validate lại server-side
  • KHÔNG console.log trong production — dùng structured logger
  • KHÔNG skip HMAC validation cho webhooks
  • KHÔNG hard-delete data liên quan đến orders/payments
  • KHÔNG store secrets trong code — dùng environment variables
  • KHÔNG dùng any type cho API responses

$ARGUMENTS

When not to use it

  • When exposing internal errors to the client
  • When processing heavy logic directly in webhook handlers
  • When skipping HMAC validation for webhooks

Limitations

  • Requires Node.js LTS version
  • Requires Remix (server-side) framework
  • Requires Prisma for ORM

How it compares

This skill enforces specific backend development conventions tailored for Remix-based Shopify apps, ensuring secure, scalable, and maintainable code through predefined patterns and principles, unlike generic API development.

Compared to similar skills

dev-api side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
dev-api (this skill)05moNo flagsIntermediate
telegram-mini-app626moReviewAdvanced
stripe-integration482moNo flagsAdvanced
nodejs-backend-patterns122moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

telegram-mini-app

davila7

Expert in building Telegram Mini Apps (TWA) - web apps that run inside Telegram with native-like experience. Covers the TON ecosystem, Telegram Web App API, payments, user authentication, and building viral mini apps that monetize. Use when: telegram mini app, TWA, telegram web app, TON app, mini app.

62163

stripe-integration

wshobson

Implement Stripe payment processing for robust, PCI-compliant payment flows including checkout, subscriptions, and webhooks. Use when integrating Stripe payments, building subscription systems, or implementing secure checkout flows.

48165

nodejs-backend-patterns

wshobson

Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.

1246

agent-dev-backend-api

ruvnet

Agent skill for dev-backend-api - invoke with $agent-dev-backend-api

318

shopify-apps

alinaqi

Shopify app development - Remix, Admin API, checkout extensions

19

ccxt-typescript

ccxt

CCXT cryptocurrency exchange library for TypeScript and JavaScript developers (Node.js and browser). Covers both REST API (standard) and WebSocket API (real-time). Helps install CCXT, connect to exchanges, fetch market data, place orders, stream live tickers/orderbooks, handle authentication, and manage errors. Use when working with crypto exchanges in TypeScript/JavaScript projects, trading bots, arbitrage systems, or portfolio management tools. Includes both REST and WebSocket examples.

15

Search skills

Search the agent skills registry