// Generate an offline-first Progressive Web App with Odoo Studio backend integration. Use when user wants to create new Odoo-backed application, mentions "PWA with Odoo", "offline Odoo app", "Odoo Studio PWA", or similar terms. Supports SvelteKit, React, and Vue frameworks.
| name | create-odoo-pwa |
| description | Generate an offline-first Progressive Web App with Odoo Studio backend integration. Use when user wants to create new Odoo-backed application, mentions "PWA with Odoo", "offline Odoo app", "Odoo Studio PWA", or similar terms. Supports SvelteKit, React, and Vue frameworks. |
| allowed-tools | Read, Write, Glob, Bash |
Generate a production-ready Progressive Web App with Odoo Studio backend, featuring offline-first architecture, smart caching, and automatic synchronization.
This skill generates a complete PWA project following proven architectural patterns:
Ask the user for the following information before generating:
Project name (required)
Framework (required)
sveltekit (recommended), react, vuePrimary Odoo model (required)
x_ prefixx_inventory, user provides: inventoryx_ prefix in codeModel display name (required)
Deployment target (optional)
vercel, github-pages, cloudflare, netlifyCreate the project directory and initialize the structure:
mkdir {{PROJECT_NAME}}
cd {{PROJECT_NAME}}
Generate the appropriate structure based on framework:
src/ directoryGenerate these files using templates from skills/create-odoo-pwa/templates/{{FRAMEWORK}}/base/:
package.json - Dependencies including @sveltejs/kit, @vite-pwa/sveltekit, @sveltejs/adapter-staticsvelte.config.js - SvelteKit configuration with adapter-staticvite.config.js - Vite + PWA plugin configurationjsconfig.json or tsconfig.json - Path aliases and compiler optionspackage.json - Dependencies including React 18, Vite, vite-plugin-pwavite.config.js - React + PWA plugin configurationtsconfig.json - TypeScript configurationpackage.json - Dependencies including Vue 3, Vite, vite-plugin-pwavite.config.js - Vue + PWA plugin configurationtsconfig.json - TypeScript configurationCreate .env.example:
# Odoo Instance Configuration
ODOO_URL=https://your-instance.odoo.com
ODOO_DB=your-database-name
ODOO_USERNAME=your-username
ODOO_API_KEY=your-api-key
# Primary Model (use x_ prefix)
ODOO_PRIMARY_MODEL=x_{{MODEL_NAME}}
# Optional: For static hosting (GitHub Pages, etc.)
PUBLIC_API_URL=
Create .gitignore:
node_modules/
.env
dist/
build/
.svelte-kit/
.vercel/
.DS_Store
*.log
Generate these essential files from templates:
src/lib/odoo.js)Features:
callApi(action, data) - Core API communicationcreateRecord(model, fields) - Create recordssearchRecords(model, domain, fields) - Search/read recordsupdateRecord(model, id, values) - Update recordsdeleteRecord(model, id) - Delete recordsformatMany2one(id) - Format single relation fieldsformatMany2many(ids) - Format multi-relation fieldssrc/lib/db.js)Features:
add(), get(), getAll(), update(), remove()src/lib/stores/{{MODEL_NAME}}Cache.js)Features:
initialize() - Load cache and start background syncsync(forceFullRefresh) - Incremental sync with OdooforceRefresh() - Clear cache and full syncsrc/lib/{{MODEL_NAME}}Utils.js)Features:
src/routes/api/odoo/+server.jsFeatures:
execute(model, method, args, kwargs) helpercreate - Create new recordsearch - Search and read recordssearch_model - Search any Odoo modelupdate - Update existing recorddelete - Delete recordsrc/api/odoo.js (server endpoint)Similar functionality adapted to framework conventions
Generate starter components and pages:
src/routes/+layout.svelte - Root layout with navigationsrc/routes/+layout.js - SSR/CSR configuration (ssr: false, csr: true)src/routes/+page.svelte - Main form for creating recordssrc/routes/list/+page.svelte - List/table view with filteringsrc/app.html - HTML template with PWA meta tagsEquivalent component structure adapted to framework conventions
OfflineBanner - Shows online/offline statusSyncStatus - Displays sync state and last sync timeLoadingSpinner - Loading indicatorGenerate PWA files:
static/manifest.json (or public/manifest.json):{
"name": "{{PROJECT_NAME}}",
"short_name": "{{PROJECT_NAME}}",
"description": "{{MODEL_DISPLAY_NAME}} management app",
"start_url": "/",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#667eea",
"icons": [
{
"src": "/icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
Configure service worker in vite.config.js:
Generate deployment files based on target:
vercel.json):{
"buildCommand": "npm run build",
"outputDirectory": "build",
"framework": "sveltekit",
"regions": ["iad1"]
}
.github/workflows/deploy.yml):name: Deploy to GitHub Pages
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm ci
- run: npm run build
- uses: actions/upload-pages-artifact@v2
with:
path: build
Generate appropriate configuration files
Generate comprehensive documentation:
README.md:CLAUDE.md:Complete architecture documentation following the expense-split-pwa pattern:
API.md:After generating all files, provide the user with:
✅ Project '{{PROJECT_NAME}}' generated successfully!
📋 Next Steps:
1. Navigate to the project:
cd {{PROJECT_NAME}}
2. Install dependencies:
npm install
3. Configure Odoo credentials:
cp .env.example .env
# Edit .env with your Odoo instance details
4. Create Odoo Studio Model:
- Log into your Odoo instance
- Go to Studio
- Create a new model named: x_{{MODEL_NAME}}
- Add custom fields with x_studio_ prefix
- Example fields:
* x_name (Char) - Required
* x_studio_description (Text)
* x_studio_value (Float)
* x_studio_date (Date)
* x_studio_category (Many2one → res.partner or custom)
5. Start development server:
npm run dev
6. Generate PWA icons:
- Create 192x192 and 512x512 PNG icons
- Place in static/ or public/ directory
- Name them icon-192.png and icon-512.png
7. Deploy (optional):
- Vercel: vercel
- GitHub Pages: Push to main branch
- Cloudflare: wrangler deploy
- Netlify: netlify deploy
📚 Documentation:
- README.md - Getting started guide
- CLAUDE.md - Architecture documentation
- API.md - Odoo integration patterns
🔗 Resources:
- Odoo API Docs: https://www.odoo.com/documentation/
- SvelteKit Docs: https://kit.svelte.dev/
When generating files, replace these placeholders:
{{PROJECT_NAME}} - User's project name (kebab-case){{MODEL_NAME}} - Odoo model name without x_ prefix{{MODEL_DISPLAY_NAME}} - Human-readable model name{{FRAMEWORK}} - sveltekit/react/vue{{DEPLOYMENT_TARGET}} - vercel/github-pages/cloudflare/netlify{{AUTHOR_NAME}} - User's name (if provided)This skill implements proven patterns from the expense-split-pwa project:
id > lastRecordIdIf generation fails:
$state, $derived, $effect)ssr: false for client-side only apps$app/paths for base path supportAfter generation, verify:
npm install completes without errorsnpm run dev starts development serverFor issues or questions: