fuz-stack #

Overview
#

Coding conventions and patterns for the @fuzdev TypeScript and Svelte 5 ecosystem. These conventions keep agent-assisted development consistent across ~20 repos — from naming and file organization to error handling, testing, and validation patterns.

This content is AI-generated and mostly poorly reviewed. Not all patterns described here are endorsed, and some may be out of date or incorrect.

The full skill documentation is at skills/fuz-stack.

Conventions
#

AreaConvention
Namingsnake_case functions/variables, PascalCase types/components, SCREAMING_SNAKE_CASE constants
File organizationsrc/lib/ for library code, src/test/ for tests (not co-located), src/routes/ for SvelteKit
ImportsAlways include .js extension, import directly from source module (no re-exports)
FormattingPrettier with tabs, 100 char width
Breaking changesAcceptable — delete unused code, don't shim or alias
Flat namespaceAll exported identifiers unique across all modules; gro gen enforces
Buildgro check runs typecheck + test + gen --check + format --check + lint
// snake_case functions — domain-prefix when bare name would be ambiguous function git_push() {} // git_* cluster, "push" alone is ambiguous function truncate() {} // action-first, self-descriptive // PascalCase types and components type PackageJson = {}; // file: DocsLink.svelte // .js extension in imports, even for .ts files import {git_push} from './git.js';

Core patterns
#

Beyond surface conventions, several deeper patterns define how @fuzdev code is structured:

PatternConvention
Error handlingResult<TValue, TError> discriminated union — never throw for expected errors
Dependency injectionSmall *Deps interfaces for all I/O, plain object mocks — no mocking libraries
Validationz.strictObject() by default, PascalCase schema naming, .brand() for nominal types
TestingFixture-based testing for parsers — input files, generated expected.json, never manually edit
// Result pattern — properties directly on the result object function parse_config(text: string): Result<{value: Config}, {error: ParseError}> { return {ok: true, value: JSON.parse(text)}; } // Deps pattern — small interfaces, no god types export interface FsDeps { read_file: (path: string) => Promise<string>; write_file: (path: string, content: string) => Promise<void>; }

References
#

14 detailed reference documents:

ReferenceCovers
Async PatternsConcurrency primitives — semaphore, deferred, concurrent map/each
Code GenerationGro gen system — .gen.* files, dependencies, output formats
Common UtilitiesResult type, Logger, Timings, DAG execution
CSS Patternsfuz_css styling — variables, utility classes, modifiers, extraction
Dependency InjectionInjectable *Deps interfaces, mock factories, composition patterns
Documentation SystemDocs pipeline — Tome system, layout architecture, project setup
Rust Conventions for the Fuz EcosystemShared Rust patterns — edition 2024, unsafe forbid, lints, crate structure
Svelte 5 PatternsSvelte 5 runes, contexts, snippets, attachments, Cell pattern
Task PatternsGro task system — .task.ts files, TaskContext, error handling
Testing PatternsVitest patterns, fixtures, mocks, assertion helpers
TSDoc Comment Style GuideTSDoc style guide — tags, conventions, auditing
Type UtilitiesNominal typing (Flavored/Branded), strict utility types
WASM Patterns for the Fuz EcosystemWASM build targets — wasm-bindgen, component model, JS interop
Zod SchemasZod conventions — strictObject, branded types, introspection

Stack
#

fuz_util → gro + fuz_css → fuz_ui → fuz_* apps

gro is a temporary build tool, to be replaced by fuz (Rust daemon + CLI). See stack for the full dependency graph and package details.

For cross-repo coordination patterns — planning, TODOs, and multi-repo goals — see grimoire.