Pre-alpha: conventions are still moving. When code or a project's
CLAUDE.mdconflicts with this skill, the code is ground truth.À la carte: each project adopts what serves it.
Skip for: planning/lore-only edits, third-party code review, simple git or shell operations.
Read by language. §Shared rules applies to everything. A TS or Svelte
task reads §TypeScript and Svelte; a Rust task skips to §Rust Crates. Each
part is the rules that most often go wrong, then a list of references to read
by task. The references own conventions, patterns, and traps; each repo's
CLAUDE.md owns its inventory (modules, commands, options).
The stack is built so that producing, deploying, and operating software is within reach of one person and an AI partner. Consistent, self-describing patterns are what let an agent learn a rule once and apply it in every repo.
query_session_get_valid, keyed_hash) with no
renaming at a boundary.gro changeset).gro publish, gro deploy, or gro release.// TODO comments are welcome, not debt to hide. // TODO @many marks
one that applies in several places. A planning doc that spans sessions
lives outside the repo, in whatever planning layer the workspace has:
gro check refuses a TODO*.md at a repo's root on CI.Dependency order:
fuz_schema → fuz_util → gro, fuz_css → fuz_code, mdz → fuz_ui → fuz_app → apps.
| Package | What it is |
|---|---|
fuz_schema | the stack's schema library |
fuz_util | foundation utilities, with no dependencies of its own |
gro | task runner and toolchain; becoming a JS runtime on V8 |
fuz_css | semantic-first CSS framework and design system |
fuz_code | syntax highlighting |
mdz | strict markdown dialect: parser, renderer, Svelte preprocessor |
fuz_ui | Svelte 5 components, theming, the docs system |
fuz_app | the TS backend spine: auth, sessions, DB, actions, realtime |
svelte-docinfo | static analysis of TS and Svelte, behind the API docs |
tsv | formatter and parser for TS, Svelte, and CSS (Rust) |
fuz_app's Rust twin is the spine crates in the fuz repo; servers such as
zzz's and fuz_forge's are built on those, and fuz_app's cross-backend suites
hold the two to one wire contract.
Functions, variables, and .ts files are snake_case. Types, classes,
components, and schemas are PascalCase. Primitive constants are
SCREAMING_SNAKE_CASE. Not camelCase. An external API keeps its own
casing (.map(), addEventListener()). svelte-docinfo follows the wider
Svelte ecosystem's conventions instead (camelCase, kebab-case files, an index
barrel), because that ecosystem is its audience.
export const git_current_branch_name = async (
git: SpawnProgram,
options?: SpawnCallOptions
): Promise<GitBranch> => { ... };
export function create_context<T>(fallback?: () => T) { ... }
const DEFAULT_TIMEOUT = 5000;
export const Args = s.object({ ... }); // a schema shares its type's name
class DocsLinks {}
// file: src/lib/DocsLink.svelteThe name's form is chosen by what disambiguates it in a flat namespace:
| Pattern | Example | When |
|---|---|---|
domain_action | git_push | the bare action is ambiguous |
domain_is_adjective | git_workspace_is_clean | a boolean in a domain cluster |
action_domain | escape_js_string | the action reads on its own |
to_target | to_file_path | a conversion |
create_domain | create_context | a factory |
query_table_verb | query_session_get_valid | a SQL query function |
The file says which: git.ts holds git_*, string.ts holds action-first
names.
Every exported name is unique across a package's modules. svelte-docinfo
checks it, and projects turn the check on with
svelte_docinfo({onDuplicates: 'throw'}), which fails the build listing each
conflict. Resolve one by renaming the side that isn't the primary API:
State (ThemeState,
AuthState, SidebarState).View (zzz's Chat and ChatView.svelte).@nodocs tag removes an export from the check and from the docs.
It is right for the task, Args, and gen exports that every task and
gen file shares, and wrong for anything a consumer imports.src/lib/ is exportable code, src/routes/ is the SvelteKit app,
and src/test/ is every test, mirroring lib/. Tests are never
beside the source.@fuzdev/fuz_app/env/load.ts, @fuzdev/gro/task.ts); package exports
are wildcards. The exceptions are gro's bare @fuzdev/gro entry, which
re-exports a few types for task and gen files, and svelte-docinfo's index.pkg/), and a project file that re-exports a task or gen a
package ships, so gro can run it by path.src/lib flat and cluster by filename prefix
(git.ts, sveltekit_shim_*.ts): the libraries, and zzz, the largest app.
fuz_app and fuz_forge group each domain into a subdirectory
(lib/auth/, lib/db/), which becomes part of the import path and which
the tests mirror. Follow the repo, and don't open a subdirectory for a file
or two.account_schema.ts,
account_queries.ts, account_routes.ts.gro format's (tsv). Don't hand-format../bar.ts, ./Foo.svelte, never .js
for a .ts file. src/lib imports relatively. Outside it, #lib/* and
#routes/* reach into those trees and a file in the same directory is
imported relatively. Another package is @fuzdev/pkg/foo.ts. Rules and
reasons: ./references/path-references §Import specifiers.gro check # everything below, the command to run before calling work done
gro typecheck # svelte-check or tsc
gro test # vitest; `gro test foo` filters
gro gen # run *.gen.ts files; `gro gen --check` fails on drift
gro format # tsv; `gro format --check` verifies
gro lint # eslint
gro sync # svelte-kit sync + package.json exports; run when check says they driftedgro directly, never through npx.gro check syncs first (svelte-kit sync, package.json exports),
then runs typecheck, tests, gen --check, a package.json drift check,
format --check, and lint.gro check skips tests when
there are no test files and fails naming them when there are.gro task src/lib/foo.task.ts. gro lists the builtins.<style> block. Work down the ladder (element, built-in
convention, composite, token or keyword class, literal class, <style>)
and never hardcode a spacing or color value. Local classes are
kebab-case and never take a fuz_css class name.create_context from @fuzdev/fuz_ui/context_helpers.ts, never
module-level runes.@fuzdev/fuz_schema is the one schema library. s.object
rejects unknown keys and is the default. A schema and its type share a
PascalCase name. s.parse at a boundary, s.parse_or_throw for an
invariant, s.with_default_fn for a mutable default.*Deps interfaces taken
as parameters and composed bottom-up; data is *Options. A function that
spawns takes each program as a handle. A root (a server entry, a task) is
thin, with its body in a function that takes deps. Tests pass plain
objects, not module mocks. In the browser, DI is Svelte context.Result from @fuzdev/fuz_util/result.ts for a
failure the caller handles, an exception for a bug. to_error_message(e)
for a caught unknown.assert from vitest (it narrows), test() not it(), files
split by aspect (module.aspect.test.ts), any test with a database named
.db.test.ts. Fixture expected.json files are generated, never
hand-edited.query_<table>_<verb>
taking QueryDeps, and every read projected through the table's *_COLUMNS
const, never SELECT *.{@link}.
@param name - description, @returns,
@throws ErrorType description, and @mutates target - description for a
mutation a reader wouldn't guess../ or ../ path is a promise that it resolves on
disk and renders as a link; backtick an illustrative one. A module is its
backticked src/lib-relative path. mdz is not GFM: single * is literal,
and snake_case survives.Args is a fuz_schema schema. Generated
files are committed and gro check fails on drift.Result, errors, Logger, timings,
concurrency, nominal types*Deps and *Options, layers, programs, roots, fakes, traps*_COLUMNS
projections, the drift guard (TS and Rust).gen.* fileThe Rust workspaces (the fuz CLI and fuzd daemon, the spine crates and
the servers on them, zap, gro's runtime, tsv, pglet, the binding
crates) share conventions distinct from the TS side: snake_case carries over,
but Rust solves with the type system and crate graph what TS solves with
*Deps. The references own conventions, each repo's CLAUDE.md owns its
inventory, and each crate's rustdoc owns its invariants.
The essentials, each expanded in ./references/rust-patterns:
cargo fmt --all --check (by -p package where path deps
reach a sibling checkout, which --all would reformat),
cargo clippy --workspace --all-targets -- -D warnings,
cargo test --workspace, cargo doc with warnings denied, and
cargo xtask check-release where the workspace has it. cargo check
skips test targets, and real-Postgres suites are #[ignore]: a green
cargo test hasn't run them.unsafe outside a dedicated boundary crate. No unwrap,
expect, or panic! in production code without
#[expect(clippy::…, reason = "…")].thiserror enums with the cause in #[source]. The binary
prints the whole chain and returns an ExitCode: by default 2 when the
caller must fix something local, 1 otherwise. fuz, fuzi, zap, and
tsv assign more; read a tool's table before touching its exits.argh::from_env(). A new command whose effect is hard to undo is a
dry run until --wetrun.*Options struct by default (no *Deps suffix in
Rust), with enum dispatch before trait objects.fuz_sys
has it, hardened; a workspace that doesn't depend on fuz_sys mirrors its
shape without adding the dep.Read by task:
run_app shape, the server toolkit, the testing_* sibling binary,
env and browser gates, actions and the JSON-RPC envelope, realtime, a
CLI's daemon lifecycle, check-release*_COLUMNS
projections, col! decode, the drift guard (TS and Rust)