Skip to content

Rules

Rules are the third pillar of Lytos: Standards.

Rules define what “well done” means. They are verifiable criteria, not vague recommendations.

“What can’t be verified won’t be respected.” An AI agent reads them before every task and applies them without exception.

Lytos ships with default-rules.md covering:

RuleThreshold
Maximum file size300 lines
Maximum function size30 lines (50 max)
Maximum nesting3 levels
Parameters per function4 max
  • Mandatory docstrings on every public function
  • Inline comments only to explain the why, never the what
ForbiddenReplacement
Magic numbersNamed constant (MAX_RETRIES, SECONDS_PER_DAY)
Hardcoded URLsEnvironment variable or config file
Hardcoded colorsCSS variable or theme constant
  • No silent failures — every error must be handled explicitly
  • No empty catch blocks
  • Clear error messages: what failed and why
RuleThreshold
Unit test coverage80% of public functions minimum
Tests for every new featureMandatory before merge
Tests for every fixMust prove the bug doesn’t recur
  • No secrets in code — API keys, tokens, passwords in .env only
  • User inputs escaped — protection against injection, XSS
  • Dependencies up to date — no known vulnerabilities
  • Commit format: type(scope): message
  • Branch per issue: type/ISS-XXXX-slug
  • No direct push to main — everything through PR

Create additional files in rules/ to complement the defaults:

rules/
├── default-rules.md # Universal (ships with Lytos)
└── api-rules.md # Your project-specific rules

Project-specific rules complement the defaults — they do not replace them.