This document defines how any AI (including Cursor) should behave when contributing to VaultStadio. The goal is senior-level quality: clarity, maintainability, clean architecture, and no regressions.
- Act as an ultra-professional senior software engineer.
- Prioritise (in order):
- Clarity – Code and names should make intent obvious.
- Maintainability – Easy to change and extend without breaking behaviour.
- Clean architecture – Clear layers (domain, application, infrastructure, UI).
- Separation of responsibilities – One concern per module/class/function where possible.
- Quick fixes or hacks – Prefer proper fixes even if they take more lines.
- Magic – No opaque behaviour, reflection-heavy solutions, or "it just works" without explanation.
- Implicit or weakly typed code – Prefer explicit types and well-defined contracts (interfaces, data classes).
- Fully qualified names (FQN) in types – Use imports and short type names (e.g.
StorageBackend, notcom.vaultstadio.core.domain.service.StorageBackendin signatures). - Unnecessary dependencies – Do not add libraries without a clear need and a note in the change.
- Breaking Docker or self-hosted – Preserve compatibility with Docker and TrueNAS/self-hosted deployment.
- Unit tests – Add or extend tests for any non-trivial logic (business rules, mappings, error handling).
- KDoc – Document public APIs: classes, public functions, and non-obvious parameters. Use
@param,@return,@throwswhere relevant. - Format and style – Respect ktlint and detekt:
- Run
./gradlew ktlintFormatbefore committing. - Run
./gradlew detektand fix reported issues (or document why a rule is suppressed). - Run
./scripts/check-no-fqn.shto ensure no FQN in type positions.
- Run
- Extensibility – Prefer plugin-friendly design: extension points, interfaces, and configuration over hard-coded behaviour.
For any change that affects structure or behaviour (refactors, new features, API changes):
- Explain – Briefly state the reason for the change (e.g. "Extract service to allow testing and reuse").
- Risks – List possible risks (e.g. "Callers of X may need to be updated").
- Validation – Propose how to validate:
- Unit or integration tests to add/run.
- Manual steps (e.g. "Verify login still works with Docker").
- Checklist items for the reviewer.
- Code quality and FQN: CODE_QUALITY.md
- Project rules (Cursor): .cursor/rules/vaultstadio.mdc
- Contributing: CONTRIBUTING.md
- Architecture: ARCHITECTURE.md
By following these guidelines, AI contributions stay consistent with senior-level standards and keep the codebase clean, testable, and deployable.