Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

frappe-code-review

БесплатноБез исполняемых скриптовНе проверен

Review code for any Frappe application — a checklist distilled from years of engineering practice on correctness, security, performance, concurrency…

frappeот 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 autocommit to 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/None filters. set_value("Site", None, ...) / db.delete with no filter updates/deletes every row. These must error, not silently operate on the whole table. Flag any set_value/delete/get_value where the name/filter could be None or 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]; watch as_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). Prefer frappe.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 to db.get_value bypasses a secret-key check. Validate input types at trust boundaries — explicit isinstance(key, str). Audit every @frappe.whitelist method for this.
  • Never eval/exec anything yourself. safe_eval/safe_exec only, 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. Prefer get_list/get_all over 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
Полный SKILL.md на GitHub

Установить 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), без исполняемых скриптов.

Похожие скиллы

Сравнить frappe-code-review с