architecture-foundation
Design architecture foundations before implementation. Use when asked to design or refactor architecture, choose Rust/Go crate, package, module, runtime, workflow, or service boundaries, compare mature project architecture, prevent stacked one-off PRs, audit migration debt in existing repos, or produce a spec before coding.
What this skill does
# Architecture Foundation ## Overview Use this skill to turn an architecture discussion into explicit boundaries, contracts, validation gates, and a small execution plan. The goal is not to copy an admired project, but to identify the project's shape and choose the minimum architecture that keeps ownership, effects, errors, and tests clear. For large existing repos, first explain the architecture they already have, then decide whether the work is boundary creation, boundary completion, or boundary deletion. ## When To Use - The user asks "what architecture should this use?", "is this stacked work?", "make a complete spec", "design the runtime", or "compare good libraries". - The change touches runtime, state ownership, adapters, plugins, event loops, rendering, schedulers, persistence, or cross-module contracts. - A repo has many issues/PRs that look individually valid but may not converge on one architecture. - A mature repo has duplicated paths, compatibility shims, generated configs, workflow definitions, or docs that may disagree about the source of truth. - A new skill, framework, library, or large feature needs a foundation guide before implementation. Do not use this for small, local fixes where the existing architecture is obvious and no boundary decision is needed. ## Workflow 1. Search first. - Inspect existing architecture docs, entrypoints, manifests, module trees, public APIs, open issues/PRs, and tests before proposing new structure. - If the user names a reference project, verify current source or official docs before treating it as evidence. - For existing repos, also inspect generated/config artifacts, migration files, background workers, cron jobs, adapters, and the largest files/tests. 2. Classify the project shape. - Simple library: stable API plus internal implementation. - CLI or developer tool: command layer, core operations, IO adapters, reporter. - API gateway or model router: transport, auth/accounting, routing policy, provider adapters, billing/settlement, observability. - Long-running runtime: state root, scheduler, drivers, observability, shutdown. - Lifecycle/composition framework: dependency graph, construction phase, runtime hooks, rollback, shutdown, and test harness. - Event/cache/reconcile controller: watch/list input, cache/projection, queue/backpressure, worker/reconciler, retry, and drain. - Config/module platform: canonical config, adapters, module lifecycle, reload order, rollback, cleanup, and plugin host interfaces. - UI or app shell: state ownership, event protocol, renderer/platform boundary, headless tests. - Service framework: domain core, application services, transport, storage, middleware, error-to-response boundary. - Agent or workflow system: task model, scheduler, provider adapters, event log, replay/test harness. 3. Choose one primary state ownership model. - App-owned entities and handles for native UI/editor runtimes. - State plus typed message for enumerated UI/application workflows. - Virtual DOM/signals when renderer portability and declarative UI dominate. - Typed state or service-instance state for services and middleware. - Event log plus projection/outbox for workflows, billing, async jobs, and reconciliation systems. - World/resource/system model only when data-parallel ECS is a product fit. - Snapshot database or input facts for incremental analysis tools. - Streaming pipeline for one-shot CLI tools and batch processors. 4. Draw the foundation boundaries. - `product/app`: entrypoints, user workflows, product-specific orchestration. - `core/domain`: pure models, invariants, decisions, typed errors, no IO. - `runtime/application`: lifecycle, scheduling, event dispatch, state mutation. - `adapters/backends`: OS, renderer, provider, filesystem, network, database. - `plugins/components`: optional capabilities behind explicit contracts. - `testing/headless`: deterministic drivers, fake adapters, contract tests. 5. Audit existing boundary health before adding tasks. - Name the current source of truth for each contract: code, database table, SQL seed, JSON/YAML config, generated docs, or external provider contract. - Mark duplicated paths as `intentional bridge`, `legacy compatibility`, or `accidental fork`; require an exit condition for compatibility paths. - Prefer a convergence/deletion plan over a new abstraction when the existing architecture is directionally correct but half migrated. - Treat generated files and docs as consumers unless the repo explicitly makes them authoritative. 6. Write the contracts before tasks. - Ownership: who owns state, handles, resources, caches, and mutation rights. - Lifecycle: init, ready, run/tick/frame/request, shutdown, cleanup. - Effect contract: which layer may persist, call providers, bill, publish messages, mutate projections, or only emit effects for another layer. - Event/action: how external events become typed commands/messages/actions. - Effects: which layer may touch IO, processes, network, OS handles, GPU, DOM, databases, or providers. - Error policy: what is recoverable, user-visible, fatal, diagnostic-only, or converted at a boundary. - Config/resources: build-time, startup-time, runtime; owner and invalidation. - Observability: logs, metrics, traces, queue depth, frame/runtime telemetry. - Tests: unit, contract, headless, fake adapter, integration, platform/E2E. 7. Produce a spec, not just a diagram. - Use `references/spec-template.md` when the user needs a durable artifact. - Include non-goals and "do not copy" notes from reference projects. - For every reference project, separate `borrow` from `do_not_copy`; borrow boundary contracts, not scale artifacts, global registries, generated machinery, historical migrations, or domain-specific complexity. - Convert the spec into P0/P1/P2 work where each task maps to one contract. - If issues/PRs already exist, map them to the contracts and identify gaps. ## Decision Rules - Prefer a thin adapter around a mature runtime when the product does not need to own that runtime. - Split crates/modules only for stable API boundaries, side-effect isolation, compile-time isolation, independent tests, or real reuse. - In existing repos, do not split crates/packages first when the real problem is duplicated source-of-truth, an unfinished migration, or missing closed-loop tests. - Keep core free of platform handles, event loops, renderer handles, webviews, database clients, HTTP requests, process spawning, and environment reads. - Make hidden global state illegal unless it is deliberately modeled as typed runtime state or a scoped resource. - Do not let plugins become architecture escape hatches. Each plugin needs API, config/permissions when relevant, lifecycle, errors, and tests. - Do not accept silent degradation. Missing capability must be an explicit unsupported error, diagnostic, or blank result according to the contract. ## Output Shape For quick answers, return: ```text verdict: chosen_shape: state_owner: boundaries: contracts: migration_debt: validation: risks: next_steps: ``` For durable planning, create or update an architecture spec with: ```text objective current evidence reference models considered chosen architecture boundary map source-of-truth map contract matrix compatibility/deletion plan issue/PR map validation matrix P0/P1/P2 roadmap open questions ``` ## Red Flags - A proposed module cannot say which boundary it belongs to. - The design names a trait/config/cache/plugin but does not wire it into startup, lifecycle, or tests. - Two state ownership models are mixed without an explicit bridge. - Two files, configs, SQL seeds, or docs claim to be the source of truth for the same product contract. - A compatibility shim or legacy path has no owner, test, telemetry, or removal condition. - Platform callbacks directly mutate core state. - Errors become warnings plus fallback for user-visible behavior. -
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.