frappe-syntax-hooks-events

Configure Frappe doc_events lifecycle hooks for DocType extensions.

Updated May 31, 2026
One-click install
npx skills add https://github.com/anonymousminati/Res-POS --skill frappe-syntax-hooks-events-anonymousminati
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frappe-syntax-hooks-events
Source: https://github.com/anonymousminati/Res-POS/tree/main/.claude/skills/syntax/frappe-syntax-hooks-events
Command: npx skills add https://github.com/anonymousminati/Res-POS --skill frappe-syntax-hooks-events-anonymousminati

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you implement Frappe document lifecycle hooks correctly so your app reacts to document changes without silent failures, broken overrides, or incorrect event assumptions.

Core Features & Use Cases

  • doc_events configuration: Register handlers for specific DocTypes or all DocTypes using wildcard hooks.
  • Event order mastery: Understand when validate, before_save, on_submit, on_cancel, and other lifecycle events fire.
  • Safe extensibility: Choose the right approach for extending another app's behavior with extend_doctype_class or override_doctype_class.
  • Use case: When adding approval checks, audit logging, or post-submit automation to an existing Frappe DocType, this Skill helps you place the logic in the right hook with the right safeguards.

Quick Start

Use this skill to identify the correct Frappe hook for your DocType change and implement it with the proper event name, handler signature, and execution order.

Frequently Asked Questions about frappe-syntax-hooks-events

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

FAQPage Schema
How do I use Frappe doc_events to run custom code when a document is submitted or cancelled?

Frappe doc_events let you register handler functions for specific lifecycle events like on_submit and on_cancel. You map event names to handler paths in hooks to ensure custom logic executes safely when documents transition states.

What is the execution order of Frappe document lifecycle hooks like validate and before_save?

Frappe document lifecycle hooks fire in a specific sequence: validate runs before before_save, and on_submit fires after the document is submitted. Mastering this event order prevents silent failures and incorrect assumptions in custom validation logic.

How do I extend an existing DocType's behavior across multiple Frappe apps without breaking overrides?

To extend existing DocTypes across multiple apps, use extend_doctype_class or override_doctype_class in your hooks. This allows your app to modify another app's behavior without causing silent failures or broken overrides during updates.

Can I register a Frappe hook for all DocTypes using a wildcard?

Yes, Frappe doc_events configuration supports wildcard hooks to register handlers for all DocTypes. This targets document changes globally, applying logic like audit logging to every document without specifying each DocType individually.

Why does my Frappe document hook fail silently during update-after-submit scenarios?

Frappe document hooks fail silently during update-after-submit scenarios if you use incorrect event names or mismatched handler signatures. Placing logic in the right hook with safe frappe.throw calls prevents these silent failures.

When should I use override_doctype_class instead of extend_doctype_class in Frappe?

Use override_doctype_class to completely replace a DocType's class behavior, whereas extend_doctype_class adds to existing methods safely. Choosing the right approach ensures safe extensibility when modifying another app's document lifecycle.