frappe-core-files

Create and serve Frappe File documents with correct private URL handling.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents broken file links, permission leaks, and failed uploads when working with Frappe File documents, especially for private attachments and S3/cloud storage configurations.

Core Features & Use Cases

  • Correct File creation and access: Use save_file, save_url, frappe.get_file, and the File DocType fields to ensure files are stored and retrieved reliably.
  • Private vs public safety: Enforce the right URL patterns (/private/files/ vs /files/) so sensitive documents remain permission-protected.
  • Production-ready attachment handling: Attach print outputs and handle max file size limits to reduce runtime errors and silent failures.
  • S3/cloud storage guidance: Configure deletion hooks for non-filesystem backends so cleanup works correctly.
  • Anti-pattern prevention: Avoid common mistakes like storing sensitive files as public, hardcoding paths, or orphaning File records.

Quick Start

Ask your Claude agent to: "Given a private Sales Invoice attachment, generate the correct Frappe code to upload the PDF, attach it to the document, and return a safe private file URL."

Frequently Asked Questions about frappe-core-files

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

FAQPage Schema
How do I upload a private file in Frappe and get the correct file_url?

To upload a private file in Frappe, use the `save_file` API and set `is_private` to 1, which generates a file_url with the `/private/files/` pattern to ensure permission-protected access.

Why are my Frappe file attachments breaking or returning permission errors?

Broken Frappe file attachments and permission errors usually occur when private files are stored with public `/files/` URL patterns or when File documents are orphaned from their parent doctype during deletion.

Does Frappe file deletion automatically remove files from S3 integration?

Standard Frappe file deletion only removes the File document and local filesystem files. You must configure specific deletion hooks for S3 and cloud storage backends to ensure proper cleanup of remote objects.

What is the best way to attach a print PDF to a Frappe doctype server-side?

The best way to attach a print PDF in Frappe is to generate the PDF content, use `save_file` to create the File document, and attach it to the target doctype and docname while respecting max file size limits.

Can I use Frappe file APIs to save content directly from bytes or a remote URL?

Yes, you can use Frappe file APIs like `save_file` to save content from raw bytes and `save_url` to attach files from remote URLs, ensuring both methods correctly create the associated File documents.