forge-idiomatic-engineer
Forge Idiomatic Engineer
Full-stack Rust framework. Single binary, PostgreSQL-backed. Axum + Tokio + SQLx. Macros generate runtime wiring and frontend bindings; each handler must be registered in src/main.rs (macros alone do not wire it in).
Compile-Loop Hard Rules
These cause hours of wasted debugging if missed. Internalize before writing code.
SQLX_OFFLINE=trueis mandatory for anycargo check/cargo buildyou run by hand. CI sets it globally. Without it, sqlx tries to validate everysqlx::query!()against your liveDATABASE_URL— including queries inside publishedforge-runtimecrate files you cannot edit — and you get a wall of "column does not exist" errors in third-party code. The simplest fix iseval "$(forge env)"in your shell rc; otherwiseexport SQLX_OFFLINE=trueby hand.forge checkauto-prepares the offline cache. It detects whensrc/is newer than.sqlx/and runscargo sqlx prepare --workspacebefore the rest of the pipeline, so you don't need to think about prepare ordering. (For rawcargo check, you still need to runforge migrate prepareafter editing anysqlx::query!().) Pass--no-preparein CI where the cache should already be correct.forge migrate preparehard-fails ifcargo-sqlxis missing. Install withcargo install sqlx-cli --no-default-features --features postgresand re-run.- All
forgecommands walk up to findforge.toml. Run them from any subdirectory; the resolved root is printed at start. No need tocdfirst. - If anything in the compile loop feels off, run
forge doctorfirst. It checks rustc,cargo-sqlx,SQLX_OFFLINE,DATABASE_URLreachability, Docker, frontend tooling,forge.tomlsyntax,.sqlx/freshness, and the latest migration's@up/@downmarkers in one shot. - A passing
cargo sqlx prepareis a passing compile. Don't runforge checkpurely to "confirm" what prepare just proved — prepare invokes a fullcargo checkinternally. Runforge checkonly when you have new edits since the last prepare, or to exercise the rest of the validation suite (registration, schema, clippy).
Session Start: Read Once, Trust Memory
Run bash docs/skills/forge-idiomatic-engineer/scripts/orient.sh first. The script walks up to find forge.toml, then prints a structured dump: project name + auth mode + frontend, environment readiness (SQLX_OFFLINE, DATABASE_URL, cargo-sqlx, Docker), .sqlx/ cache freshness, the contents of src/main.rs / src/functions/mod.rs / src/schema/mod.rs, every registered handler grouped by kind, the latest migration, reactivity-enabled tables, and concrete NEXT action hints. One invocation replaces five separate reads.