Skip to content

Coding Standards

Document ID: IMPL-003
File Path: docs/19-implementation-guide/coding-standards.md
Version: 1.0.0
Status: Draft
Owner: Engineering Team
Last Updated: 2026-06-27


This document defines the coding standards for the Wovyr AI Platform — consistent style, error handling, logging, and testing practices so the codebase stays readable and safe as it grows.


Match the surrounding code. Consistency with the existing module (naming, structure, idioms) outweighs personal preference. New code should read like it was always there.


  • rustfmt is canonical; CI fails on unformatted code.
  • clippy runs with -D warnings — no warnings merged.
  • Dashboard: ESLint + Prettier enforced.

These run in pre-commit hooks and CI (build system).


  • Clear, descriptive names; no abbreviations that obscure intent.
  • One responsibility per module; keep Clean Architecture boundaries — domain logic free of infrastructure types.
  • Public APIs are documented with doc comments and examples.

  • Use Result with typed, descriptive errors (thiserror-style); avoid unwrap/ panic in service code (allowed in tests and truly-unreachable invariants).
  • Map internal errors to the stable API error envelope at the boundary; preserve a correlation request_id.
  • Authorization and verification paths are fail-closed (authorization).

  • Structured, leveled logs per logging standards: events not prose, variables in fields.
  • Never log secrets or raw PII (masking).
  • Include request_id/trace_id for correlation.

Core logic must be deterministic and testable: inject clocks, IDs, and randomness rather than calling them ambiently (unit testing). This is required for workflow replay.


  • Prefer message passing and clear ownership; document shared-state invariants.
  • No blocking calls in async contexts; bound concurrency explicitly.

  • Least privilege everywhere; no ambient credentials.
  • Validate all external input against schemas at boundaries.
  • Treat tool/plugin code as untrusted (isolation).
  • Changes to auth/isolation/crypto require a security review.

Every change ships tests at the appropriate level (testing); bug fixes include a regression test. Coverage gates apply to critical modules.


  • Update specs/ADRs when behavior or design changes (ADRs).
  • Keep public API docs and examples current with the code.


VersionDateDescription
1.0.02026-06-27Initial Coding Standards