Code quality and implementation¶
Phase 5 of 16 in the complete engineering review.
Correctness, readability, contracts, errors, resources, concurrency, dependencies, review, testability, and maintainability.
Assess every control as Pass, Fail, Blocked, or Not Applicable. A Pass needs current evidence for the exact product, revision, artifact, configuration, environment, and data state under review.
Functional Correctness and Business Logic¶
Consolidated from quality standards/05-code-implementation/01-functional-correctness-and-business-logic.md; 18 non-duplicative controls.
Universal controls¶
- USEQ-1A47E1A7 — Every critical journey passes positive, negative, boundary, invalid-input, empty-state, maximum-size, and high-volume tests.
- USEQ-6CEC2D29 — Duplicate submissions, refreshes, retries, browser navigation, and network interruption do not create unintended duplicate effects or corrupt state.
- USEQ-CA554C6A — Race conditions are tested around balances, inventory, permissions, limits, quotas, and state transitions.
- USEQ-C2C592DA — Invalid state-transition ordering is rejected.
- USEQ-FBD441AF — Partial failures cannot leave ambiguous or silently inconsistent results.
- USEQ-4C913037 — Eventually consistent operations expose correct pending, completed, and failed states.
- USEQ-F667636D — Reconciliation detects missing, duplicated, and mismatched records.
- USEQ-24D602A2 — Money uses correct decimal, currency, tax, exchange-rate, and rounding behavior.
- USEQ-814D36E1 — Unicode, normalization, collation, case behavior, and confusable characters do not create duplicates or bypasses.
- USEQ-55D4825F — Limits and quotas are enforced at a trusted server-side boundary.
- USEQ-5FF60A0C — Approval and multi-person authorization workflows cannot be bypassed.
- USEQ-4DE12FD4 — Suspension and termination affect all relevant sessions, tokens, workers, integrations, and cached permissions.
- USEQ-D0B81370 — Long-running operations resume safely or fail clearly.
- USEQ-2136C6A9 — Scheduled jobs handle missed runs, overlap, retry, and duplicate execution.
- USEQ-E608D673 — Background jobs preserve correct user, authorization, and tenant context.
- USEQ-04FA8EC6 — Dead-lettered work can be inspected and replayed safely.
- USEQ-D138E3DB — Support tools cannot create unsupported or impossible states.
- USEQ-A0B1E367 — Error messages provide a safe, actionable next step without exposing sensitive details.
Input Validation, Output Encoding, and Safe Processing¶
Consolidated from quality standards/05-code-implementation/02-input-validation-encoding-and-safe-processing.md; 14 non-duplicative controls.
Universal controls¶
- USEQ-948F079B — All untrusted input sources are identified.
- USEQ-7C5F1359 — Input is validated for type, syntax, range, length, structure, and allowed values.
- USEQ-4E8F864C — Canonicalization and normalization occur before security-sensitive comparison.
- USEQ-EC27C7B3 — Allowlists are used where a finite valid set exists.
- USEQ-3A437981 — Operating-system commands are not constructed from untrusted input.
- USEQ-4E590049 — Directory, query, search, template, expression, mail, logging, and interpreter contexts use safe APIs.
- USEQ-D96C2840 — Rich text or markup is sanitized with an appropriate maintained sanitizer.
- USEQ-1A1943A0 — Unsafe deserialization is avoided; expected types and structures are bounded.
- USEQ-94B4DD17 — XML processing disables unnecessary external entities and resources.
- USEQ-F5787145 — Path traversal, archive traversal, symbolic-link abuse, and filesystem races are prevented or controlled.
- USEQ-7008ECFF — Server-side request-forgery protections constrain protocol, destination, redirects, DNS resolution, and metadata endpoints.
- USEQ-032834EB — Header, response-splitting, log, CSV/formula, and email injection are addressed.
- USEQ-B50A09FA — Object and property injection through automatic binding or merging is addressed.
- USEQ-8E9BA9B9 — Unicode confusables and normalization cannot bypass validation or identity checks.
Maintainability and Long-Term Operability¶
Consolidated from quality standards/05-code-implementation/03-maintainability-and-long-term-operability.md; 14 non-duplicative controls.
Universal controls¶
- USEQ-FDCA6C71 — A current operating entry point or README exists.
- USEQ-F564C015 — Architecture, data flow, dependencies, deployment, recovery, and local setup are documented.
- USEQ-AB553CE4 — Build, test, migration, deployment, and troubleshooting commands are documented.
- USEQ-F1784541 — Coding, review, testing, security, release, and support conventions are documented.
- USEQ-7CBEA80E — Critical code and systems have appropriate maintainers.
- USEQ-3FF4CC5B — Complexity, coupling, and operational burden are reviewed.
- USEQ-B6E04832 — Dead code, obsolete paths, stale flags, and unsupported compatibility layers are removed.
- USEQ-6EF014F9 — Runtime, platform, protocol, certificate, and dependency end-of-support dates are tracked.
- USEQ-2B9BF81E — Technical debt affecting reliability, security, privacy, accessibility, or operability is recorded.
- USEQ-BBB6533E — API, data, feature, and client deprecation policies exist.
- USEQ-FA1B43F8 — Support personnel are trained on released behavior.
- USEQ-967C2427 — Known issues and limitations are communicated accurately.
- USEQ-F534424C — Maintenance windows and communications are defined.
- USEQ-51159B9E — Decommissioning, end-of-service export, retention, archival, and secure deletion have documented plans.
Universal Code Quality¶
Consolidated from quality standards/05-code-implementation/04-universal-code-quality.md; 22 non-duplicative controls.
Category-specific universal rules¶
- USEQ-8FA820FA — Make code behavior satisfy explicit requirements and preserve documented invariants.
- USEQ-6992FD80 — Choose representations, algorithms, and control flow that make correctness apparent.
- USEQ-5D133AD0 — Keep units small enough to understand while preserving cohesive behavior.
- USEQ-D34491E9 — Use clear names that reflect domain meaning, units, ownership, and side effects.
- USEQ-C7003C4F — Prefer explicit data flow, dependencies, state transitions, and error paths.
- USEQ-3AB6A8DF — Avoid surprising implicit conversion, mutation, global state, order dependence, and hidden I/O.
- USEQ-AE80C3B2 — Validate untrusted input at trust boundaries and preserve validated types internally.
- USEQ-1248940A — Keep authorization, privacy, safety, and business rules in enforceable trusted locations.
- USEQ-166192E3 — Handle every resource, transaction, lock, stream, handle, and subscription through a defined lifecycle.
- USEQ-1D7ED71D — Use abstractions only when they reduce total understanding and change cost.
- USEQ-0CC65394 — Keep comments focused on intent, constraints, trade-offs, and non-obvious reasons rather than restating syntax.
- USEQ-B6439E9E — Delete unreachable, obsolete, duplicated, debug, and commented-out code.
- USEQ-660F0A5E — Treat warnings, static-analysis findings, and undefined behavior according to an explicit policy.
- USEQ-2C162579 — Make exceptional and degraded behavior deliberate rather than accidental fall-through.
- USEQ-5BA83821 — Use deterministic behavior where nondeterminism is not required.
- USEQ-476447F8 — Avoid unbounded recursion, allocation, concurrency, retries, queues, and input size.
- USEQ-B80088F6 — Make important behavior observable without logging secrets or sensitive data.
- USEQ-509CC760 — Keep code reviewable through focused changes and stable formatting.
- USEQ-F5EA5C82 — Refactor when structure obscures correctness, but verify behavior before and after change.
- USEQ-22CB2FA4 — Do not optimize without evidence; do not ignore known high-impact inefficiency.
Category no-go conditions¶
- USEQ-E95604AB — Undefined or implementation-dependent behavior can affect critical correctness.
- USEQ-E66B032D — Critical logic cannot be explained, reviewed, or tested by another qualified engineer.
Readability, Naming, and Style¶
Consolidated from quality standards/05-code-implementation/05-readability-naming-and-style.md; 20 non-duplicative controls.
Category-specific universal rules¶
- USEQ-DAF77C8F — Use a consistent machine-enforced style so review focuses on behavior and design.
- USEQ-9AF5256A — Name concepts using the ubiquitous domain vocabulary agreed with stakeholders.
- USEQ-51F9CDC3 — Name booleans and predicates so truth meaning is unambiguous.
- USEQ-73138957 — Include units, time basis, currency, encoding, and coordinate system where confusion is plausible.
- USEQ-63B6EFE7 — Distinguish identifiers, display labels, secrets, tokens, user input, and trusted values through naming and types.
- USEQ-0A590DC8 — Avoid abbreviations unless they are standard and unambiguous in the relevant domain.
- USEQ-AA3301B8 — Avoid misleading legacy names when behavior has changed.
- USEQ-DC209C03 — Keep related logic physically and conceptually close.
- USEQ-A69D553C — Order code to reveal the normal flow before exceptional detail where practical.
- USEQ-403F240B — Use early returns or structured decomposition to limit unnecessary nesting.
- USEQ-1B3ECB70 — Avoid dense expressions that hide evaluation order, side effects, or error handling.
- USEQ-4697DF3E — Replace unexplained literals with named domain concepts when meaning is not obvious.
- USEQ-E621FB99 — Use comments to explain why constraints exist, including external quirks and security assumptions.
- USEQ-1729029B — Keep documentation synchronized with behavior or remove misleading documentation.
- USEQ-084F8B56 — Write error messages that identify context and action without leaking sensitive information.
- USEQ-79C6A5E7 — Use consistent terminology across code, schemas, APIs, UI, logs, tests, and documentation.
- USEQ-9914FF54 — Make public contracts readable without requiring knowledge of internal implementation.
- USEQ-F8A9898C — Use examples for complex contracts and edge semantics.
- USEQ-CD3455A4 — Prefer clarity over cleverness, novelty, terseness, or stylistic performance.
- USEQ-E67B4E95 — Review readability from the perspective of a competent maintainer unfamiliar with the change.
Abstractions, Interfaces, and Contracts¶
Consolidated from quality standards/05-code-implementation/06-abstractions-interfaces-and-contracts.md; 20 non-duplicative controls.
Category-specific universal rules¶
- USEQ-F39FA898 — Abstract stable domain meaning rather than superficial syntax similarity.
- USEQ-C484D3B0 — Define each public contract's purpose, inputs, outputs, errors, side effects, timing, ordering, ownership, and security expectations.
- USEQ-4EDDA552 — State preconditions, postconditions, invariants, and exceptional behavior.
- USEQ-84D5B294 — Keep contracts smaller than implementations and free from unnecessary implementation detail.
- USEQ-85DDD1B8 — Hide representation so it can evolve without changing consumers.
- USEQ-6F3283A1 — Use types or schemas that make invalid states difficult or impossible to represent.
- USEQ-51A3C767 — Avoid boolean flags and parameter combinations whose semantics are unclear.
- USEQ-82F98FD7 — Prefer cohesive parameter objects or explicit variants when arguments must change together.
- USEQ-04B47B17 — Prevent null, missing, sentinel, and optional values from carrying multiple ambiguous meanings.
- USEQ-66DD52CA — Make mutability and ownership explicit.
- USEQ-781C734B — Do not expose writable internal collections or mutable references unintentionally.
- USEQ-48E6F214 — Keep interface segregation aligned to consumer needs.
- USEQ-BF0669D4 — Provide stable error categories rather than forcing consumers to parse text.
- USEQ-1C9AF441 — Define compatibility and versioning before publishing a contract outside one change boundary.
- USEQ-12574552 — Test contracts independently from implementations and across every substitute.
- USEQ-47C5760F — Avoid wrapping every dependency when no policy, isolation, testability, or evolution benefit exists.
- USEQ-D0944F6C — Avoid generic abstractions that erase meaningful constraints.
- USEQ-73588D8A — Document performance and resource characteristics when consumers can depend on them.
- USEQ-38607061 — Define cancellation, timeout, retry, and idempotency semantics for remote or long-running contracts.
- USEQ-A1CE1F63 — Retire obsolete interfaces through monitored migration rather than indefinite parallel support.
Error Handling and Defensive Programming¶
Consolidated from quality standards/05-code-implementation/07-error-handling-and-defensive-programming.md; 22 non-duplicative controls.
Category-specific universal rules¶
- USEQ-0903254E — Define an error taxonomy that distinguishes validation, conflict, authorization, not-found, dependency, resource, timeout, cancellation, integrity, and internal failures.
- USEQ-DA42055F — Detect errors as close as practical to their source while handling them at the layer that has recovery context.
- USEQ-CD710602 — Do not ignore, overwrite, convert to success, or silently log-and-continue after an error that invalidates the operation.
- USEQ-50C6FF56 — Preserve causal context while redacting secrets and sensitive data.
- USEQ-208AD931 — Use structured error values rather than parsing human-readable strings.
- USEQ-8F5AF188 — Translate errors at boundaries without losing retryability, severity, and causal identity.
- USEQ-50874EC8 — Fail closed for authorization, identity, privacy, safety, and integrity controls.
- USEQ-F69CB29C — Avoid broad catch-all handling that masks programming defects or corrupt state.
- USEQ-60CEF31B — Ensure cleanup, rollback, lock release, and cancellation occur on every exit path.
- USEQ-13405F0D — Make retries explicit, bounded, delayed, and safe for the operation.
- USEQ-CF15A8BE — Separate user-facing guidance from diagnostic detail.
- USEQ-0E8AFB14 — Avoid exposing internal paths, queries, stack traces, keys, topology, or tenant information.
- USEQ-F07D674E — Treat assertion and invariant failures as defects requiring investigation, not routine user errors.
- USEQ-3B20FCE0 — Validate external assumptions and provider responses before use.
- USEQ-0C9AFBF3 — Use defensive copies or immutable values when callers could corrupt shared state.
- USEQ-BACFAF4F — Bound input, recursion, allocation, loops, retries, and concurrency against resource exhaustion.
- USEQ-AA460D26 — Define safe fallback and degraded behavior before failures occur.
- USEQ-F2F9031A — Make partial success explicit and reconcilable.
- USEQ-A45DF449 — Test error injection at every material dependency and state transition.
- USEQ-718A1C3D — Monitor unexpected error classes and repeated recoveries as signals of systemic defects.
Category no-go conditions¶
- USEQ-F5CCDCCC — A critical operation can report success after losing, duplicating, corrupting, or failing to authorize its effect.
- USEQ-A1DBD310 — Errors can leave security or business invariants silently violated.
Resource Lifecycle, Memory, and Cleanup¶
Consolidated from quality standards/05-code-implementation/08-resource-lifecycle-memory-and-cleanup.md; 20 non-duplicative controls.
Category-specific universal rules¶
- USEQ-A3BE3A81 — Identify every finite resource used by the code, including memory, files, sockets, connections, threads, tasks, locks, handles, subscriptions, and temporary storage.
- USEQ-0836A8FC — Make resource ownership and transfer explicit.
- USEQ-00041688 — Acquire resources as late as practical and release them as early as safe.
- USEQ-FEF94073 — Use structured lifetime mechanisms so cleanup occurs on success, error, cancellation, and timeout.
- USEQ-1AF33210 — Prevent double release, use-after-release, dangling references, and ownership ambiguity.
- USEQ-12D8A914 — Bound pools, queues, buffers, caches, batches, and concurrency.
- USEQ-7233DE8D — Set timeouts and cancellation for operations that can wait indefinitely.
- USEQ-743D7427 — Avoid holding scarce resources across user input, network calls, or long computation without justification.
- USEQ-4204983E — Size pools from measured demand and downstream capacity rather than arbitrary defaults.
- USEQ-C16F962C — Prevent pool exhaustion from causing uncontrolled retry or cascading failure.
- USEQ-353D14C8 — Clean temporary, orphaned, expired, and abandoned resources reliably.
- USEQ-21DBD1D6 — Handle partial acquisition by releasing already-acquired resources.
- USEQ-4A482940 — Avoid unbounded object retention through listeners, closures, caches, registries, or diagnostic context.
- USEQ-3A5B2F4F — Measure memory, allocation, handle, connection, and thread behavior under sustained load.
- USEQ-3E450704 — Test resource exhaustion and recovery.
- USEQ-EB0A5E6E — Make spill, eviction, rejection, and load-shedding behavior explicit.
- USEQ-E9F27341 — Protect shared resources from noisy neighbors.
- USEQ-24A3BDC9 — Avoid performing cleanup that can delete another operation's or tenant's resources.
- USEQ-13140E4F — Make resource limits configurable, validated, documented, and observable.
- USEQ-1A94D768 — Verify that shutdown drains, transfers, persists, or safely abandons in-flight work.
Concurrent, Asynchronous, and Parallel Code¶
Consolidated from quality standards/05-code-implementation/09-concurrent-asynchronous-and-parallel-code.md; 20 non-duplicative controls.
Category-specific universal rules¶
- USEQ-D1B25825 — Use concurrency only where it provides required responsiveness, throughput, isolation, or latency benefit.
- USEQ-D464A4C5 — Define which state is shared, immutable, thread-confined, message-owned, or synchronized.
- USEQ-0C811996 — Prefer ownership transfer and immutability over shared mutation.
- USEQ-8D0CC00B — Protect every shared invariant with a coherent synchronization strategy.
- USEQ-EDE64E87 — Avoid blocking operations on event loops, cooperative schedulers, or latency-critical threads.
- USEQ-6944D6B8 — Bound task creation, fan-out, parallelism, queues, and in-flight work.
- USEQ-6BCF0D32 — Propagate cancellation, deadlines, tenant context, identity, trace context, and request scope correctly.
- USEQ-9136B800 — Do not detach background work without ownership, error handling, lifecycle, and shutdown behavior.
- USEQ-2854EA57 — Define ordering and completion semantics explicitly.
- USEQ-38212874 — Prevent races between timeout, cancellation, completion, retry, and cleanup.
- USEQ-1AC46AF9 — Avoid holding locks while invoking untrusted, remote, or reentrant code.
- USEQ-B3FAEE44 — Use lock ordering or lock-free designs deliberately to prevent deadlock.
- USEQ-A5FFFB7A — Protect against starvation, livelock, priority inversion, and unfair scheduling.
- USEQ-8EF6EF5A — Make async errors observable and attributable to the initiating work.
- USEQ-41B0B0C5 — Preserve idempotency when work can be retried or duplicated.
- USEQ-B4C195BA — Test under randomized scheduling, high contention, slow dependencies, cancellation, and shutdown.
- USEQ-4C15F6BF — Use race detectors, deterministic schedulers, model checking, or stress tools where available and appropriate.
- USEQ-4D867D6C — Document memory visibility and consistency assumptions where the execution model requires it.
- USEQ-272FFC6D — Treat nondeterministic test failures as defects rather than normal noise.
- USEQ-95839798 — Verify that parallel execution does not violate rate, quota, ordering, or downstream capacity limits.
Configuration and Feature-Flag Code Quality¶
Consolidated from quality standards/05-code-implementation/10-configuration-and-feature-flag-code-quality.md; 20 non-duplicative controls.
Category-specific universal rules¶
- USEQ-2C7B2D29 — Define a schema, type, allowed range, default, sensitivity, owner, and description for every configuration value.
- USEQ-88C70738 — Validate all configuration before serving work and fail safely on invalid critical values.
- USEQ-3AE6779A — Make precedence across defaults, files, environment, remote sources, and command-line input explicit.
- USEQ-B0283141 — Avoid configuration values whose meaning changes by undocumented convention.
- USEQ-EEC9584F — Do not store secrets in ordinary configuration or expose them through diagnostics.
- USEQ-26B1A7AC — Separate environment identity from behavior and avoid environment-name conditionals scattered through code.
- USEQ-C0A2F9FB — Version configuration with the release or maintain equivalent auditable traceability.
- USEQ-98F39A05 — Make dynamic configuration updates atomic, observable, authorized, and reversible.
- USEQ-81C2964A — Define stale-cache, unavailable-source, and partial-update behavior.
- USEQ-F3EE8B38 — Treat flags as temporary lifecycle-managed code with owner, purpose, default, scope, creation date, and removal date.
- USEQ-340326EC — Test both flag states and material combinations before exposure.
- USEQ-CC9C98B9 — Use safe defaults when flag evaluation fails.
- USEQ-985ADD85 — Restrict and audit high-impact flag changes.
- USEQ-27A8638E — Avoid nested flags and flag interactions that create untestable state spaces.
- USEQ-6D9F904A — Remove completed rollout flags and dead branches promptly.
- USEQ-7FF8A889 — Do not use flags as permanent authorization, pricing, compliance, or data-isolation mechanisms without appropriate governance.
- USEQ-BB0F7387 — Ensure configuration changes cannot bypass validation, deployment controls, or segregation of duties.
- USEQ-C5D04742 — Redact sensitive values from logs, UIs, metrics, and support tools.
- USEQ-6A2615C9 — Provide configuration drift detection and reconstruction.
- USEQ-555D7538 — Include configuration in incident, rollback, and reproducibility evidence.
Dependency Selection and Hygiene¶
Consolidated from quality standards/05-code-implementation/11-dependency-selection-and-hygiene.md; 20 non-duplicative controls.
Category-specific universal rules¶
- USEQ-D0D3A457 — Add a dependency only when its total lifecycle benefit exceeds implementing or avoiding the capability.
- USEQ-AA278192 — Evaluate maintainer identity, release history, support, security practice, community health, documentation, and abandonment risk.
- USEQ-184D1160 — Use trusted sources and verify package identity, namespace, signature, hash, or provenance as available.
- USEQ-71972C15 — Pin versions or constraints tightly enough to prevent unreviewed substitution.
- USEQ-2FA33CEA — Record direct and transitive dependencies in a machine-readable inventory.
- USEQ-D4E7F5C7 — Separate build, development, optional, and runtime dependencies.
- USEQ-D49F7FE4 — Minimize privileged, networked, native, dynamically loaded, or executable dependencies.
- USEQ-DD00A1EA — Review license, notice, patent, redistribution, and source-disclosure obligations before use.
- USEQ-3EC4C6D1 — Avoid multiple libraries providing the same capability without a justified migration plan.
- USEQ-B894A653 — Wrap volatile or high-risk dependencies behind a policy boundary when replacement or containment is valuable.
- USEQ-CB6E238D — Do not rely on undocumented behavior or private interfaces.
- USEQ-EA32C05E — Test supported versions and upgrade paths.
- USEQ-B09FE69D — Automate updates while preserving review, test, provenance, and rollback gates.
- USEQ-9A64DA9A — Monitor newly disclosed vulnerabilities and compromised releases after deployment.
- USEQ-6A7D79B1 — Prioritize remediation by exploitability, reachability, exposure, impact, and controls.
- USEQ-02FECB7F — Remove unused, abandoned, end-of-life, and superseded dependencies.
- USEQ-55D2754E — Maintain an emergency process to revoke, replace, rebuild, and redeploy a compromised dependency.
- USEQ-F0B1DD9F — Track local patches and forks with ownership and upstream strategy.
- USEQ-4559EED5 — Prevent dependency confusion, typosquatting, namespace collision, and untrusted install scripts.
- USEQ-696A7B67 — Verify the final artifact contains only intended dependency content.
Refactoring and Legacy Code¶
Consolidated from quality standards/05-code-implementation/12-refactoring-and-legacy-code.md; 20 non-duplicative controls.
Category-specific universal rules¶
- USEQ-9B50CC48 — Define the problem, desired quality improvement, boundaries, risks, and measurable completion criteria.
- USEQ-E52095B1 — Establish characterization tests or other evidence for current required behavior before structural change.
- USEQ-9D7728A6 — Distinguish required behavior from defects, accidental quirks, and obsolete compatibility.
- USEQ-7B68CEDF — Use small, reviewable, reversible steps with continuous verification.
- USEQ-B9589547 — Avoid mixing broad behavior change, dependency upgrade, migration, and refactoring without a clear reason.
- USEQ-48D1C437 — Preserve public contracts or provide a controlled migration.
- USEQ-7E07C9BB — Add seams around tightly coupled or untestable areas before changing internals.
- USEQ-3AC09F62 — Use parallel run, shadow comparison, dual read, or reconciliation where behavior equivalence is difficult to prove.
- USEQ-E9BADF4B — Measure defect rate, change lead time, complexity, performance, and operational burden before and after.
- USEQ-6CD08E3B — Remove dead paths, compatibility shims, stale flags, and old data only after consumers have migrated.
- USEQ-BED93E1D — Keep data migrations resumable and auditable.
- USEQ-57C309A4 — Do not translate code mechanically into a new language or framework without reconsidering domain boundaries and failure semantics.
- USEQ-B3207962 — Prioritize high-interest debt that creates recurring incidents, vulnerability, delay, or inability to change.
- USEQ-F763C13B — Stop modernization that expands scope without reducing the target risk or cost.
- USEQ-89E1A165 — Preserve historical decision context and document new constraints.
- USEQ-2C1D6F3B — Verify rollback or safe roll-forward at each migration stage.
- USEQ-DA219C26 — Avoid permanent dual systems without an owner and exit date.
- USEQ-DEE55F32 — Include operators, support, security, data, and users in modernization impact review.
- USEQ-07A0BBCB — Treat unexplained legacy behavior as an investigation target, not permission to break it.
- USEQ-354B29AD — Retire obsolete infrastructure, credentials, data, and suppliers after migration completes.
Code Review and Work-Product Review¶
Consolidated from quality standards/05-code-implementation/13-code-review-and-work-product-review.md; 20 non-duplicative controls.
Category-specific universal rules¶
- USEQ-04CD3D8D — Define review objectives, required reviewers, independence, evidence, and approval rules according to risk.
- USEQ-8B82476F — Keep changes small and focused enough for reliable human review.
- USEQ-39D96811 — Provide context, requirement links, design rationale, risk, test evidence, migration, rollout, and rollback information.
- USEQ-8C7532C7 — Review behavior and consequences rather than formatting already enforced by tools.
- USEQ-9E82B4E8 — Verify requirements, invariants, authorization, validation, error handling, concurrency, data, and operational behavior.
- USEQ-561E2A9E — Examine deleted and generated content as well as added lines.
- USEQ-6FF0CECF — Check whether tests can fail for the defect they claim to detect.
- USEQ-3FEE7961 — Challenge assumptions, edge cases, misuse, partial failure, and recovery.
- USEQ-5143F148 — Use specialists for security, privacy, accessibility, data, cryptography, performance, or safety-sensitive changes.
- USEQ-02E7213F — Prevent authors from approving their own material changes.
- USEQ-235B0220 — Resolve review comments explicitly; do not dismiss findings through status changes without rationale.
- USEQ-D61F1909 — Distinguish blocking defects, required follow-up, questions, and optional suggestions.
- USEQ-2BA69F57 — Re-review materially changed code after approval.
- USEQ-7DB8FB57 — Record exceptional bypasses and perform prompt retrospective review.
- USEQ-42214EC2 — Use checklists as memory aids, not substitutes for understanding.
- USEQ-683FB10E — Avoid review overload, rubber-stamping, and excessive queues through ownership and change sizing.
- USEQ-A87A04F3 — Measure escapes and review effectiveness rather than comment count or review speed alone.
- USEQ-58E7D957 — Create automated rules from recurring objective review findings.
- USEQ-7A2E33C3 — Maintain respectful, specific, evidence-based review communication.
- USEQ-CA466120 — Verify the merged artifact and configuration still match the reviewed change.
Testability¶
Consolidated from quality standards/05-code-implementation/14-testability.md; 20 non-duplicative controls.
Category-specific universal rules¶
- USEQ-839B5A77 — Separate pure decision logic from I/O, time, randomness, process state, and external dependencies where practical.
- USEQ-28C12031 — Inject or otherwise control clocks, randomness, identifiers, schedulers, and external boundaries.
- USEQ-792699A0 — Expose behavior through stable public contracts rather than test-only access to internals.
- USEQ-0880766A — Make important state transitions and outcomes observable without exposing sensitive data.
- USEQ-4FD13567 — Support deterministic setup, execution, teardown, and repeatable seeds.
- USEQ-E384EC6B — Avoid hidden globals, ambient singletons, static caches, and order-dependent initialization.
- USEQ-0D13F05F — Design dependency boundaries that can be replaced by faithful fakes, simulators, or contract-tested test doubles.
- USEQ-1117639C — Keep test doubles behaviorally constrained so they do not create false confidence.
- USEQ-BAE66E14 — Provide safe test hooks only when production security and integrity cannot be weakened.
- USEQ-2C8EA20F — Make data creation concise, valid by default, and capable of expressing edge states.
- USEQ-B3264D1A — Allow failure, timeout, cancellation, retry, and partial-response injection at material boundaries.
- USEQ-7E74EFCD — Make asynchronous completion, queues, and eventual consistency waitable by state rather than arbitrary delay.
- USEQ-7F30BB3A — Provide stable identifiers and correlation for cross-component verification.
- USEQ-10B21BF1 — Keep units cohesive enough that failures localize the cause.
- USEQ-2EF78BB9 — Avoid nondeterministic concurrency and network dependence in lower-level tests.
- USEQ-430CE5AC — Design migrations and background jobs to support dry run, checkpoint, and reconciliation.
- USEQ-12F0CBBD — Expose health and diagnostic signals suitable for production-safe verification.
- USEQ-AC43E131 — Ensure tests can distinguish absence of work from successful completion.
- USEQ-7330C584 — Measure test setup complexity and time as design feedback.
- USEQ-36AB1DA6 — Refactor production design when testing requires excessive private knowledge or brittle global setup.
Reusability in Code¶
Consolidated from quality standards/05-code-implementation/15-reusability-in-code.md; 20 non-duplicative controls.
Category-specific universal rules¶
- USEQ-B338A49B — Extract reuse only when multiple consumers share stable semantics and change drivers.
- USEQ-A31D6133 — Keep reusable units cohesive and independent of consumer-specific workflow.
- USEQ-BD0179D8 — Define explicit inputs, outputs, errors, side effects, resource ownership, and extension points.
- USEQ-DEA324DE — Use configuration for genuine variation, not to combine incompatible responsibilities.
- USEQ-AD85128A — Provide safe defaults and prevent invalid configuration combinations.
- USEQ-288CCD01 — Avoid leaking one consumer's terminology, permissions, tenant context, or data into the shared contract.
- USEQ-457E0384 — Keep dependencies minimal and visible.
- USEQ-25CA518A — Version and document compatibility commitments.
- USEQ-4B011C6E — Provide examples for ordinary use and guidance for unsupported use.
- USEQ-0845C21B — Test each supported context and representative integration.
- USEQ-BEC9299D — Track consumers and communicate security fixes, deprecations, and breaking changes.
- USEQ-B704594F — Avoid global utility modules without ownership or domain boundaries.
- USEQ-F32FF3B0 — Prefer local duplication over a shared abstraction that causes coordinated change across unrelated products.
- USEQ-1E288863 — Measure whether reuse reduces total defects, effort, and inconsistency after maintenance cost.
- USEQ-D15F66C8 — Provide a clear path to fork or replace when shared governance no longer serves consumers.
- USEQ-41D3FA73 — Retire unused exports and variants.
- USEQ-459360CC — Keep reusable security and validation functions context-aware rather than universally permissive.
- USEQ-EFD9E266 — Do not expose internal implementation merely to make reuse convenient.
- USEQ-5E19F6A1 — Avoid inheritance or mixins that create hidden coupling and fragile override behavior.
- USEQ-E2E29325 — Treat reuse as a product with ownership, support, documentation, and lifecycle.
Universal Code Quality, Design, and Implementation Master Checklist¶
Consolidated from gap supplement/02-universal-code-quality-design-and-implementation.md; 205 non-duplicative controls.
Expanded gap-closure controls¶
How to apply engineering principles without dogma¶
- USEQ-B3C67404 — Treat correctness, security, privacy, safety, accessibility, and recoverability as constraints; optimize elegance, reuse, and brevity only within those constraints.
- USEQ-53A25470 — Use SOLID, DRY, KISS, YAGNI, separation of concerns, information hiding, composition, immutability, and related principles as context-sensitive heuristics rather than unconditional laws.
- USEQ-60CC7E5A — Document the quality attribute or change scenario that justifies a nontrivial abstraction, pattern, layer, cache, concurrency mechanism, framework, or generated solution.
- USEQ-21B58F87 — Prefer the simplest design that satisfies current evidenced requirements and known near-term constraints without closing necessary evolution paths.
- USEQ-E17453CC — Do not invoke YAGNI to omit a known requirement, required control, migration path, operability need, or foreseeable high-impact failure treatment.
- USEQ-41F7BE92 — Do not invoke DRY to merge coincidentally similar concepts that have different reasons to change, ownership, lifecycle, authorization, or semantics.
- USEQ-0124C8F5 — Do not preserve duplication when repeated defects or synchronized changes show that one authoritative abstraction is warranted.
- USEQ-B89A1447 — Do not invoke SOLID to create an excessive number of indirections, interfaces, containers, files, services, or extension points that increase total cognitive load.
- USEQ-08D5F342 — Do not optimize for minimum line count; optimize for clear intent, correct behavior, safe change, and total lifecycle cost.
- USEQ-9887E01F — Choose consistency with the codebase when alternatives are equivalent, but change an established convention when evidence shows it causes defects or unacceptable cost.
- USEQ-E0F101C2 — Make trade-offs explicit when a principle conflicts with latency, memory, safety, compatibility, auditability, or simplicity.
- USEQ-D18F9478 — Review principles at system boundaries and data flows, not only within individual functions or classes.
Specifications, contracts, invariants, and correctness¶
- USEQ-A191CD19 — Express externally observable behavior as testable preconditions, postconditions, invariants, state transitions, error outcomes, timing expectations, and side-effect guarantees.
- USEQ-9072DA14 — Identify which invariants are enforced by types, schemas, constructors, validation, storage constraints, transactions, authorization, tests, monitoring, or manual process.
- USEQ-76DF8B5A — Represent invalid states as unconstructable or immediately rejected where practical.
- USEQ-6DAA216C — Keep domain rules independent from presentation, transport, persistence, and vendor details unless coupling is inherent to the requirement.
- USEQ-B01D50C5 — Make units, coordinate systems, currencies, time zones, precision, encoding, normalization, and ordering explicit in names and contracts.
- USEQ-076FF26C — Specify behavior for zero, empty, missing, duplicate, stale, maximum, minimum, overflow, underflow, malformed, unauthorized, concurrent, canceled, and partially completed inputs.
- USEQ-C6B6695E — Define equality, identity, uniqueness, ordering, hashing, comparison, and canonicalization consistently for domain values.
- USEQ-B39802DF — Use one authoritative rule for each business invariant and ensure every entry point reaches it.
- USEQ-F46D430E — Ensure a successful result means the complete promised effect occurred or a clearly modeled pending state was created.
- USEQ-3305DCE8 — Ensure failure cannot be mistaken for success through default values, swallowed errors, partial writes, stale caches, or ambiguous status.
- USEQ-C3DFBAB2 — Verify critical calculations with an independent oracle, reconciliation, property, model, or second implementation where consequence warrants it.
- USEQ-1E0653D0 — Make assumptions about external systems executable through contract tests, runtime validation, or monitored assertions.
- USEQ-75B210AD — Use assertions for internal impossible states and diagnostics, not as the sole validation of untrusted input or security policy.
- USEQ-92DFE757 — Define deterministic conflict resolution when multiple valid updates, versions, or sources can disagree.
- USEQ-44BCDEC5 — Preserve invariants across retries, replay, rollback, restoration, migration, mixed versions, and disaster recovery.
Boundaries, modularity, coupling, and ownership¶
- USEQ-611FF9D1 — Align module boundaries with cohesive capabilities, data ownership, trust boundaries, scaling needs, and independent reasons to change.
- USEQ-2500EBD9 — Keep dependency direction consistent with architectural policy and make forbidden dependencies mechanically detectable where practical.
- USEQ-3E378FD4 — Prevent internal representation, storage schema, framework types, transport objects, and vendor models from leaking across boundaries without an intentional contract.
- USEQ-D6F735CA — Minimize the number of modules that can mutate a given state or enforce a given invariant.
- USEQ-5F91F410 — Give every public module, service, package, component, data set, and interface an owner and lifecycle policy.
- USEQ-FD78B783 — Keep boundary contracts smaller and more stable than internal implementations.
- USEQ-EE97AF92 — Avoid cyclic dependencies; when a cycle is unavoidable, document the shared invariant and why extraction would be worse.
- USEQ-65E57265 — Prefer explicit dependency injection or parameterization over hidden service location, ambient globals, import-time side effects, or implicit thread context.
- USEQ-8265FFBB — Separate policy from mechanism and pure decision logic from effectful execution where that improves verification and reuse.
- USEQ-AC6193E0 — Co-locate behavior with the data and invariants it owns unless doing so creates a stronger boundary violation.
- USEQ-197BE325 — Prevent shared utility areas from becoming unowned collections of unrelated behavior.
- USEQ-F826255C — Track fan-in, fan-out, change coupling, dependency depth, and cross-boundary change frequency for high-risk components.
- USEQ-5F8E12FC — Test boundaries independently and through representative integration paths.
- USEQ-5B7AE895 — Keep failure containment boundaries aligned with ownership and operational recovery.
Abstraction, reuse, and duplication¶
- USEQ-DCB9C605 — Abstract after understanding the stable common concept, not merely after observing matching syntax.
- USEQ-9A07F40A — Require shared abstractions to have a clear semantic contract, owner, versioning policy, compatibility policy, and consumer tests.
- USEQ-5E68F12C — Prefer composition of small capabilities over inheritance or extension hierarchies that expose fragile implementation details.
- USEQ-2D91D43D — Keep extension points narrow, explicit, permission-aware, and bounded by real use cases.
- USEQ-4A1FF0C9 — Avoid speculative genericity, configuration surfaces, plugin mechanisms, and type parameters without demonstrated consumers.
- USEQ-69AF721B — Duplicate small, volatile code temporarily when sharing would couple independent domains; record the decision if material.
- USEQ-3A790373 — Centralize security-sensitive validation, authorization, cryptographic use, privacy rules, and dangerous operations where divergence would create risk.
- USEQ-6E130389 — Do not hide fundamentally different latency, failure, transaction, ownership, or consistency semantics behind one misleading interface.
- USEQ-69283C1D — Make reusable components safe by default and difficult to use incorrectly.
- USEQ-4BBEF611 — Document thread safety, reentrancy, ownership, lifecycle, mutability, blocking behavior, side effects, and error semantics for reusable units.
- USEQ-309520B0 — Test reusable components against multiple representative consumers rather than only their original use case.
- USEQ-ACE422A4 — Version shared components conservatively and provide migration support for breaking changes.
- USEQ-FB8D2947 — Measure reuse by reduced total change and defect cost, not by the number of consumers or abstraction layers.
- USEQ-22929EAB — Delete unused generality and retire abstractions whose maintenance cost exceeds their value.
Naming, readability, and cognitive load¶
- USEQ-A9C943F1 — Use domain language consistently and maintain a glossary for terms whose meaning is not obvious or is contested.
- USEQ-747F50E2 — Name values and operations by meaning and effect rather than storage type, implementation mechanism, or historical accident.
- USEQ-182734ED — Include units, scope, state, direction, or security sensitivity in names when omission can cause misuse.
- USEQ-DEF452E6 — Avoid negated, ambiguous, overloaded, misleading, joke, temporary, and context-dependent names.
- USEQ-18FF61DA — Keep one level of abstraction within a unit of code when practical and extract detail that obscures the primary intent.
- USEQ-2C7F27CA — Use early validation or guard structure when it reduces nesting without hiding cleanup or transactional behavior.
- USEQ-6F203597 — Keep control flow explicit enough that all exits, retries, cancellations, side effects, and error paths can be reviewed.
- USEQ-14DC38B4 — Prefer readable intermediate values over compressed expressions when they expose assumptions or aid diagnostics.
- USEQ-3EDFCA38 — Keep comments synchronized with behavior and remove comments that merely repeat syntax or preserve obsolete history.
- USEQ-D4930961 — Explain why a surprising constraint, workaround, algorithm, threshold, ordering, security control, or compatibility behavior exists.
- USEQ-4446A52B — Reference decision records or issue identifiers for temporary workarounds and include removal conditions.
- USEQ-0E8F2EB1 — Apply stable automated formatting so reviews focus on behavior rather than style churn.
- USEQ-AF70F539 — Keep changes focused; separate mechanical refactoring, generated output, dependency updates, and behavior changes when doing so improves review confidence.
- USEQ-60313694 — Ensure another qualified engineer can explain critical code, failure behavior, and invariants without consulting the original author.
State, effects, time, and determinism¶
- USEQ-86ACCDA1 — Minimize mutable shared state and make the owner, lifetime, synchronization, and persistence of every material state explicit.
- USEQ-2D7758AD — Distinguish source-of-truth state, derived state, cached state, transient workflow state, and presentation state.
- USEQ-D200CC6D — Derive values instead of storing duplicates when derivation is reliable and affordable.
- USEQ-D30F8D53 — When duplicated state is necessary, define synchronization, reconciliation, invalidation, conflict, and repair behavior.
- USEQ-6121CE83 — Make side effects explicit at boundaries and separate them from pure transformations where practical.
- USEQ-0DA007A6 — Pass time, randomness, identity, locale, configuration, and external effects through controllable interfaces when deterministic testing matters.
- USEQ-85AD8D5E — Use a consistent time model and distinguish wall-clock time, monotonic elapsed time, business date, event time, processing time, and effective time.
- USEQ-27E5FAAF — Never infer elapsed duration from a wall clock that may jump.
- USEQ-A9FAC9E7 — Define clock-skew tolerance and authoritative time sources for distributed decisions, tokens, ordering, billing, and audit.
- USEQ-9B8A7D56 — Use explicit random seeds for reproducible tests and experiments while using cryptographically secure randomness for security-sensitive values.
- USEQ-F0B0FCA9 — Make serialization and deserialization preserve semantic meaning, version, precision, and unknown-field behavior.
- USEQ-DD5BE9BC — Ensure restarting, retrying, replaying, or resuming cannot silently repeat irreversible effects.
- USEQ-1FC568C7 — Define state-machine transitions explicitly for complex workflows and reject illegal transitions.
- USEQ-E343856B — Use deterministic ordering or tie-breaking where nondeterministic output would harm tests, users, signatures, caches, or reconciliation.
Error handling, cancellation, and recovery¶
- USEQ-61D9C5BA — Define an error taxonomy that distinguishes invalid input, authorization denial, conflict, absence, timeout, cancellation, dependency failure, resource exhaustion, invariant violation, and unexpected defect.
- USEQ-2490A721 — Preserve the original cause, operation context, correlation information, and retryability without exposing sensitive internals to untrusted callers.
- USEQ-51DDEC07 — Handle errors at the layer that has enough context to recover, translate, compensate, or communicate; otherwise propagate them intact.
- USEQ-FD48C8C6 — Do not catch broad failures merely to continue in an unknown or corrupted state.
- USEQ-9EE161FC — Do not silently discard errors from cleanup, background work, callbacks, asynchronous tasks, streams, or destructors when they affect correctness.
- USEQ-13655EB8 — Make retry policies explicit, bounded, observable, and limited to operations that are safe to repeat.
- USEQ-2ED61C97 — Use backoff, jitter, deadlines, and budgets so retries do not amplify overload or exceed user expectations.
- USEQ-1230BB14 — Propagate cancellation and deadlines across internal and external calls where work should stop.
- USEQ-7DD3C0A2 — Define what happens to partial work when a request is canceled, a worker terminates, or a dependency times out.
- USEQ-97D83064 — Use compensation only when true rollback is impossible and verify compensation itself is retryable and reconcilable.
- USEQ-703563EC — Return user-actionable errors while retaining richer diagnostic context in protected telemetry.
- USEQ-BCFA2E39 — Avoid using exceptional mechanisms for expected high-volume control flow when that harms clarity or performance.
- USEQ-9E0F9B73 — Test error translation so one layer does not convert distinct failures into misleading success, absence, or generic retry.
- USEQ-9B3E4081 — Verify recovery after process restart, duplicate delivery, network partition, storage failure, and partial commit.
Resources, concurrency, asynchronous work, and transactions¶
- USEQ-758F3740 — Define acquisition, ownership, transfer, sharing, release, timeout, cancellation, and cleanup for every finite resource.
- USEQ-929CC93B — Use structured lifetime management so cleanup occurs on success, failure, cancellation, and early return.
- USEQ-E112B91C — Bound memory, recursion, stack, threads, tasks, processes, connections, files, sockets, handles, subscriptions, queues, buffers, batches, and temporary storage.
- USEQ-07EE43CB — Avoid holding scarce resources across slow or unbounded external calls unless necessary and justified.
- USEQ-FEDFBF14 — Document thread safety, process safety, reentrancy, ordering, atomicity, isolation, and visibility guarantees.
- USEQ-7AC74572 — Protect shared invariants with one coherent synchronization or transactional strategy.
- USEQ-B938A5BB — Use the narrowest lock scope compatible with correctness and define lock ordering to prevent deadlock.
- USEQ-850EB655 — Avoid blocking operations on execution contexts that must remain responsive.
- USEQ-414A8CDE — Apply backpressure between producers and consumers and define overload behavior before queues become unbounded.
- USEQ-C4C5F2C3 — Treat timeouts as uncertain outcomes when the remote side may have completed the operation.
- USEQ-F6C7947D — Use idempotency keys, deduplication, sequence numbers, or reconciliation where messages and requests may be repeated.
- USEQ-2AD963FD — Define delivery semantics and never assume exactly-once execution without an end-to-end proof.
- USEQ-995147C5 — Keep transaction boundaries aligned with business invariants and avoid long transactions that span unreliable dependencies.
- USEQ-9E11F421 — Use optimistic or pessimistic concurrency deliberately and surface conflicts clearly.
- USEQ-1CB07EFE — Test race conditions, starvation, deadlock, livelock, reordering, duplicate execution, partial visibility, and shutdown under load.
Secure and privacy-preserving implementation¶
- USEQ-FB0E62E5 — Treat every external, cross-process, cross-tenant, stored, queued, cached, imported, and deserialized value as untrusted until validated for its use.
- USEQ-74C08945 — Perform authorization at every trusted operation using current actor, tenant, resource, action, context, and policy.
- USEQ-46A8E662 — Keep authentication, authorization, validation, privacy, and audit decisions out of client-only or caller-controlled code.
- USEQ-191810F1 — Use safe parameterization and context-specific encoding for queries, commands, markup, templates, headers, logs, spreadsheets, and other interpreters.
- USEQ-92C2BC98 — Constrain outbound destinations, protocols, redirects, DNS resolution, file paths, and parsers that process attacker-influenced input.
- USEQ-FEEEAD00 — Use approved cryptography through maintained libraries and prevent callers from selecting insecure algorithms or modes.
- USEQ-B00F5F93 — Avoid secret-dependent branching, comparison, logging, caching, or error behavior where side channels are material.
- USEQ-887FDDCF — Minimize collection, retention, copying, logging, tracing, caching, indexing, and exposure of personal or confidential data.
- USEQ-0064D510 — Redact or tokenize sensitive values before they enter generic diagnostics, analytics, exception systems, or support tools.
- USEQ-C6D97724 — Prevent one user, tenant, request, job, cache key, log context, or background task from inheriting another's security context.
- USEQ-D502B36F — Use least-privilege identities and capabilities for code, jobs, tests, migrations, and administrative utilities.
- USEQ-0DED5F53 — Make dangerous APIs hard to call accidentally through explicit types, capability objects, validation, and review gates.
- USEQ-DB12D4C5 — Fail closed for authorization and confidentiality while designing availability fallbacks deliberately.
- USEQ-96F9AAB8 — Add regression tests for every material security and privacy defect.
Performance, scalability, and resource efficiency in code¶
- USEQ-15F1FD62 — Define performance requirements and resource budgets for critical operations before optimizing.
- USEQ-B3518752 — Use representative profiling and measurement to identify dominant costs rather than guessing from local code appearance.
- USEQ-ED6D076A — Select algorithms and data structures whose worst-case behavior is acceptable for adversarial and maximum supported input.
- USEQ-A577B30D — Bound user-controlled computational complexity, allocation, fan-out, query cardinality, decompression, parsing, and serialization.
- USEQ-729C23DC — Avoid repeated remote calls, repeated parsing, accidental nested scans, redundant serialization, and hidden per-item I/O in collection operations.
- USEQ-00C6A928 — Batch work only when it preserves latency, fairness, memory, failure isolation, and transactional semantics.
- USEQ-CFB9CE23 — Cache only with a defined key, authorization scope, freshness model, invalidation path, memory bound, and failure behavior.
- USEQ-9D9D041C — Prevent cache stampedes, hot keys, unbounded cardinality, and cross-user data reuse.
- USEQ-FF566A37 — Avoid premature micro-optimization that obscures correctness; preserve benchmark and profiling evidence for non-obvious optimized code.
- USEQ-43DA35AB — Test performance under cold starts, warm state, realistic data skew, maximum object size, concurrency, and dependency degradation.
- USEQ-3532A80B — Track algorithmic and allocation regressions in automated tests where stable measurement is possible.
- USEQ-B98C679D — Prefer streaming or incremental processing when full materialization creates unacceptable memory or latency.
- USEQ-7A4A1550 — Release resources promptly and avoid retaining graphs, closures, listeners, or caches longer than their useful lifetime.
- USEQ-4A549DE1 — Consider energy, bandwidth, storage, and client-device cost when alternatives provide equivalent product outcomes.
Testability, verification, and proof obligations¶
- USEQ-88C87EB4 — Design critical logic so inputs, outputs, dependencies, time, randomness, side effects, and failure modes can be controlled and observed.
- USEQ-8140ABCD — Keep unit boundaries aligned with meaningful behavior rather than testing private implementation trivia.
- USEQ-DA8D2229 — Use examples for known cases and properties or invariants for broad input spaces.
- USEQ-2C2DD5CB — Use generative, fuzz, mutation, model-based, differential, concurrency, and fault-injection techniques where ordinary examples leave material risk.
- USEQ-2959B58C — Verify parser, protocol, state-machine, numerical, authorization, financial, cryptographic, and migration logic against independent models or oracles where warranted.
- USEQ-F41CC7BD — Require tests to fail for the defect they are intended to prevent and use mutation or deliberate fault seeding selectively to validate test effectiveness.
- USEQ-0B7747C8 — Avoid mocks that reproduce implementation details while failing to represent real dependency contracts.
- USEQ-B85907BD — Use contract tests and representative emulators, sandboxes, or test instances for external systems.
- USEQ-61D6A6CC — Make test fixtures explicit, minimal, valid, isolated, deterministic, and representative of production edge conditions.
- USEQ-B9ABC567 — Ensure tests clean up resources and cannot pass because of execution order, shared state, time zone, locale, machine speed, or network access unless intended.
- USEQ-FC90E237 — Classify flaky tests as product defects in the engineering system and fix root causes rather than normalizing retries.
- USEQ-04007F77 — Map critical requirements and risks to verification evidence and identify untested assumptions.
- USEQ-3397D184 — Apply static analysis, type checking, conformance checking, symbolic execution, formal specification, model checking, proof, or runtime verification when consequence and tractability justify them.
- USEQ-53209324 — Independently review proofs, models, generators, test oracles, and safety claims because defects can exist in the verification system itself.
- USEQ-E7843EF8 — Test the built and configured artifact, not only source-level units.
Observability and diagnosability in implementation¶
- USEQ-B9CB9777 — Define which decisions, state transitions, external calls, retries, security events, and business outcomes require telemetry.
- USEQ-BE07FB46 — Use stable event names, field definitions, units, identifiers, severity, and versioning so telemetry remains interpretable across releases.
- USEQ-D1487D42 — Propagate correlation and causation context across asynchronous and distributed work without trusting caller-supplied identifiers blindly.
- USEQ-86A37C88 — Make important failures distinguishable by cause, affected operation, dependency, tenant, release, and retryability.
- USEQ-5866714D — Avoid high-cardinality, secret-bearing, personal, attacker-controlled, or unbounded telemetry fields.
- USEQ-E6F2C57A — Ensure diagnostic logging cannot change business behavior, exhaust critical resources, or introduce deadlocks.
- USEQ-21B0B78A — Use sampling that preserves rare critical events and supports unbiased interpretation.
- USEQ-6AB83E4E — Make audit records tamper-resistant and semantically distinct from ordinary debug logs where accountability is required.
- USEQ-0488BD90 — Provide enough state and decision context to reconstruct consequential outcomes without logging prohibited data.
- USEQ-8693CC5C — Test telemetry assertions, alert predicates, dashboards, and trace propagation as part of behavior.
- USEQ-0D0A9B71 — Make telemetry pipeline failure observable and ensure the application has deliberate degradation behavior.
- USEQ-0FB8250E — Remove temporary debug logging, probes, and sensitive instrumentation before production unless explicitly approved.
Configuration, flags, dependencies, and generated code¶
- USEQ-7BECCA66 — Define a schema, type, allowed range, default, owner, sensitivity, environment scope, and reload behavior for every material configuration value.
- USEQ-154F3E57 — Fail startup or activation safely when required configuration is absent, malformed, contradictory, stale, or insecure.
- USEQ-821892E1 — Do not let a missing flag service, configuration store, or secret silently enable risky behavior.
- USEQ-4C6EE6DE — Test all material feature-flag combinations, transitions, targeting rules, default states, and rollback paths.
- USEQ-E6BA3845 — Remove stale flags, compatibility shims, dead branches, experimental paths, and obsolete configuration after their exit criteria are met.
- USEQ-0D903230 — Pin and verify build and runtime dependencies sufficiently to prevent unexpected substitution.
- USEQ-A7D84FB4 — Assess dependency API surface, transitive graph, maintenance health, license, provenance, security history, performance, and exit cost before adoption.
- USEQ-49AA2475 — Wrap vendor or unstable dependencies only where the wrapper provides a real boundary, not ceremonial indirection.
- USEQ-FA7B7D7F — Treat generated code, models, schemas, clients, migrations, and assets as reproducible outputs with a trusted generator, version, review path, and diff policy.
- USEQ-C8FBA56E — Do not edit generated output manually unless the process explicitly preserves and verifies such changes.
- USEQ-2C0D2973 — Ensure dependency upgrades, generator upgrades, and configuration changes receive behavior, compatibility, security, and performance testing.
- USEQ-C0C75F62 — Remove unused dependencies and capabilities to reduce attack surface and maintenance cost.
- USEQ-497725A5 — Provide a replacement or migration plan for critical unsupported, proprietary, or single-maintainer dependencies.
Review, change safety, technical debt, and maintainability¶
- USEQ-96222956 — Require every material change to explain intent, scope, risk, alternatives, testing, deployment, rollback, data impact, and observability impact.
- USEQ-E6E8E65D — Use reviewers with relevant domain, security, privacy, accessibility, data, or operational expertise for high-impact changes.
- USEQ-B42D60FB — Review changed behavior in context of callers, consumers, data flows, concurrency, failure paths, and deployment order, not only the diff.
- USEQ-8B195A70 — Use automated checks to remove mechanical review burden while never substituting automation for judgment on semantics and risk.
- USEQ-3F1DB8A6 — Keep review size and latency within limits that preserve attention; split work by coherent behavior, not arbitrary line count.
- USEQ-954F522D — Record dissent and unresolved design questions for consequential changes.
- USEQ-EE7867F6 — Treat technical debt as a specific future cost or risk with evidence, owner, affected outcomes, and trigger for repayment.
- USEQ-FD32E7E9 — Do not label missing requirements, security defects, or production failures as harmless technical debt.
- USEQ-8DC4A289 — Refactor behind characterization tests or stronger specifications when current behavior is poorly understood.
- USEQ-BC601120 — Separate behavior-preserving refactoring from behavior changes where it improves review and rollback.
- USEQ-49D3FE94 — Delete dead code and obsolete compatibility paths after confirming no runtime, data, customer, or external dependency remains.
- USEQ-57E2CEAB — Measure maintainability using defect patterns, change lead time, review difficulty, dependency structure, cognitive load, recovery cost, and ownership—not one complexity metric alone.
- USEQ-6F163940 — Turn escaped defects into regression tests and systemic prevention when practical.
- USEQ-473642A2 — Schedule maintenance before support deadlines, degradation, or concentration of knowledge creates an emergency.
- USEQ-CA602113 — Ensure code ownership and documentation survive staff changes and do not depend on one person.
Code-specific release blockers¶
- USEQ-97163345 — Do not release critical behavior whose invariants, authorization, failure modes, or data effects cannot be explained and tested.
- USEQ-CD7D768A — Do not release with known undefined, implementation-dependent, race-prone, overflow-prone, or precision-losing behavior in a critical path.
- USEQ-F78B1390 — Do not release when an error, timeout, retry, cancellation, or restart can cause silent corruption, duplicate irreversible effects, or false success.
- USEQ-205749EA — Do not release unbounded work or allocation reachable from untrusted input when it can exhaust shared resources.
- USEQ-DD8B007F — Do not release code that logs reusable secrets, session material, payment credentials, or prohibited personal data.
- USEQ-DF40914E — Do not release a critical dependency, generated artifact, or build output whose source and version cannot be traced and reproduced.
- USEQ-09B573EE — Do not release high-impact code that was self-approved without the required independent review.
- USEQ-C1797663 — Do not release a material refactor without evidence that required behavior and compatibility were preserved.
- USEQ-2B15F92E — Do not waive failing tests, static findings, warnings, or code-review concerns without a documented technical disposition and owner.
- USEQ-8B433E08 — Do not claim high code quality solely from coverage percentage, linter cleanliness, low complexity, style conformance, or absence of known defects.
Universal Code Quality, Correctness, and Maintainability¶
Consolidated from final consolidated corpus/03-architecture-code-frontend-backend-apis-integration.md#Universal Code Quality, Correctness, and Maintainability; 344 non-duplicative controls.
Quality requirements, ownership, and boundaries¶
- USEQ-DBA869FD — Define the externally observable behavior, quality attributes, constraints, and failure tolerances before treating implementation as complete.
- USEQ-E3378793 — Trace code to product requirements, architecture decisions, risks, interfaces, data contracts, and tests.
- USEQ-D89D9D0E — Identify safety-, security-, privacy-, accessibility-, financial-, integrity-, and availability-critical code explicitly.
- USEQ-F2AFF580 — Assign ownership for each maintained component, package, service, shared library, generated artifact, and operational script.
- USEQ-0B7FDB5F — Document supported runtimes, platforms, protocols, data versions, clients, and compatibility windows.
- USEQ-9EA13006 — Define measurable quality gates for correctness, maintainability, reliability, security, performance, testability, and operability.
- USEQ-6F4186A3 — Use risk-adjusted gates rather than one universal numeric threshold for every component.
- USEQ-62BF7DDD — Document assumptions about inputs, ordering, timing, consistency, scale, trust, environment, and dependencies.
- USEQ-67D8E81C — Validate material assumptions with executable tests, monitoring, proofs, or reviewed evidence.
- USEQ-D9F573BA — Keep production behavior reproducible from reviewed source, dependencies, configuration, and build instructions.
- USEQ-2B266C16 — Ensure temporary code, experiments, bypasses, compatibility shims, and migrations have owners and removal conditions.
- USEQ-7A1B2A2D — Do not accept “works on my machine” as evidence of correctness or portability.
- USEQ-04A082D7 — Use independent review for changes that can violate critical invariants or trust boundaries.
- USEQ-AEDE7315 — Reassess quality requirements when the component changes role, exposure, data sensitivity, scale, or criticality.
Specifications, contracts, invariants, and correctness¶
- USEQ-DD170383 — Define preconditions, postconditions, invariants, state transitions, side effects, and error outcomes for important behavior.
- USEQ-90E40C1E — Make contracts precise enough that two independent implementers or testers can reach the same conclusion.
- USEQ-7263D6F2 — Distinguish required behavior from implementation detail and optimization.
- USEQ-DA2FF151 — Define behavior for empty, missing, malformed, duplicate, stale, conflicting, maximum, minimum, and out-of-order inputs.
- USEQ-C8FE1A2E — Define behavior for partial completion, interruption, timeout, cancellation, retry, and recovery.
- USEQ-2F31C3BE — Define consistency, ordering, atomicity, durability, freshness, and idempotency requirements explicitly.
- USEQ-77A2171A — Keep business rules in one authoritative, testable location or ensure replicated rules are generated and verified from one source.
- USEQ-69F05E34 — Enforce critical invariants at the strongest practical boundary, including storage constraints where appropriate.
- USEQ-1C2B1A8A — Fail safely when a contract cannot be satisfied; do not silently invent or discard critical state.
- USEQ-F90057EF — Use assertions for programmer assumptions, not as the sole validation of untrusted production input.
- USEQ-DAE95EAC — Ensure assertions and diagnostics do not change required production semantics when disabled.
- USEQ-7A14D117 — Treat undefined, implementation-defined, unspecified, and version-dependent behavior as explicit risk.
- USEQ-41287C60 — Do not rely on accidental ordering, timing, memory layout, locale, platform defaults, or undocumented supplier behavior.
- USEQ-69E95A61 — Use reference implementations, independent calculations, reconciliation, or formal models for high-impact algorithms.
- USEQ-41F13300 — Prove or test that optimization preserves externally observable behavior and required invariants.
- USEQ-D6652FBA — Keep specification and implementation changes synchronized and reviewed together.
Simplicity, SOLID, DRY, KISS, YAGNI, and proportional design¶
- USEQ-8CB4627D — Prefer the simplest design that demonstrably satisfies current requirements and foreseeable risk.
- USEQ-C88E2CE9 — Apply KISS to reduce accidental complexity, not to ignore essential security, reliability, accessibility, or domain complexity.
- USEQ-6B7D177D — Apply YAGNI to speculative features and abstractions, not to mandatory controls or inexpensive risk prevention.
- USEQ-BBBE3359 — Apply DRY to duplicated knowledge and business rules; do not force unrelated code to share an abstraction merely because syntax looks similar.
- USEQ-F9448375 — Tolerate small local duplication when premature sharing would couple unrelated change reasons.
- USEQ-CC802841 — Give each cohesive unit a clear responsibility and a limited set of reasons to change.
- USEQ-762F0998 — Extend behavior through stable boundaries when that is cheaper and safer than repeated modification of fragile core logic.
- USEQ-589556B7 — Ensure substituted implementations preserve the promises, error semantics, timing constraints, and invariants expected by their clients.
- USEQ-65503381 — Keep interfaces focused on actual client needs rather than requiring consumers to depend on irrelevant operations.
- USEQ-D83EB0DC — Direct dependencies toward stable policies and contracts rather than volatile mechanisms where this improves change safety.
- USEQ-B7E68721 — Do not add indirection, factories, layers, patterns, or configuration without a demonstrated problem they solve.
- USEQ-720017DC — Prefer explicit code over clever compression when the explicit form improves review and maintenance.
- USEQ-0752BFB6 — Remove obsolete abstractions when their original variation or reuse case no longer exists.
- USEQ-E43DC013 — Document intentional violations of a design principle and the trade-off that makes the violation safer or simpler.
- USEQ-C094CF5D — Review whether an abstraction reduces total cognitive load across creation, use, debugging, and change—not only line count.
Modularity, cohesion, coupling, and dependency direction¶
- USEQ-58FC16E8 — Partition code around cohesive domain responsibilities and stable change boundaries.
- USEQ-AFD6FB35 — Keep related data and behavior together unless separation is required for a clear architectural reason.
- USEQ-8F5FC968 — Minimize hidden coupling through global state, shared databases, implicit conventions, environment variables, clocks, files, or side channels.
- USEQ-FFD3A39D — Make dependencies explicit in interfaces, construction, configuration, or documented runtime contracts.
- USEQ-A3F10A7E — Prevent cyclic dependencies or justify and test any unavoidable cycle.
- USEQ-3ECB7AC5 — Keep public surfaces smaller than internal implementation surfaces.
- USEQ-02773C41 — Expose the minimum data and operations needed by consumers.
- USEQ-2FFF5F59 — Preserve encapsulation; do not let consumers depend on mutable internal representation.
- USEQ-17CEBD14 — Use stable abstractions at trust, process, ownership, deployment, and compatibility boundaries.
- USEQ-27722554 — Avoid splitting code into modules so small that behavior can no longer be understood locally.
- USEQ-0D3D31EF — Avoid modules so large that unrelated responsibilities, owners, and change rates become inseparable.
- USEQ-C11942B6 — Keep policy separate from replaceable mechanisms when doing so improves testability, portability, or security.
- USEQ-30615094 — Isolate high-risk parsers, privileged operations, external services, and unsafe components behind narrow boundaries.
- USEQ-47555284 — Design failure containment so one module cannot unnecessarily corrupt or exhaust unrelated modules.
- USEQ-EECAD1C3 — Measure coupling through actual dependency and change data, not only static diagrams.
- USEQ-1E8B7C1F — Review boundaries whenever teams, data ownership, deployment units, or scaling needs change.
Readability, naming, comments, and local reasoning¶
- USEQ-D1B3D7E0 — Use names that communicate domain meaning, units, scope, lifetime, and intent.
- USEQ-5BF298DE — Use consistent terminology from the product glossary and data contracts.
- USEQ-041246F0 — Avoid names that misrepresent security, certainty, units, ownership, mutability, or side effects.
- USEQ-51888F7A — Use positive, unambiguous boolean names and avoid confusing double negatives.
- USEQ-233613E8 — Keep units, currencies, time bases, coordinate systems, and normalization states visible in names or types.
- USEQ-416EBFC9 — Organize code so the normal path and exceptional paths are easy to identify.
- USEQ-C2E77A64 — Keep control flow shallow and comprehensible; extract or restructure deeply nested logic when it obscures behavior.
- USEQ-A8D58020 — Prefer early validation or guard clauses when they make preconditions and failure clearer.
- USEQ-9A0C71A3 — Keep functions and classes cohesive; size is a signal, not a goal by itself.
- USEQ-FE04149F — Use formatting and automated style rules consistently so review focuses on behavior.
- USEQ-C70CE853 — Write comments that explain intent, constraints, non-obvious trade-offs, provenance, and why—not a restatement of syntax.
- USEQ-54B9FB4B — Keep comments, examples, diagrams, and documentation synchronized with code.
- USEQ-F482985B — Remove commented-out code and obsolete explanations; version control is the history.
- USEQ-51D2BF8A — Mark generated code, generated sections, and source-of-truth locations clearly.
- USEQ-A8AABA93 — Keep public API documentation accurate about inputs, outputs, side effects, errors, thread safety, compatibility, and security requirements.
- USEQ-5A2A45DA — Ensure a qualified maintainer can understand a change without reconstructing undocumented context from multiple private channels.
Types, values, validation, nullability, and data representation¶
- USEQ-D98F8957 — Use the strongest practical representation for domain constraints rather than representing every value as an unconstrained primitive.
- USEQ-1A3B18B4 — Make optionality, absence, unknown, not-applicable, redacted, and zero distinct where the domain distinguishes them.
- USEQ-0A5F8102 — Do not use sentinel values that collide with valid domain values.
- USEQ-8BC70D0E — Validate untrusted input at the trusted boundary for syntax, type, range, size, structure, encoding, and allowed relationships.
- USEQ-1064D8A5 — Validate again when data crosses a boundary with different trust or invariants.
- USEQ-8AEEBE13 — Canonicalize or normalize before security-sensitive comparison when the domain requires it.
- USEQ-D239B15F — Avoid lossy conversion unless the loss and rounding behavior are explicit and acceptable.
- USEQ-6A357CE5 — Preserve unknown fields or reject them intentionally according to the compatibility contract.
- USEQ-A660250A — Prevent unintended mass assignment, implicit field binding, and over-posting.
- USEQ-06BBD221 — Define default values explicitly and distinguish omitted values from supplied defaults when behavior differs.
- USEQ-2149D309 — Ensure serialization and storage preserve required precision, ordering, identity, and null semantics.
- USEQ-40B3A71F — Use immutable values for identifiers, money, timestamps, configuration, and other concepts where mutation creates risk.
- USEQ-DD9D56FD — Constrain collections, recursion, nesting, and graphs to safe bounds.
- USEQ-AD83A277 — Check for duplicate keys, ambiguous names, conflicting fields, and parser-specific interpretation.
- USEQ-715C83F0 — Use domain-specific validation for checksums, identifiers, addresses, account numbers, and other structured values without over-restricting legitimate international input.
- USEQ-25BEFB10 — Do not treat client-side validation as the authoritative security or integrity control.
Errors, exceptions, cancellation, and defensive behavior¶
- USEQ-1FFA1E56 — Define an error taxonomy that distinguishes invalid input, expected business outcomes, transient dependency failure, permanent failure, conflict, authorization denial, and programmer defect.
- USEQ-61DA8691 — Use error types or structures that let callers make safe decisions without parsing human-readable text.
- USEQ-FC3083A0 — Preserve the causal chain and relevant context without leaking secrets or personal data.
- USEQ-A5570D23 — Do not catch an error unless the code can add context, translate it meaningfully, retry safely, compensate, or terminate at the correct boundary.
- USEQ-639681F8 — Do not silently swallow exceptions, rejected promises, failed tasks, background-job failures, or partial writes.
- USEQ-97FD1F80 — Ensure cleanup occurs on success, failure, cancellation, timeout, and abrupt termination as far as the platform permits.
- USEQ-E517601F — Propagate cancellation and deadlines through dependent operations.
- USEQ-6844C27F — Distinguish user cancellation from failure in product behavior and telemetry.
- USEQ-9E562DFB — Use bounded retries only for failures that are plausibly transient and operations that are safe to repeat.
- USEQ-0CE498E4 — Apply backoff and jitter and honor server or dependency retry guidance.
- USEQ-F65C7D19 — Prevent retry amplification, duplicate side effects, and infinite retry loops.
- USEQ-A60CCF18 — Provide compensation or reconciliation when distributed work cannot be made atomic.
- USEQ-D5017311 — Degrade safely when optional functionality fails and preserve critical operations where possible.
- USEQ-5D9BBF61 — Fail closed for security and authorization decisions unless a documented safety analysis requires another behavior.
- USEQ-377BC484 — Fail visibly for data corruption, invariant violation, and unreconciled financial or integrity discrepancies.
- USEQ-1E5C1F68 — Test error paths with the same rigor as successful paths.
State, side effects, lifecycle, and idempotency¶
- USEQ-37702BA8 — Make state ownership, lifecycle, transitions, persistence, and reset behavior explicit.
- USEQ-3EB68BF3 — Use explicit state machines for workflows with consequential or nontrivial transitions.
- USEQ-F770BA67 — Reject impossible or unauthorized transitions at the authoritative boundary.
- USEQ-1BE42A4F — Keep pure calculations separate from side effects where this improves reasoning and testing.
- USEQ-953367E0 — Minimize mutable shared state and scope it to the narrowest appropriate lifetime.
- USEQ-9D35A4E8 — Do not store derived state when it can be recomputed reliably and cheaply unless caching has a clear consistency contract.
- USEQ-D9B4B237 — When derived state is stored, define invalidation, reconciliation, and source-of-truth rules.
- USEQ-5F10320A — Make operations idempotent when clients, queues, networks, or users can repeat them.
- USEQ-EEBC6397 — Use idempotency keys, deduplication, sequence numbers, or uniqueness constraints appropriate to the effect being protected.
- USEQ-57546D0C — Define behavior for duplicate, late, missing, and out-of-order events.
- USEQ-A614E073 — Ensure refresh, navigation, retry, process restart, and failover cannot repeat irreversible effects unintentionally.
- USEQ-47D45544 — Version persisted state and provide controlled migration paths.
- USEQ-B246588E — Clear, revoke, or migrate state when users log out, lose access, change tenant, or delete accounts.
- USEQ-DAF65900 — Avoid hidden state in caches, static variables, singletons, environment, and thread-local storage unless explicitly governed.
- USEQ-CDC0657B — Expose enough state-transition telemetry to diagnose stuck, repeated, and invalid workflows.
- USEQ-1242CF67 — Test recovery from interruption at every durable transition in critical workflows.
Concurrency, asynchronous work, and distributed correctness¶
- USEQ-62C77BAB — Identify every shared mutable resource and define its concurrency model.
- USEQ-AF544541 — Document whether APIs and components are thread-safe, reentrant, single-threaded, actor-confined, or externally synchronized.
- USEQ-C2209208 — Avoid data races through ownership, immutability, isolation, or correctly scoped synchronization.
- USEQ-AFA11F1F — Use synchronization primitives according to their memory-ordering and visibility guarantees.
- USEQ-35E7D6B6 — Prevent deadlock through consistent lock ordering, bounded acquisition, reduced lock scope, or lock-free design with proven safety.
- USEQ-3EF36B7D — Do not hold locks across unbounded I/O, user callbacks, or remote calls unless explicitly justified.
- USEQ-97608DC7 — Handle task cancellation, orphaned work, and executor shutdown deliberately.
- USEQ-DAEA6A4E — Bound concurrency, queues, buffers, and fan-out.
- USEQ-0224AD1D — Apply backpressure rather than accepting unbounded work.
- USEQ-9A5360E0 — Assume network calls can be delayed, duplicated, reordered, partially completed, or fail after the remote effect occurred.
- USEQ-D631AF7E — Do not infer global order from local clocks or message arrival unless the protocol guarantees it.
- USEQ-4E5F16CC — Use transactions, compare-and-swap, version checks, leases, fencing tokens, or other concurrency controls according to the invariant.
- USEQ-91D6A6CD — Test race conditions with stress, randomized scheduling, fault injection, and invariant checks.
- USEQ-6C6FB1A4 — Ensure logging and tracing do not introduce unsafe synchronization or materially alter timing-sensitive behavior.
- USEQ-D4F9E4F1 — Document consistency trade-offs and user-visible consequences.
Numbers, money, units, limits, and quantitative correctness¶
- USEQ-4FF9BBD0 — Choose numeric representations according to range, precision, rounding, determinism, interoperability, and performance requirements.
- USEQ-4993931E — Detect or prevent integer overflow, underflow, wraparound, unsafe narrowing, and sign conversion.
- USEQ-99D0CC73 — Handle floating-point non-associativity, exceptional values, comparison tolerance, and platform variance deliberately.
- USEQ-446A1812 — Do not use binary floating point for money when exact decimal behavior is required.
- USEQ-A9E4B0E9 — Represent currency explicitly and do not combine amounts of different currencies without a defined conversion.
- USEQ-25CDB0B9 — Define rounding mode, scale, timing, allocation, tax, fee, and residual handling for financial calculations.
- USEQ-B8FE3E36 — Keep units explicit and prevent mixing incompatible units.
- USEQ-EB371EA3 — Define inclusive and exclusive bounds clearly.
- USEQ-434929F3 — Validate division-by-zero, logarithm, root, overflow, and domain conditions.
- USEQ-ADD15932 — Define behavior for negative, zero, extremely large, and highly precise values.
- USEQ-C1985A8A — Use stable algorithms for large, small, or ill-conditioned values where numerical error matters.
- USEQ-E51F3165 — Preserve significant figures and uncertainty where the domain requires them.
- USEQ-80B622D5 — Use independent reconciliation for balances, inventory, quotas, counters, and aggregates.
- USEQ-E9022BE0 — Define whether limits are per request, user, tenant, account, time window, region, or global.
- USEQ-A971554D — Test boundary values and values immediately around every significant threshold.
- USEQ-232C833B — Document any approximate algorithm and its accepted error bound.
Time, dates, schedules, and temporal logic¶
- USEQ-8779E97F — Store instants in an unambiguous time scale and retain the original zone or offset when business meaning requires it.
- USEQ-ACBA370F — Use named IANA time zones for civil-time rules rather than fixed offsets when local rules matter.
- USEQ-B9A6124F — Keep time-zone data current and treat political rule changes as production changes.
- USEQ-29E529E7 — Distinguish instants, local date-times, dates, times of day, durations, periods, deadlines, and recurring schedules.
- USEQ-F10AEA71 — Do not assume every day has 24 hours, every minute has 60 seconds in all time scales, or every local time exists exactly once.
- USEQ-D9025CDC — Define behavior across daylight-saving gaps, overlaps, leap years, month lengths, leap seconds, calendar changes, and end-of-period calculations.
- USEQ-7AFB4A13 — Use monotonic clocks for elapsed-time measurement and deadlines where wall-clock adjustment would be unsafe.
- USEQ-2297697E — Use synchronized wall clocks for audit and cross-system correlation and monitor drift.
- USEQ-EF634494 — Define clock-skew tolerance for tokens, leases, caches, signatures, and distributed coordination.
- USEQ-3B5E73FE — Use standards-based timestamp formats such as RFC 3339 where interoperability requires them.
- USEQ-B5224D30 — Include zone identifiers when an offset alone cannot preserve future or recurring civil-time meaning.
- USEQ-17F4977A — Define inclusive and exclusive deadline semantics and the time zone used for cutoffs.
- USEQ-AB3585AB — Test scheduling around transitions, month/year boundaries, clock adjustments, and delayed execution.
- USEQ-F016ED9E — Ensure recurring jobs handle missed, repeated, and overlapping runs.
- USEQ-5EBED0C4 — Do not use user locale to parse machine protocol timestamps.
- USEQ-FF9FB4C0 — Record source, precision, and uncertainty when timestamps are evidence.
Unicode, localization, identifiers, and text correctness¶
- USEQ-54CB477A — Use Unicode-capable storage and interfaces end to end for human text.
- USEQ-F29B5184 — Define the normalization form required for identifiers, comparison, search, signatures, and storage; do not normalize blindly when distinctions matter.
- USEQ-743A74EC — Apply Unicode normalization before security-sensitive comparison when the identifier policy requires it.
- USEQ-EFF318B7 — Address confusable characters, mixed scripts, bidirectional controls, invisible characters, and spoofing in security-sensitive identifiers.
- USEQ-1E6FD2C8 — Distinguish byte length, code-unit length, code-point length, and grapheme-cluster length.
- USEQ-05AB855D — Do not truncate or split text in the middle of an encoded character or grapheme cluster.
- USEQ-82D12A4A — Use locale-aware case conversion, collation, segmentation, formatting, and pluralization where human language requires them.
- USEQ-1AF27C78 — Do not use locale-sensitive transformations for protocol tokens, security identifiers, hashes, or machine field names.
- USEQ-649E0701 — Use BCP 47 language tags and Unicode CLDR data for locale behavior where applicable.
- USEQ-8A8A064A — Support bidirectional text without allowing direction controls to conceal malicious code or identifiers.
- USEQ-89D597B0 — Define canonical comparison rules for usernames, email addresses, domains, filenames, and other identifiers separately.
- USEQ-7B766695 — Preserve user-preferred spelling and display form even when a normalized comparison key is used.
- USEQ-34895ED7 — Handle emoji sequences, combining marks, variation selectors, and evolving character repertoires safely.
- USEQ-5373073B — Validate text encoding at boundaries and reject or replace malformed sequences according to an explicit policy.
- USEQ-6CA6203E — Ensure logs, terminals, review tools, and source code cannot hide control characters or bidirectional text attacks.
- USEQ-6975C61E — Test representative scripts, long translations, right-to-left content, and mixed-language input.
Parsing, serialization, protocols, and interoperability¶
- USEQ-CE1E87B3 — Use maintained parsers and serializers rather than ad hoc string construction for structured formats.
- USEQ-A4B1C801 — Constrain parser input size, nesting, recursion, entity expansion, references, compression, and processing time.
- USEQ-C82D80FE — Define duplicate-key, unknown-field, number-range, ordering, whitespace, encoding, and invalid-token behavior.
- USEQ-06C44B02 — Reject ambiguous or nonconforming input at security-sensitive boundaries instead of accepting parser differentials.
- USEQ-7C22624C — Ensure producer and consumer agree on schema, version, semantics, units, defaults, nullability, and compatibility.
- USEQ-B5F47BE7 — Use deterministic or canonical serialization when signatures, hashes, cache keys, or reproducible comparisons depend on byte identity.
- USEQ-EC2F0E8A — Do not assume JSON object member order or numeric precision beyond the agreed interoperable profile.
- USEQ-45D4DAB0 — Use HTTP methods, status codes, headers, validators, content negotiation, redirects, and caching according to current semantics.
- USEQ-FA014D20 — Do not return a success status for a failed operation merely to simplify clients.
- USEQ-314A66C9 — Make safe, idempotent, and cacheable operation semantics accurate.
- USEQ-67B4A882 — Handle conditional requests and concurrent updates consistently where supported.
- USEQ-5A9B0093 — Set content types and character encodings explicitly and prevent content sniffing where relevant.
- USEQ-ADF990FF — Validate media types before selecting a parser.
- USEQ-74E85045 — Keep protocol extension behavior forward-compatible and bounded.
- USEQ-D4B3F5DE — Use explicit versioning and deprecation policies for externally consumed formats and APIs.
- USEQ-E30C995C — Test against independent implementations and malformed-message suites for important protocols.
Resources, memory, files, processes, and cleanup¶
- USEQ-D973FD6B — Acquire resources as late as practical and release them deterministically or through a reliable lifecycle mechanism.
- USEQ-BE0CD793 — Close files, sockets, streams, cursors, transactions, locks, subscriptions, timers, and handles on every path.
- USEQ-B8095D09 — Bound memory, disk, network, file-descriptor, process, thread, connection, and temporary-storage consumption.
- USEQ-960E9C6B — Prevent unbounded accumulation in caches, queues, collections, logs, retries, and background tasks.
- USEQ-70FE713D — Check allocation and I/O failures where the platform exposes them.
- USEQ-82B29943 — Prefer memory-safe implementation technologies for new high-risk code where practical.
- USEQ-897ECAE9 — When memory-unsafe code remains, use a documented migration roadmap plus compiler, runtime, sandbox, fuzzing, and isolation defenses.
- USEQ-E7228FEB — Prevent use-after-free, out-of-bounds access, uninitialized memory, double release, lifetime confusion, and unsafe aliasing.
- USEQ-3A0A386A — Zeroize highly sensitive material when the platform and threat model make this effective, while recognizing copies may remain.
- USEQ-98BA29DA — Use secure temporary-file creation and restrictive permissions.
- USEQ-68117F8C — Prevent path traversal, symbolic-link races, archive traversal, and unsafe filename handling.
- USEQ-8E4CC777 — Handle partial reads, partial writes, interrupted system calls, disk-full conditions, and remote disconnects.
- USEQ-5D68BE42 — Do not invoke shells or interpreters with concatenated untrusted input.
- USEQ-3C9326DD — Limit child-process permissions, environment, working directory, inherited handles, runtime, and output size.
- USEQ-18F01CFE — Make shutdown graceful, bounded, observable, and safe for in-flight work.
- USEQ-B7EDD921 — Test repeated startup, shutdown, reload, failover, and resource exhaustion.
Security, privacy, and misuse resistance in code¶
- USEQ-1BCE07D5 — Treat every external input, dependency output, stored record, message, file, and model response according to its actual trust level.
- USEQ-493DBF2E — Enforce authentication and authorization at the authoritative server or service boundary for every protected action and object.
- USEQ-29781772 — Deny access by default and minimize privileges, scopes, data fields, and capabilities.
- USEQ-A6F0EAEF — Use parameterized or structurally safe APIs for queries, commands, templates, paths, headers, and output contexts.
- USEQ-77921370 — Encode output for the exact destination context and sanitize untrusted rich content with a maintained policy.
- USEQ-576C6557 — Use approved cryptographic libraries and protocols; do not design custom cryptography.
- USEQ-86DDC0AA — Keep secrets out of source, test fixtures, logs, client bundles, exceptions, analytics, and generated artifacts.
- USEQ-F9A11E4B — Use constant-time or side-channel-resistant operations where secrets and threat models require them.
- USEQ-12E66D3D — Prevent resource exhaustion, algorithmic complexity attacks, regex denial of service, and decompression bombs.
- USEQ-7DBD9354 — Minimize collection, retention, copying, logging, and exposure of personal and confidential data.
- USEQ-4D7E05CD — Use safe defaults and make insecure modes explicit, constrained, and difficult to activate accidentally.
- USEQ-5E34B75C — Ensure debug, test, and support functionality cannot bypass production controls.
- USEQ-0F2C50CC — Log security-relevant outcomes without recording reusable credentials or unnecessary personal data.
- USEQ-08007372 — Map code-level weaknesses to applicable CWE classes and threat-model findings.
- USEQ-B52AB6AA — Review abuse cases and economic incentives, not only syntactic vulnerabilities.
Performance, complexity, scalability, and efficiency¶
- USEQ-BF70B8CD — Measure representative workloads, data shapes, cache states, devices, networks, and dependency behavior.
- USEQ-E324A2A1 — Choose algorithms and data structures appropriate to expected and adversarial scale.
- USEQ-8A0C791A — Analyze time and space complexity for input-controlled or high-volume operations.
- USEQ-E2F87986 — Prevent accidental quadratic, exponential, or unbounded behavior.
- USEQ-1A19A79B — Use batching, streaming, pagination, indexing, caching, and concurrency only with explicit correctness contracts.
- USEQ-9352A08B — Do not cache authorization-sensitive or user-specific data without complete cache-key and invalidation dimensions.
- USEQ-70825EBF — Avoid repeated remote calls, repeated parsing, unnecessary allocation, and excessive serialization in hot paths.
- USEQ-FD32920A — Optimize after measurement unless a well-known unsafe complexity or capacity problem is evident from design.
- USEQ-3F5D5780 — Preserve readability, correctness, accessibility, and security during optimization.
- USEQ-840336E3 — Document performance-sensitive invariants and benchmark methodology.
- USEQ-3250050E — Use stable benchmarks with variance, warmup, sample size, and environment recorded.
- USEQ-F00285A1 — Check latency percentiles and tail behavior rather than averages alone.
- USEQ-0434E2D2 — Bound background work and ensure it yields to critical user operations.
- USEQ-AB9DE8ED — Monitor performance regression and resource growth across releases.
- USEQ-7638CC53 — Remove obsolete optimization code when its complexity no longer provides measured value.
Testability, observability, and diagnosability¶
- USEQ-4ACE6492 — Design important logic so it can be exercised without uncontrolled network, clock, random, filesystem, process, or global-state dependencies.
- USEQ-8388B6C1 — Inject or abstract nondeterministic dependencies at appropriate boundaries without creating unnecessary indirection.
- USEQ-7208E8C0 — Make randomness seedable in tests and cryptographically secure in production where security requires it.
- USEQ-64212472 — Provide controlled clocks for testing time behavior.
- USEQ-C3D32C77 — Expose observable outcomes for state transitions, retries, reconciliation, queueing, and partial failure.
- USEQ-70F9FF8F — Use structured logs, metrics, traces, and audit events with stable schemas and correlation identifiers.
- USEQ-587DF350 — Include version, environment, tenant or scope, operation, outcome, and causal context where appropriate.
- USEQ-AEA849FB — Do not require debug logging that leaks sensitive data to diagnose normal production failures.
- USEQ-3D339246 — Keep telemetry failures from breaking critical business behavior unless audit guarantees require a fail-closed design.
- USEQ-6BE98043 — Ensure sampling does not remove critical security, integrity, or rare failure evidence.
- USEQ-BB92033C — Create health signals that distinguish process liveness, readiness, dependency health, correctness, and user journey success.
- USEQ-40C08B37 — Make feature flags, configuration versions, migrations, and deployment versions visible in diagnostics.
- USEQ-2C8854E2 — Provide deterministic fixtures and builders for complex domain objects.
- USEQ-99993149 — Keep public interfaces small enough to test exhaustively or systematically at boundaries.
- USEQ-D1828585 — Use fault injection points for critical dependencies and recovery logic.
- USEQ-802A6876 — Validate that diagnostic code and instrumentation do not create unacceptable overhead or behavior changes.
Dependencies, configuration, feature flags, and generated artifacts¶
- USEQ-00EDEF12 — Add a dependency only when its lifecycle cost and risk are lower than implementing or avoiding the capability.
- USEQ-56DBBE9E — Assess maintenance activity, ownership, support horizon, security history, license, transitive dependencies, size, portability, and replacement cost.
- USEQ-8FA79EE4 — Pin or constrain versions to balance reproducibility with timely security updates.
- USEQ-728124AE — Remove unused direct and transitive dependencies and unreachable bundled code.
- USEQ-3A6BB91D — Use one authoritative configuration schema with types, constraints, defaults, documentation, and secret classification.
- USEQ-4C6B728A — Validate configuration before serving traffic and fail safely on invalid critical values.
- USEQ-A60E84DD — Keep production configuration reviewable, auditable, reproducible, and separated from secrets.
- USEQ-3E5F2D86 — Avoid configuration options that create untested combinatorial behavior without clear value.
- USEQ-0E91A950 — Test supported configuration and feature-flag combinations, including failure of the flag service.
- USEQ-DDC54163 — Give every flag an owner, purpose, safe default, rollout plan, observability, and removal date.
- USEQ-CDEE0611 — Do not use long-lived flags as an ungoverned substitute for architecture, permissions, or product plans.
- USEQ-5260DD86 — Make generated code and artifacts reproducible from a reviewed source and trusted generator.
- USEQ-EC8D2059 — Pin and verify generators, schemas, templates, and toolchains.
- USEQ-B433EC66 — Do not manually edit generated output unless the source-of-truth and regeneration rules explicitly permit it.
- USEQ-0147BEB3 — Scan generated and vendored code with the same relevant security and quality controls as handwritten code.
- USEQ-2563896F — Preserve provenance from input schema or model through generator to output artifact.
Review, static analysis, metrics, and quality gates¶
- USEQ-4F610242 — Require review by someone other than the author for material production changes.
- USEQ-92000C1E — Match reviewers to domain, security, data, accessibility, performance, and operational risk.
- USEQ-876EAEF6 — Review behavior, failure modes, contracts, data effects, observability, tests, rollback, and migration—not only style.
- USEQ-2755D60A — Keep changes small enough to review effectively whenever practical.
- USEQ-12655775 — Use automated formatting, linting, compilation, type checking, static analysis, dependency scanning, and secret scanning appropriate to the code.
- USEQ-43674C7E — Treat new warnings and high-confidence findings as failures unless a reviewed suppression explains why the finding is not applicable.
- USEQ-FE2D4DFC — Scope suppressions narrowly, record ownership and expiry, and prevent global disabling for convenience.
- USEQ-5901EFEA — Use code-quality metrics as investigation signals rather than targets that can be gamed.
- USEQ-CC5B174C — Track trends in complexity, duplication, dependency cycles, warnings, churn, defect density, flaky tests, coverage gaps, and technical debt.
- USEQ-A1F8C6E6 — Define local limits based on component criticality and change cost rather than enforcing arbitrary organization-wide numbers.
- USEQ-F01FABCC — Review highly complex, frequently changed, defect-prone, or security-sensitive code for redesign.
- USEQ-A4C2204F — Use automated source-code quality measures aligned with reliability, security, performance efficiency, and maintainability where useful.
- USEQ-060292B5 — Require evidence that tests fail before the fix and pass after it for material defects.
- USEQ-920D4B56 — Protect review and quality-gate configuration from unauthorized bypass.
- USEQ-FBD94500 — Audit emergency bypasses and complete retrospective review promptly.
- USEQ-40CDE58A — Ensure the final artifact—not merely source—passes applicable checks.
Refactoring, technical debt, legacy code, and deletion¶
- USEQ-6DF9FEA2 — Refactor to reduce demonstrated change risk, defects, cognitive load, coupling, or operating cost—not merely to follow fashion.
- USEQ-4DFE7944 — Preserve behavior through characterization tests, contracts, monitoring, or formal equivalence appropriate to risk.
- USEQ-5034A635 — Separate behavior-preserving refactoring from feature change when that improves reviewability.
- USEQ-72261A80 — Use incremental migration and compatibility seams for high-risk legacy replacement.
- USEQ-7D1AAF08 — Document technical debt with principal, ongoing interest, affected outcomes, owner, trigger, and proposed treatment.
- USEQ-D5248200 — Prioritize debt using risk and cost of delay rather than age or developer preference alone.
- USEQ-0730A9EE — Do not label deliberate, understood trade-offs as debt unless they create a future obligation or cost.
- USEQ-64A92D0D — Remove dead code, stale flags, unused APIs, obsolete compatibility paths, abandoned migrations, and unsupported versions.
- USEQ-745499A4 — Prove absence of consumers before deleting externally or asynchronously consumed behavior.
- USEQ-2CB162C9 — Use telemetry, repository search, contracts, and consumer confirmation to support deprecation decisions.
- USEQ-C46562AC — Provide migration guidance and sufficient notice for supported consumers.
- USEQ-68AF1C3C — Keep rollback or restore paths until deletion risk is acceptably low.
- USEQ-A4F02E4C — Decommission secrets, jobs, queues, storage, dashboards, alerts, and documentation associated with deleted code.
- USEQ-98563D35 — Ensure replacement code does not reproduce the same hidden assumptions or defects.
- USEQ-9D06A061 — Measure whether refactoring improved the intended quality outcome.
- USEQ-FB8113ED — Capture recurring causes in standards, tooling, architecture, and training.
AI-generated, synthesized, copied, and externally sourced code¶
- USEQ-F0F5ACE7 — Treat generated or suggested code as untrusted input requiring the same ownership, review, testing, security, licensing, and provenance as handwritten code.
- USEQ-4DB2AD50 — Never merge code solely because a tool reports confidence or compilation success.
- USEQ-30E40C42 — Verify every referenced API, package, version, algorithm, security control, and configuration against authoritative documentation.
- USEQ-A8DCB48D — Check for hallucinated, abandoned, malicious, typosquatted, or inappropriate dependencies.
- USEQ-29B0FA93 — Check generated code for copied protected material, incompatible licensing, missing attribution, and confidential-source leakage.
- USEQ-361CFE54 — Do not provide secrets, personal data, proprietary code, customer data, or restricted artifacts to an unapproved model or service.
- USEQ-0174E68B — Ensure generated tests assert required behavior rather than simply mirroring generated implementation.
- USEQ-A036EF8F — Use independent reviewers or tools for high-risk generated code rather than relying on the same model to validate itself.
- USEQ-D973EED1 — Check generated code for insecure defaults, missing error paths, unbounded resource use, concurrency defects, and fabricated edge-case handling.
- USEQ-F1392D49 — Retain sufficient provenance to identify tool, model, version, context, author, reviewer, and affected code where policy requires it.
- USEQ-183D2712 — Prevent autonomous agents from merging, deploying, changing permissions, rotating secrets, or modifying production without enforced authorization and gates.
- USEQ-EA441182 — Sandbox code execution and restrict network, filesystem, credentials, and tool permissions.
- USEQ-090DA6D3 — Monitor whether AI assistance increases change size, rework, vulnerabilities, incidents, review burden, or dependency growth.
- USEQ-F3FCECA7 — Do not use productivity metrics to pressure engineers into accepting unreviewed generated code.
- USEQ-FFBABB8B — Keep human accountability with the person and organization approving the change.
- USEQ-97DE9743 — Reevaluate generated code after model, prompt, plugin, or policy changes that can alter output risk.
Code-quality release blockers and final evidence¶
- USEQ-B1D30269 — Block release when critical behavior lacks a testable contract or acceptance criterion.
- USEQ-F85696BF — Block release when a known invariant violation, data corruption path, authorization bypass, unsafe duplicate effect, or unreconciled financial discrepancy remains possible.
- USEQ-59868E58 — Block release when the implementation relies on unsupported runtime behavior or an unreviewed high-risk dependency.
- USEQ-447C9B3C — Block release when critical warnings, analyzer findings, failed tests, or suppressions lack evidence-based disposition.
- USEQ-27CDEDEA — Block release when resource bounds, timeout, retry, cancellation, or failure behavior is unknown for a critical path.
- USEQ-243EC747 — Block release when a migration or state transition can leave irreversible ambiguous state without a tested recovery.
- USEQ-8EF0D6E8 — Block release when generated or copied code lacks ownership, license provenance, or sufficient review.
- USEQ-8D4964EC — Block release when production diagnostics cannot distinguish success, expected failure, dependency failure, and invariant violation.
- USEQ-B642E26A — Attach source revision, build provenance, dependency lock, configuration schema, analysis reports, review approvals, test results, benchmark results, and known-risk register to the release evidence.
- USEQ-C70D0E0F — Record which code-quality controls were automated, manually reviewed, formally verified, sampled, or not applicable.
- USEQ-64378ECF — Record residual limitations and the conditions under which evidence becomes stale.
- USEQ-4C2E2D56 — Confirm that the deployed artifact matches the reviewed and tested artifact.
- USEQ-D84E91AD — Confirm that rollback or roll-forward preserves data and compatibility assumptions.
- USEQ-A4761631 — Confirm that owners and operational responders understand the critical invariants and diagnostic signals.
Standards and source references¶
- ISO/IEC 25010:2023 — Product quality model
- ISO/IEC/IEEE 29148:2018 — Requirements engineering
- ISO/IEC/IEEE 29119-4:2021 — Test techniques
- OWASP Application Security Verification Standard 5.0.0
- OWASP Top 10 — 2025
- OWASP Web Security Testing Guide 4.2
- ISO/IEC/IEEE 12207:2026 — Software life cycle processes
- ISO/IEC 5055:2021 — Automated source code quality measures
- ISO/IEC 20246:2017 — Work product reviews
- ISO/IEC/IEEE 42010:2022 — Architecture description
- ISO/IEC 27001:2022 — Information security management systems
- NIST SP 800-218 v1.1 — Secure Software Development Framework
- SLSA Specification 1.2
- OpenSSF Security Baseline and Best Practices
- SPDX 3.0.1 / ISO/IEC 5962:2021
- ISO/IEC/IEEE 29119-2:2021 — Test processes
- IEEE Computer Society SWEBOK v4
- SEI secure development resources
Previous phase · Next: Phase 6: Application services and APIs