- name
- librarian-indexer
- description
- Meta-skill that indexes, optimizes, and auto-generates Claude skills with GitOps automation, OCA GitHub bot integration, and Odoo developer tools. Use for skill creation, CI/CD workflows, OCA module management, and advanced Odoo development.
# Librarian Indexer Skill v2.0
## Purpose
Advanced meta-skill that combines knowledge base optimization, skill auto-generation, GitOps automation, OCA GitHub bot workflows, and Odoo developer mode expertise for maximum development efficiency.
## Version History
```yaml
v2.0.0 (2025-10-30):
added:
- GitOps expertise (CI/CD, GitHub Actions)
- OCA GitHub bot integration and commands
- Odoo Developer Mode tools and techniques
- Automated workflow patterns
- Advanced debugging capabilities
v1.0.0 (2025-10-30):
- Initial release
- Core skill templates
- Knowledge base optimization
- Skill taxonomy
```
## Core Functions
### 1. Skill Taxonomy & Indexing
Automatically catalog all skills with metadata:
- **Category**: Technical, Business, Integration, Domain-Specific
- **Dependencies**: Which skills/tools/APIs this skill relies on
- **Cross-references**: Related skills, overlapping functionality
- **Complexity**: Beginner, Intermediate, Advanced, Expert
- **Update frequency**: Static knowledge vs. rapidly evolving domains
- **GitOps**: CI/CD pipeline requirements, automated testing
### 2. GitOps Expertise
#### CI/CD Pipeline Architecture
```yaml
github_actions_workflows:
module_testing:
name: "Test Odoo Module"
trigger: [push, pull_request]
steps:
- checkout_code
- setup_odoo_environment
- install_dependencies
- run_unit_tests
- run_integration_tests
- generate_coverage_report
best_practices:
- Use OCA's maintainer-tools for testing
- Test against multiple Odoo versions
- Cache dependencies for speed
- Fail fast on critical errors
docker_build_push:
name: "Build and Push Docker Image"
trigger: [push_to_main, release]
steps:
- checkout_code
- setup_docker_buildx
- login_to_registry
- build_multi_arch_image # AMD64, ARM64
- push_to_dockerhub
- create_github_release
best_practices:
- Use multi-stage builds
- Tag with version + latest
- Sign images for security
- Use BuildKit for caching
oca_bot_integration:
name: "OCA Bot Automated Workflows"
trigger: [pull_request_review, schedule]
commands:
- /ocabot merge [major|minor|patch|nobump]
- /ocabot rebase
- /ocabot migration <module_name>
automation:
- Auto-generate README.rst from fragments
- Auto-generate addon icons
- Auto-update setup.py
- Auto-approve with 2+ approvals
- Auto-merge after 5 days + green CI
deployment_pipeline:
name: "Deploy to Production"
trigger: [release, manual_dispatch]
environments: [staging, production]
steps:
- run_all_tests
- build_docker_image
- push_to_registry
- deploy_to_staging
- run_smoke_tests
- manual_approval
- deploy_to_production
- rollback_on_failure
```
#### Git Workflow Patterns
```bash
# OCA-compliant Git workflow
# 1. Fork and clone
git clone https://github.com/YOUR_USERNAME/OCA_REPO.git
cd OCA_REPO
git remote add upstream https://github.com/OCA/OCA_REPO.git
# 2. Create feature branch from target version
git checkout -b 19.0-feat-new-feature origin/19.0
# 3. Make changes following OCA conventions
# - One commit per logical change
# - Conventional commit messages: feat:, fix:, docs:, etc.
# - Sign commits: git commit -s
# 4. Pre-commit hooks (OCA maintainer-tools)
pre-commit install
pre-commit run --all-files
# 5. Push and create PR
git push origin 19.0-feat-new-feature
# Create PR via GitHub UI targeting OCA/19.0
# 6. Use OCA bot commands in PR
# /ocabot merge minor (auto-merge with version bump)
# /ocabot rebase (rebase on target branch)
# /ocabot migration module_name (track migration)
# 7. After merge, sync fork
git checkout 19.0
git fetch upstream
git merge upstream/19.0
git push origin 19.0
```
#### GitHub Actions Templates
```yaml
# .github/workflows/test.yml
name: Test Odoo Modules
on:
push:
branches: [19.0, 18.0]
pull_request:
branches: [19.0, 18.0]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
odoo-version: ['19.0']
python-version: ['3.11']
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
- name: Install OCA maintainer-tools
run: |
git clone https://github.com/OCA/maintainer-tools.git
cd maintainer-tools
pip install -r requirements.txt
- name: Install Odoo
run: |
git clone --depth=1 --branch=${{ matrix.odoo-version }} https://github.com/odoo/odoo.git
pip install -r odoo/requirements.txt
- name: Install module dependencies
run: |
# Auto-detect and install OCA dependencies
python maintainer-tools/tools/install_odoo_modules.py
- name: Run tests
run: |
export ODOO_RC=/dev/null
python -m pytest tests/ --cov=. --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
# .github/workflows/dockerhub-publish.yml
name: Build and Push Docker Image
on:
push:
branches: [main]
tags: ['v*']
release:
types: [published]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: yourorg/insightpulse-odoo
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
```
### 3. OCA GitHub Bot Integration
#### Bot Commands
```bash
# Available commands in OCA repositories
# Merge with version bump
/ocabot merge major # Breaking changes (1.0.0 -> 2.0.0)
/ocabot merge minor # New features (1.0.0 -> 1.1.0)
/ocabot merge patch # Bug fixes (1.0.0 -> 1.0.1)
/ocabot merge nobump # No version change (tests, docs)
# Rebase PR on target branch
/ocabot rebase
# Track module migration
/ocabot migration account_payment_order
# Links PR to migration issue for version tracking
# Bot will automatically:
# ✅ Merge when CI is green and approved
# ✅ Bump version in __manifest__.py
# ✅ Update CHANGELOG with oca-towncrier
# ✅ Generate wheels and upload to PyPI
# ✅ Run all post-merge operations
```
#### Bot Automated Operations
**Webhooks (Real-time)**:
```yaml
on_pull_request_opened:
- mention_maintainers # @-mention addon maintainers
- call_for_maintainers # If no maintainers, ask for volunteers
on_pull_request_approved:
- set_approved_label # When 2+ approvals
- set_ready_to_merge_label # When >5 days old
on_ci_success:
- set_needs_review_label # Unless "wip:" in title
on_merge:
- delete_pr_branch # Auto-cleanup
- bump_version # If requested
- update_changelog # With oca-towncrier
- generate_wheel # Upload to PyPI
```
**Scheduled Tasks (Nightly)**:
```yaml
daily_maintenance:
- update_readme_table # Addons table in README.md
- generate_addon_readme # From readme/ fragments
- generate_addon_icons # Default OCA icon if missing
- update_setup_py # Via setuptools-odoo-make-defaults
- generate_wheels # For all addons
- upload_to_pypi # Or rsync to PEP 503 index
```
#### Setting Up OCA Bot for Your Org
```bash
# 1. Clone and configure
git clone https://github.com/OCA/oca-github-bot.git
cd oca-github-bot
# 2. Create .env file
cp environment.sample .env
# Edit .env with your settings:
GITHUB_TOKEN=ghp_xxxxx # GitHub PAT with repo access
GITHUB_SECRET=your_webhook_secret
BOT_TASKS=all # Or specific tasks
BOT_TASKS_DISABLED= # Tasks to disable
# 3. Docker Compose deployment
docker-compose up -d
# Services started:
# - Bot webhook server (port 8080)
# - Celery worker (task processor)
# - Celery beat (scheduler)
# - Flower (monitoring at port 5555)
# - Redis (message queue)
# 4. Configure GitHub webhook
# URL: https://your-bot-url.com/webhooks
# Content type: application/json
# Secret: [value from GITHUB_SECRET]
# Events: All or specific (pull_request, push, etc.)
# 5. Test locally with ngrok
ngrok http 8080
# Use ngrok URL for GitHub webhook during development
```
#### Custom Bot Tasks
```python
# src/oca_github_bot/tasks/custom_validation.py
from celery import task
from ..github import gh_call
@task()
def validate_module_structure(org, repo, pr_number):
"""Custom task: Validate Odoo module structure"""
# Get PR files
files = gh_call(f'repos/{org}/{repo}/pulls/{pr_number}/files')
required_files = [
'__manifest__.py',
'__init__.py',
'README.rst',
'security/ir.model.access.csv'
]
for module_path in detect_modules(files):
missing = []
for req_file in required_files:
if not file_exists(module_path, req_file):
missing.append(req_file)
if missing:
# Post comment on PR
gh_call(
f'repos/{org}/{repo}/issues/{pr_number}/comments',
method='POST',
data={
'body': f'⚠️ Module `{module_path}` is missing: {", ".join(missing)}'
}
)
return False
return True
```
### 4. Odoo Developer Mode
#### Activation Methods
```python
# Method 1: Settings app
# Settings → Developer Tools → Activate the developer mode
# Method 2: URL parameter
https://example.odoo.com/odoo?debug=1 # Standard mode
https://example.odoo.com/odoo?debug=assets # With JS assets
https://example.odoo.com/odoo?debug=tests # With test tours
https://example.odoo.com/odoo?debug=0 # Deactivate
# Method 3: Command palette (Ctrl+K or Cmd+K)
# Type "debug" → select activation mode
# Method 4: Browser extension
# Chrome: https://chromewebstore.google.com/detail/odoo-debug/...
# Firefox: https://addons.mozilla.org/firefox/addon/odoo-debug/
```
#### Developer Mode Tools
**View Architecture:**
```python
# In any view, click "Developer Mode" menu
→ Edit View: Form / Tree / Kanban / etc.
→ View Fields: See all field definitions
→ View Metadata: Created, modified, version info
→ Manage Filters: Edit search filters
→ Edit Action: Modify window actions
→ Edit Workflow: (Legacy) View state transitions
# Access technical info on any field
→ Hover over field → See technical name
→ Right-click field → "View Field"
- Name: account_id
- Model: account.move
- Type: many2one
- Widget: many2one
- Required: True
- Readonly: False
```
**Database Tools:**
```python
# Technical Menu Access
Settings → Technical
# Key sections:
Database Structure/
├── Models # All Odoo models (res.partner, sale.order, etc.)
├── Fields # Field definitions across all models
├── Menu Items # Application menu structure
├── Views # Form, tree, kanban, search views
├── Actions # Window actions, server actions, reports
├── Translations # i18n strings
└── Parameters # System parameters (ir.config_parameter)
Sequences/
└── Sequences # Number sequences (SO001, INV/2024/0001, etc.)
Automation/
├── Scheduled Actions (Cron) # Background jobs
├── Automation Rules # Trigger-based automation
└── Server Actions # Python code execution
Security/
├── Users & Companies
├── Groups # Access groups
├── Access Rights # Model-level (ir.model.access)
├── Record Rules # Row-level security
└── Access Control Lists # File access
```
**Python Debugging:**
```python
# In Odoo shell or code
# 1. Enable debug mode programmatically
self.env.user.write({'debug': True})
# 2. Debug ORM queries
import logging
_logger = logging.getLogger(__name__)
# Log SQL queries
_logger.setLevel(logging.DEBUG)
self.env['sale.order'].search([('state', '=', 'draft')])
# SQL: SELECT "sale_order".id FROM "sale_order" WHERE ...
# 3. Inspect recordsets
order = self.env['sale.order'].browse(1)
_logger.info(f"Order: {order}")
_logger.info(f"Fields: {order.fields_get()}")
在 GitHub 查看