Agent skill

Frappe Syntax Query Builder

by Impertio-Studio in Impertio-Studio/Frappe_Claude_Skill_Package

A skill your agent uses when building database queries with frappe.qb in Frappe v14-v16.

MITAuto-check passedDatabases

Install Frappe Syntax Query Builder

skills CLI
$ npx skills add Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-syntax-query-builder -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Impertio-Studio/Frappe_Claude_Skill_Package frappe-syntax-query-builder --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/source/syntax/frappe-syntax-query-builder .claude/skills/frappe-syntax-query-builder && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
frappe-syntax-query-builder
GitHub stars
187
Token cost
~1.7k tokens
SKILL.md length
185 words
Files
4 (incl. references)
Skills in repo
61
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when building database queries with frappe.qb in Frappe v14-v16.

  • Works in 6 steps: NEVER pass qb query to frappe.db.sql() —… → NEVER use Table() for DocTypes — use… → NEVER forget .run() — without it you get… → …
  • Building database queries with frappe.qb in Frappe v14-v16
  • SKILL.md covers Quick Reference, Decision Tree, Core Patterns and Filtering, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Frappe Syntax Query Builder is an agent skill from Impertio-Studio/Frappe_Claude_Skill_Package. Use when building database queries with frappe.qb in Frappe v14-v16. Covers the PyPika-based query builder: SELECT, INSERT, UPDATE, DELETE, joins, aggregation, subqueries, cross-DB compatibility (MariaDB/PostgreSQL), and migration from raw SQL. Prevents SQL injection and DB-specific bugs. Keywords: frappe.qb, query builder, DocType, Field, pypika, join,, frappe.qb example, how to write query, join tables, SQL replacement, parameterized query. aggregate, ImportMapper, cross-database, parameterized query.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/cross-db-patterns.md`, `references/functions-reference.md` and `references/migration-from-sql.md`). Compatibility notes: Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16.

It sits in Databases, covering ORMs and data access, SQL and Web application vulnerabilities. It works with SQL, MariaDB and PostgreSQL. The repository describes itself as: 60 deterministic Claude AI skills for Frappe Framework & ERPNext v14-v16 development and operations. The licence is MIT.

When your agent uses it

  • Building database queries with frappe.qb in Frappe v14-v16
  • Tasks that involve ORMs and data access
  • Tasks that involve SQL

Example prompts

  • “/frappe-syntax-query-builder”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16.

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. NEVER pass qb query to frappe.db.sql() — bypasses parameterization
  2. NEVER use Table() for DocTypes — use DocType() (adds tab prefix)
  3. NEVER forget .run() — without it you get a query object, not results
  4. NEVER use raw SQL strings in frappe.get_all(fields=[...]) — use dict syntax
  5. ALWAYS use ImportMapper for DB-specific functions
  6. ALWAYS chain .run(as_dict=True) when you need dicts — default is tuples

What it can do on your machine

Read from SKILL.md and the folder at commit 36cfa80. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16.

    From compatibility in the SKILL.md frontmatter.

Context cost

Frappe Syntax Query Builder loads about 1.7k tokens when it runs, and up to ~5.2k if it reads all its reference files. Until then it costs about 134 tokens; SKILL.md has 185 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~134
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Impertio-Studio/Frappe_Claude_Skill_Package at commit 36cfa80, republished under its MIT licence (© Impertio-Studio). 185 words, ~1,671 tokens.

Download SKILL.mdSave it as .claude/skills/frappe-syntax-query-builder/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
frappe-syntax-query-builder
description
Use when building database queries with frappe.qb in Frappe v14-v16. Covers the PyPika-based query builder: SELECT, INSERT, UPDATE, DELETE, joins, aggregation, subqueries, cross-DB compatibility (MariaDB/PostgreSQL), and migration from raw SQL. Prevents SQL injection and DB-specific bugs. Keywords: frappe.qb, query builder, DocType, Field, pypika, join,, frappe.qb example, how to write query, join tables, SQL replacement, parameterized query. aggregate, ImportMapper, cross-database, parameterized query.
compatibility
Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16.
license
MIT
metadata.author
OpenAEC-Foundation
metadata.version
3.0

Frappe Query Builder (frappe.qb)

Quick Reference

python
from frappe.query_builder import DocType, Field
from frappe.query_builder.functions import Count, Sum, IfNull
from frappe.query_builder.custom import ConstantColumn, GROUP_CONCAT
from frappe.query_builder.terms import SubQuery
from frappe.query_builder.utils import ImportMapper, db_type_is
from pypika.terms import Case, ValueWrapper
from pypika import CustomFunction, Order
ActionPattern
SELECTfrappe.qb.from_("DocType").select("field1", "field2")
WHERE.where(Field("status") == "Open")
ORDER.orderby("creation", order=Order.desc)
LIMIT.limit(10).offset(0)
JOIN.left_join(dt2).on(dt2.name == dt1.parent)
COUNT.select(Count("*"))
INSERTfrappe.qb.into("DocType").columns("f1", "f2").insert("v1", "v2")
UPDATEfrappe.qb.update("DocType").set("field", "value").where(...)
DELETEfrappe.qb.from_("DocType").delete().where(...)
RUN.run() (tuples) / .run(as_dict=True) (dicts)

Decision Tree

Need to query the database?
│
├─ Simple get/list → frappe.db.get_value(), frappe.get_all()
│  (See frappe-core-database skill)
│
├─ Complex query with joins/aggregates/subqueries → frappe.qb ✓
│
├─ Very complex SQL not expressible in qb → frappe.db.sql()
│  (ALWAYS use parameterized values: frappe.db.sql(query, values))
│
└─ Need cross-DB compatibility → frappe.qb + ImportMapper ✓

Using frappe.qb?
│
├─ Table reference → DocType("Sales Order") — NEVER use Table()
├─ Field reference → dt.field_name or Field("field_name")
├─ Execute → .run() for tuples, .run(as_dict=True) for dicts
├─ DB-specific function → ImportMapper({db_type_is.MARIADB: X, db_type_is.POSTGRES: Y})
└─ Get SQL string → query.get_sql() — NEVER pass to frappe.db.sql()

Core Patterns

SELECT with DocType
python
# ALWAYS use DocType() for table references — adds "tab" prefix
so = frappe.qb.DocType("Sales Order")
soi = frappe.qb.DocType("Sales Order Item")

orders = (
    frappe.qb.from_(so)
    .select(so.name, so.customer, so.grand_total)
    .where(so.status == "To Deliver and Bill")
    .where(so.docstatus == 1)
    .orderby(so.creation, order=Order.desc)
    .limit(20)
    .run(as_dict=True)
)
JOIN
python
result = (
    frappe.qb.from_(so)
    .left_join(soi).on(soi.parent == so.name)
    .select(so.name, so.customer, soi.item_code, soi.qty)
    .where(so.docstatus == 1)
    .where(soi.item_code.like("ITEM-%"))
    .run(as_dict=True)
)
Aggregation
python
from frappe.query_builder.functions import Count, Sum

gl = frappe.qb.DocType("GL Entry")
result = (
    frappe.qb.from_(gl)
    .select(gl.account, Sum(gl.debit).as_("total_debit"), Count("*").as_("entries"))
    .where(gl.docstatus == 1)
    .groupby(gl.account)
    .run(as_dict=True)
)

# Shortcut aggregation methods
total = frappe.qb.sum("GL Entry", "debit", filters={"account": "Sales"})
max_qty = frappe.qb.max("Stock Ledger Entry", "actual_qty", filters={"item_code": "ITEM-001"})
INSERT / UPDATE / DELETE
python
# INSERT
frappe.qb.into("Activity Log").columns("user", "action").insert("admin", "login").run()

# UPDATE
customer = frappe.qb.DocType("Customer")
(frappe.qb.update(customer)
    .set(customer.status, "Active")
    .where(customer.name == "CUST-001")
    .run())

# DELETE
frappe.qb.from_("Error Log").delete().where(Field("creation") < "2024-01-01").run()

Filtering

python
dt = frappe.qb.DocType("Sales Order")

# Equality
.where(dt.status == "Open")

# OR (pipe operator)
.where((dt.status == "Open") | (dt.status == "Draft"))

# AND (chain .where() calls)
.where(dt.status == "Open")
.where(dt.docstatus == 1)

# LIKE
.where(dt.customer.like("CUST-%"))

# IN
.where(dt.status.isin(["Open", "Draft"]))

# BETWEEN (bracket syntax)
.where(dt.creation[start_date:end_date])

# NULL checks
.where(dt.email.isnotnull())
.where(dt.phone.isnull())

# Comparison
.where(dt.grand_total > 1000)
.where(dt.grand_total >= 500)
.where(dt.status != "Cancelled")

Cross-DB Compatibility

python
from frappe.query_builder.utils import ImportMapper, db_type_is
from frappe.query_builder.custom import GROUP_CONCAT, STRING_AGG

# ImportMapper selects correct function per database
GroupConcat = ImportMapper({
    db_type_is.MARIADB: GROUP_CONCAT,
    db_type_is.POSTGRES: STRING_AGG,
})

dt = frappe.qb.DocType("Has Role")
result = (
    frappe.qb.from_(dt)
    .select(dt.parent, GroupConcat(dt.role))
    .groupby(dt.parent)
    .run(as_dict=True)
)
MariaDBPostgreSQLUse ImportMapper
GROUP_CONCATSTRING_AGGYes
MATCH...AGAINSTTO_TSVECTORYes
LocateStrposYes
TimestampExtract-basedAuto-handled

Anti-patterns

  1. NEVER pass qb query to frappe.db.sql() — bypasses parameterization
  2. NEVER use Table() for DocTypes — use DocType() (adds tab prefix)
  3. NEVER forget .run() — without it you get a query object, not results
  4. NEVER use raw SQL strings in frappe.get_all(fields=[...]) — use dict syntax
  5. ALWAYS use ImportMapper for DB-specific functions
  6. ALWAYS chain .run(as_dict=True) when you need dicts — default is tuples

Version Differences

Featurev14v15v16
Core qb APIIntroducedYesYes
ImportMapperYesYesYes
SQLite backend----Added
Masked fields----Added
Union queries (.walk)--AddedYes
Child query execution----Added

Reference Files

© Impertio-Studio, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/source/syntax/frappe-syntax-query-builder of Impertio-Studio/Frappe_Claude_Skill_Package.

  • SKILL.md
  • references/cross-db-patterns.md
  • references/functions-reference.md
  • references/migration-from-sql.md

Open the folder on GitHubat commit 36cfa80

Compare with similar skills

Frappe Syntax Query Builder next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Frappe Syntax Query Builder compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Frappe Syntax Query Builder this skillImpertio-Studio/Frappe_Claude_Skill_Package187—~1.7kAutomated safety check: PassMIT
Query Builderthalysjuvenal/advpl-specialist186—~594Automated safety check: PassMIT
Tsh SQL And Database UnderstandingTheSoftwareHouse/copilot-collections284—~11kAutomated safety check: PassMIT
Safe SQL Executionsupabase/supabase111k—~4.2kAutomated safety check: PassApache-2.0
Releaserogerpadilla/uql125—~842Automated safety check: PassMIT
Database FundamentalsDanielPodolsky/ownyourcode2901 repos~1.6kAutomated safety check: PassMIT

Similar skills

  • Query Builder

    thalysjuvenal/advpl-specialist

    A skill your agent uses when the user needs to build, choose the pattern for, or optimize a SQL query against Protheus ERP tables -- covering Workarea (DbSelectArea/DbSeek) vs Embedded SQL vs…

    186 GitHub stars~594 tokensUpdated 24 days ago
    DatabasesAuto-check passed
  • Tsh SQL And Database Understanding

    TheSoftwareHouse/copilot-collections

    SQL writing and database engineering patterns, standards, and procedures.

    284 GitHub stars~11k tokensUpdated 3 days ago
    DatabasesAuto-check passed
  • Safe SQL Execution

    supabase/supabase

    Official

    A skill your agent uses whenever code will build, return, fetch, or execute SQL that runs against a user's real Postgres database — even when the request reads like an ordinary feature or bug fix…

    111k GitHub stars~4.2k tokensUpdated today
    DatabasesAuto-check passed
  • Release

    rogerpadilla/uql

    Cut and publish a uql release - review the change, changelog entry, commit, version bump and tag, GitHub Release, npm publish, docs site.

    125 GitHub stars~842 tokensUpdated today
    DatabasesAuto-check passed
  • Database Fundamentals

    DanielPodolsky/ownyourcode

    Reviews schema design, SQL queries, ORM patterns. An agent skill from DanielPodolsky/ownyourcode.

    290 GitHub starsUsed in 1 repo~1.6k tokens
    DatabasesAuto-check passed
  • Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context…

    241 GitHub starsUsed in 2 repos~2.9k tokens
    DatabasesAuto-check passed

More from Impertio-Studio/Frappe_Claude_Skill_Package

All 61 skills in this repo
  • Frappe Agent Interpreter

    Impertio-Studio/Frappe_Claude_Skill_Package

    A skill your agent uses when receiving vague or unclear ERPNext/Frappe development requests that need interpretation.

    187 GitHub starsUsed in 1 repo~3.2k tokens
    Auto-check passed
  • Frappe Ops Website Deploy

    Impertio-Studio/Frappe_Claude_Skill_Package

    Deploy HTML/CSS websites to ERPNext/Frappe (v15/v16) as Web Pages via the REST API.

    187 GitHub stars~2.5k tokensUpdated 21 days ago
    Auto-check passed
  • Frappe Core API

    Impertio-Studio/Frappe_Claude_Skill_Package

    A skill your agent uses when building ERPNext/Frappe API integrations (v14/v15/v16) including REST API, RPC API, authentication, webhooks, and rate limiting.

    187 GitHub starsUsed in 1 repo~3.2k tokens
    Auto-check passed
  • Frappe Errors API

    Impertio-Studio/Frappe_Claude_Skill_Package

    A skill your agent uses when debugging or handling API errors in Frappe/ERPNext v14/v15/v16.

    187 GitHub starsUsed in 1 repo~4k tokens
    Auto-check passed
  • Frappe Impl Hooks

    Impertio-Studio/Frappe_Claude_Skill_Package

    A skill your agent uses when implementing hooks.py configurations in a Frappe custom app.

    187 GitHub starsUsed in 1 repo~3k tokens
    Auto-check passed
  • Frappe Impl Whitelisted

    Impertio-Studio/Frappe_Claude_Skill_Package

    A skill your agent uses when building API endpoints with @frappe.whitelist() in Frappe.

    187 GitHub starsUsed in 1 repo~3.1k tokens
    Auto-check passed

Categories

Questions about Frappe Syntax Query Builder

What does Frappe Syntax Query Builder do?

A skill your agent uses when building database queries with frappe.qb in Frappe v14-v16. Frappe Syntax Query Builder is an agent skill from Impertio-Studio/Frappe_Claude_Skill_Package.qb in Frappe v14-v16.

When should I use Frappe Syntax Query Builder?

Frappe Syntax Query Builder fits situations like: building database queries with frappe.qb in Frappe v14-v16; tasks that involve ORMs and data access; tasks that involve SQL.

How do I install Frappe Syntax Query Builder in Claude Code?

Run `npx skills add Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-syntax-query-builder -a claude-code`. Or copy the skill folder (skills/source/syntax/frappe-syntax-query-builder in Impertio-Studio/Frappe_Claude_Skill_Package) into .claude/skills/frappe-syntax-query-builder in your project. Claude Code loads it when a task matches its description.

How do I install Frappe Syntax Query Builder in Codex?

Run `npx skills add Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-syntax-query-builder -a codex`. Or copy the skill folder (skills/source/syntax/frappe-syntax-query-builder in Impertio-Studio/Frappe_Claude_Skill_Package) into .agents/skills/frappe-syntax-query-builder in your project. Codex loads it when a task matches its description.

Can I use Frappe Syntax Query Builder in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-syntax-query-builder -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/frappe-syntax-query-builder, .gemini/skills/frappe-syntax-query-builder, .github/skills/frappe-syntax-query-builder and .opencode/skills/frappe-syntax-query-builder in your project.

What does Frappe Syntax Query Builder need to run?

SKILL.md names no scripts, command-line tools or credentials: Frappe Syntax Query Builder is instructions for the agent only. Our summary lists: Python 3. Compatibility (from SKILL.md): Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16..

Does Frappe Syntax Query Builder access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Frappe Syntax Query Builder safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Frappe Syntax Query Builder use?

Frappe Syntax Query Builder is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Frappe Syntax Query Builder use?

About 1.7k tokens (SKILL.md is roughly 6.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.5k tokens, read only when the agent opens those files.

What are the alternatives to Frappe Syntax Query Builder?

Skills that share tags, products or a category with Frappe Syntax Query Builder: Query Builder (thalysjuvenal/advpl-specialist, 186 stars), Tsh SQL And Database Understanding (TheSoftwareHouse/copilot-collections, 284 stars), Safe SQL Execution (supabase/supabase, 111k stars) and Release (rogerpadilla/uql, 125 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Frappe Syntax Query Builder?

Impertio-Studio (a GitHub organization) maintains it in Impertio-Studio/Frappe_Claude_Skill_Package, which has 187 GitHub stars. The repository holds 61 skills in this directory. The repository was last updated on September 17, 2026.

Source: Impertio-Studio/Frappe_Claude_Skill_Package on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.