skills/bff-pattern-implementation/SKILL.md
Guidance and best practices for bff pattern implementation (backend for frontend).
npx skillsauth add jyjeanne/ai-setup-forge bff-pattern-implementationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A BFF is a dedicated backend service for a specific frontend (e.g., Web BFF, Mobile BFF).
Different frontends have different data needs. A "one-size-fits-all" API might over-fetch for mobile or under-fetch for desktop.
Identify the unique data needs for each client (Web vs. Mobile).
The BFF calls multiple downstream services and merges the results.
// Web BFF - Express/TypeScript
router.get('/dashboard', async (req, res) => {
const [userProfile, recentOrders, notifications] = await Promise.all([
userService.getProfile(req.userId),
orderService.getRecent(req.userId),
notificationService.getUnread(req.userId)
]);
res.json({
user: { name: userProfile.name, avatar: userProfile.avatar },
orders: recentOrders.map(o => ({ id: o.id, total: o.price })),
alerts: notifications.length
});
});
Convert internal protocols (like gRPC) to client-friendly JSON/REST or GraphQL.
// Translating gRPC to JSON
async function getProduct(id: string) {
const grpcResponse = await productGrpcClient.getProduct({ id });
return {
id: grpcResponse.uuid,
name: grpcResponse.title,
price: grpcResponse.amount / 100 // Convert cents to dollars
};
}
Handle different auth flows (e.g., Session cookies for Web, JWT for Mobile).
// Mobile BFF - JWT Validation
app.use((req, res, next) => {
const token = req.headers.authorization;
if (!isValidMobileToken(token)) return res.status(401).send();
next();
});
Promise.all) to avoid "waterfall" latency.A middleware service that optimizes communication between specific frontend clients and the backend ecosystem, reducing payload sizes and simplifying frontend logic.
development
Generate breadboard circuit mockups and visual diagrams using HTML5 Canvas drawing techniques. Use when asked to create circuit layouts, visualize electronic component placements, draw breadboard diagrams, mockup 6502 builds, generate retro computer schematics, or design vintage electronics projects. Supports 555 timers, W65C02S microprocessors, 28C256 EEPROMs, W65C22 VIA chips, 7400-series logic gates, LEDs, resistors, capacitors, switches, buttons, crystals, and wires.
development
Apply lean thinking to UX: hypothesis-driven design, collaborative sketching, and rapid experiments instead of heavy deliverables. Use when the user mentions "Lean UX", "design hypothesis", "UX experiment", "collaborative design", or "outcome over output". Covers hypothesis statements, MVPs for UX, and cross-functional collaboration. For Build-Measure-Learn, see lean-startup. For usability audits, see ux-heuristics.
development
Design MVPs, validated learning experiments, and pivot-or-persevere decisions using Build-Measure-Learn. Use when the user mentions "MVP scope", "validated learning", "pivot or persevere", "vanity metrics", or "test assumptions". Covers innovation accounting and actionable metrics. For 5-day prototype testing, see design-sprint. For customer motivation analysis, see jobs-to-be-done.
tools
Instrument, trace, evaluate, and monitor LLM applications and AI agents with LangSmith. Use when setting up observability for LLM pipelines, running offline or online evaluations, managing prompts in the Prompt Hub, creating datasets for regression testing, or deploying agent servers. Triggers on: langsmith, langchain tracing, llm tracing, llm observability, llm evaluation, trace llm calls, @traceable, wrap_openai, langsmith evaluate, langsmith dataset, langsmith feedback, langsmith prompt hub, langsmith project, llm monitoring, llm debugging, llm quality, openevals, langsmith cli, langsmith experiment, annotate llm, llm judge.