Skip to content

Commit 93aeae1

Browse files
committed
deps: condense fuz-stack skill
1 parent b245aa4 commit 93aeae1

18 files changed

Lines changed: 53139 additions & 3985 deletions

skills/fuz-stack/SKILL.md

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,10 @@ patterns, and drift-detection guidance.
268268
period; multi-sentence: capitalize, end with period
269269
- `@returns` (not `@return`): same single/multi-sentence rule as `@param`
270270
- `@module`: complex modules get a module-level doc comment with `@module` at end
271-
- `@mutates target - description`: document parameter/state mutations
272-
(also `` @mutates `target` `` for self-evident mutations)
271+
- `@mutates target - description`: document parameter/state mutations. The
272+
description carries the tag — name the columns, cascades, or side channels a
273+
reader wouldn't guess. When the method name already says it, omit the tag
274+
rather than writing a bare `` @mutates `target` ``
273275
- `@nodocs`: exclude from docs and flat namespace validation
274276
- Wrap identifier references in backticks for auto-linking via `mdz`
275277

@@ -334,16 +336,18 @@ caveat, anti-patterns, and formatter cautions.
334336

335337
## Svelte 5 Patterns
336338

337-
See ./references/svelte-patterns.md for `$state.raw()`, `$derived.by()`,
338-
reactive collections (SvelteMap/SvelteSet), schema-driven reactive classes,
339-
snippets, effects, attachments, props, event handling, component composition,
340-
and legacy features to avoid.
339+
See ./references/svelte-patterns.md for `$derived.by()`, reactive collections
340+
(SvelteMap/SvelteSet), schema-driven reactive classes, snippets, effects,
341+
attachments, props, event handling, component composition, and legacy features
342+
to avoid.
341343

342344
### Runes API
343345

344-
`$state.raw()` by default for all reactive state. `$state()` only for
345-
arrays/objects mutated in place (push, splice, index assignment). `$derived`
346-
for computed values, `$effect` for side effects.
346+
`$state()` for all reactive state — it proxies objects and arrays so in-place
347+
mutation (push, splice, property writes, `bind:` on object properties) triggers
348+
updates. `$state.raw()` is a performance opt-out for large wholesale-replaced
349+
values, not a default. `$derived` for computed values, `$effect` for side
350+
effects.
347351

348352
### Context Pattern
349353

@@ -392,20 +396,19 @@ no `<style>` block at all.
392396
5. Literal classes (`display:flex`, `width:100%`, `hover:opacity:80%`)
393397
6. `<style>` block with design tokens
394398

395-
Rungs 3–5 are one tier in practice — mix freely (a composite when one exactly
396-
matches, else tokens/literals); literal flex classes are common, not a rare last
397-
resort. The real cut points are semantic-vs-class and classes-vs-`<style>`. Don't
398-
churn existing `<style>` blocks into long class strings (4–6 classes is the
399-
comfortable ceiling). See css-patterns.md §Default styling is the baseline.
399+
Rungs 3–5 are one tier in practice — mix freely; the real cut points are
400+
semantic-vs-class and classes-vs-`<style>`. Don't churn existing `<style>`
401+
blocks into long class strings. See ./references/css-patterns.md §The Styling
402+
Ladder.
400403

401404
**Class naming**: fuz_css tokens use `snake_case` (`p_md`, `gap_lg`);
402405
component-local classes use `kebab-case` (`site-header`) — the target convention,
403406
adopted in zzz and fuz_ui.
404407

405408
Architecture — the three layers (semantic defaults, design tokens, utility
406409
classes), the class families, and the classes-vs-`<style>` matrix: see
407-
css-patterns.md §Style Variables (Design Tokens), §Utility Classes, and
408-
§When to Use Classes vs Styles.
410+
./references/css-patterns.md §Style Variables (Design Tokens), §Utility
411+
Classes, and §When to Use Classes vs Styles.
409412

410413
## Dependency Injection
411414

@@ -463,7 +466,9 @@ metadata, CLI help text, and serialization. Schema changes cascade through the
463466
stack; treat them as critical review points.
464467

465468
- **`z.strictObject()`** — default for all object schemas. `z.looseObject()`
466-
or `z.object()` for external/third-party data with a comment explaining why.
469+
or `z.object()` for external/third-party data, client-consumed
470+
response/error schemas, and protocol shapes the other side may extend —
471+
with a comment explaining why.
467472
- **PascalCase naming** — schema and type share the same name, no suffix:
468473
`const Foo = z.strictObject({...}); type Foo = z.infer<typeof Foo>;`
469474
- **`.meta({description: '...'})`** — not `.describe()`. Both work in Zod 4

