yoink
AGENTS.md112 starsChanged 7 months agoApache-2.0View on GitHub
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,196 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- sea-orm-2Skill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
50 rules. About 0 are common, 14 are distinctive, and 36 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
36
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 27
Run both dev servers through mise: mise run dev
- Very specific: line 28
Start Docker services: docker compose up -d
- Very specific: line 29
Start dev Docker services: docker compose -f compose.dev.yaml up -d
- Very specific: line 32
Run server once: cargo run -p yoink-server
- Very specific: line 33
Run server through mise: mise run run-server
- Very specific: line 43
Run tests matching a name substring: cargo test -p yoink-server list_jobs_returns_album_and_track_jobs
- Very specific: line 44
Run one exact backend test: cargo test -p yoink-server list_jobs_returns_album_and_track_jobs -- --exact
- Very specific: line 45
Run one exact fully-qualified backend test: cargo test -p yoink-server services::downloads::tests::list_jobs_returns_album_and_track_jobs …
- Very specific: line 55
Run frontend tests: bun run test
- Very specific: line 56
Run one frontend test file: bun x vitest run src/lib/router/breadcrumbs.test.ts
- Very specific: line 57
Run one named frontend test: bun x vitest run src/lib/router/breadcrumbs.test.ts -t "returns static breadcrumb labels"
- Very specific: line 80
Prefer nested imports when it improves readability, for example use std::{path::PathBuf, sync::Arc};.
- Distinctive: line 81
Prefer explicit imports over globs.
- Very specific: line 82
Keep top-level module declarations in main.rs or lib.rs.
- Very specific: line 83
Keep mod tests adjacent to the code it tests.
- Very specific: line 86
Follow rustfmt defaults; do not hand-format against the formatter.
- Distinctive: line 87
Use trailing commas in multiline enums, structs, function calls, and macro arguments.
- Distinctive: line 90
Add doc comments for public or non-obvious behavior, not for obvious plumbing.
- Very specific: line 95
Use Uuid::now_v7() for new persistent IDs.
- Distinctive: line 96
Prefer enums over raw strings for domain state such as quality, wanted status, or download status.
- Very specific: line 97
Use Option<T> for nullable provider data and partial metadata.
- Very specific: line 98
Keep conversions from DB models to shared models explicit with impl From<...> blocks.
- Very specific: line 110
Prefer contextual error variants carrying fields like operation, resource, reason, service, or path.
- Very specific: line 111
Prefer helper constructors such as AppError::not_found(...) instead of rebuilding strings at call sites.
- Very specific: line 112
Use ? for propagation.
- Very specific: line 116
Use tracing::{debug, info, warn, error}.
- Distinctive: line 123
When changing API shapes, update the utoipa annotations and regenerate frontend types.
- Very specific: line 126
Prefer inline #[cfg(test)] mod tests blocks in the same file as the implementation.
- Very specific: line 128
Test setup is commonly local to each module via helper functions like test_state() or local seed helpers.
- Very specific: line 129
Use descriptive test names that explain behavior, for example list_jobs_returns_album_and_track_jobs.
- Very specific: line 133
Use file-based TanStack Router routes in frontend/src/routes/.
- Very specific: line 135
Keep route exports in the TanStack pattern: export const Route = createFileRoute(...)(...).
- Very specific: line 139
Use the central API client in frontend/src/lib/api/client.ts.
- Very specific: line 140
Put canonical query key helpers in frontend/src/lib/api/queries.ts.
- Very specific: line 141
Put mutation-side cache updates and invalidation logic in frontend/src/lib/api/mutations.ts.
- Distinctive: line 143
Prefer updating query caches intentionally instead of scattering ad hoc refetches.
- Very specific: line 147
Prefer import type for type-only imports.
- Distinctive: line 149
Keep components small and focused.
- Very specific: line 153
Use Tailwind CSS v4 utilities and theme variables defined in frontend/src/styles.css.
- Very specific: line 154
Use cn() from @/lib/utils for conditional classes.
- Very specific: line 158
Do not hand-edit frontend/src/routeTree.gen.ts or frontend/src/lib/api/types.gen.ts.
- Distinctive: line 161
Do make small, local changes that match nearby patterns.
- Distinctive: line 162
Do update tests when behavior changes.
- Distinctive: line 163
Do regenerate generated frontend API types after backend contract changes.
- Very specific: line 164
Do keep OpenAPI docs complete with #[utoipa::path(...)] and ToSchema derives where needed.
- Distinctive: line 165
Do preserve provider-specific fallbacks and partial-data handling.
- Distinctive: line 166
Don't introduce alternate data-fetching patterns when a query or mutation helper already exists.
- Distinctive: line 167
Don't replace structured errors or tracing with plain strings.
- Distinctive: line 168
Don't hand-edit generated frontend files.
- Very specific: line 169
Don't confuse the Rust backend port 3000 with the frontend dev server port 5173.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Guidance for coding agents working in yoink.
Project Overview
yoinkis a self-hosted music library manager.- Backend: Rust 2024, Axum, Tokio, SeaORM, utoipa/OpenAPI, tracing.
- Frontend: React 19 SPA in
frontend/using TanStack Start, TanStack Router, TanStack Query, TanStack DB, shadcn/ui v4, Tailwind CSS v4, Bun, and Vite. - The frontend is built separately and embedded into the server binary via
rust-embed. - Workspace crates:
crates/yoink-server: API server, auth, providers, services, DB entities, background workers.
Repo-Specific Rule Files
- Checked for Cursor rules in
.cursor/rules/and.cursorrules: none found. - Checked for Copilot rules in
.github/copilot-instructions.md: none found. - The only repository-local agent instructions currently live in this
AGENTS.md.
Setup
- Install toolchain helpers with
mise install. - Install frontend dependencies with
bun installinfrontend/. - Copy env defaults with
cp .env.example .envif needed. - Backend dev server runs on
http://127.0.0.1:3000. - Frontend dev server runs on
http://localhost:5173and proxies/api/**and/auth/**to the backend.
Build, Lint, and Test Commands
Root / Combined
- Lint everything wired through mise:
mise run lint - Run both dev servers through mise:
mise run dev - Start Docker services:
docker compose up -d - Start dev Docker services:
docker compose -f compose.dev.yaml up -d
Backend (Rust)
- Run server once:
cargo run -p yoink-server - Run server through mise:
mise run run-server - Watch mode:
mise run dev-server - Build debug:
cargo build -p yoink-server - Build release:
cargo build -p yoink-server --release - Format:
cargo fmt - Format check:
cargo fmt --check - Lint:
cargo clippy --package yoink-server -- -D warnings - Server tests:
cargo test -p yoink-server - Whole workspace tests:
cargo test --workspace - List backend tests:
cargo test -p yoink-server -- --list - Run tests matching a name substring:
cargo test -p yoink-server list_jobs_returns_album_and_track_jobs - Run one exact backend test:
cargo test -p yoink-server list_jobs_returns_album_and_track_jobs -- --exact - Run one exact fully-qualified backend test:
cargo test -p yoink-server services::downloads::tests::list_jobs_returns_album_and_track_jobs -- --exact
Frontend
- Dev server:
bun run dev - Production build:
bun run build - Preview production build:
bun run preview - Lint:
bun run lint - Auto-fix lint issues:
bun run lint:fix - Format:
bun run fmt - Format check:
bun run fmt:check - Run frontend tests:
bun run test - Run one frontend test file:
bun x vitest run src/lib/router/breadcrumbs.test.ts - Run one named frontend test:
bun x vitest run src/lib/router/breadcrumbs.test.ts -t "returns static breadcrumb labels"
API Type Generation
- Regenerate frontend API types from a running backend:
mise run gen-frontend-types - This writes
frontend/src/lib/api/types.gen.ts.
Validation Guidance
- Small Rust change:
cargo fmt --check && cargo test -p yoink-server - Frontend change: run
bun run lint && bun run fmt:check && bun run testinfrontend/ - API contract change: also run
mise run gen-frontend-types - Release-oriented change: run
bun run buildinfrontend/beforecargo build -p yoink-server --release
Architecture Notes
- The server bootstraps from
crates/yoink-server/src/main.rsand builds the provider registry there. - Routing is assembled in
crates/yoink-server/src/routes/mod.rsusingOpenApiRouter. - App state lives in
crates/yoink-server/src/state.rsand holds the DB connection, provider registry, SSE broadcaster, auth service, and shared settings. - The database is initialized through SeaORM schema sync in
AppState::new; do not assume SQLx query macros or committed.sqlxmetadata are in use. - Frontend routes are file-based under
frontend/src/routes/. frontend/src/routeTree.gen.tsandfrontend/src/lib/api/types.gen.tsare generated; do not hand-edit them.
Rust Style Guidelines
Imports and Layout
- Group imports as
stdfirst, external crates second,crate::imports last. - Prefer nested imports when it improves readability, for example
use std::{path::PathBuf, sync::Arc};. - Prefer explicit imports over globs.
- Keep top-level module declarations in
main.rsorlib.rs. - Keep
mod testsadjacent to the code it tests; this repo strongly favors inline test modules.
Formatting
- Follow
rustfmtdefaults; do not hand-format against the formatter. - Use trailing commas in multiline enums, structs, function calls, and macro arguments.
- Split long method chains and builder chains one call per line.
- Preserve section-divider comments when present; banner comments are used in larger files.
- Add doc comments for public or non-obvious behavior, not for obvious plumbing.
Types and Data Modeling
- Server-owned API/OpenAPI DTOs live in
crates/yoink-server/src/api/. - Shared models usually derive
Serialize,Deserialize, andToSchema. - Use
Uuid::now_v7()for new persistent IDs; SeaORM active models commonly set this inActiveModelBehavior::new(). - Prefer enums over raw strings for domain state such as quality, wanted status, or download status.
- Use
Option<T>for nullable provider data and partial metadata. - Keep conversions from DB models to shared models explicit with
impl From<...>blocks.
Naming
- Types, enums, and traits use
UpperCamelCase. - Functions, modules, files, and route helpers use
snake_case. - Constants use
SCREAMING_SNAKE_CASE. - Bool fields should read naturally, for example
monitored,explicit,authenticated,must_change_password. - Async function names are verb-led and descriptive.
Error Handling
- Backend code uses
AppResult<T>andAppErrorfromcrates/yoink-server/src/error.rs. - API errors use
ApiErrorincrates/yoink-server/src/error.rs. - Prefer contextual error variants carrying fields like
operation,resource,reason,service, orpath. - Prefer helper constructors such as
AppError::not_found(...)instead of rebuilding strings at call sites. - Use
?for propagation. - Reserve
unwrapandexpectfor tests, startup, or impossible states.
Logging, Async, and Database Patterns
- Use
tracing::{debug, info, warn, error}; never addprintln!for application logging. - Include useful structured context in logs, especially around providers, downloads, filesystem operations, and HTTP requests.
- Tokio is the async runtime; keep server code async-first.
- Shared state is cloned through cheap handles like
Arc,broadcast::Sender, andAppStateclones. - This codebase uses SeaORM entities and active models, not hand-written SQLx query macros.
- Entity models live under
crates/yoink-server/src/db/entities/; preferEntity::find(), relation loaders, and active model updates that match surrounding code. - Model timestamps are often maintained in
before_savehooks. - When changing API shapes, update the utoipa annotations and regenerate frontend types.
Testing
- Prefer inline
#[cfg(test)] mod testsblocks in the same file as the implementation. - Async tests use
#[tokio::test]; pure helpers often use plain#[test]. - Test setup is commonly local to each module via helper functions like
test_state()or local seed helpers. - Use descriptive test names that explain behavior, for example
list_jobs_returns_album_and_track_jobs.
Frontend Style Guidelines
General Structure
- Use file-based TanStack Router routes in
frontend/src/routes/. - Authenticated app routes live under
frontend/src/routes/_app/. - Keep route exports in the TanStack pattern:
export const Route = createFileRoute(...)(...). - Router setup lives in
frontend/src/router.tsx; root document and shared context live infrontend/src/routes/__root.tsx.
Data Fetching and State
- Use the central API client in
frontend/src/lib/api/client.ts. - Put canonical query key helpers in
frontend/src/lib/api/queries.ts. - Put mutation-side cache updates and invalidation logic in
frontend/src/lib/api/mutations.ts. - TanStack DB collections are used for local normalized state and optimistic UI helpers.
- Prefer updating query caches intentionally instead of scattering ad hoc refetches.
TypeScript and React
- The frontend runs in strict TypeScript mode; keep code compatible with
strict,noUnusedLocals, andnoUnusedParameters. - Prefer
import typefor type-only imports. - Reuse generated OpenAPI schema types from
components["schemas"][...]when possible. - Keep components small and focused; extract helpers for repeated view logic.
- Match existing style for props objects, inline helper functions, and early-return render branches.
Styling and Generated Files
- Use Tailwind CSS v4 utilities and theme variables defined in
frontend/src/styles.css. - Use
cn()from@/lib/utilsfor conditional classes. oxfmtsorts Tailwind classes insidecn()andcva(); avoid fighting formatter output.- Preserve the existing design language built on shadcn/ui primitives, muted neutrals, and album-art-driven accents.
- Frontend tests use Vitest and Testing Library, typically near the code they cover.
- Do not hand-edit
frontend/src/routeTree.gen.tsorfrontend/src/lib/api/types.gen.ts.
Agent Do / Don't
- Do make small, local changes that match nearby patterns.
- Do update tests when behavior changes.
- Do regenerate generated frontend API types after backend contract changes.
- Do keep OpenAPI docs complete with
#[utoipa::path(...)]andToSchemaderives where needed. - Do preserve provider-specific fallbacks and partial-data handling.
- Don't introduce alternate data-fetching patterns when a query or mutation helper already exists.
- Don't replace structured errors or tracing with plain strings.
- Don't hand-edit generated frontend files.
- Don't confuse the Rust backend port
3000with the frontend dev server port5173.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

