architecture-scaffold
Build a compilable type-level skeleton from a high-level architecture spec before writing any implementation logic. Use when you have an architectural assessment, design doc, or restructuring plan and need to prove the new architecture is sound before migrating code. Also use when asked to "scaffold the new architecture", "create type stubs", "build the shell", "flesh out this spec", "skeleton the modules", or any request to turn architectural intent into verified structure. This skill follows the "Human Builds the Shell" paradigm: types are hard constraints that the compiler enforces, so if the skeleton compiles, the architecture is structurally sound. Especially valuable for large refactors where you don't trust agents to maintain coherence.
What this skill does
# Architecture Scaffold
Turn a high-level architecture spec into a compilable type skeleton, then prove it's sound with the compiler before anyone writes a line of logic.
## Why This Exists
Large refactors fail when agents jump straight to implementation. They lose the thread, make local decisions that contradict the global design, and you end up with a different mess than the one you started with. The "Human Builds the Shell" paradigm (Mengdi Chen, 2026) solves this by separating structure from logic:
1. **Types** are hard constraints — the compiler rejects violations at build time
2. **Tests** are behavioral verification — they confirm what the code does at runtime
3. **Specs** are soft guidance — they inform but can't enforce
This skill operates at layer 1. By the time you're done, every module, every function signature, every protocol/trait, and every type relationship exists as real code that the compiler has verified. No logic yet — just the architectural skeleton. An agent literally cannot hallucinate past a compiler error.
## The Three Phases
### Phase 1: Extract the Target Architecture
Read the spec. Produce a structured outline of every module, type, and signature.
### Phase 2: Build the Skeleton
Write real source files with real types and stub bodies. Compile layer by layer until it all passes.
### Phase 3: Map the Old Codebase
For each stub, determine whether existing logic can be ported or needs rewriting.
---
## Phase 1: Extract the Target Architecture
Read the assessment or design document the user provides. You're looking for:
- **Modules/components** — what are the new architectural units?
- **Responsibilities** — what does each unit own?
- **Types** — what data structures cross boundaries?
- **Dependencies** — which modules depend on which? What's the dependency direction?
- **Boundaries** — where are the hard seams? (FFI, network, persistence, framework edge)
Produce a **module map** — a structured outline that captures this. Don't write code yet. The module map is your intermediate representation between the prose spec and the code skeleton.
```markdown
# Module Map
## Layer 1: Domain Types (innermost — no dependencies on other project modules)
### module: domain
Location: core/capacitor-core/src/domain/
Responsibility: Shared value types, identities, and enums used across all modules
Types:
- Project { id, name, path, ... }
- RuntimeSnapshot { active_project, hooks, timestamp, ... }
- HookEvent (enum: session_start, session_end, tool_use, ...)
Dependency rule: This module imports nothing from the project. Everything else may import this.
## Layer 2: Service Contracts (depend only on domain types)
### module: RuntimeEngine
Location: core/capacitor-core/src/runtime/
Responsibility: Core runtime lifecycle — start, stop, snapshot reads
Dependencies: domain (inward only)
Exposes:
- RuntimeEngine (protocol/trait)
- start(config: RuntimeConfig) -> Result<(), RuntimeError>
- stop() -> Result<(), RuntimeError>
- current_snapshot() -> RuntimeSnapshot
Types:
- RuntimeConfig { storage_path, poll_interval, ... }
- RuntimeError (enum: already_running, storage_unavailable, ...)
### module: SetupService
Location: core/capacitor-core/src/setup/
Responsibility: First-run and configuration workflows
Dependencies: domain (inward only)
Exposes:
- SetupService (protocol/trait)
- validate_setup() -> SetupStatus
- perform_setup(config: SetupConfig) -> Result<(), SetupError>
...
## Layer 3: FFI Boundary (translates between layers)
### module: ffi
Location: core/capacitor-core/src/ffi/
Responsibility: Expose Rust services to Swift via C-compatible interface
Dependencies: Layer 2 services, domain types
Boundary types (must be repr(C) or serializable):
- FFIRuntimeConfig, FFIRuntimeSnapshot, ...
Binding mechanism: [cbindgen / uniffi / manual C headers — match what the project uses]
## Layer 4: Swift Application Layer (outermost — depends on FFI)
### module: RuntimeSupervisor
Location: apps/swift/Sources/Capacitor/Services/RuntimeSupervisor.swift
...
```
### Dependency rules
The module map must declare explicit dependency rules per layer. These become enforceable constraints during verification:
```
Layer 1 (domain) → imports nothing from the project
Layer 2 (services) → imports only Layer 1
Layer 3 (FFI) → imports Layers 1 and 2
Layer 4 (Swift app) → imports only Layer 3's public interface
```
These rules are what prevent the architecture from drifting back to spaghetti. Write them down. They'll be verified mechanically in Phase 2.
### The level of detail matters
Each function signature should include parameter names, parameter types, and return types. If the assessment doesn't specify them, infer them from the described responsibilities and the existing codebase. Flag anything you're uncertain about — the user should confirm before you proceed to code.
### Handling ambiguity
The assessment will inevitably leave gaps. Common ones:
- **Error types** — the spec says "extract SetupService" but doesn't say what errors it can produce. Look at the existing code to see what errors the current implementation handles, and design the error enum from that.
- **Shared types** — two modules both need access to `Project`. Where does the type live? In the domain layer that both depend on (dependency points inward).
- **Boundary data** — what crosses the FFI or persistence boundary? These types need to be serializable. Flag them explicitly.
When in doubt, ask the user. A five-second clarification now prevents an hour of rework later.
### Leverage the assessment's existing references
If the assessment names specific files, functions, and line numbers (and a good one will), use those as anchors when inferring signatures. Don't search the codebase from scratch when the assessment already points you to `CoreRuntime.initialize()` in `lib.rs:276`. Read what's there and design the new signature from it.
### Present the module map for sign-off
Show the module map to the user before writing any code. They should confirm:
- The modules cover all the assessment's recommendations
- The dependency directions are correct
- The file/directory placement makes sense for the project
- Nothing critical is missing
- The granularity feels right (not too many tiny modules, not too few bloated ones)
---
## Phase 2: Build the Skeleton
Now you write real code. Every module, every type, every function signature — but no implementation logic. Bodies are stubs.
### Create a working branch
```
git checkout -b architecture-scaffold
```
### File placement
Where new files go matters — it determines the module graph. Follow these principles:
- **New modules get new files/directories**, not insertions into existing files. If you're splitting `CoreRuntime` into `RuntimeEngine` + `SetupService`, create `src/runtime/mod.rs` and `src/setup/mod.rs` — don't try to carve them out of `lib.rs` yet.
- **The module map's "Location" field is the source of truth.** You decided on placement in Phase 1; now execute it.
- **Old files stay untouched for now.** The skeleton lives alongside the existing code. Don't delete or modify old code — that's the migration phase's job.
- **Update module declarations** (Rust `mod` statements, Swift package targets) so the compiler sees the new files.
### Scaffold layer by layer
Don't write all the skeleton files at once and then compile. Build from the inside out, compiling at each layer. This keeps errors localized and prevents cascading failures.
**Step 1: Domain types (Layer 1)**
Write the shared types — structs, enums, type aliases. Compile.
These have no dependencies, so if they don't compile, it's a self-contained problem.
**Step 2: Service contracts (Layer 2)**
Write the protocols/traits and their associated types. Write stub implementations. Compile.
If this fails, it's either a bad import (trivial) or a type mismatch with the domain layer (architectural — see below).
**Step 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.