skills/fuz-stack/references/async-patterns.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,6 @@ Lifecycle type for tracking async operations in UI:
1616
type AsyncStatus = 'initial' | 'pending' | 'success' | 'failure';
1717
```
1818

19-
## Basic Utilities
20-
21-
### wait
22-
23-
```typescript
24-
await wait(500); // wait 500ms
25-
await wait(); // wait 0ms (next macrotask via setTimeout)
26-
```
27-
28-
### is_promise
29-
30-
Type guard for Promise/thenable detection:
31-
32-
```typescript
33-
if (is_promise(value)) {
34-
const result = await value;
35-
}
36-
```
37-
3819
## Deferred Pattern
3920

4021
Separates promise creation from resolution — external control over when and

skills/fuz-stack/references/code-generation.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,9 @@ gro gen src/lib/foo.gen.ts # run a specific gen file
213213
gro gen --check # verify no drift (used by gro check and CI)
214214
```
215215

216-
| Arg | Default | Description |
217-
| ------------- | ----------------- | ------------------------------------------------ |
218-
| `_` | `['src']` | input paths (files or directories to scan) |
219-
| `--root_dirs` | `[process.cwd()]` | root directories to resolve input paths against |
220-
| `--check` | `false` | exit nonzero if any generated files have changed |
221-
222-
`gro gen --check` compares generated output against existing files; if any is
223-
new or changed, it fails with a message to run `gro gen`. Called by `gro check`
224-
as part of CI.
216+
Positional args default to `['src']`; `--root_dirs` (default `[process.cwd()]`)
217+
resolves them. `gro gen --check` compares generated output against existing
218+
files and fails if any is new or changed — called by `gro check` as part of CI.
225219

226220
## Common Patterns
227221

skills/fuz-stack/references/common-utilities.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -217,20 +217,10 @@ nominal typing and strict utility types.
217217

218218
### `swallow`
219219

220-
Claims an event by preventing its default action and stopping propagation:
221-
222-
```typescript
223-
import { swallow } from '@fuzdev/fuz_util/dom.ts';
224-
225-
swallow(event); // preventDefault + stopImmediatePropagation
226-
swallow(event, false); // preventDefault + stopPropagation (non-immediate)
227-
swallow(event, true, false); // stopImmediatePropagation only (no preventDefault)
228-
```
229-
230-
Design principle: if you `preventDefault`, you're claiming the event — use
231-
`swallow` to also stop propagation. Parents needing to observe before children
232-
claim should use the `capture` phase. See ./svelte-patterns.md
233-
§Event Handling for full guidance.
220+
Claims an event by preventing its default action and stopping propagation —
221+
`swallow(event, immediate?, preventDefault?)`. The design principle (handling
222+
an event = claiming it) and usage guidance: ./svelte-patterns.md §Event
223+
Handling.
234224

235225
### `handle_target_value`
236226

