frappe-performance-optimizer

Frappe Performance Optimizer

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "frappe-performance-optimizer" with this command: npx skills add venkateshvenki404224/frappe-apps-manager/venkateshvenki404224-frappe-apps-manager-frappe-performance-optimizer

Frappe Performance Optimizer

Generate performance-optimized code including efficient queries, caching strategies, and database indexes for Frappe applications.

When to Use This Skill

Claude should invoke this skill when:

  • User reports slow queries or performance issues

  • User wants to add caching

  • User needs database indexing

  • User mentions performance, optimization, or slow queries

  • User wants to eliminate N+1 queries

Capabilities

  1. Query Optimization

Optimized Report Query:

Efficient query with proper indexing

def get_sales_summary(from_date, to_date): return frappe.db.sql(""" SELECT si.customer, c.customer_name, c.customer_group, COUNT(si.name) as invoice_count, SUM(si.grand_total) as total_amount FROM tabSales Invoice si INNER JOIN tabCustomer c ON c.name = si.customer WHERE si.posting_date BETWEEN %s AND %s AND si.docstatus = 1 GROUP BY si.customer ORDER BY total_amount DESC LIMIT 100 """, (from_date, to_date), as_dict=True)

Add index for performance

frappe.db.add_index('Sales Invoice', ['customer', 'posting_date', 'docstatus'])

  1. Caching Implementation

Cache Expensive Calculations:

def get_item_price(item_code, price_list, customer=None): """Get price with caching""" cache_key = f"price:{item_code}:{price_list}:{customer or 'default'}"

# Try cache
cached_price = frappe.cache().get_value(cache_key)
if cached_price is not None:
    return cached_price

# Calculate price (expensive)
price = frappe.db.get_value('Item Price',
    filters={'item_code': item_code, 'price_list': price_list},
    fieldname='price_list_rate'
)

# Cache for 1 hour
if price:
    frappe.cache().set_value(cache_key, price, expires_in_sec=3600)

return price

3. Batch Operations

Bulk Update Pattern:

def bulk_update_items(updates): """Update multiple items efficiently""" # updates = [{'item_code': 'ITEM-001', 'is_active': 1}, ...]

# Build single query
item_codes = [u['item_code'] for u in updates]

frappe.db.sql("""
    UPDATE `tabItem`
    SET is_active = 1,
        modified = NOW(),
        modified_by = %s
    WHERE name IN %s
""", (frappe.session.user, tuple(item_codes)))

frappe.db.commit()

References

Performance Examples:

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

frappe-api-handler

No summary provided by upstream source.

Repository SourceNeeds Review
General

frappe-report-generator

No summary provided by upstream source.

Repository SourceNeeds Review
General

ai-image-generator

AI 图片与视频异步生成技能,调用 AI Artist API 根据文本提示词生成图片或视频,自动轮询直到任务完成。 ⚠️ 使用前必须设置环境变量 AI_ARTIST_TOKEN 为你自己的 API Key! 获取 API Key:访问 https://staging.kocgo.vip/index 注册登录后创建。 支持图片模型:SEEDREAM5_0(默认高质量图片)、NANO_BANANA_2(轻量快速)。 支持视频模型:SEEDANCE_1_5_PRO(文生视频,支持音频)、SORA2(文生视频或首尾帧图生视频,支持 firstImageUrl/lastImageUrl)。 触发场景: - 用户要求生成图片,如"生成一匹狼"、"画一只猫"、"风景画"、"帮我画"等。 - 用户要求生成视频,如"生成视频"、"用 SORA2 生成"、"文生视频"、"图生视频"、"生成一段...的视频"等。 - 用户指定模型:SEEDREAM5_0、NANO_BANANA_2、SEEDANCE_1_5_PRO、SORA2。

Archived SourceRecently Updated
General

淘宝投放数据分析

# 投放数据分析技能

Archived SourceRecently Updated