frappe-code-review
БесплатноБез исполняемых скриптовНе проверенReview code for any Frappe application — a checklist distilled from years of engineering practice on correctness, security, performance, concurrency…
от frappe★ 185 звёзд на GitHubОб этом скилле
Quality Code Review
A reviewer's checklist for Frappe applications. Protect correctness, security, and the future maintainer, in that order of consequence. The sections below run in that order — spend most attention on §1 and §2. Prefer a root-cause fix over a workaround, and say why a finding matters (what breaks, for whom).
1. Correctness & stability (highest consequence)
The worst bug is silent stateful corruption — wrong ledgers/stock posted with no error. Treat stateful and legal/accounting/compliance code as "failure is not an option" code.
- Fail early and loudly. Use assertions for internal invariants:
assert total_credit == total_debit. (Assertions are for invariants the code guarantees — not user-facing validation.) - Picture how it breaks. For every change ask: Where can this break? How will someone misuse this? Write fool-proof code. Extensions and overrides should especially consider handling all sorts of failure modes.
- No partial commits. A stray
frappe.db.commit()/db.rollback()mid-transaction ends the transaction and exposes partial state — flag every one. Submitting/saving with validation bypassed (docs posted with no SL/GL entry when validation fails) is a critical bug. - Don't sacrifice atomicity for convenience (e.g. adding
autocommitto fix bootstrapping makes transactions non-atomic). Autocommit belongs only on schema creation. - Preserve invariants over UX. "Compromise UX, but guarantee correctness." Don't degrade working code to accommodate broken code.
- Validate the issue before fixing it. Sometimes the correct fix is "don't fix this". Identify the root causes first.
- Watch for destructive DB APIs with empty/
Nonefilters.set_value("Site", None, ...)/db.deletewith no filter updates/deletes every row. These must error, not silently operate on the whole table. Flag anyset_value/delete/get_valuewhere the name/filter could beNoneor empty- or attacker-controlled. - Check the types in a condition actually match. A comparison between
mismatched types (string vs
datetime, string vs int) silently never matches or is always true — cast explicitly (cint/flt) at the boundary. - Question the return shape. Before indexing a result, ask whether it can be
None/[None, None]; watchas_dict=1(list of dicts) vs scalar confusion. - Don't silently change long-standing semantics. Behavior callers have relied on for a long time is a contract — altering it is a breaking change in disguise, even when no signature changed.
2. Security
Avoiding a vulnerability is far easier than fixing one safely. Audit security-critical code (auth, authorization, permissions, user management) especially hard.
Injection
- NEVER build SQL by string concatenation/f-strings. Use the ORM or query
builder. If raw SQL is unavoidable, use parameter substitution
(
frappe.db.sql("... where name = %s", (user,))) — never interpolate yourself. Better still, avoid introducing new raw SQL at all: beyond injection risk it ties code to one database, and the framework aims to stay DB-agnostic (Postgres support). Preferfrappe.qb. - Type confusion is an injection vector even with the ORM. Frappe accepts
complex types, so a parameter expected to be a string can arrive as a filter
list:
{"key": ["!=", ""]}passed todb.get_valuebypasses a secret-key check. Validate input types at trust boundaries — explicitisinstance(key, str). Audit every@frappe.whitelistmethod for this. - Never
eval/execanything yourself.safe_eval/safe_execonly, in limited volume, and "safe_exec is not magic." Never accept a client-supplied method path to execute.
Sandboxing & trust boundaries
- Sandboxed execution (RestrictedPython/
safe_exec) is not reliably safe — assume escapes exist. Security toggles must live at the right trust boundary: server-script enablement is a bench-level config, never site-level (a tenant could enable it and take over the whole server). - Prefer allowlists over blocklists — blocklists are bypassable. Don't expose everything by default.
Access control
- "Think 10 times before
allow_guest=True" — it is not a shortcut around real authn/authz. Web pages must apply permissions before reading/sharing data. Preferget_list/get_allover hand-rolled queries. - Scope relaxations precisely. Verify a rate-limit/permission exception targets exactly the intended principal — not, say, all non-guest users.
Path traversal / filesystem
- Prefer the File doctype API. If user input enters a path, ensure it can't
traverse (
/../../) outside the site folder.
Crypto / secrets
- Never roll your own crypto; reuse existing implementations. Verify authenticity of guest/webhook requests (HMAC).
- Signed/one-time URLs: use a truly secret signing value; expire by both time and fir
Установить frappe-code-review в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл frappe-code-review?
Review code for any Frappe application — a checklist distilled from years of engineering practice on correctness, security, performance, concurrency, readability, API design, and testing. Use this when reviewing a diff, a PR, or a piece of code for quality and security, or when you want a reviewer's checklist grounded in hard-won Frappe/ERPNext lessons.
Как установить скилл frappe-code-review?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл frappe-code-review запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic