frappe-impl-controllers

Implement Frappe Document Controllers with correct lifecycle hooks and validation.

163|53|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-impl-controllers-impertio-studio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frappe-impl-controllers
Source: https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package/tree/main/skills/source/impl/frappe-impl-controllers
Command: npx skills add https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-impl-controllers-impertio-studio

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents common production failures by guiding you to implement correct server-side Frappe Document Controller lifecycles instead of using brittle or incorrectly-timed logic.

Core Features & Use Cases

  • Controller lifecycle workflows: Choose the right controller methods for validate, naming, insert/update events, submit/cancel, and change detection.
  • Correct validation and mutation rules: Learn when changes to self are saved versus when you must use db_set/set_value to persist safely.
  • Safe extension patterns: Override standard ERPNext controllers correctly with super() and alternative event-driven handlers, including v16+ extend_doctype_class.
  • Practical inter-hook communication and testing: Use flags for passing state across hooks and structure tests using Frappe test utilities.

Quick Start

Tell your AI to design a custom Frappe controller for a submittable DocType, selecting the correct hooks for autoname, validate, before_submit, on_submit, before_cancel, and on_cancel, and ensuring on_update persists changes using db_set.

Frequently Asked Questions about frappe-impl-controllers

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

FAQPage Schema
How do I override a standard ERPNext doctype controller correctly?

To override ERPNext doctype controllers correctly, use super() calls and alternative event-driven handlers, including v16+ extend_doctype_class, to ensure production-safe extension patterns without breaking core workflows.

When should I use db_set instead of modifying self in Frappe lifecycle hooks?

Use db_set or set_value to persist changes safely in Frappe lifecycle hooks during post-save events like on_update, because direct mutations to self are not automatically saved after the document is inserted.

What is the best way to structure submit and cancel workflows in a Frappe doctype?

Structure Frappe submit and cancel workflows by selecting the correct controller hooks, specifically before_submit, on_submit, before_cancel, and on_cancel, to manage state changes and side effects cleanly.

How do I pass state between Frappe validation and on_update hooks?

Pass state between Frappe validation and on_update hooks by using flags, which provide flags-based inter-hook communication to securely share data across different controller events without relying on global variables.

Does this approach work for migrating logic from hooks.py and server scripts to doctype controllers?

Yes, this approach works for migrating logic from hooks.py and server scripts to Frappe doctype controllers by applying proper hook semantics and production-grade patterns to ensure correct timing and safe persistence.

Why are my Frappe controller changes not saving during the on_update hook?

Your Frappe controller changes are not saving during on_update because standard validation and mutation rules require using db_set or set_value to persist post-save updates safely, as modifications to self are lost after insertion.