About odoo-best-practices
odoo-best-practices is a guidance skill for building, extending, and reviewing Odoo modules for versions 18–20. It emphasizes ORM-based development, safe extensions, security, and focused references for specific tasks.
Key features
- 01Odoo 18–20 module guidance
- 02Favor extensions over core modifications
- 03ORM and access-control practices
- 04Routing to topic-specific references
- 05Guidance for testing and performance
Use cases
- 01Design a custom Odoo module
- 02Review model and access-rule implementations
- 03Build or inherit XML views and OWL components
- 04Prepare tests or optimize ORM queries
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ mercatorproj/ odoo-best-practices --skill odoo-best-practicesAfter installing, type/odoo-best-practicesin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
LICENSEREADME.mdagents/openai.yamlreferences/official-docs.mdfrontend-architecture.mdmodule-architecture.mddev-environment.mdproject-roadmap.mdexternal-api.mdorm-patterns.mdtesting-performance.mdtesting.mdsecurity-i18n.mdviews-owl.mdDetails
From the project READMEOdoo Best Practices
Apply these practices when building, extending, or reviewing Odoo modules targeting versions 18-20. The guidance assumes Odoo 20.0 conventions unless the user specifies an older version.
Design Philosophy
These rules exist to uphold Odoo's core design philosophy:
- Everything is a module — even Enterprise features are just modules stacked on top of Community.
- Data is the program — views, actions, menus, and security rules are database records; XML data files install them.
- Extend, never modify — model
_inherit, xpath view inheritance, QWeb inheritance; a pristine core upgrades cleanly. - XML IDs are the glue —
module.xml_idis the global namespace;dependsbehaves like a system package manager. - Convention over configuration — names map automatically to tables, columns, and UI; follow the naming conventions.
- The ORM is the API and the security boundary — public methods are RPC-exposed; raw SQL bypasses security.
- Integrated by design — one database, shared base models; OWL is the presentation-tier direction.
When in doubt, choose the option that keeps future upgrades safe and stays within the ORM.
Core Rules
- Never modify core modules. Always extend via
_inheritin a custom module. - Every new model must define
_descriptionand have access rules inir.model.access.csv. - Use
api.onchangefor UI-only validation andapi.constrainsfor database-level invariants. - Prefix custom module names with a vendor or project namespace (e.g.,
mycompany_feature) to avoid collisions. - Set
versionin__manifest__.pyto match the Odoo series (e.g.,20.0.1.0.0). - Mark user-facing strings with
_()for translation support. - Use recordset methods (
mapped,filtered,sorted) over Python loops when possible to leverage ORM prefetch. - Prefer
sudo()sparingly; always document why elevated access is needed. - Never concatenate domains from user input; use the
Domainobject (domain &= Domain(...)) to prevent injection. - Use
models.Constraint/models.Index(Odoo 20+) instead of legacy_sql_constraints.
Routing
Read the relevant reference when the task touches that area. Do not load all references by default.
- Module setup, manifest, migration: read references/module-architecture.md.
- External JSON-2 API integration, API keys, RPC transactions: read references/external-api.md.
- Model definitions, computed fields, constraints, recordsets: read references/orm-patterns.md.
- XML views, view inheritance, OWL components, frontend assets: read references/views-owl.md.
- Web client architecture, contexts, py_js, JS Domain class: read references/frontend-architecture.md.
- Access rules, record rules, multi-company, translations: read references/security-i18n.md.
- Test framework, performance patterns, query optimization: read references/testing-performance.md.
- Dev environment setup, source install, odoo-bin, config, scaffolding, running the server: read references/dev-environment.md.
- Official documentation index (tutorials, reference, howtos, install, guidelines): read references/official-docs.md.