skills/fuz-stack/references/documentation-system.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -367,22 +367,11 @@ consumers unchanged (see [Cross-Project Pattern](#cross-project-pattern)).
367367

368368
## Cross-Project Pattern
369369

370-
fuz_ui **defines** all documentation components and the analysis pipeline.
371-
Other projects **import** them:
372-
373-
```typescript
374-
// In fuz_ui (defines the components)
375-
import Docs from './Docs.svelte';
376-
import { library_context } from './library.svelte.ts';
377-
378-
// In fuz_css or any consumer project
379-
import Docs from '@fuzdev/fuz_ui/Docs.svelte';
380-
import { library_context } from '@fuzdev/fuz_ui/library.svelte.ts';
381-
```
382-
383-
Layout structure is identical — only tomes, categories, and breadcrumb
384-
branding differ. The `svelte-docinfo` Vite plugin and `virtual:svelte-docinfo`
385-
are the shared analysis engine across projects.
370+
fuz_ui **defines** all documentation components and the analysis pipeline;
371+
other projects import them unchanged from `@fuzdev/fuz_ui/*`. Layout structure
372+
is identical — only tomes, categories, and breadcrumb branding differ. The
373+
`svelte-docinfo` Vite plugin and `virtual:svelte-docinfo` are the shared
374+
analysis engine across projects.
386375

387376
## See Also
388377

skills/fuz-stack/references/file-organization.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,6 @@ import { create_app_backend } from '@fuzdev/fuz_app/server/app_backend.ts';
7373

7474
## Tests Mirror the Subdirectory Structure
7575

76-
Tests live in `src/test/` (NOT co-located) and mirror `src/lib/` subdirectories:
77-
78-
```
79-
src/test/
80-
├── env/
81-
│ ├── load.test.ts
82-
│ ├── resolve.test.ts
83-
│ ├── dotenv.test.ts
84-
│ └── mask.test.ts
85-
├── auth/
86-
│ ├── keyring.test.ts
87-
│ └── account_queries.db.test.ts # .db.test.ts suffix for PGlite tests
88-
└── server/
89-
└── env.test.ts # server-specific env (BaseServerEnv, validate_server_env)
90-
```
91-
76+
Tests live in `src/test/` (NOT co-located) and mirror `src/lib/`
77+
subdirectories — `src/lib/auth/keyring.ts``src/test/auth/keyring.test.ts`.
9278
See ./testing-patterns.md for the full test file layout, naming, and fixtures.

skills/fuz-stack/references/rust-dependencies.md

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ deps and belong here.
5353
| `url` | URL parsing |
5454
| `tempfile` | Temp files/dirs (`NamedTempFile`) |
5555
| `smallvec` | Stack-allocated small vectors |
56-
| `bumpalo` | Arena allocation (`collections` feature) — tsv's core AST strategy; see rust-perf.md §Arena allocation |
56+
| `bumpalo` | Arena allocation (`collections` feature) — tsv's core AST strategy; see ./rust-perf.md §Arena allocation |
5757
| `string-interner` | String interning |
5858
| `phf` | Compile-time perfect-hash maps/sets (keyword tables) |
5959
| `unicode-ident` / `unicode-segmentation` / `unicode-width` | Unicode text handling |
@@ -75,7 +75,7 @@ deps and belong here.
7575

7676
| Crate | Purpose |
7777
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
78-
| `parking_lot` | `Mutex`/`RwLock` for sync-only critical sections (no poisoning). See rust-perf.md §Async lock hygiene for when to use `tokio::sync` or `std::sync` instead. |
78+
| `parking_lot` | `Mutex`/`RwLock` for sync-only critical sections (no poisoning). See ./rust-perf.md §Async lock hygiene for when to use `tokio::sync` or `std::sync` instead. |
7979
| `lru` | Bounded LRU cache backing the `RateLimiter` — caps tracked keys so a key-enumeration attacker can't grow the map unboundedly (twin of fuz_app's `LruMap`). |
8080

8181
## Database
@@ -112,7 +112,7 @@ deps and belong here.
112112

113113
| Crate | Purpose |
114114
| ------ | --------------------------------------------------------------------------------------------------- |
115-
| `argh` | Derive arg parser, size-optimized. See rust-patterns.md §CLI Patterns for the parser-tier guidance. |
115+
| `argh` | Derive arg parser, size-optimized. See ./rust-patterns.md §CLI Patterns for the parser-tier guidance. |
116116

117117
## Logging
118118

@@ -133,7 +133,7 @@ deps and belong here.
133133
| `wit-bindgen` | Component-model bindings |
134134
| `wasmtime` / `wasmtime-wasi` | WASM host (tests, benches) |
135135

136-
See wasm-patterns.md for the binding-layer conventions these support.
136+
See ./wasm-patterns.md for the binding-layer conventions these support.
137137

138138
## Image processing
139139

@@ -157,31 +157,22 @@ dependency graph or it is not, and that is auditable.
157157
- Enforcement is the `cargo xtask check-release` dep-graph audit (`fuz_audit`),
158158
which fails if any non-`testing_`-prefixed binary transitively links a
159159
forbidden crate; workspaces add extra forbids via `AuditRules`. See
160-
rust-spine.md §xtask & check-release for the entry points and the
160+
./rust-spine.md §xtask & check-release for the entry points and the
161161
built-in layering rules.
162162

163-
## Shared low-level leaves (consolidation candidates)
164-
165-
The pattern is proven: the sandboxed config-eval harness was extracted from
166-
zap into the spine's `fuz_eval` — a spine-free leaf (no tokio-server/HTTP/DB
167-
surface) consumable even by spine-free repos — and is now shared across
168-
consumers, including the JS wrapper ingredients themselves
169-
(`DETERMINISM_STUBS_JS`, `CONSOLE_TO_STDERR_JS`,
170-
`build_extract_export_wrapper`). Remaining candidates, still independently
171-
reimplemented:
172-
173-
- a minimal dotenv (`KEY=VALUE`) parser — three copies today (`zap_core`,
174-
plus two inside zzz: the CLI's daemon-env loader and its xtask),
175-
- an env-isolating subprocess harness with a capped output drain —
176-
prototyped in `fuz_forge_server`, promotion deferred until a second
177-
consumer,
178-
- the atomic-write/flock transactional-file dance for spine-free consumers —
179-
`fuz_sys::fs::write_atomic` is canonical but zap can't link it and
180-
hand-rolls both authority calibrations (rust-patterns.md §Transactional
181-
state files),
182-
- an exponential-backoff retry combinator — no generic one exists;
183-
`fuz_sidecar`'s crash-recovery respawn loop is the only backoff
184-
implementation, and it's supervision-shaped, not request-retry.
163+
## Shared low-level leaves
164+
165+
**When a utility gets reimplemented a third time, extract it as a spine-free
166+
leaf** — no tokio-server/HTTP/DB surface, so spine-free repos can link it too.
167+
`fuz_eval` (the sandboxed config-eval harness, lifted out of zap) is the proven
168+
case, now shared down to its JS wrapper ingredients.
169+
170+
Known-duplicated, not yet extracted: a minimal dotenv (`KEY=VALUE`) parser
171+
(three copies), an env-isolating subprocess harness with a capped output drain
172+
(one, awaiting a second consumer), the atomic-write/flock dance for consumers
173+
that can't link `fuz_sys::fs::write_atomic` (./rust-patterns.md §Transactional
174+
state files), and an exponential-backoff retry combinator (none generic today —
175+
the only backoff is supervision-shaped, not request-retry).
185176

