backend-bff-pattern

backend-bff-pattern is a skill for Claude Code, Codex from j4flmao/agent-skills. It costs 102 tokens per session (5,243 once invoked), scanned A, original, MIT.

A backend service tailored to one type of client, such as a website, mobile app, or connected device. It gathers and reshapes data from several backend services so each client receives the data it needs.

In plain words
What is it for?
Use it to plan a web, mobile, IoT, or third-party gateway that combines backend responses, transforms them, and applies client-specific authentication or caching.
Why use it?
It reduces the amount of client-side code and avoids sending too much or too little data. It also gives different clients a place for their own API shape and error handling.

Skill for Claude CodeCodex

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 skills/j4flmao/agent-skills/bff-pattern
Any agent
npx skills add j4flmao/agent-skills --skill bff-pattern
Clone the repo
git clone --depth 1 https://github.com/j4flmao/agent-skills

Made for: Claude Code, Codex.

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 backend-bff-pattern

README.md
[![agentmods](https://agentmods.dev/badge/skills/j4flmao/agent-skills/bff-pattern.svg)](https://agentmods.dev/skills/j4flmao/agent-skills/bff-pattern)
Your own site
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/bff-pattern"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/bff-pattern.svg" alt="Measured on agentmods" height="20"></a>
Per session 102 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,243 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.1 $0.00102 $0.05243
Opus 5 $0.00051 $0.02622
Sonnet 5 $0.00020 $0.01049
Haiku 4.5 $0.00010 $0.00524

Measured 2d ago against content hash 8486155738c4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

backend-bff-pattern scanned grade A with 1 finding 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 2d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const response = await fetch(url, { agent, signal: controller.signal });
skills/backend/universal/bff-pattern/SKILL.md · 610 lines

How it starts

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

Backend BFF Pattern

Purpose

Design specialized Backend for Frontend (BFF) services that compose and transform backend APIs for each client type (web, mobile, IoT, third-party), reducing over-fetching and client complexity.

Agent Protocol

Trigger

Exact user phrases: "BFF", "Backend for Frontend", "API gateway", "gateway specialization", "frontend API", "mobile API", "web API", "API composition", "aggregation service", "frontend gateway", "BFF pattern".

Input Context

  • Client types consuming the API (web, iOS, Android, third-party).
  • Backend microservices architecture.
  • Latency and data shape requirements per client.

Output Artifact

BFF architecture design or implementation snippet. No file unless requested.

Response Format

BFF: {client type}
Backing Services: [{service list}]
Composition: {aggregation|transformation|caching}
Security: {auth pattern}

Completion Criteria

  • BFF per distinct client type defined.
  • API composition logic documented.
  • Auth model appropriate for each BFF.
  • Caching and error handling configured.
  • No business logic in BFF — only orchestration.

Max Response Length

4 lines per BFF. 20 lines for full design.

Workflow

Step 1: Identify Client Types

Web BFF      -> SPA (React, Vue)
Mobile BFF   -> iOS + Android apps
Partners BFF -> Third-party integrations
Admin BFF    -> Internal admin panel

Step 2: Design BFF API per Client

Each BFF exposes APIs shaped for its client:

// Web BFF: returns a page-shaped response
GET /api/web/checkout/{cartId}
{
  "items": [
    {"id": "prod-1", "name": "Widget", "quantity": 2, "price": 19.99, "image": "https://..."}
  ],
  "subtotal": 39.98,
  "shipping": 5.99,
  "tax": 3.20,
  "total": 49.17,
  "shippingOptions": [
    {"id": "standard", "name": "Standard", "price": 5.99, "estimate": "5-7 days"},
    {"id": "express", "name": "Express", "price": 12.99, "estimate": "2-3 days"}
  ],
  "paymentMethods": [
    {"id": "card", "name": "Credit Card", "last4": "4242", "expiry": "04/27"}
  ]
}

// Mobile BFF: returns a compact response with mobile-specific fields
GET /api/mobile/checkout/{cartId}
{
  "total": 49.17,
  "shippingOptions": ["standard", "express"],
  "defaultPayment": "card_4242"
}

// Partner BFF: returns normalized data with partner-specific metadata
GET /api/partners/checkout/{cartId}?partner=acme
{
  "orderReference": "ext-123",
  "items": [...],
  "commission": 2.46,
  "total": 49.17
}

Read the full file on GitHub · 610 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. 2d ago First seen · 610 lines · 102 tokens per session scan A 8486155738c4

Subscribe to this mod's changes

backend-bff-pattern is a skill published in the GitHub repository j4flmao/agent-skills (20 stars, last pushed today), licensed MIT. It adds 102 tokens to every session and 5,243 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

api-gateway-patterns

API Gateway patterns for routing, authentication, rate limiting, and service composition in microservices architectures. Use when implementing API gateways, building BFF layers, or managing service-to-service communication at scale.

NickCrew/Claude-Cortex · 45 tokens

commerce-api-gateway

Aggregate multiple commerce microservices behind a single API gateway with GraphQL federation, rate limiting, and unified authentication.

finsilabs/awesome-ecommerce-skills · 26 tokens

bff-pattern

When and how to use a Backend-for-Frontend (BFF) for mobile -- scoping, ownership, and anti-patterns. Use when deciding whether a BFF is justified or designing one.

almasumdev/awesome-mobile-backend-agent-skills · 44 tokens

graphql-for-mobile

GraphQL server design tuned for mobile -- persisted queries, batching, N+1 mitigation, and Apollo client integration. Use when building or reviewing a GraphQL API for mobile apps.

almasumdev/awesome-mobile-backend-agent-skills · 40 tokens

mobile-auth-backend

Server-side OAuth 2.1 + PKCE for native mobile apps -- authorization endpoint, token endpoint, refresh rotation, and device binding. Use when implementing or reviewing the auth server for mobile clients.

almasumdev/awesome-mobile-backend-agent-skills · 45 tokens

session-management

Model multi-device sessions on the backend with sliding vs absolute expiry, device listing, and remote logout. Use when building the session model or a "Your devices" screen.

almasumdev/awesome-mobile-backend-agent-skills · 37 tokens