server-scripts

Implement Frappe server-side logic with controller, event, and API patterns.

21|6|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/UnityAppSuite/frappe-claude --skill server-scripts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: server-scripts
Source: https://github.com/UnityAppSuite/frappe-claude/tree/main/plugins/frappe-fullstack/skills/server-scripts
Command: npx skills add https://github.com/UnityAppSuite/frappe-claude --skill server-scripts

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Frappe developers often implement server-side logic without a consistent pattern for controllers, document events, whitelisted APIs, background tasks, and database interactions. This Skill provides structured patterns, templates, and examples to standardize and accelerate robust server-side development.

Core Features & Use Cases

  • Controller templates for Doctype logic and lifecycle hooks
  • Document events & hooks to handle insert, update, submit, cancel flows
  • Whitelisted APIs and permission checks for secure server endpoints
  • Background jobs & database operations patterns with examples
  • Real-world use cases across ERPNext modules with ready-to-adapt code

Quick Start

Create a Python Doctype controller following the Complete Controller Template and place it at your_app/doctype/your_doctype/your_doctype.py

Frequently Asked Questions about server-scripts

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

FAQPage Schema
How do I structure a Frappe controller for a Doctype with lifecycle hooks?

Frappe controller patterns place Doctype logic and lifecycle hooks in a Python file at your_app/doctype/your_doctype/your_doctype.py. This structure ensures clear separation of concerns and reusable templates for insert, update, submit, and cancel flows.

What is the best way to secure whitelisted APIs in Frappe?

Securing whitelisted APIs in Frappe requires applying strict permission checks within your server-side Python controllers. This approach validates user permissions before processing endpoint requests, ensuring secure server interactions across Doctypes.

How do document events work in Frappe for background jobs?

Document events in Frappe trigger Python handlers during insert, update, submit, or cancel operations. These handlers can enqueue background jobs and execute database operations asynchronously, preventing blocking during server-side processing.

Can I use these server-side patterns for ERPNext module development?

These server-side patterns are applicable to ERPNext module development. They provide ready-to-adapt Python code templates for controllers, whitelisted APIs, and document event handlers that validate behavior across Doctypes.

Why do I need standard patterns for Frappe database operations?

Standard patterns for Frappe database operations are needed to enforce consistent error handling and permissions. Without structured templates, server-side logic across Doctypes becomes difficult to maintain and prone to security gaps.