platform-seams

Apply build-time platform seams across browser, Tauri, and host targets using package.json import conditions.

4.8k|376|Updated Mar 16, 2023
One-click install
npx skills add https://github.com/EpicenterHQ/epicenter --skill platform-seams
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: platform-seams
Source: https://github.com/EpicenterHQ/epicenter/tree/main/.agents/skills/platform-seams
Command: npx skills add https://github.com/EpicenterHQ/epicenter --skill platform-seams

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cross-platform apps need code that behaves differently per build target (browser, Tauri WebView, Epicenter host), but runtime branching and global file-suffix resolution cause silent misconfiguration and untyped code paths. This Skill guides you through Epicenter's #platform/* seam mechanism so each build resolves the correct implementation leaf at build time.

Core Features & Use Cases

  • Declaring a seam: Map a #platform/* specifier in package.json imports with one entry per condition plus a default, then import the bare specifier with no call-site branching.
  • Build and typecheck wiring: Activate conditions in vite.config.ts (preserving ...defaultClientConditions) and add a tsconfig.<condition>.json per leaf so every variant is typechecked.
  • Contract enforcement: Define a shared type in types.ts and annotate each leaf with : Contract instead of satisfies to keep all leaves in lockstep.
  • Use Case: When adding a new #platform/auth leaf for the epicenter-host condition, use this Skill to wire the import map, Vite conditions, and per-condition tsconfig correctly while avoiding anti-patterns like storage seams or runtime host detection.

Quick Start

Ask the AI to add a new #platform seam for a capability that differs between the browser and Tauri builds, following the Epicenter seam conventions.

Frequently Asked Questions about platform-seams

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a platform-specific code path for Tauri vs browser builds?

Declare a #platform/* specifier in package.json imports with one entry per condition plus a default, then import the bare specifier at call sites. Activate the condition in vite.config.ts resolve.conditions and add a tsconfig.<condition>.json so each leaf is typechecked.

What is the difference between the tauri and epicenter-host conditions?

The tauri condition means the build runs in a Tauri WebView and may call native commands. The epicenter-host condition means the desktop Epicenter host serves the build, so a leaf may reach the host for credentials, deployment choice, or an asset base.

Should storage or database access go behind a platform seam?

No. Every build opens its own store, including the Tauri build, so a #platform/* seam for storage or replicas is an anti-pattern that ADR-0226 explicitly refused. Seams cover only credentials, deployment selection, and native capability.

Why does dropping a platform condition leaf not break the build?

Resolution silently falls back to the default entry, so the hosted build quietly runs the browser leaf. Detect this with the platform-selection test that reads the declarations and the build test that inspects emitted bytes.

Why use a type annotation instead of satisfies on seam leaves?

satisfies leaks the concrete type of each leaf, breaking the lockstep that keeps every leaf the same shape. Annotate each leaf as export const x: Contract so all leaves conform to the shared type declared in types.ts.