AGENTS
always use just command to verify etc You find documentation on how to to do:
- styling for the html inside skills/t.md
- for htmx inside skills/t.md
- for clickhouse look at clickhouse-*.md
This file contains essential commands and code-style guidance for autonomous agents working in this repository.
Always prefer using just recipes when possible — they wrap common flows (build, lint, test, docker, hurl).
Quick reference
- Run app (dev):
just runorcargo run - Build:
cargo build --release(orjust runfor dev runs) - Format (fix):
just fmtorcargo fmt - Format (check):
cargo fmt -- --check(present injust verify) - Lint:
cargo clippy(andcargo clippy --fix --allow-dirtyinjust fmt) - Full verification:
just verify(runs fmt check, check, clippy, tests, docker acceptance tests) - Unit tests:
cargo test - Run a single Rust test:
cargo test <TEST_NAME>orcargo test --test <INTEGRATION_TEST_NAME>; for exact-match use-- --exactor-- --nocaptureto see output - Acceptance tests (HTTP):
just hurl testorjust testsviatests/hurl.just; run a single hurl file withhurl tests/<file>.hurl - Start dependencies / docker stack:
just docker run/just docker stop
Repository commands (examples)
Use these exact commands where appropriate. Prefer just when available.
- Build and run locally (dev):
just run
- Full verification (format-check, clippy, tests, acceptance tests):
just verify
- Format + attempt autofixes:
just fmt
# or
cargo fmt && cargo clippy --fix --allow-dirty
- Run only unit tests or a single test:
cargo test # all tests
cargo test my_test_name # runs tests with "my_test_name" in the name
cargo test my_test_name -- --exact # run exact named test
cargo test --test my_integration # run specific integration test file
- Run HTTP acceptance tests (hurl):
just hurl test # runs the suite via tests/hurl.just
hurl tests/health.hurl # run a single hurl file (requires hurl installed)
Project layout notes
- Rust project using Cargo. See
Cargo.tomlfor deps (actix-web, maud, serde_json, env_logger). justfilecontains convenient recipes:run,verify,fmt, and atests/hurl.justmodule.- Acceptance tests live under
tests/*.hurland are orchestrated throughtests/hurl.just. - Docker helper recipes live in
docker.justand are referenced from the top-leveljustfile.
Code style & conventions
Follow idiomatic Rust conventions; the repo enables clippy warnings (see main.rs top level attribute). Below are repository-specific conventions agents should follow when editing or adding code.
-
Formatting
- Run
cargo fmtbefore committing changes. Usecargo fmt -- --checkin CI and injust verify. - Keep line lengths reasonable (~100 columns); rustfmt will handle most details.
- Run
-
Linting
- Run
cargo clippyand fix warnings. The project sets#![warn(clippy::all, clippy::pedantic)]insrc/main.rs— address pedantic lints when practical. - If you intentionally silence a clippy lint, add a short comment explaining why and scope it narrowly (function/module).
- Run
-
Imports & module order
- Group imports by origin: standard library first (
std::), external crates second, local crate modules last. - Use grouped imports where it improves readability:
use actix_web::{App, HttpServer, web};(as already used). - Keep
moddeclarations near the top ofmain.rsafter crate-level attributes and use statements.
- Group imports by origin: standard library first (
-
Naming
- Types and structs: CamelCase (e.g.,
KeyValueStore,Server). - Functions, variables, module files: snake_case (e.g.,
get_kv,kv_store.rs). - Constants: SCREAMING_SNAKE_CASE (e.g.,
TCSS,HTMX) — repo already uses these conventions.
- Types and structs: CamelCase (e.g.,
-
Error handling
- Prefer propagating errors (the
?operator) in non-handler code; in HTTP handlers prefer returning appropriateHttpResponseorResult<T, actix_web::Error>instead of panicking. - Avoid
unwrap()andexpect()in production paths. Ifunwrap()is used for truly impossible cases, include a short explanatory comment. - When interacting with locks (
Mutex), handle poisoning appropriately. Currently code useslock().unwrap(); prefermatch store.lock()and map poisoning to a safe error path orHttpResponse::InternalServerError()in handlers.
- Prefer propagating errors (the
-
Pattern matching & early returns
- Use
let Some(x) = … else { ... }for concise early returns (used in this repo). Prefer explicit matches when you need to log or map errors.
- Use
-
Thread-safety & concurrency
- Shared state is
web::Data<T>(actix-web). Keep interior mutability minimal and guard withMutexor better primitives as needed. ConsiderRwLockwhen concurrent reads dominate.
- Shared state is
-
Types & API surface
- Keep handler signatures small and explicit (the repo commonly uses
req: HttpRequest, key: web::Path<String>, store: web::Data<KeyValueStore>). - For public helper functions prefer returning concrete
Result<T, E>where callers can decide how to convert to HTTP responses.
- Keep handler signatures small and explicit (the repo commonly uses
-
Tests
- Unit tests should live in
srcfiles in#[cfg(test)]modules; integration tests intests/directory. - For HTTP acceptance tests, use the provided
.hurlfiles and thejustrecipes. Ensure services are running (just docker runmay be needed). Usejust hurl testto run the suite.
- Unit tests should live in
-
Maud templates
- Keep maud markup functions pure where possible and return
maud::Markupdirectly (seesrc/view/mod.rs). Avoid heavy business logic in template code — prepare data in the handler.
- Keep maud markup functions pure where possible and return
-
Logging
- Use
env_logger+logmacros (info!,debug!,error!). Configure verbosity viaLOG_LEVELenv var —config::from_env()reads this in the project.
- Use
-
Documentation & comments
- Write short doc comments (
///) for public functions and types. Inline comments are allowed when explaining non-obvious decisions. Do not over-comment trivial code.
- Write short doc comments (
Cursor / Copilot rules
- Cursor rules: none found under
.cursor/rules/or.cursorrulesin repository root. - GitHub Copilot instructions: none found at
.github/copilot-instructions.md.
If you find repository-specific Cursor or Copilot rules later, include them in this file and follow them.
Commit & CI guidance for agents
- Run
just verifylocally before creating a PR. This runs formatting checks, clippy, unit tests, and acceptance tests (docker + hurl). - Make minimal commits with focused changes and a clear commit message describing "why" rather than "what".
Practical examples
- Run a single handler's unit test (example):
# run tests containing `kv_get` in their name
cargo test kv_get
# run exact integration test file (if present)
- Run a single hurl test file (example):
hurl tests/kv_plaintext_string.hurl --test --very-verbose --variables-file tests/variables
When in doubt
- Prefer using
justrecipes. They encode project intent and reduce mistakes. - If a change affects runtime behaviour, add or update tests (unit or acceptance) and update
just verifyflows if needed.
Contact
If the repository owner (or maintainers) provided project guidelines elsewhere (README, CONTRIBUTING, or CI), follow those first and update this file to match.