Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Use Slabs agent skills in your workflow

Pair always-on repository rules in AGENTS.md and CLAUDE.md with the five procedural skills in skills/. Every new project created by slabs new app bundles all five skills under .claude/skills/.

Why static rules live in AGENTS.md and CLAUDE.md

Coding agents load AGENTS.md (and Claude Code loads CLAUDE.md) at the start of every session. Keep short repository invariants in AGENTS.md and point CLAUDE.md at it with one line:

@AGENTS.md

This keeps one source of truth across coding tools with no duplicated instructions. Reserve AGENTS.md for rules that apply to every edit:

  • One endpoint per file under slabs/<feature>/<action>.rs and one background job per file under jobs/<name>.rs.
  • No models/, controllers/, repositories/, services/, or central routes.rs.
  • Pool selection (ctx.db.reader() for reads, ctx.db.begin().await? for multi-step writes) and parameterized SQL.
  • Explicit line-1 auth and rate-limit guards, safe Markdown rendering (html::render_markdown), and verification commands (slabs doctor, slabs check).

Multi-step procedures do not belong in AGENTS.md. Putting long checklists into the root file inflates every session prompt even when an agent is doing unrelated work. Move repeatable workflows into focused SKILL.md files that agents load on demand.

The five Slabs agent skills

The Slabs repository ships five skills under skills/, and slabs new app copies all five into .claude/skills/:

Skill fileWhen to use itWhat it enforces
skills/add-slab/SKILL.mdAdding a new HTTP endpoint, HTML page, or HTMX fragment handler.Inspect schema.sql, create slabs/<feature>/<action>.rs with Axum 0.8 {param} syntax, put auth and rate-limit guards on line 1, use ctx.db.reader() or BEGIN IMMEDIATE transactions, enqueue jobs and webhooks inside tx, render user Markdown with html::render_markdown, write co-located tests, and run slabs css and slabs check.
skills/add-migration/SKILL.mdAdding or changing SQLite or PostgreSQL tables, columns, indexes, or FTS5 tables.Create a numbered migrations/<NNNN>_<description>.sql without editing applied migrations, follow expand-and-contract safety, avoid colliding with the twelve slabs_* system tables, run slabs db migrate and slabs db dump-schema to refresh schema.sql, update .sqlx/ with slabs db prepare when using macros, and run cargo nextest run.
skills/review-slab/SKILL.mdAuditing a pull request or completed feature before merging.Check for stray MVC folders or src/lib.rs route edits, leading _ prefixes on helper files, Axum 0.8 syntax, ctx.db.reader() vs BEGIN IMMEDIATE, parameterized binds, fts5_query escaping, atomic job enqueues instead of in-tx ctx.mail.send, line-1 auth and rate limits, html::render_markdown, BlobMeta::into_safe_response, json_script, fingerprint checks on optimistic updates, co-located tests, and slabs check.
skills/deploy-app/SKILL.mdShipping a release or rolling back a production deploy on Kamal 2, Fly.io, or a Linux VPS.Run slabs doctor, slabs check --no-docs, and slabs css, generate configs with slabs deploy init --db sqlite|postgres, verify SLABS_ENV=production and a 32-byte SLABS_SECRET_KEY, confirm expand-and-contract migrations, take a pre-deploy SQLite or Litestream backup, tag Docker images with an immutable git SHA, respect SQLite single-writer rollout limits and PRAGMA wal_checkpoint(TRUNCATE) drain, check /health/ready and /_slabs/metrics, and keep rollback commands ready.
skills/fix-incident/SKILL.mdTriaging and fixing active (open or reopened) runtime errors, slow routes, slow jobs, or user bug reports from slabs_incidents.Pull slabs incidents list --json and slabs incidents perf --json, inspect slabs incidents show <id> (including its repro_test skeleton and recent_occurrences_json), read only the reported source_file and schema.sql, write a failing co-located test (using Db::explain_query_plan for slow queries), fix the bug, run slabs check, and resolve with slabs incidents resolve <id> --sha <sha>. See Track incidents, bug reports, and performance.

Use skills in an existing Slabs app

  1. Keep AGENTS.md at your application root with your commands, schema notes, and architecture rules.
  2. Add CLAUDE.md at your application root containing @AGENTS.md.
  3. Copy skills/add-slab/, skills/add-migration/, skills/review-slab/, skills/deploy-app/, and skills/fix-incident/ from sogamoso/slabs into .claude/skills/ (or link them into your agent’s global skills folder) so every agent follows the same build, migration, review, deployment, and incident-triage procedures.

Keep skills focused as your app grows

Add a new skill only for a repeatable, multi-step procedure with clear verification commands (such as adding a billing webhook or rotating keys). Keep each SKILL.md short, concrete, and scoped to one task. Move one-line rules that apply to every edit back into AGENTS.md.