10. Conventions
The house rules for names, TypeScript, formatting, comments, docs, and commits.
Vocabulary
Names come from 1 coherent world, so you can guess them once you know the theme.
| Concept | Name | Why |
|---|---|---|
| The framework | Avelon | the isle where the wounded king is carried to rest and heal |
| CLI | reeve | the official who administers a place on behalf of its lord |
| Model layer | Scrivener | the one who writes the records |
| Row access rules | Ward | a thing kept under protection |
| Background work | Errand | a task sent out to be done elsewhere |
| Queue dashboard | Vigil | a watch kept |
| Debug and introspection | Lantern | see into a dark place |
| Realtime | Peal | bells carrying across a distance |
| API tokens | Signet | the seal that proves who sent it |
| Feature flags | Banner | raised or not |
| Architecture linter | Bailiff | the officer who keeps order |
| Test harness | Assay | to test a material for what it really is |
| Local environment | Hearth | where the work happens |
| Admin panel | Moot | the assembly where matters are settled |
Names not on this list are descriptive on purpose: Controllers, Models, Policies, Events, Listeners, Middleware, Requests.
A clever name costs every new reader time. It's only worth it where the concept is new.
Under a scope, none of these need availability checks. @avelonjs/scrivener is yours the moment the scope is.
TypeScript
strictplusnoUncheckedIndexedAccess.- No
anyin an exported signature.unknownplus a narrowing function is almost always right. anyis permitted only at a vendor boundary inside a driver package, with a comment naming what it bridges.- Prefer type inference at call sites and explicit types at boundaries.
- Every exported function annotates its return type.
interfacefor contracts,typefor unions and mapped types.- Const assertions on configuration and capability objects, because capability narrowing depends on literal types surviving.
- No enums. Use a union of string literals.
- Errors extend the framework taxonomy. Don't use a bare
throw new Error()in framework code.
Formatting
Prettier with the shipped config. It isn't configurable per project, because the point of shipping a config is that nobody spends a meeting on it.
{
"semi": false,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "all"
}
- Do not reformat files you are not otherwise changing.
- Do not open formatting-only pull requests.
Comments
Comment the non-obvious "why," never the "what."
// Bad
// Loop over the posts and map them to views
const views = posts.map(PostView.make)
// Good
// PostgREST caps embeds at two levels, so the third relation loads separately.
const comments = await Comment.query().whereIn('post_id', ids).get()
- A comment explaining a workaround must name what it is working around.
- A comment restating the code is deleted on sight.
Documentation Standard
Modeled on the register of yannelli/attempt:
- hierarchical sections
- progressive complexity
- method reference tables
- abundant realistic code
- instructional voice
Voice
Second person, present tense, instructional.
- Write: "You may configure the retry count with
tries." - Not: "the developer can optionally set."
- Not: "we recommend."
Structure
Every package README, in this order:
- Introduction. What it does and when to reach for it, in under 5 sentences.
- Installation. One command, plus any required configuration.
- Basic Usage. The smallest complete example that does something real.
- Feature sections. One per capability, ordered simple to advanced.
- Method Reference. A table of every public method, its signature, and a one-line description.
- Testing. How to test code that uses this package, including the fake.
Code Examples
Real and runnable:
- No
foo - No
doSomething() - No ellipses standing in for the interesting part
- Every example parses as TypeScript
Tables
Use them for method references, capability matrices, and option lists. Not for prose.
Enforcement
Packages read alike when the docs set a register and a lint pass holds it.
reeve make:package scaffolds the structure.
reeve docs:check fails a package when:
- a public export is missing from the Method Reference table
- a code block does not parse
- a required section is absent without an explicit waiver
The docs site consumes the same source, so a package README and its docs page can't drift.
Commits and Branches
- Conventional commits scoped to the package:
feat(orm): eager load via query IR - The pull request body states which checks passed
- Never commit
.env, a service role key, or a real project reference