186177
Signal-crate convention: prefer `nix` for syscall wrappers; reserve `libc` for
187178
types/constants `nix` doesn't expose (PTY). Avoid pulling both into one
@@ -192,7 +183,7 @@ workspace for the same job.
192183
- **`default-features = false` + explicit feature lists** for deps with heavy
193184
optional trees — `reqwest`, `nix`, `notify`, `futures-util` all do. Opt into
194185
exactly what the workspace uses; don't inherit a crate's default surface.
195-
- **`multiple_crate_versions = "allow"`** (rust-patterns.md §Lints) tolerates
186+
- **`multiple_crate_versions = "allow"`** (./rust-patterns.md §Lints) tolerates
196187
_forced_ duplicate majors from the dep graph — e.g. `tsv` carries hashbrown
197188
0.16 (via `string-interner`) and 0.17 (via `serde_json``indexmap`),
198189
unresolvable until `string-interner` bumps upstream. Not a license to ignore

skills/fuz-stack/references/rust-patterns.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ struct — `Keyring` deliberately has no trait.)
430430
trait": a one-shot injection point that must be generic over the consumer's
431431
type gets a boxed-`FnOnce` type alias, not a trait —
432432
`ExtraActionSpecsFactory<App>` / `PreMigrationHook<E>`
433-
(`fuz_actions::consumer_lifecycle`; see rust-spine.md §Server lifecycle).
433+
(`fuz_actions::consumer_lifecycle`; see ./rust-spine.md §Server lifecycle).
434434
The caller supplies it once at startup; test binaries hook through it; no
435435
trait ceremony accrues. A trait earns the slot only when the seam has
436436
multiple methods or long-lived polymorphic state.
@@ -701,20 +701,13 @@ key can capture.
701701

702702
### Sidecar controller
703703

704-
The pattern for a long-running subprocess multiplexing many concurrent
705-
requests: a spawn config of function pointers (statically-known runtimes),
706-
JSON-lines framing over stdin/stdout, an mpsc command channel into a
707-
serializer task that owns stdin, per-request `oneshot` responses parked in a
708-
map keyed by request id, and the script embedded via `include_str!` + written
709-
to a `NamedTempFile` at spawn. Skip it for one-shot invocations (plain
710-
`tokio::process::Command`) or pure in-process work.
711-
712-
**Currently dormant** — the sidecar _runtimes_ (`fuz_deno`/`fuz_python`
713-
factories, behind `fuzd`'s off-by-default `sidecar` feature) are gated off, so
714-
the shipped daemon wires no runtime into the pool; `fuz_sidecar` itself always
715-
links into `fuzd`/`fuzd_server` for the empty pool and dispatch (tsv replaced
716-
the Deno sidecar's parsing role). The controller and its crash-recovery
717-
respawn loop (exponential backoff, capped) remain the reference if a
704+
For a long-running subprocess multiplexing many concurrent requests: a spawn
705+
config of function pointers (statically-known runtimes), JSON-lines framing
706+
over stdin/stdout, an mpsc command channel into a serializer task that owns
707+
stdin, per-request `oneshot` responses parked in a map keyed by request id, and
708+
the script embedded via `include_str!`. Skip it for one-shot invocations (plain
709+
`tokio::process::Command`) or pure in-process work. **Dormant** — no shipped
710+
binary wires a runtime into the pool today; `fuz_sidecar` is the reference if a
718711
runtime-hosting workload returns.
719712

720713
### Security

0 commit comments

Comments
 (0)