principles
Engineering principles indexed as one-liners: safety and correctness, design and architecture, composition and interfaces, code structure, performance, visibility. Use when writing new code, reviewing a diff, or justifying a design choice.
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- principles
- description
- Engineering principles indexed as one-liners: safety and correctness, design and architecture, composition and interfaces, code structure, performance, visibility. Use when writing new code, reviewing a diff, or justifying a design choice.
- user-invocable
- false
02 资源文件 31
- 参考文档references/assertions.md2.0 KB
- 参考文档references/avoid-duplication.md2.1 KB
- 参考文档references/batching.md2.2 KB
- 参考文档references/bounds.md1.9 KB
- 参考文档references/clarity.md1.3 KB
- 参考文档references/composition.md1.5 KB
- 参考文档references/control-flow-structure.md1.8 KB
- 参考文档references/diversity.md1.7 KB
- 参考文档references/economy.md1.8 KB
- 参考文档references/explicit-control-flow.md2.1 KB
- 参考文档references/explicit-options.md1.9 KB
- 参考文档references/extensibility.md1.8 KB
- 参考文档references/foundational-axioms.md2.1 KB
- 参考文档references/function-length.md1.8 KB
- 参考文档references/generation.md1.5 KB
- 参考文档references/layered-architecture.md4.3 KB
- 参考文档references/least-surprise.md1.6 KB
- 参考文档references/mechanical-sympathy.md2.2 KB
- 参考文档references/modularity.md1.3 KB
- 参考文档references/naming.md4.1 KB
- 参考文档references/optimization.md1.9 KB
- 参考文档references/parsimony.md1.5 KB
- 参考文档references/pr-etiquette.md2.5 KB
- 参考文档references/repair.md1.9 KB
- 参考文档references/representation.md1.6 KB
- 参考文档references/safety-priority.md1.7 KB
- 参考文档references/scope-minimization.md1.8 KB
- 参考文档references/separation.md1.5 KB
- 参考文档references/silence.md1.6 KB
- 参考文档references/simplicity.md1.9 KB
- 参考文档references/transparency.md1.4 KB
03 SKILL.md 正文
When to use
New code is about to be written, or a diff is about to be reviewed; two designs have to be chosen between; a function is growing past what one screen holds; an error path, a limit, a default, or a boundary is being decided; a name, an abbreviation, or a magic literal is in question; or someone asks why the code is shaped the way it is.
How to Use
Scan index below to apply principles.
Pull relevant references/ file(s) for rationale, corollaries, and guards.
Foundational context is in references/foundational-axioms.md.
Safety & Correctness
| Principle | One-liner | Reference |
|---|---|---|
| Safety Priority | Order: Safety → Performance → Developer Experience. | references/safety-priority.md |
| Assertions | Assert preconditions, postconditions, and invariants; cover positive and negative space. | references/assertions.md |
| Bounds | Put a limit on everything: loops, queues, buffers, events. | references/bounds.md |
| Repair | Handle all errors. When you must fail, fail noisily and fast. | references/repair.md |
| Explicit Control Flow | Execution paths must be visible and traceable; no implicit branching or dispatch. | references/explicit-control-flow.md |
Design & Architecture
| Principle | One-liner | Reference |
|---|---|---|
| Simplicity | Minimise internal structural complexity; add it only where demonstrated necessity demands. | references/simplicity.md |
| Parsimony | Minimise program scope and feature count; build only what demonstrated need requires. | references/parsimony.md |
| Separation | Separate policy from mechanism; separate interfaces from engines. | references/separation.md |
| Representation | Fold knowledge into data so logic can be stupid and robust. | references/representation.md |
| Avoid Duplication | No duplicate state; no aliases that can desynchronize. | references/avoid-duplication.md |
Composition & Interfaces
| Principle | One-liner | Reference |
|---|---|---|
| Modularity | Simple parts, clean interfaces. | references/modularity.md |
| Composition | Design to be connected with other programs. | references/composition.md |
| Least Surprise | In interface design, always do the least surprising thing. | references/least-surprise.md |
| Extensibility | Design for the future, because it will be here sooner than you think. | references/extensibility.md |
| Explicit Options | Pass options explicitly at call sites; never rely on defaults you don't own. | references/explicit-options.md |
Code Structure
| Principle | One-liner | Reference |
|---|---|---|
| Layered Architecture | Interface (thin), Logic (side effects), Helper (pure / single effect, primitives only). | references/layered-architecture.md |
| Clarity | Clarity over cleverness. | references/clarity.md |
| Function Length | Hard limit: 25 logical lines of code, excluding comments. | references/function-length.md |
| Control Flow Structure | Organise branching and iteration across the call hierarchy: ifs up, fors down. | references/control-flow-structure.md |
| Scope Minimization | Declare variables at the smallest scope; check them close to where they're used. | references/scope-minimization.md |
| Naming | Never abbreviate. Descriptive, unambiguous, pronounceable, searchable. No magic literals. No type encodings. | references/naming.md |
Performance
| Principle | One-liner | Reference |
|---|---|---|
| Economy | Programmer time is expensive; solve problems early; zero technical debt. | references/economy.md |
| Optimization | Best wins come at design time. Prototype before polishing; measure before tuning. | references/optimization.md |
| Mechanical Sympathy | Design with awareness of the actual resource characteristics of your system. | references/mechanical-sympathy.md |
| Batching | Amortize expensive operations by grouping them. | references/batching.md |
Visibility & Process
| Principle | One-liner | Reference |
|---|---|---|
| Transparency | Design for visibility to make inspection and debugging easier. | references/transparency.md |
| Silence | When a program has nothing surprising to say, it should say nothing. | references/silence.md |
| Generation | Write programs to write programs; avoid hand-hacking repetition. | references/generation.md |
| Diversity | Distrust all claims for "one true way." | references/diversity.md |
| PR Etiquette | Small stacked PRs (<500 best, <1000 max), plain conventional titles, task-linked minimal descriptions, draft by default. | references/pr-etiquette.md |
04 同仓库更多 Skills
report-incident
Draft a terse GitHub issue for an incident in the Odoo dev suite (odoo-dev, odoo-orchestrator, dispatcher), with a current environment block and no private data. Files it only after you approve. Use when a tool or workflow failed.
odoo-upgrade
Plan and run code upgrades of custom Odoo modules between major versions (16.0→17.0→18.0→19.0). Use to migrate or port a module or addon, for breaking changes, a module inventory, or an upgrade estimate or plan.
odoo-upgrade-project
Human SOP for a whole Odoo upgrade project past the code port: staging database upgrade through upgrade.odoo.com, on-prem restore, cutover, go-live, support tickets and functional requirements. A planning reference.
odoo-test-run
Run an Odoo module's unit tests and HttpCase browser tours on a throwaway database and return machine-checkable evidence: tests executed, tours executed, failure lines. Use before a PR, after a fix, or when a green run never said how many tests ran.
odoo-task-env
Stand up the working environment for one Odoo task: find work that already exists, create or reuse an isolated git worktree on the task branch, bring a runnable stack up. Use at the START of implementing any task, and whenever one is picked back up.
odoo-session-db
Give one session its own throwaway test database name, so two sessions on one task in one project cannot land on the same database. Use before odoo-dev:odoo-test-run whenever more than one session can work in the same project, and when a test database vanished mid-run.