# Bff Transport Boundary

> Design and review Backend-for-Frontend transport boundaries. Use when implementing or changing request parsing, response mapping, streaming proxy behavior, CORS, header allowlists, authentication boundaries, timeouts, cancellation, error envelopes, or upstream orchestration.

- **Type:** Skill
- **Install:** `agentstack add skill-hsienw-ai-agent-engineering-playbook-bff-transport-boundary`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [HsienW](https://agentstack.voostack.com/s/hsienw)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [HsienW](https://github.com/HsienW)
- **Source:** https://github.com/HsienW/ai-agent-engineering-playbook/tree/master/skills-contract-boundaries/bff-transport-boundary

## Install

```sh
agentstack add skill-hsienw-ai-agent-engineering-playbook-bff-transport-boundary
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# BFF Transport Boundary

## Skill Interface

- Name: bff-transport-boundary.
- Description: Design and review Backend-for-Frontend transport boundaries for request parsing, response mapping, streaming proxy behavior, CORS, header allowlists, authentication boundaries, timeouts, cancellation, error envelopes, and upstream orchestration.
- Parameters: BFF route or transport boundary, inbound request shape, upstream targets, authentication and authorization context, header policy, streaming behavior, timeout and cancellation rules, error envelope shape, and verification commands.
- Instructions: Use this skill before implementing or changing BFF transport behavior. Keep orchestration and transport safety in the BFF, validate untrusted inputs, propagate cancellation, bound streaming resources, map errors explicitly, and verify success plus failure paths.

A BFF owns transport safety and orchestration. It should not absorb product
reasoning, model prompts, workflow planning, or domain decisions that belong to
backend services.

## Ownership

The BFF owns:

- Request parsing and runtime validation.
- Authentication and authorization boundaries.
- Header allowlists.
- CORS and security headers.
- Request-size limits and rate limits.
- Timeout and cancellation propagation.
- Upstream request orchestration.
- Stream forwarding and backpressure.
- Transport error mapping.
- Request tracing and audit metadata.

The BFF does not own:

- Model reasoning.
- Prompt construction.
- Agent planning.
- Workflow graph routing.
- Natural-language intent classification.
- Tool implementation details.

## Request Rules

- Treat headers, cookies, query parameters, route parameters, body fields,
  multipart metadata, filenames, MIME types, and forwarded-address headers as
  untrusted.
- Validate at the transport boundary.
- Do not forward arbitrary inbound headers upstream.
- Do not let clients control upstream hosts, internal URLs, authorization
  targets, trace ownership, or filesystem paths.

## Streaming Rules

- Do not buffer unbounded upstream streams in memory.
- Respect backpressure.
- Do not write after the response is closed or destroyed.
- Release listeners, timers, and readers on every terminal path.
- When the downstream client disconnects, abort upstream work when supported.

Define terminal reasons:

- `completed`
- `client_cancelled`
- `client_disconnected`
- `bff_timeout`
- `upstream_timeout`
- `upstream_error`
- `malformed_upstream_event`
- `process_shutdown`

## Error Contract

Separate HTTP status, stable error code, developer message, user message key,
retryability, and terminal reason.

Never expose stack traces, internal URLs, provider responses, authorization
headers, cookies, tokens, or raw internal exception names.

## Observability

Include request id, trace id, route, method, status, upstream target category,
duration, bytes in/out, terminal reason, and error code where relevant.

## Verification

Test success, invalid request, forbidden request, malformed upstream response,
client disconnect, timeout, cancellation, upstream error, duplicate events,
backpressure behavior, and cleanup of listeners and timers.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [HsienW](https://github.com/HsienW)
- **Source:** [HsienW/ai-agent-engineering-playbook](https://github.com/HsienW/ai-agent-engineering-playbook)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-hsienw-ai-agent-engineering-playbook-bff-transport-boundary
- Seller: https://agentstack.voostack.com/s/hsienw
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
