/frappe-apps-manager:frappe-database-ormfrom frappe-apps-manager
Provides Frappe ORM best practices for safe database reads/writes, raw SQL via parameterized queries, and preventing SQL injection and permission leaks.
Ships in frappe-apps-manager. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Prefer the ORM; drop to SQL only when needed, and only parameterized.
Cross-ref: frappe-syntax-query-builder (frappe.qb deep dive), frappe-errors-database (debugging).
| Need | API | Permissions |
|---|---|---|
| Full document | frappe.get_doc(dt, name) | Checks read |
| One field, fast | frappe.db.get_value(dt, name, field) | No check |
| List (server-side) | frappe.get_all(...) | Ignores user perms |
| List (user-facing) | frappe.get_list(...) | Enforces user perms |
| Single field write, no hooks | frappe.db.set_value(...) | No lifecycle |
| Full lifecycle write | doc.save() | Runs validate/hooks |
| Complex dynamic SQL | frappe.qb or %s parameterized SQL | — |
frappe.get_doc("Sales Order", "SO-0001") # full document (all children)
frappe.db.get_value("Sales Order", "SO-0001", "status") # one field, fast
frappe.db.get_value("Sales Order", {"customer": "ACME"}, ["name", "status"], as_dict=True)
frappe.get_all("Sales Order",
filters={"status": "Draft", "grand_total": [">", 1000]},
fields=["name", "customer", "grand_total"],
order_by="creation desc", limit=50)
frappe.get_list(...) # same, but enforces the current user's permissions
get_all ignores user permissions (use server-side); get_list enforces them (use for user-facing).
frappe.db.set_value("Sales Order", "SO-0001", "status", "Closed") # single field, no hooks
doc = frappe.get_doc("Sales Order", "SO-0001"); doc.status = "Closed"; doc.save() # runs validate/hooks
frappe.db.set_value("Sales Order", {"customer": "ACME"}, "hold", 1) # by filter
db.set_value skips controller hooks/validation — fast but bypasses business logic. doc.save()
runs the full lifecycle. Choose deliberately.
# RIGHT — %s placeholders
rows = frappe.db.sql("""
SELECT customer, SUM(grand_total) AS total
FROM `tabSales Order` WHERE status = %s AND company = %s
GROUP BY customer
""", ("Draft", company), as_dict=True)
# WRONG — string interpolation = SQL injection
frappe.db.sql(f"... WHERE name = '{name}'") # NEVER
Escape identifiers/values with frappe.db.escape(value) when you must build dynamically.
frappe.db.savepoint("before_bulk")
try:
...
frappe.db.commit()
except Exception:
frappe.db.rollback(save_point="before_bulk")
Web requests auto-commit on success / rollback on exception. Background jobs must commit explicitly.
Update many documents in one SQL statement — skips controller hooks/validation:
frappe.db.bulk_update(
"Task",
{
"TASK-0001": {"status": "Closed"},
"TASK-0002": {"status": "Open"},
},
chunk_size=200,
update_modified=True,
)
Use when you need speed and know lifecycle hooks are not required.
get_list / run=False changePrior to v16, run=False on get_list returned a SQL string. From v16 it returns a Query Builder object — call .get_sql() for the string or mutate before .run().
frappe.db.after_commit.add(my_func)
frappe.db.after_rollback.add(cleanup_func)
query = frappe.qb.get_query("Sales Order",
fields=["name", "customer.customer_name as customer_name",
{"items": ["item_code", "qty"]}],
filters={"docstatus": 1, "items.item_code": "ITEM-001"},
limit=50)
rows = query.run(as_dict=True)
Use ignore_permissions=False when the query serves user-facing data. Use for_update=True for row locking.
get_all(filters={"parent": ["in", names]}) instead of looping get_doc.fields you need — never pull whole docs to read one column.search_index: 1 on the field, or a migration).frappe.db.bulk_insert / batched set_value, and commit periodically.%-format values into frappe.db.sql — always %s params.get_all vs get_list — know which one applies permissions.db.set_value/db.delete skip hooks; use doc.save()/doc.delete() when lifecycle matters.frappe.db.commit() manually — exception: flush writes before enqueue_after_commit reads them.Contributed from sbknext/forge-frappe-skill (MIT) — https://github.com/sbknext/forge-frappe-skill
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
90 skills in this plugin
/frappe-add-service-composeAdd a new microservice to dev-podman-compose.yml with proper configuration, dependencies, and networking./frappe-agent-debuggerUse when debugging Frappe errors, using bench console for live inspection, analyzing tracebacks, or reading Frappe log files. Prevents wasted debugging time from ignoring log context, misreading tracebacks, and not using bench console effectively. Covers bench console, frappe.logger, error log DocType, traceback analysis, common error patterns, log file locations, pdb/debugger integration, VS Code DAP, profiling, Frappe Recorder, mariadb diagnostics. Keywords: debug, bench console, traceback, error log, frappe.logger, pdb, debugging, log analysis, inspect, VS Code, DAP, profiling, recorder, mariadb, monitor, ERPNext error, how to debug, find the bug, what went wrong, stack trace, error message..
/frappe-agent-interpreterUse when receiving vague or unclear ERPNext/Frappe development requests that need interpretation. Transforms requirements like 'make invoice auto-calculate' or 'add approval workflow' into concrete technical specifications. Determines which Frappe mechanisms to use and maps to the full 61-skill catalog. Keywords: vague requirement, clarify scope, translate business need, technical spec, implementation plan, what does this mean, unclear requirement, translate to code, how to build this.
npx claudepluginhub vyogotech/frappe-apps-manager --plugin frappe-apps-managerOther plugins' skills for the same job