frappe-core-database

Standardize ERPNext database operations with ORM, parameterized SQL, and transaction handling.

163|53|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/OpenAEC-Foundation/Frappe_Claude_Skill_Package --skill frappe-core-database
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frappe-core-database
Source: https://github.com/OpenAEC-Foundation/Frappe_Claude_Skill_Package/tree/main/skills/source/core/frappe-core-database
Command: npx skills add https://github.com/OpenAEC-Foundation/Frappe_Claude_Skill_Package --skill frappe-core-database

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

ERPNext/Frappe database operations across v14–v16 can be error-prone and unsafe if not standardized. This skill provides best practices for using frappe.db, ORM patterns, raw SQL with parameterization, caching strategies, and transaction handling to ensure robust, high-performance data access.

Core Features & Use Cases

  • Standardized patterns for common database tasks (read, write, update, delete) with proper permission handling and error checking.
  • Clear guidance on when to use ORM vs raw SQL vs the Query Builder, including performance-focused strategies and caching.
  • Real-world usage examples covering get_value/get_list, bulk updates, transaction control, and safe SQL patterns for ERPNext apps.

Quick Start

Begin by reviewing core database patterns and integrating safe, scalable operations into your Frappe ERPNext codebase.

Frequently Asked Questions about frappe-core-database

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write safe database queries in Frappe to prevent SQL injection?

Safe Frappe database queries require parameterized SQL and standardized ORM patterns to prevent injection. This skill enforces parameterization for raw SQL and proper use of frappe.db methods to ensure high-integrity data access across v14–v16.

When should I use the Frappe ORM vs raw SQL in ERPNext?

Use the Frappe ORM for standard CRUD operations to maintain permission handling, and use parameterized raw SQL only for performance-critical or complex queries. This skill provides clear guidance on choosing ORM, raw SQL, or the Query Builder.

How do I handle transactions safely in ERPNext custom apps?

Proper transaction handling in ERPNext requires standardized control mechanisms for commits and rollbacks. This skill details transaction management practices to ensure robust data consistency and prevent partial updates during bulk operations.

What's the best way to optimize Frappe database performance and caching?

Optimizing Frappe database performance involves strategic caching and selecting efficient read patterns like get_value or get_list. This skill provides performance-focused strategies and caching guidance to scale ERPNext data access safely.

Does this Frappe database approach work across ERPNext v14, v15, and v16?

Yes, these standardized database operations are explicitly designed for compatibility across ERPNext v14 through v16. The skill enforces safe query and transaction practices that apply universally to code using frappe.db within these versions.