Opinionated conventions for writing, linting and evolving OpenAPI specs as the source of truth for an API.
# OpenAPI Spec taste of an API designer who treats the spec as the contract - Write the OpenAPI document first and review it in a pull request before any endpoint is implemented. Confidence: 0.80 - Use OpenAPI 3.1 so schemas are real JSON Schema and nullable fields are written as type unions. Confidence: 0.80 - Keep the spec in the repo as YAML, split into files with `$ref`, and bundle it into one file in CI. Confidence: 0.85 - Lint every change with Spectral or Redocly using a shared ruleset, and fail the build on errors. Confidence: 0.90 - Give every operation a unique, stable `operationId` in camelCase, because generated clients use it as the method name. Confidence: 0.90 - Define reusable models under `components/schemas` and never repeat the same object inline in several places. Confidence: 0.85 - Mark `required` fields explicitly and set `additionalProperties: false` on request bodies. Confidence: 0.75 - Describe every error with one shared problem-details schema (RFC 9457), not a different shape per endpoint. Confidence: 0.85 - Document every response code an endpoint can really return, including 401, 403, 404, 409 and 429. Confidence: 0.80 - Add a realistic `example` to every schema and operation so docs, mocks and tests have real data. Confidence: 0.85 - Use string formats like `date-time`, `uuid` and `email`, plus `minLength`, `maximum` and `pattern` constraints, instead of plain strings. Confidence: 0.80 - Model enums as strings, and document that clients must tolerate unknown values added later. Confidence: 0.75 - Use the same cursor-based pagination parameters and response envelope on every list endpoint. Confidence: 0.80 - Declare `securitySchemes` once and apply them globally, overriding only for truly public operations. Confidence: 0.85 - Run a breaking-change check such as oasdiff against the main branch on every pull request. Confidence: 0.90 - Validate requests and responses against the spec in contract tests so the code cannot quietly drift from it. Confidence: 0.85 - Generate clients and server types from the spec, and never hand-edit generated files. Confidence: 0.85 - Write `summary` and `description` fields for humans, explaining behavior and edge cases rather than repeating the field name. Confidence: 0.75 - Mark old fields and operations with `deprecated: true` and announce a removal date before deleting them. Confidence: 0.80 - Publish rendered docs from the spec on every release so the docs always match the deployed API. Confidence: 0.80
Opinionated conventions for Docker Compose files that give every developer a reliable one-command local stack.
# Docker Compose taste of a developer who wants one-command local environments - Make `docker compose up` the only command a new teammate needs to start the full local stack. Confidence: 0.90 - Name the file `compose.yaml` and drop the obsolete top-level `version:` key. Confidence: 0.85 - Pin every image to a specific version tag, never `latest`, so the stack behaves the same next month. Confidence: 0.90 - Add a `healthcheck` to every database and queue, and use `depends_on` with `condition: service_healthy` instead of sleep loops. Confidence: 0.90 - Keep secrets and machine-specific values in a gitignored `.env` file, and commit a `.env.example` with safe defaults. Confidence: 0.90 - Use named volumes for database data so `docker compose down` does not wipe local work by accident. Confidence: 0.85 - Bind ports to `127.0.0.1` on the host so local databases are not reachable from the whole network. Confidence: 0.80 - Mount source code only for services you edit live, and use `develop.watch` or a bind mount with clear sync rules. Confidence: 0.75 - Put optional tools like admin UIs, mail catchers and tracing behind `profiles` so the default stack stays small. Confidence: 0.80 - Use `compose.override.yaml` for personal tweaks and keep it out of git. Confidence: 0.70 - Build app images from the same Dockerfile used in production, with a separate `dev` target if needed. Confidence: 0.85 - Run services as a non-root user even locally, so permission problems show up before production. Confidence: 0.70 - Seed the database with a small, deterministic dataset through an init script or a one-off `seed` service. Confidence: 0.80 - Let services talk by service name on the default network instead of hardcoding IPs or `host.docker.internal`. Confidence: 0.85 - Set memory and CPU limits on heavy services so one container cannot freeze a laptop. Confidence: 0.65 - Keep log output on stdout and stderr, and use `docker compose logs -f <service>` instead of log files inside containers. Confidence: 0.85 - Give each project a fixed `name:` so containers, networks and volumes do not collide between repos. Confidence: 0.75 - Wrap common tasks like migrate, test and reset in `make` or `just` targets that call `docker compose run --rm`. Confidence: 0.80 - Use the same Compose file in CI for integration tests, so CI and laptops run one setup. Confidence: 0.75 - Do not use Compose as the production orchestrator for anything that needs zero-downtime deploys or scaling. Confidence: 0.80
Opinionated conventions for clean, reproducible Jupyter notebooks in data science work.
# Jupyter Notebook taste of a data scientist who wants notebooks that rerun cleanly - Make every notebook run top to bottom with "Restart and Run All" before sharing or committing it. Confidence: 0.95 - Put imports, configuration and constants in the first cells, never scattered through the notebook. Confidence: 0.85 - Move reusable logic into a normal Python package in the repo and import it, keeping notebooks for exploration and storytelling. Confidence: 0.90 - Use `%load_ext autoreload` and `%autoreload 2` while developing that package alongside the notebook. Confidence: 0.75 - Pin the environment with a lock file such as `uv.lock`, `poetry.lock` or a conda lock, and name the kernel after the project. Confidence: 0.85 - Strip outputs before committing with `nbstripout` or a pre-commit hook, unless the notebook is a published report. Confidence: 0.85 - Pair notebooks with plain-text versions through Jupytext so diffs and code reviews stay readable. Confidence: 0.70 - Read data paths and parameters from one config cell or Papermill parameters, not hard-coded absolute paths. Confidence: 0.85 - Never store credentials in a notebook; load them from environment variables or a secrets manager. Confidence: 0.95 - Set random seeds for NumPy, Python and any ML library in one place so results can be reproduced. Confidence: 0.85 - Give each notebook one clear question, and start it with a short markdown cell that states the goal and data sources. Confidence: 0.80 - Use markdown cells to explain decisions and findings, not just to label code. Confidence: 0.80 - Keep cells short and focused, with the final expression showing a result instead of long `print` chains. Confidence: 0.70 - Avoid relying on hidden state from cells run out of order; if a variable is redefined, restart and rerun. Confidence: 0.90 - Cache expensive steps to Parquet files with clear names rather than recomputing them on every run. Confidence: 0.80 - Sample large datasets during exploration and run the full data only once the analysis is settled. Confidence: 0.75 - Label every chart with a title, axis names and units so it makes sense when pasted into a slide. Confidence: 0.85 - Add small `assert` checks on row counts, nulls and key uniqueness after each major data transformation. Confidence: 0.80 - Name notebooks with a number and topic like `03-churn-features.ipynb` so the order of work is obvious. Confidence: 0.70 - Turn notebooks that run on a schedule into scripts or Papermill jobs with tests, instead of opening them by hand. Confidence: 0.80 - Clean up dead experiments before sharing; keep only the path that leads to the conclusion. Confidence: 0.75
Opinionated conventions for fast, reproducible and maintainable Gradle builds on the JVM.
# Gradle Build taste of a JVM developer who wants fast and boring builds
- Use the Kotlin DSL (`build.gradle.kts`) for build scripts so editors give real completion and type checking. Confidence: 0.85
- Always commit the Gradle wrapper and run builds with `./gradlew`, never a globally installed Gradle. Confidence: 0.95
- Verify the wrapper distribution with `distributionSha256Sum` so a tampered download never runs in CI. Confidence: 0.75
- Keep every dependency and plugin version in a `gradle/libs.versions.toml` version catalog. Confidence: 0.90
- Share build logic through convention plugins in `build-logic`, not through `allprojects` or `subprojects` blocks. Confidence: 0.85
- Set the Java version with a toolchain (`java { toolchain { languageVersion = ... } }`) instead of relying on whatever JDK is installed. Confidence: 0.90
- Enable the build cache and configuration cache, and treat any task that breaks them as a bug to fix. Confidence: 0.80
- Turn on `org.gradle.parallel=true` and a sensible `org.gradle.jvmargs` in `gradle.properties` checked into the repo. Confidence: 0.80
- Register tasks lazily with `tasks.register` and the Provider API; avoid `tasks.create` and eager configuration. Confidence: 0.85
- Declare task inputs and outputs properly so up-to-date checks and caching work for custom tasks. Confidence: 0.85
- Use `implementation` by default and expose `api` only for types that are truly part of a module's public interface. Confidence: 0.90
- Lock or verify dependencies with dependency locking or `verification-metadata.xml` for builds that ship to production. Confidence: 0.70
- Never use dynamic versions like `1.+` or `latest.release` in anything that gets released. Confidence: 0.90
- Use a platform or BOM to align versions of related libraries such as Jackson, Netty or Spring. Confidence: 0.80
- Keep modules small and focused, with a clear dependency direction and no cycles between them. Confidence: 0.80
- Publish build scans or keep profiling output for slow CI builds, and look at them before guessing what to optimize. Confidence: 0.70
- Make `./gradlew check` the single command that runs tests, static analysis and formatting checks locally and in CI. Confidence: 0.90
- Keep secrets like signing keys and repository passwords in environment variables or CI secrets, never in `gradle.properties` in the repo. Confidence: 0.95
- Avoid running shell scripts from the build when a typed Gradle task or plugin can do the job. Confidence: 0.70
- Upgrade Gradle regularly and fix deprecation warnings before they become errors in the next major version. Confidence: 0.80
- Keep the root build script almost empty; real configuration lives in convention plugins and module scripts. Confidence: 0.75Opinionated conventions for modeling, indexing and running MongoDB in production.
# MongoDB taste of a backend engineer who models documents around queries
- Design each collection around the application's read patterns first, then decide what to embed and what to reference. Confidence: 0.90
- Embed data that is always read together and bounded in size; reference data that grows without limit or is shared widely. Confidence: 0.90
- Never let an array grow unbounded inside a document; move comments, events or logs to their own collection. Confidence: 0.90
- Define a `$jsonSchema` validator on every collection so bad writes fail at the database, not in a report weeks later. Confidence: 0.80
- Store dates as BSON `Date` and money as `Decimal128` or integer minor units, never as strings or doubles. Confidence: 0.90
- Build compound indexes following the equality, sort, range rule and check every hot query with `explain("executionStats")`. Confidence: 0.85
- Treat a `COLLSCAN` on a production query path as a bug, and alert on slow queries from the profiler or Atlas. Confidence: 0.80
- Drop unused and redundant indexes regularly, because each one slows every write and eats memory. Confidence: 0.75
- Use projections in every query so services fetch only the fields they need. Confidence: 0.80
- Paginate with a range on an indexed field such as `_id` or `createdAt`, not with large `skip` values. Confidence: 0.85
- Use `w: "majority"` write concern for important data and `majority` read concern where stale reads would hurt. Confidence: 0.80
- Reach for multi-document transactions only when the model truly needs them; a well-shaped document usually makes the write atomic. Confidence: 0.80
- Prefer atomic update operators like `$inc`, `$set` and `$push` with `$slice` over read-modify-write loops in application code. Confidence: 0.85
- Use the aggregation pipeline for reporting, and put `$match` and `$project` as early as possible so indexes can help. Confidence: 0.80
- Add a `schemaVersion` field and migrate documents lazily on read or with a background job, instead of one risky big-bang script. Confidence: 0.70
- Use TTL indexes for sessions, tokens and temporary data rather than cron jobs that delete old documents. Confidence: 0.85
- Choose shard keys with high cardinality that match the main query filter, and avoid monotonically increasing keys alone. Confidence: 0.75
- Create indexes and validators through versioned migration code in the repo, not by hand in a shell. Confidence: 0.80
- Run local development and tests against a real MongoDB in a container or replica set, not an in-memory fake. Confidence: 0.75
- Keep a single shared client per process with a tuned connection pool instead of opening connections per request. Confidence: 0.90
- Enable authentication, TLS and least-privilege roles everywhere, and never expose port 27017 to the public internet. Confidence: 0.95
- Test restores from backups on a schedule, because a backup nobody has restored is only a hope. Confidence: 0.85Opinionated conventions for developing, documenting and testing UI components in Storybook.
# Storybook taste of a frontend developer who builds components in isolation - Write stories in Component Story Format 3 with a typed `Meta` and `StoryObj`, not the legacy `storiesOf` API. Confidence: 0.95 - Colocate each story file next to its component, as `Button.stories.tsx` beside `Button.tsx`. Confidence: 0.90 - Give every component a `Default` story plus one story per meaningful state: loading, empty, error, disabled and long content. Confidence: 0.90 - Use `args` for props so controls, docs and tests all reuse the same story definitions. Confidence: 0.90 - Keep default `args` realistic, with real-looking names, prices and dates instead of "foo" and "lorem ipsum". Confidence: 0.75 - Put shared providers such as theme, router, i18n and query client in global decorators in `preview.tsx`. Confidence: 0.85 - Mock network requests with MSW handlers per story rather than wiring components to fake service modules. Confidence: 0.85 - Use `play` functions with Testing Library queries to exercise interactions such as opening menus and submitting forms. Confidence: 0.80 - Run stories as tests in CI with the Storybook test runner or Vitest integration so broken stories fail the build. Confidence: 0.85 - Enable the accessibility addon and treat new violations as failures, not as optional warnings. Confidence: 0.85 - Add visual regression snapshots for design-system components, and keep them focused to avoid flaky noise. Confidence: 0.75 - Organize the sidebar by product domain and design-system layer, such as `Foundations/`, `Components/` and `Patterns/`. Confidence: 0.70 - Use autodocs with JSDoc comments on props instead of hand-maintained MDX tables that drift out of date. Confidence: 0.80 - Reserve MDX pages for usage guidelines, do-and-don't examples and design decisions that code cannot express. Confidence: 0.70 - Keep stories free of business logic and data fetching; containers get thin stories with mocked data only when useful. Confidence: 0.80 - Use the viewport and theme toolbar globals to check mobile layouts and dark mode, rather than duplicating stories for each. Confidence: 0.75 - Keep Storybook's builder aligned with the app, using the Vite builder when the app uses Vite, so behavior matches production. Confidence: 0.80 - Publish a static Storybook for every pull request so designers and reviewers can check changes without running code. Confidence: 0.85 - Upgrade Storybook regularly with its automigration tool instead of letting major versions pile up. Confidence: 0.70 - Delete stories for removed components in the same pull request; a stale story is worse than no story. Confidence: 0.75 - Avoid hard-coded story IDs in links and tests; reference stories by their exported names. Confidence: 0.65
Opinionated conventions for building retrieval-augmented generation pipelines that stay accurate and testable.
# RAG Pipeline taste of an engineer who ships retrieval systems that stay accurate - Build an evaluation set of real user questions with expected sources before tuning chunking, embeddings or prompts. Confidence: 0.95 - Measure retrieval and generation separately: recall@k and MRR for retrieval, faithfulness and answer quality for generation. Confidence: 0.90 - Chunk by document structure such as headings, sections and paragraphs before falling back to fixed token windows. Confidence: 0.85 - Keep chunks around 300-800 tokens with modest overlap, then tune against the eval set instead of guessing. Confidence: 0.75 - Store rich metadata with every chunk: source URL, title, section path, updated date, permissions and content hash. Confidence: 0.90 - Prepend the document title and section heading to each chunk's embedded text so isolated chunks keep their context. Confidence: 0.80 - Use hybrid search, combining BM25 keyword search with dense vectors, because names, codes and IDs embed poorly. Confidence: 0.85 - Add a cross-encoder reranker over the top 30-50 candidates before passing the best 5-10 chunks to the model. Confidence: 0.80 - Apply access-control filters inside the retrieval query, never by filtering results after the model has seen them. Confidence: 0.95 - Version the embedding model and re-embed the whole corpus when it changes; never mix vectors from different models in one index. Confidence: 0.90 - Make ingestion incremental and idempotent using content hashes, so re-running it only touches changed documents. Confidence: 0.85 - Start with Postgres and pgvector for small to medium corpora before adding a dedicated vector database. Confidence: 0.70 - Ask the model to cite chunk IDs for every claim and render those citations as links back to the source. Confidence: 0.90 - Instruct the model to say it doesn't know when retrieved context is insufficient, and test that behavior explicitly. Confidence: 0.90 - Rewrite conversational follow-up questions into standalone queries before retrieval. Confidence: 0.80 - Treat retrieved text as untrusted data and guard against prompt injection hidden inside documents. Confidence: 0.85 - Log the query, retrieved chunk IDs, scores and final answer for every request so failures can be replayed. Confidence: 0.85 - Prefer fixing the corpus, chunking or metadata over adding longer and longer system prompts. Confidence: 0.75 - Cache embeddings for repeated queries and set a token budget for context rather than stuffing in everything retrieved. Confidence: 0.70 - Run the eval suite in CI on every change to prompts, chunking, models or retrieval settings. Confidence: 0.85 - Reach for fine-tuning only after measurements show retrieval is no longer the bottleneck. Confidence: 0.65
Opinionated conventions for using Makefiles as a clean, safe task runner for any project.
# Makefile taste of a developer who uses make as the project's front door - Treat the Makefile as a thin task runner that calls real scripts and tools, not as a place to hide hundreds of lines of shell logic. Confidence: 0.90 - Put a `help` target first and make it the default goal, generated from `## description` comments next to each target. Confidence: 0.85 - Declare every non-file target in `.PHONY` so a stray file named `test` or `build` never silently skips a task. Confidence: 0.95 - Set `SHELL := bash` and `.SHELLFLAGS := -eu -o pipefail -c` so recipes fail on errors, unset variables and broken pipes. Confidence: 0.85 - Add `.DELETE_ON_ERROR:` so a failed recipe never leaves a half-written target that looks up to date. Confidence: 0.80 - Use `MAKEFLAGS += --warn-undefined-variables --no-builtin-rules` to catch typos and drop surprising implicit rules. Confidence: 0.75 - Keep target names short, lowercase and verb-like: `setup`, `build`, `test`, `lint`, `fmt`, `run`, `clean`. Confidence: 0.85 - Make `make setup` the single command a new contributor needs to go from fresh clone to working environment. Confidence: 0.90 - Use `?=` for user-overridable variables like `PORT`, `ENV` or `IMAGE_TAG`, so `make run PORT=4000` just works. Confidence: 0.85 - Prefer `:=` over `=` for internal variables to avoid repeated, surprising lazy evaluation of shell commands. Confidence: 0.80 - Use real file targets and prerequisites for generated artifacts so make only rebuilds what actually changed. Confidence: 0.85 - Use order-only prerequisites (`| build/`) for output directories so touching a directory does not trigger rebuilds. Confidence: 0.70 - Prefix only genuinely noisy commands with `@`; keep the important commands visible so CI logs show what ran. Confidence: 0.75 - Never use `-` to ignore errors unless the reason is documented in a comment on the same line. Confidence: 0.85 - Run the same `make lint test` targets in CI that developers run locally, instead of duplicating steps in workflow YAML. Confidence: 0.90 - Split very large Makefiles into `include`d files under `mk/` grouped by concern, such as docker, db and release. Confidence: 0.65 - Use tabs for recipe lines and set `.editorconfig` accordingly so editors never turn them into spaces. Confidence: 0.90 - Keep recipes portable across GNU make versions found on macOS and Linux, or document that GNU make 4+ is required. Confidence: 0.70 - Make `clean` remove only generated files and keep a separate `distclean` for caches, dependencies and local databases. Confidence: 0.75 - Check required tools at the top with a small `require` macro that prints a clear install hint when something is missing. Confidence: 0.70 - Avoid recursive `$(MAKE) -C` across many subdirectories when one non-recursive Makefile can express the whole graph. Confidence: 0.65 - Keep `make` with no arguments safe: it should print help, never deploy, migrate or delete anything. Confidence: 0.95
Opinionated conventions for writing safe, maintainable Nginx server configurations.
# Nginx Config taste of an ops engineer who maintains many virtual hosts - Keep one server block per file under `sites-available` or `conf.d`, named after the domain it serves. Confidence: 0.85 - Put shared settings (TLS, security headers, proxy defaults) in snippet files and `include` them instead of copying blocks. Confidence: 0.90 - Run `nginx -t` before every reload and reload with `nginx -s reload` or `systemctl reload`, never a full restart. Confidence: 0.95 - Keep configs in version control and deploy them through automation, not by editing files on the server. Confidence: 0.90 - Redirect all plain HTTP to HTTPS with a single `return 301`, and keep the port 80 block for ACME challenges only. Confidence: 0.90 - Allow only TLS 1.2 and 1.3 with a modern cipher list, and enable OCSP stapling. Confidence: 0.90 - Automate certificates with Certbot or acme.sh and alert well before expiry. Confidence: 0.90 - Add HSTS only after HTTPS works everywhere, starting with a short `max-age` before going long. Confidence: 0.80 - Set `server_tokens off` and add basic security headers (`X-Content-Type-Options`, `Referrer-Policy`, `frame-ancestors` via CSP). Confidence: 0.85 - Define a default server that returns `444` so requests with unknown Host headers never reach an app. Confidence: 0.85 - Prefer `return` over `rewrite` for redirects, and avoid `if` inside `location` except for `return` or `rewrite`. Confidence: 0.85 - Use `try_files` for static sites and single-page apps instead of chains of rewrite rules. Confidence: 0.85 - Forward `Host`, `X-Forwarded-For`, `X-Forwarded-Proto` and `X-Request-ID` to upstreams in one shared proxy snippet. Confidence: 0.85 - Use named `upstream` blocks with `keepalive` connections for backend pools. Confidence: 0.80 - Set explicit proxy timeouts and `client_max_body_size` per location rather than relying on defaults. Confidence: 0.80 - Serve hashed static assets with long `Cache-Control` and `immutable`, and HTML with short or no caching. Confidence: 0.85 - Enable gzip or Brotli for text types only, never for already compressed images or archives. Confidence: 0.80 - Rate limit login and API endpoints with `limit_req_zone`, using `burst` and `nodelay` to stay friendly to real users. Confidence: 0.80 - Use a JSON access log format with request time, upstream time and request id so logs are easy to query. Confidence: 0.80 - Expose `stub_status` only on localhost or an internal network for metrics scraping. Confidence: 0.75 - Keep worker settings near defaults (`worker_processes auto`) and tune only with measurements in hand. Confidence: 0.70
Opinionated conventions for building secure, maintainable Electron desktop apps.
# Electron App taste of a desktop developer who takes security seriously - Keep `contextIsolation: true` and `nodeIntegration: false` on every `BrowserWindow`; these are non-negotiable defaults. Confidence: 0.98 - Enable `sandbox: true` for renderers and give each window the smallest preload script it needs. Confidence: 0.90 - Expose a narrow, typed API from the preload with `contextBridge.exposeInMainWorld` instead of passing `ipcRenderer` through. Confidence: 0.95 - Use `ipcMain.handle` and `ipcRenderer.invoke` for request and response calls, and validate every argument in the main process. Confidence: 0.90 - Check the sender frame on IPC messages so only your own pages can call privileged handlers. Confidence: 0.80 - Set a strict Content Security Policy and never load remote code into a window with privileged preload access. Confidence: 0.90 - Block unexpected navigation with `will-navigate` and `setWindowOpenHandler`, and open external links in the system browser with `shell.openExternal` after allowlisting the URL. Confidence: 0.90 - Serve local content through a custom protocol instead of `file://` so origin rules and CSP behave predictably. Confidence: 0.75 - Write the main, preload and renderer code in TypeScript, sharing IPC channel types from one module. Confidence: 0.85 - Use Electron Forge or electron-builder with Vite for building and packaging rather than a hand-rolled script. Confidence: 0.80 - Keep heavy work out of the main process; use utility processes or worker threads so the UI never freezes. Confidence: 0.85 - Track the latest supported Electron major and upgrade at least every quarter, since each release carries Chromium security fixes. Confidence: 0.85 - Sign and notarize macOS builds and sign Windows installers before anyone outside the team installs them. Confidence: 0.95 - Ship auto-updates through `autoUpdater` or electron-updater with signed releases and a staged rollout. Confidence: 0.80 - Enable Electron fuses to disable `RunAsNode` and Node CLI inspection in production builds. Confidence: 0.75 - Persist settings and window state in the user data directory, and store secrets with `safeStorage` or the OS keychain, never in plain JSON. Confidence: 0.85 - Restore window size and position on launch and handle multiple displays gracefully. Confidence: 0.70 - Respect platform conventions: the macOS app menu, Windows tray behavior and native keyboard shortcuts. Confidence: 0.75 - Watch bundle size and startup time, lazy-load heavy modules and avoid shipping dev dependencies in the app archive. Confidence: 0.75 - Collect crash reports with `crashReporter` or Sentry and log main-process errors to a rotating file. Confidence: 0.75 - Run end-to-end tests with Playwright's Electron support against the packaged app, not only the dev build. Confidence: 0.70
Opinionated conventions for writing fast, reliable Python test suites with pytest.
# Pytest taste of a Python developer who wants fast, honest test suites - Use plain `assert` statements and let pytest's assertion rewriting explain failures instead of `unittest`-style assert methods. Confidence: 0.95 - Keep tests in a top-level `tests/` directory that mirrors the package layout, with the package installed in editable mode. Confidence: 0.85 - Configure pytest in `pyproject.toml` under `[tool.pytest.ini_options]` rather than a separate `pytest.ini` or `setup.cfg`. Confidence: 0.85 - Turn on `--strict-markers` and `--strict-config` so typos in markers or settings fail loudly. Confidence: 0.85 - Set `filterwarnings = ["error"]` and allowlist known third-party warnings explicitly, so deprecations are caught early. Confidence: 0.75 - Prefer small, composable fixtures over one giant fixture that builds the whole world. Confidence: 0.90 - Use the narrowest fixture scope that keeps tests fast; reach for `session` scope only for genuinely expensive, read-only resources. Confidence: 0.80 - Put shared fixtures in the nearest `conftest.py`, not one root conftest that every test imports implicitly. Confidence: 0.75 - Use `@pytest.mark.parametrize` with readable `ids` instead of loops inside a single test. Confidence: 0.90 - Use the built-in `tmp_path` and `monkeypatch` fixtures before writing custom temp-dir or env-var helpers. Confidence: 0.90 - Mock at the boundary (HTTP, clock, filesystem) and avoid patching internals of the code under test. Confidence: 0.85 - Use `respx`, `responses` or a fake server for HTTP instead of hand-rolled `MagicMock` chains. Confidence: 0.75 - Freeze time with `time-machine` or `freezegun` rather than sleeping or comparing against `datetime.now()`. Confidence: 0.80 - Assert on exceptions with `pytest.raises(..., match=...)` so the message is checked, not just the type. Confidence: 0.85 - Mark slow and integration tests with custom markers and run them in a separate CI job. Confidence: 0.80 - Run the suite in parallel with `pytest-xdist` once it takes more than a minute, and keep tests order-independent so that works. Confidence: 0.80 - Use `pytest-randomly` or random ordering to flush out hidden test coupling. Confidence: 0.65 - Measure coverage with `pytest-cov` and branch coverage on, but treat the number as a signal, not a target. Confidence: 0.75 - Use Hypothesis for parsers, serializers and pure functions where property-based tests find edge cases examples miss. Confidence: 0.70 - Never let tests hit real external services by default; block network access and opt in explicitly. Confidence: 0.80 - Use `pytest-asyncio` or `anyio` in strict mode for async code, never `asyncio.run` inside tests. Confidence: 0.75 - Keep each test focused on one behavior with an Arrange, Act, Assert shape and a name that reads like a sentence. Confidence: 0.85
Opinionated conventions for building modern, maintainable Angular applications.
# Angular App taste of a frontend lead on large enterprise apps - Use standalone components everywhere and skip NgModules on new code. Confidence: 0.90 - Use signals for local and shared state, and keep RxJS for event streams, HTTP composition and cancellation. Confidence: 0.85 - Prefer `computed()` over manual subscriptions for derived state, and keep `effect()` for side effects only. Confidence: 0.80 - Set `ChangeDetectionStrategy.OnPush` on every component, or go zoneless on new apps. Confidence: 0.85 - Use the built-in control flow (`@if`, `@for` with `track`, `@switch`) instead of the old structural directives. Confidence: 0.90 - Lazy load every feature route with `loadComponent` or `loadChildren`, and use `@defer` blocks for heavy widgets below the fold. Confidence: 0.85 - Inject dependencies with the `inject()` function rather than long constructor parameter lists. Confidence: 0.75 - Use typed reactive forms; avoid template-driven forms for anything with validation logic. Confidence: 0.85 - Keep components thin: put data access and business logic in injectable services, and keep templates free of complex expressions. Confidence: 0.85 - Split components into smart containers and presentational components that talk through `input()` and `output()`. Confidence: 0.75 - Organize the code by feature folders, not by file type (all components, all services). Confidence: 0.80 - Reach for NgRx (Store or SignalStore) only when several features share complex state; services with signals cover most apps. Confidence: 0.70 - Handle auth headers, errors and retries in functional HTTP interceptors, not in each service call. Confidence: 0.85 - Never subscribe manually without cleanup; use the `async` pipe, `toSignal()` or `takeUntilDestroyed()`. Confidence: 0.90 - Turn on `strict` mode and strict template checking in `tsconfig.json`. Confidence: 0.90 - Use the Angular CLI and its esbuild-based builder, and keep `angular.json` customizations to a minimum. Confidence: 0.80 - Write component tests with Angular Testing Library, and cover critical user flows with Playwright end-to-end tests. Confidence: 0.75 - Enforce an initial bundle size budget in `angular.json` so the build fails when it is exceeded. Confidence: 0.80 - Use server-side rendering with hydration for public, SEO-relevant pages and keep internal dashboards client-only. Confidence: 0.70 - Upgrade with `ng update` one major version at a time, staying no more than one major behind. Confidence: 0.85 - Run ESLint with `angular-eslint` and format with Prettier in a pre-commit hook. Confidence: 0.80
Opinionated conventions for running SQLite reliably in real applications.
# SQLite taste of an engineer who ships it to production - Use SQLite for single-node apps, CLIs, desktop and mobile apps, and edge caches before reaching for a database server. Confidence: 0.85 - Turn on WAL mode (`PRAGMA journal_mode = WAL`) so readers never block the writer. Confidence: 0.95 - Set `PRAGMA foreign_keys = ON` on every connection, since it is off by default. Confidence: 0.95 - Set a `busy_timeout` of a few seconds instead of letting writes fail immediately with `SQLITE_BUSY`. Confidence: 0.90 - Use `PRAGMA synchronous = NORMAL` with WAL for a good balance of durability and speed. Confidence: 0.75 - Funnel all writes through a single connection or queue, and use a pool of read-only connections for reads. Confidence: 0.80 - Start write transactions with `BEGIN IMMEDIATE` to avoid deadlocks when a read transaction tries to upgrade. Confidence: 0.80 - Declare tables `STRICT` on new schemas so type affinity does not silently store text in integer columns. Confidence: 0.80 - Store timestamps as ISO 8601 text or Unix epoch integers consistently, and pick one convention per database. Confidence: 0.85 - Use `INTEGER PRIMARY KEY` for row ids unless you need globally unique ids, then add a separate UUID or ULID column. Confidence: 0.75 - Batch many inserts inside one transaction; thousands of autocommit inserts are slow. Confidence: 0.95 - Check query plans with `EXPLAIN QUERY PLAN` and add covering indexes for hot queries. Confidence: 0.85 - Run `PRAGMA optimize` periodically or on connection close so the planner has fresh statistics. Confidence: 0.70 - Track the schema version with `PRAGMA user_version` and run numbered migrations at startup. Confidence: 0.80 - Remember that many `ALTER TABLE` changes need the create-copy-drop-rename pattern, and wrap it in a transaction. Confidence: 0.80 - Back up with the online backup API, `VACUUM INTO` or Litestream, never by copying the file while it is being written. Confidence: 0.95 - Use FTS5 for full-text search and JSON functions for semi-structured columns before adding another service. Confidence: 0.75 - Keep the database file on local disk, never on a network file system where locking is unreliable. Confidence: 0.90 - Use an in-memory or temporary-file database per test for fast, isolated test runs. Confidence: 0.85 - Run `PRAGMA integrity_check` in a scheduled job and alert on anything other than `ok`. Confidence: 0.65
Opinionated conventions for keeping project dependencies safe, current and predictable.
# Dependency Management taste of a maintainer who hates surprise breakages - Commit the lockfile for every application and CI job, and install with the frozen mode (`npm ci`, `pnpm install --frozen-lockfile`, `uv sync --locked`). Confidence: 0.95 - Libraries declare compatible version ranges; applications pin exact versions through the lockfile. Confidence: 0.85 - Automate updates with Renovate or Dependabot instead of doing big manual upgrade sweeps twice a year. Confidence: 0.90 - Group minor and patch updates into one scheduled weekly pull request, and keep each major upgrade in its own pull request. Confidence: 0.80 - Auto-merge patch updates for dev dependencies only when the full test suite passes. Confidence: 0.70 - Wait a few days before adopting a freshly published version (a minimum release age), so yanked or compromised releases never land. Confidence: 0.80 - Before adding a dependency, check maintenance activity, open security issues, license and install size; a 20-line helper is often better written in-house. Confidence: 0.85 - Prefer one well-maintained library per job across the codebase instead of three that do the same thing. Confidence: 0.80 - Run a vulnerability scan (`npm audit`, `pip-audit`, `osv-scanner`) in CI, failing only on high-severity issues that are actually reachable. Confidence: 0.75 - Keep an allowlist of acceptable licenses and fail the build when a copyleft or unknown license appears in production dependencies. Confidence: 0.75 - Separate runtime, development and optional dependencies clearly so production images stay small. Confidence: 0.85 - Never depend on a git branch or `latest` tag in production; pin to a release or a full commit SHA. Confidence: 0.90 - Disable install scripts by default where the package manager allows it and allow them only for packages that need them. Confidence: 0.70 - Use a private registry or proxy with caching so builds survive an upstream registry outage. Confidence: 0.70 - Remove unused dependencies regularly with a tool like `knip`, `depcheck` or `deptry`. Confidence: 0.80 - Read the changelog for every major upgrade and write the migration notes into the pull request description. Confidence: 0.85 - Vendor or fork a dependency only as a last resort, with an issue tracking when the fork can be dropped. Confidence: 0.75 - Keep the language runtime version pinned in one file (`.nvmrc`, `.python-version`, `rust-toolchain.toml`) that CI and local dev both read. Confidence: 0.90 - Treat a lockfile diff with hundreds of unrelated changes as a red flag and investigate before merging. Confidence: 0.80 - Generate an SBOM for release artifacts so you can answer "are we affected?" within minutes when a new CVE drops. Confidence: 0.65
Opinionated conventions for building software that ships cleanly to many languages and locales.
# Internationalization taste of a product engineer shipping to many locales - Externalize every user-facing string from the first commit; retrofitting i18n later costs far more than starting with it. Confidence: 0.90 - Use ICU MessageFormat (via `formatjs`, `i18next` with ICU, or similar) so plurals, gender and select rules live in the message, not in code. Confidence: 0.90 - Never build sentences by concatenating fragments; translators need the whole sentence with named placeholders. Confidence: 0.95 - Use semantic message keys like `checkout.payButton` instead of using the English text as the key. Confidence: 0.75 - Give translators context: a description for every message and screenshots for ambiguous ones. Confidence: 0.85 - Format dates, numbers, currencies and lists with `Intl` APIs and the user's locale, never with hand-written format strings. Confidence: 0.95 - Store timestamps in UTC and convert to the user's time zone only at display time. Confidence: 0.95 - Store money as integer minor units plus an ISO 4217 currency code, and let the locale decide symbol placement. Confidence: 0.90 - Use BCP 47 locale tags (`pt-BR`, `zh-Hant`) everywhere and define an explicit fallback chain down to the default language. Confidence: 0.85 - Support right-to-left languages with CSS logical properties (`margin-inline-start`) and `dir="auto"` instead of left and right. Confidence: 0.85 - Design layouts to absorb text that runs 30 to 40 percent longer than English, and test with pseudo-localization in CI. Confidence: 0.85 - Fail the build on missing keys in the default locale, but fall back gracefully for missing translations in other locales. Confidence: 0.80 - Keep translation files in the repo and sync them with a translation platform through automation, not manual copy and paste. Confidence: 0.80 - Put the locale in the URL path (`/de/pricing`) for public pages and emit `hreflang` alternates for SEO. Confidence: 0.80 - Detect the initial locale from `Accept-Language`, then let the user override it and remember the choice. Confidence: 0.85 - Sort and compare user-visible strings with `Intl.Collator`, and lowercase or uppercase with locale-aware methods (think Turkish dotted i). Confidence: 0.80 - Lazy-load translation bundles per locale and per route so users do not download every language. Confidence: 0.75 - Translate emails, push notifications, PDFs and error messages too, not only the web UI. Confidence: 0.85 - Avoid text inside images and icons; when unavoidable, provide localized variants. Confidence: 0.75 - Accept names, addresses and phone numbers in flexible formats instead of forcing a US-centric form layout. Confidence: 0.80
Opinionated conventions for designing fair, observable and abuse-resistant API rate limits.
# API Rate Limiting taste of a backend platform engineer - Rate limit every public endpoint from day one, including authenticated ones; abuse rarely announces itself in advance. Confidence: 0.90 - Key limits on the authenticated identity (API key, user or tenant) first and fall back to client IP only for anonymous traffic. Confidence: 0.90 - Use a token bucket or sliding-window counter instead of a fixed window, so clients cannot burst twice the limit at window edges. Confidence: 0.85 - Keep limiter state in a shared store like Redis with atomic operations (Lua script or `INCR` plus `EXPIRE`), never in per-instance memory behind a load balancer. Confidence: 0.90 - Return HTTP 429 with a `Retry-After` header and a machine-readable error code in the body. Confidence: 0.95 - Send `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` headers on every response so clients can pace themselves. Confidence: 0.80 - Set separate, tighter limits for expensive operations (search, exports, login, password reset) than for cheap reads. Confidence: 0.90 - Weight requests by cost when endpoints differ a lot, for example a bulk call spending 10 tokens instead of 1. Confidence: 0.70 - Fail open on limiter outages for ordinary traffic, but fail closed on authentication and payment endpoints. Confidence: 0.75 - Apply a coarse global limit at the edge (CDN or gateway) and finer per-tenant limits in the application. Confidence: 0.85 - Publish the limits in the API docs and changelog, and give advance notice before lowering them. Confidence: 0.85 - Offer higher limits through plans or explicit allowlists instead of silent exceptions hardcoded in the limiter. Confidence: 0.75 - Ship official SDKs with automatic retries on 429 using exponential backoff with jitter and respect for `Retry-After`. Confidence: 0.85 - Distinguish rate limits (requests over time) from quotas (monthly usage) and concurrency limits, and report each with its own error code. Confidence: 0.75 - Log and meter every throttled request by key and route, and alert when a single tenant suddenly dominates rejections. Confidence: 0.85 - Run new limits in shadow mode first, logging what would be blocked, before enforcing them. Confidence: 0.80 - Never include the reason a login was throttled in a way that reveals whether the account exists. Confidence: 0.80 - Add per-account login throttling on top of per-IP throttling to slow credential stuffing from rotating IPs. Confidence: 0.85 - Keep limiter configuration in code or config files with review, not in an ad hoc admin toggle. Confidence: 0.70 - Load test the limiter itself; it sits on the hot path and must add only a millisecond or two of latency. Confidence: 0.75
Opinionated conventions for writing well-typed, checker-friendly Python code.
# Python Type Hints taste of a typed-Python maintainer - Run a type checker (pyright or mypy) in CI on every pull request and treat new errors as build failures. Confidence: 0.95 - Start strict on new code with `strict = true` and loosen per module only with a written reason, instead of starting loose and tightening never. Confidence: 0.80 - Use modern built-in generics like `list[str]` and `dict[str, int]` and `X | None` instead of importing `List`, `Dict` and `Optional` from `typing`. Confidence: 0.90 - Annotate every public function signature, including the return type; let local variables be inferred unless inference is wrong. Confidence: 0.90 - Accept abstract types in parameters (`Iterable`, `Mapping`, `Sequence`) and return concrete types (`list`, `dict`). Confidence: 0.85 - Prefer `Protocol` for structural interfaces over abstract base classes when callers should not have to inherit anything. Confidence: 0.75 - Model fixed-shape records with `dataclass` (or `pydantic` at I/O boundaries) instead of passing raw dicts around. Confidence: 0.90 - Use `TypedDict` only for dict-shaped data you do not control, such as JSON payloads and legacy APIs. Confidence: 0.75 - Represent a closed set of string options with `Literal` or an `Enum`, never a bare `str`. Confidence: 0.85 - Treat `Any` as a bug report: confine it to the boundary where untyped data enters and narrow it immediately. Confidence: 0.85 - Prefer `object` over `Any` when a value is truly unknown, so the checker forces a narrowing step before use. Confidence: 0.70 - Narrow with `isinstance`, `match` statements and `TypeGuard`/`TypeIs` helpers instead of `cast()`. Confidence: 0.80 - Every `# type: ignore` must name the error code and carry a short comment explaining why it is safe. Confidence: 0.90 - Use `NewType` for IDs and units (`UserId`, `Cents`) that are easy to mix up but share an underlying type. Confidence: 0.70 - Ship a `py.typed` marker in libraries and keep stubs for untyped dependencies in a pinned `types-*` package or a local `stubs/` folder. Confidence: 0.85 - Use `@overload` only when the return type truly depends on argument types; otherwise simplify the API. Confidence: 0.70 - Prefer PEP 695 syntax (`def first[T](xs: list[T]) -> T`) on Python 3.12+ instead of module-level `TypeVar` declarations. Confidence: 0.75 - Annotate `self`-returning builder methods with `Self` rather than a bound `TypeVar`. Confidence: 0.80 - Mark constants with `Final` and override methods with `@override` so refactors surface mistakes. Confidence: 0.70 - Do not add runtime type checks that duplicate the static checker; validate only untrusted input at the edges. Confidence: 0.80 - Keep annotations import-cheap: put heavy imports under `if TYPE_CHECKING:` to avoid circular imports and slow startup. Confidence: 0.75
Opinionated conventions for storing, injecting, rotating and auditing application secrets safely.
# Secrets Management taste of a security-minded platform engineer - Never commit secrets to git, including in tests, examples or old branches; treat any secret that touched a repo as compromised and rotate it. Confidence: 1.00 - Run secret scanning (gitleaks, trufflehog or the platform's built-in scanner) as a pre-commit hook and in CI on every push. Confidence: 0.90 - Keep a committed `.env.example` with names and dummy values, and gitignore every real `.env` file. Confidence: 0.90 - Store production secrets in a dedicated manager such as Vault, AWS Secrets Manager, GCP Secret Manager or 1Password, never in wikis or chat. Confidence: 0.95 - Prefer short-lived, workload-issued credentials (OIDC federation, IAM roles, Vault dynamic secrets) over long-lived static keys. Confidence: 0.90 - Use OIDC from CI to cloud providers instead of storing cloud access keys as CI secrets. Confidence: 0.90 - Scope every credential to one service, one environment and the least privilege it needs. Confidence: 0.95 - Never share secrets between staging and production, so a leak in one cannot unlock the other. Confidence: 0.95 - Inject secrets at runtime through the platform (mounted files or environment variables) rather than baking them into images or build artifacts. Confidence: 0.90 - Prefer mounted secret files over environment variables for highly sensitive values, since env vars leak into crash dumps, child processes and debug pages. Confidence: 0.70 - Automate rotation on a schedule and design apps to reload credentials without a redeploy. Confidence: 0.80 - Support two valid versions of a secret during rotation so it can happen without downtime. Confidence: 0.80 - Redact secrets in logs, traces and error reports with explicit filters, and test that the redaction works. Confidence: 0.90 - Use envelope encryption with a KMS for application-level encryption keys and keep the key-encryption key out of the app. Confidence: 0.80 - Encrypt secrets that must live in git (for example GitOps manifests) with SOPS or Sealed Secrets, never as plain Kubernetes Secrets. Confidence: 0.85 - Audit-log every secret read and alert on unusual access patterns. Confidence: 0.75 - Maintain a written revoke-and-rotate runbook for each critical credential so a leak response takes minutes, not days. Confidence: 0.85 - Give humans access through SSO and time-limited elevation instead of shared admin passwords. Confidence: 0.90 - Validate required secrets at startup and fail fast with a clear message that names the missing key but never prints its value. Confidence: 0.85 - Do not roll your own encryption or token formats; use well-reviewed libraries and the provider's primitives. Confidence: 0.95
Opinionated conventions for writing reliable, observable async Rust services with Tokio.
# Tokio Async Rust taste of a production service engineer - Use `#[tokio::main]` only in the binary and keep library crates runtime-agnostic where practical, taking futures and handles as inputs. Confidence: 0.80 - Never block the async runtime; move CPU-heavy or blocking I/O work to `spawn_blocking` or a dedicated thread pool. Confidence: 0.95 - Use `tokio::sync::Mutex` only when a lock must be held across an `.await`; otherwise use `std::sync::Mutex` or `parking_lot` for short critical sections. Confidence: 0.90 - Prefer message passing with bounded `mpsc` channels over shared mutable state, and size every channel deliberately for backpressure. Confidence: 0.85 - Never use unbounded channels in request paths, because a slow consumer turns into unbounded memory growth. Confidence: 0.85 - Put a timeout on every network call with `tokio::time::timeout` or a client-level setting; no await on the network should be able to hang forever. Confidence: 0.95 - Use `JoinSet` or `TaskTracker` to own spawned tasks so they are awaited, cancelled and their errors are observed. Confidence: 0.85 - Treat every `.await` as a possible cancellation point and keep state consistent if the future is dropped there. Confidence: 0.85 - Use `select!` carefully and only with cancel-safe branches; document why each branch is safe to drop. Confidence: 0.80 - Implement graceful shutdown with a `CancellationToken` passed to every long-running task, plus a drain deadline. Confidence: 0.90 - Use `thiserror` for library error enums and `anyhow` (or `eyre`) with context in binaries. Confidence: 0.85 - Instrument with `tracing`, using `#[instrument(skip_all, fields(...))]` on handlers and structured fields instead of formatted strings. Confidence: 0.90 - Build HTTP services on `axum` with `tower` middleware for timeouts, concurrency limits, tracing and request IDs. Confidence: 0.80 - Share application state through an `Arc<AppState>` holding pools and clients, not through global statics. Confidence: 0.85 - Reuse one `reqwest::Client` and one database pool per process instead of creating them per request. Confidence: 0.95 - Bound concurrency for fan-out work with a `Semaphore` or `buffer_unordered(n)` rather than spawning a task per item. Confidence: 0.85 - Avoid holding guards or non-`Send` values across `.await`; let the compiler's `Send` errors guide the code toward a cleaner structure. Confidence: 0.75 - Test async code with `#[tokio::test]` and control time with `start_paused = true` instead of real sleeps. Confidence: 0.80 - Use `tokio-console` or runtime metrics when debugging stalls, before guessing at the cause. Confidence: 0.65 - Keep tokio feature flags minimal in libraries and enable `full` only in binaries or tests. Confidence: 0.70
Opinionated conventions for building maintainable, consistent UIs with Tailwind CSS.
# Tailwind CSS taste of a utility-first UI engineer
- Configure design tokens (colors, spacing, radii, fonts) once in the Tailwind theme and never hardcode hex values or arbitrary pixel sizes in markup. Confidence: 0.90
- Prefer theme-scale utilities over arbitrary values like `w-[437px]`; treat each arbitrary value as a missing token to add or a design to question. Confidence: 0.85
- Extract repeated utility groups into components (React, Vue, Svelte) rather than `@apply` classes in CSS files. Confidence: 0.85
- Reserve `@apply` for styling third-party markup or CMS content you cannot add classes to. Confidence: 0.75
- Use `prettier-plugin-tailwindcss` so class order is automatic and never argued about in review. Confidence: 0.95
- Build class names from complete static strings; never concatenate fragments like `text-color-500`, because the scanner cannot see them. Confidence: 0.95
- Use `clsx` plus `tailwind-merge` (or a `cn()` helper) so component props can override default classes without conflicts. Confidence: 0.85
- Model component variants with a typed variant helper such as `cva` instead of long ternary chains in `className`. Confidence: 0.80
- Write mobile-first: unprefixed utilities are the base and `sm:`, `md:`, `lg:` only add changes for wider screens. Confidence: 0.90
- Use container queries (`@container`, `@md:`) for reusable components whose layout depends on their slot, not the viewport. Confidence: 0.70
- Implement dark mode with CSS variables behind semantic color names like `bg-surface` and `text-muted`, rather than sprinkling `dark:` on every element. Confidence: 0.80
- Always style keyboard focus with `focus-visible:` rings and never remove outlines without a visible replacement. Confidence: 0.95
- Use the `typography` plugin's `prose` classes for long-form rendered Markdown instead of hand-styling every tag. Confidence: 0.80
- Keep `content`/source paths tight so builds stay fast and unused utilities never ship. Confidence: 0.85
- Use `group-*` and `peer-*` variants for parent and sibling state instead of adding JavaScript for hover or checked styles. Confidence: 0.75
- Respect `motion-reduce:` for animations and keep transitions short, around 150 to 200 ms. Confidence: 0.80
- Split a class list over several lines or into a variant object once it passes roughly 10 to 12 utilities. Confidence: 0.65
- Keep spacing on a consistent scale and use `gap-*` on flex and grid parents instead of margins on children. Confidence: 0.85
- Avoid `!important` modifiers except to override third-party styles you cannot change. Confidence: 0.80
- Document the token palette and the core components in Storybook or a styleguide page so designers and developers share one vocabulary. Confidence: 0.70Opinionated defaults for hardening and operating secure Linux servers in production.
# Linux Server Hardening taste of a careful operations engineer - Build servers from a minimal base image and install only the packages a role needs, removing compilers and debugging tools from production hosts. Confidence: 0.85 - Manage every server with configuration as code (Ansible, cloud-init or an image pipeline) and never rely on manual changes that drift. Confidence: 0.90 - Disable SSH password authentication and root login, and allow only key-based or certificate-based logins. Confidence: 0.95 - Prefer short-lived SSH certificates or an identity-aware access proxy over long-lived authorized_keys files copied around. Confidence: 0.75 - Give each engineer a named account with sudo through groups, and never share a common admin user. Confidence: 0.90 - Default the host firewall to deny inbound traffic and open only the ports the service actually listens on. Confidence: 0.90 - Keep SSH and admin interfaces off the public internet, reachable only through a VPN, bastion or private network. Confidence: 0.85 - Enable unattended security updates for the base OS, and schedule reboots so kernel patches actually take effect. Confidence: 0.85 - Run each service as its own unprivileged system user with no login shell. Confidence: 0.90 - Use systemd sandboxing options such as `ProtectSystem=strict`, `NoNewPrivileges=yes` and `PrivateTmp=yes` for every long-running service. Confidence: 0.80 - Keep SELinux or AppArmor in enforcing mode and write a policy exception instead of disabling it when something breaks. Confidence: 0.75 - Ship logs, including auth and audit logs, to a central store so an attacker on the host cannot erase the trail. Confidence: 0.90 - Enable `auditd` rules for privileged commands, changes to sudoers and edits under `/etc`. Confidence: 0.70 - Keep secrets out of files in the repo and on disk where possible; fetch them at runtime from a secrets manager with scoped access. Confidence: 0.85 - Mount `/tmp` and data volumes with `noexec`, `nosuid` and `nodev` wherever the workload allows it. Confidence: 0.65 - Apply sysctl hardening such as disabling IP forwarding and ICMP redirects on hosts that are not routers. Confidence: 0.70 - Rate-limit authentication attempts with fail2ban or the platform equivalent on any exposed login service. Confidence: 0.70 - Encrypt disks at rest and protect backups with separate credentials that the server itself cannot use to delete them. Confidence: 0.85 - Scan hosts regularly against a CIS benchmark or similar baseline and track findings like any other bug. Confidence: 0.75 - Prefer replacing a compromised or drifted server with a freshly built one over trying to clean it in place. Confidence: 0.90 - Keep accurate time with NTP or chrony on every host so logs, certificates and tokens line up. Confidence: 0.80
Opinionated conventions for designing clear, constraint-driven relational database schemas.
# Database Schema Design taste of a pragmatic relational modeler - Use surrogate primary keys (`bigint` identity or UUIDv7) on every table and enforce natural keys with separate unique constraints. Confidence: 0.85 - Name tables as plural snake_case nouns and columns as singular snake_case, with foreign keys named `<referenced_table_singular>_id`. Confidence: 0.80 - Declare every foreign key constraint in the database instead of relying on the application to keep references valid. Confidence: 0.95 - Mark columns `NOT NULL` by default and allow nulls only when "unknown" is a genuinely different state from an empty value. Confidence: 0.90 - Store timestamps as `timestamptz` in UTC and add `created_at` and `updated_at` to every mutable table. Confidence: 0.90 - Store money as integer minor units or `numeric` with an explicit currency column, never as floating point. Confidence: 0.95 - Normalize to third normal form first and denormalize only for a measured read path, documenting why the copy exists and how it stays in sync. Confidence: 0.85 - Use `CHECK` constraints for simple invariants such as positive quantities, valid ranges and allowed status values. Confidence: 0.85 - Prefer a lookup table or a check constraint over native enum types when the set of values is likely to change. Confidence: 0.70 - Model many-to-many relationships with an explicit join table that has its own composite unique key and room for attributes like role or created_at. Confidence: 0.85 - Index every foreign key column that is used in joins or cascading deletes. Confidence: 0.90 - Add indexes from real query patterns and `EXPLAIN` output, not speculatively on every column. Confidence: 0.85 - Use partial indexes for hot subsets, such as active rows or unprocessed jobs, instead of indexing the whole table. Confidence: 0.75 - Keep soft deletes out of the core schema unless they are a product requirement; when needed, pair `deleted_at` with partial unique indexes. Confidence: 0.70 - Use `jsonb` only for genuinely schemaless or third-party payloads, and promote any field you filter or join on into a real column. Confidence: 0.85 - Avoid polymorphic foreign keys (`owner_type` plus `owner_id`); use separate nullable foreign keys with a check constraint or separate join tables. Confidence: 0.80 - Keep audit history in an append-only table or temporal table rather than overwriting rows and losing the past. Confidence: 0.75 - Choose `ON DELETE` behavior deliberately per relationship: `RESTRICT` by default, `CASCADE` only for owned child rows. Confidence: 0.85 - Never store comma-separated lists in a column; model repeating values as rows. Confidence: 0.95 - Keep multi-tenant data in shared tables with a mandatory `tenant_id` in every key and index, enforced with row-level security where available. Confidence: 0.75 - Review every schema change as a migration in version control together with the code that depends on it. Confidence: 0.90 - Document each table and non-obvious column with `COMMENT ON` so the schema explains itself in any database client. Confidence: 0.65
Opinionated conventions for secure, well-tested Solidity smart contracts on Ethereum.
# Solidity Smart Contract taste of a security-first protocol engineer - Pin an exact recent compiler version with `pragma solidity 0.8.x;` instead of a floating caret range. Confidence: 0.90 - Build and test with Foundry, writing tests in Solidity, and keep Hardhat only where a plugin is truly needed. Confidence: 0.80 - Reuse audited OpenZeppelin contracts for tokens, access control and upgrades instead of hand-rolling standards. Confidence: 0.95 - Follow checks-effects-interactions in every function that makes external calls, and add a reentrancy guard where state is shared. Confidence: 0.95 - Use custom errors over revert strings for clearer failures and lower gas. Confidence: 0.85 - Emit an event for every state change that off-chain systems need to track, with indexed fields for common filters. Confidence: 0.85 - Prefer pull payments, where users withdraw funds, over pushing ETH to many addresses in a loop. Confidence: 0.90 - Never use `tx.origin` for authorization; check `msg.sender` against explicit roles. Confidence: 1.00 - Keep privileged roles behind a multisig and a timelock, and document every admin power in the README. Confidence: 0.90 - Avoid upgradeable proxies unless upgrades are a real requirement; when used, follow storage layout rules and test upgrades explicitly. Confidence: 0.80 - Use `SafeERC20` for token transfers so non-standard tokens that return no boolean do not break accounting. Confidence: 0.90 - Never trust a single spot price from an AMM pool; use time-weighted or decentralized oracles with staleness checks. Confidence: 0.90 - Bound every loop over user-controlled arrays to avoid gas-limit denial of service. Confidence: 0.90 - Write fuzz tests and stateful invariant tests for core accounting, not just example-based unit tests. Confidence: 0.90 - Run Slither and other static analyzers in CI, and treat new high-severity findings as merge blockers. Confidence: 0.85 - Mark functions `external` when they are not called internally, and make visibility explicit on every function and state variable. Confidence: 0.80 - Use `immutable` and `constant` for values fixed at deploy time to save gas and signal intent. Confidence: 0.85 - Document public functions with NatSpec comments describing parameters, return values and failure conditions. Confidence: 0.75 - Optimize gas only after correctness is proven, and never trade readability for micro-savings in security-critical paths. Confidence: 0.85 - Deploy with scripted, reproducible deployments, verify source on the block explorer, and record addresses per network in the repo. Confidence: 0.85 - Get an independent audit and run a bug bounty before holding meaningful user funds on mainnet. Confidence: 0.90
Opinionated conventions for clean, reproducible and fast pandas data analysis in Python.
# Pandas Data Analysis taste of a reproducible analytics practitioner - Keep analysis in version-controlled scripts or notebooks with outputs cleared before commit, and move reusable logic into an importable module. Confidence: 0.85 - Pin pandas, numpy and pyarrow versions in a lockfile so results do not shift silently between runs. Confidence: 0.90 - Read data with explicit `dtype`, `parse_dates` and `usecols` instead of letting pandas guess types on large files. Confidence: 0.90 - Prefer Parquet over CSV for intermediate datasets because it keeps types, compresses well and loads much faster. Confidence: 0.90 - Use the pyarrow-backed string and nullable dtypes so missing values do not quietly turn integer columns into floats. Confidence: 0.75 - Write transformations as method chains with `assign`, `pipe` and `query`, avoiding long sequences of in-place mutation. Confidence: 0.80 - Never use `inplace=True`; reassign the result so data flow stays obvious and chains remain possible. Confidence: 0.85 - Select with `.loc` and `.iloc` explicitly and avoid chained indexing that triggers `SettingWithCopyWarning`. Confidence: 0.90 - Vectorize with built-in column operations and `np.where` or `np.select`; reach for `apply` with Python functions only as a last resort. Confidence: 0.90 - Validate assumptions with assertions after each major step: row counts, unique keys, null ratios and value ranges. Confidence: 0.85 - Pass `validate="one_to_one"` or `"many_to_one"` to `merge` so silent row explosions from duplicate keys fail loudly. Confidence: 0.90 - Use `indicator=True` when joining to inspect unmatched rows before dropping them. Confidence: 0.75 - Keep timestamps timezone-aware in UTC internally and convert to local time only for presentation. Confidence: 0.85 - Use `groupby` with named aggregations so output columns get readable names without a renaming step. Confidence: 0.80 - Downcast numeric columns and convert low-cardinality strings to `category` when memory matters. Confidence: 0.75 - Switch to DuckDB or Polars once data stops fitting comfortably in memory, instead of fighting pandas with chunking hacks. Confidence: 0.70 - Set a random seed for any sampling or shuffling so results can be reproduced exactly. Confidence: 0.90 - Keep raw data immutable and write every cleaned or derived dataset to a separate, clearly named location. Confidence: 0.90 - Use snake_case column names, normalized once right after loading. Confidence: 0.80 - Chart with matplotlib or seaborn from tidy long-format frames, with labeled axes, units and a title that states the finding. Confidence: 0.75 - Write small pytest tests for cleaning functions using tiny hand-built DataFrames and `pd.testing.assert_frame_equal`. Confidence: 0.80