frappe-core-utils
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "frappe-core-utils":https://skillpi.com/zh/skills/deepskill-3c84e52541ec684832e7e5ed1c9f3bde6bbc743759c8e442869eecb15f5ef2b8。安装前核对上游来源和版本:https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
适用于在 Frappe v14–v16 中使用 frappe.utils.* 工具函数的场景,覆盖日期/时间(如 nowdate、getdate、add_days、date_diff、pretty_date)、数字与金额处理(如 flt、cint、fmt_money)、字符串与验证(如 validate_email)、以及文件路径操作(如 get_files_path)。旨在避免重复造轮子并保留时区感知、本地化格式化与多租户行为。
介绍来源: third_party · Impertio-Studio · 3.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: frappe-core-utils
description: >
Use when working with utility functions in Frappe v14-v16. Covers
frappe.utils.* for date/time, number/money, string, validation, and
file path operations. Prevents reinventing stdlib alternatives that
break timezone awareness, locale formatting, or multi-tenancy.
Keywords: frappe.utils, nowdate, flt, cint, fmt_money, getdate,, date calculation, format number, money format, validate email, how to calculate days between.
add_days, date_diff, validate_email, pretty_date, get_files_path.
license: MIT
compatibility: "Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16."
metadata:
author: OpenAEC-Foundation
version: "3.0"Frappe Utility Functions
Quick Reference: Python
| Need | Function | Returns |
|---|---|---|
| Current date | nowdate() / today() |
datetime.date |
| Current datetime | now_datetime() |
datetime.datetime |
| Parse date string | getdate(str) |
datetime.date |
| Parse datetime string | get_datetime(str) |
datetime.datetime |
| Add days | add_days(date, n) |
datetime.date |
| Add months | add_months(date, n) |
datetime.date |
| Date difference | date_diff(end, start) |
int (days) |
| Format for user | format_date(dt) |
str (user locale) |
| Relative time | pretty_date(dt) |
str ("2 hours ago") |
| Safe float | flt(val, precision) |
float |
| Safe int | cint(val) |
int |
| Safe string | cstr(val) |
str |
| Safe bool | sbool(val) |
bool |
| Safe division | safe_div(a, b) |
float [v15+] |
| Money format | fmt_money(amt, currency) |
str |
| Money in words | money_in_words(amt, cur) |
str |
| Strip HTML | strip_html(text) |
str |
| List to prose | comma_and(items) |
str ("a, b, and c") |
| Validate email | validate_email_address(e) |
str or "" |
| Validate URL | validate_url(url) |
bool |
| Parse JSON | parse_json(s) |
Any |
| Files path | get_files_path(is_private) |
str |
| Site path | get_site_path(*parts) |
str |
| Unique list | unique(seq) |
list |
| Hash | generate_hash(s, length) |
str |
ALL imports:
from frappe.utils import nowdate, flt, ...in controllers/whitelisted methods. In Server Scripts: Usefrappe.utils.nowdate()directly — NO import statements allowed.
Decision Tree: "Which function do I use?"
Need a date/time value?
├─ Current date → nowdate() or today()
├─ Current datetime → now_datetime()
├─ Parse a string → getdate() or get_datetime()
├─ Add/subtract time → add_days(), add_months(), add_to_date()
├─ Difference → date_diff() (days), month_diff(), time_diff_in_seconds()
├─ Period boundary → get_first_day(), get_last_day(), get_quarter_start()
└─ Display to user → format_date(), format_datetime(), pretty_date()
Need a number?
├─ Convert safely → flt(), cint(), cstr(), sbool()
├─ Round → rounded() (banker's rounding)
├─ Safe divide → safe_div(a, b, default=0) [v15+]
├─ Format money → fmt_money(amount, currency)
└─ Money to words → money_in_words(amount, currency)
Need string processing?
├─ HTML → strip_html(), escape_html(), is_html()
├─ Join list → comma_and(), comma_or(), comma_sep()
├─ Markdown ↔ HTML → to_markdown(), md_to_html()
└─ Mask sensitive → mask_string(input, show_first=4) [v16+]
Need validation?
├─ Email → validate_email_address(email, throw=False)
├─ URL → validate_url(url, valid_schemes=["https"])
├─ Phone → validate_phone_number(phone, throw=False)
├─ JSON → validate_json_string(s)
└─ IBAN → validate_iban(iban) [v16+]
Need file/path?
├─ Public files → get_files_path()
├─ Private files → get_files_path(is_private=True)
├─ Site directory → get_site_path("private", "backups")
├─ Bench root → get_bench_path()
└─ File size → get_file_size(path, format=True)
Critical Anti-Patterns
NEVER use Python stdlib when frappe.utils exists
| NEVER (stdlib) | ALWAYS (frappe.utils) | Why |
|---|---|---|
datetime.datetime.now() |
now_datetime() |
Ignores system timezone |
datetime.date.today() |
nowdate() |
Ignores system timezone |
float(val) |
flt(val, precision) |
Crashes on None/empty |
int(val) |
cint(val) |
Crashes on None/empty |
round(val, 2) |
rounded(val, 2) |
Inconsistent rounding |
val1 / val2 |
safe_div(val1, val2) |
ZeroDivisionError [v15+] |
json.loads(s) |
parse_json(s) |
Crashes on None/empty |
json.dumps(obj) |
frappe.as_json(obj) |
Inconsistent serialization |
"{:,.2f}".format(a) |
fmt_money(a, currency) |
Ignores locale/currency |
os.path.join(...) |
get_site_path(...) |
Breaks multi-tenancy |
", ".join(items) |
comma_and(items) |
No localized "and" |
dt.strftime(fmt) |
format_date(dt) |
Ignores user preference |
re.sub(r'<.*?>', '', h) |
strip_html(h) |
Misses edge cases |
Server Script Sandbox
# ❌ NEVER in Server Scripts
from frappe.utils import nowdate, flt
import json
# ✅ ALWAYS in Server Scripts (no imports allowed)
today = frappe.utils.nowdate()
amount = frappe.utils.flt(doc.amount, 2)
data = frappe.parse_json(doc.json_field)
JavaScript Quick Reference
| Need | Function |
|---|---|
| Escape HTML | frappe.utils.escape_html(txt) |
| HTML to text | frappe.utils.html2text(html) |
| Check if HTML | frappe.utils.is_html(txt) |
| Parse JSON | frappe.utils.parse_json(str) |
| Validate URL | frappe.utils.is_url(txt) |
| Title case | frappe.utils.to_title_case(str) |
| Join with "and" | frappe.utils.comma_and(list) |
| Unique array | frappe.utils.unique(list) |
| Copy clipboard | frappe.utils.copy_to_clipboard(txt) |
| Scroll to element | frappe.utils.scroll_to(el) |
| Is mobile | frappe.utils.is_mobile() |
| Throttle | frappe.utils.throttle(fn, delay) |
| Debounce | frappe.utils.debounce(fn, delay) |
| Format value | frappe.format(value, df, options, doc) |
| Duration display | frappe.utils.get_formatted_duration(secs) |
Version Differences
| Function | v14 | v15 | v16 |
|---|---|---|---|
safe_div() |
-- | Added | Yes |
duration_to_seconds() |
-- | Added | Yes |
guess_date_format() |
-- | Added | Yes |
validate_duration_format() |
-- | Added | Yes |
mask_string() |
-- | -- | Added |
validate_iban() |
-- | -- | Added |
validate_name() |
-- | -- | Added |
safe_json_loads() |
-- | -- | Added |
groupby_metric() |
-- | -- | Added |
| Core functions | Yes | Yes | Yes |
Reference Files
- Date/Time Functions — Complete date/time API with signatures
- Number & Money Functions — flt, fmt_money, rounding
- String & Validation Functions — HTML, join, validate
- JavaScript Utilities — Client-side frappe.utils.*
- Anti-patterns — stdlib vs frappe.utils comparison
版本历史
-
v3.1.1
GitHub ↗
原版更新说明
## What's new Expanded Keywords in all skill descriptions with user-friendly, non-technical discovery terms. Skills are now easier to find when users describe problems in plain language instead of technical terminology. Examples of added terms: - Symptom-based: "app is slow", "nothing shows", "container won't start" - Beginner-friendly: "how do I start", "what is", "getting started" - Error messages: literal error text users would paste - Alternative names: common synonyms and abbreviations No skill content was changed. Only the Keywords line in SKILL.md frontmatter was expanded.
-
v3.1.0
GitHub ↗
原版更新说明
## What's new - package.json with agents.skills[] manifest for external discovery (60 skills) - agents/openai.yaml for OpenAI Codex - GitHub topic agentskills added - SKILLS_LOG.md added to .gitignore - Em-dashes replaced with colons in 31 SKILL.md section headings Enables discovery via npx skills add, skills.sh, LobeHub, and other platforms.
-
v3.0.0
GitHub ↗
原版更新说明
## Summary - **60 deterministic skills** for Frappe Framework v14-v16 (up from 53 in v2.0) - **~95% surface area coverage** (up from ~85%) - 7 new skills + 12 existing skills extended with new reference files ## New Skills (7) | Skill | Category | Coverage | |-------|----------|----------| | `frappe-core-translation` | core | i18n, _(), __(), CSV/PO files, string extraction | | `frappe-core-utils` | core | 140+ date, number, string, validation functions | | `frappe-syntax-print` | syntax | Print formats, PDF generation, Letter Head | | `frappe-syntax-query-builder` | syntax | frappe.qb, joins, aggregation, cross-DB | | `frappe-impl-workspace` | impl | Workspace builder, number cards, charts | | `frappe-core-logging` | core | frappe.logger(), Error Log, Sentry integration | | `frappe-core-search` | core | Link search, global search, SQLiteSearch FTS5 | ## Extended Skills (12) 13 new reference files added to existing skills covering: Controls API, Tree View, Portal Generators, Print Format decision tree, Email system, Module/Workspace shipping, complete Document API, custom bench commands, request lifecycle, advanced debugging (VS Code DAP), Frappe Packages, data masking (v16+), and Python type stubs. ## Stats | Category | Count | |----------|:-----:| | syntax/ | 13 | | core/ | 11 | | impl/ | 14 | | errors/ | 7 | | ops/ | 8 | | agents/ | 5 | | testing/ | 2 | | **Total** | **60** | ## Install ```bash git clone https://github.com/OpenAEC-Foundation/Frappe_Claude_Skill_Package.git cp -r Frappe_Claude_Skill_Package/skills/source/* ~/.claude/skills/ ```
-
v2.0.0
GitHub ↗
原版更新说明
## Frappe Claude Skill Package v2.0.0 Massive upgrade from 28 ERPNext-specific skills to **53 Frappe Framework skills** covering ~85% of the Frappe surface area. ### What's New - **25 new skills** across 3 new categories (ops, testing, agents) - **28 existing skills** fully rewritten with fresh research - **Renamed** from `erpnext-*` to `frappe-*` (all skills are Frappe Framework, not ERPNext-specific) - **7 categories**: syntax (11), core (7), impl (13), errors (7), ops (8), agents (5), testing (2) ### New Categories - **ops/** — Bench CLI, deployment, backup, performance, upgrades, frontend build, cloud - **testing/** — Unit/integration tests, CI/CD with GitHub Actions - **3 new agents** — debugger, migrator, architect ### Key Improvements - All skills verified against official Frappe docs (March 2026) - v16 features documented: `extend_doctype_class`, data masking, type annotations - MIT license (was LGPL-3.0) - Deterministic language throughout (ALWAYS/NEVER) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
-
v1.1.0
GitHub ↗
原版更新说明
V16 compatibility update and documentation improvements. ## Added - USAGE.md with platform-specific guides (Claude.ai, Claude Code, API) - Complete README overhaul with quick start guide ## Changed - All 28 skills updated for ERPNext/Frappe V16 compatibility - Agent Skills now follow standard skill structure - Improved validation: 28/28 skills pass all checks ## Fixed - V16-specific syntax changes in 9 skills - Agent SKILL.md files now under 500 lines
此处仅展示最近 5 个版本。 在原站查看完整版本历史 ↗
当前收录版本
3.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Frappe v14-v16 核心工具函数的全面指南
- 涵盖日期时间、数字金额、字符串处理、验证和文件路径等高频场景
- 有效帮助开发者避免常见反模式和错误
亮点
- 触发词精准完整,覆盖具体函数名和使用场景
- 关键词列表详尽,边界清晰,便于准确触发
待提升项
-
缺少显式 When to Use 章节 原报告严重程度:轻微
文档结构完整但缺少显式的 When to Use 章节标题
改进建议:建议添加显式的 When to Use 章节以提升规范性
亮点
- 文档结构清晰,包含快速参考、决策树、反模式对比等完整章节
- frontmatter 完整,兼容性说明清晰
待提升项
-
缺少端到端代码示例 原报告严重程度:轻微
提供了函数参考但未包含完整的端到端使用示例
改进建议:建议添加完整的端到端代码示例以提升执行可靠性
亮点
- 提供了具体的导入方式和使用注意事项
- 详细说明了 Server Script 中的特殊用法
- stdlib 与 frappe.utils 对比清晰,指导性强
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。