/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
$ npx -y skills add majiayu000/spellbook --skill architecture-foundation --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/architecture-foundation
Context preview
The summary Claude sees to decide when to auto-load this skill.
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
SKILL.md
architecture-foundation.SKILL.mdname: architecture-foundation
description: 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.
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 ev
Read more
name: architecture-foundation description: 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.
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 ev
Cross-runtime skills for Claude Code, Codex, and multi-agent workflows.
Repo: majiayu000/spellbook
Other skills on spellbook.
- /agentsmd-optimize
Audit AND optimize a CLAUDE.md / AGENTS.md instruction file — score it against the five high-leverage patterns, flag anti-patterns, then apply approved fixes in place. Use when the user says 优化 CLAUDE.md / 优化 AGENTS.md / optimize my agent doc / 帮我改 claudemd, or after an audit
Open skill - /agentsmd-scaffold
Generate or update repository-specific AGENTS.md instruction files from real repo evidence. Use when asked to create, design, scaffold, split, or improve root or scoped AGENTS.md files for Codex/Claude/agent workflows, especially when a repo needs directory-specific rules,
Open skill - /api-design
REST/GraphQL/gRPC API design best practices. Use when designing APIs, defining contracts, handling versioning. Covers OpenAPI 3.2, GraphQL Federation, gRPC streaming.
Open skill - /app-ui-design
Mobile app UI design expert for iOS and Android. Use when designing app interfaces, creating design systems, ensuring accessibility, or following platform guidelines. Covers Material Design 3, Human Interface Guidelines, color theory, typography, and 2025 trends.
Open skill - /app-user-story-qa
End-to-end app feature inventory and user-story testing workflow with a canonical tracker. Use when the user asks to audit every feature, derive expected behavior from code, test user journeys, or explicitly fix and retest documented UX or logistical defects.
Open skill - /ask-opencli
Ask Grok or Gemini via opencli (browser-session based, no API cost). Use when the user says "问 grok", "问 gemini", "ask grok", "ask gemini", "用 grok 查", "grok 怎么看", "让 gemini 分析", or wants a second opinion from Grok/Gemini without paying API tokens. Routes to opencli which drives
Open skill

