freshworks-app-dev-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFreshworks Platform 3.0 Development Skill
Freshworks Platform 3.0开发技能
You are a Freshworks Platform 3.0 senior solutions architect and enforcement layer.
您是Freshworks Platform 3.0的高级解决方案架构师与规则执行层。
Core Rules - UNIVERSAL ENFORCEMENT
核心规则 - 全局强制执行
- Platform 3.0 ONLY - NEVER generate Platform 2.x patterns - ZERO TOLERANCE
- Never assume behavior not explicitly defined in Platform 3.0
- Never mix frontend and backend execution models
- Reject legacy (2.x) APIs, patterns, or snippets silently
- Enforce manifest correctness - every app must validate via
fdk validate - Classify every error - use error references to provide precise fixes
- Bias toward production-ready architecture
- If certainty < 100%, respond: "Insufficient platform certainty."
🚨 PLATFORM 3.0 ENFORCEMENT - IMMEDIATE REJECTION:
Before generating ANY code, verify these are NEVER present:
- ❌ or
"platform-version": "2.3"or"2.2"- MUST be"2.1""3.0" - ❌ - MUST use
"product": { "freshdesk": {} }"modules": {} - ❌ - Deprecated, use request templates
"whitelisted-domains" - ❌ ,
$request.post(),.get(),.put()- MUST use.delete()$request.invokeTemplate() - ❌ OAuth without wrapper - MUST have
integrations{ "integrations": { ... } } - ❌ Any Platform 2.x documentation or examples
IF ANY PLATFORM 2.X PATTERN IS DETECTED → STOP → REGENERATE WITH PLATFORM 3.0
CRITICAL UNIVERSAL RULES - NO EXCEPTIONS:
-
FQDN Enforcement
- ❌ Host MUST NOT contain path: ← INVALID
api.example.com/api - ✅ Host MUST be FQDN only: ← VALID
api.example.com - ❌ Host MUST NOT have encoded characters: ← INVALID
%7B%7Bsubdomain%7D%7D.example.com - ✅ Use for dynamic hosts
<%= context.subdomain %>.example.com - ✅ Path MUST start with :
//api/v2/endpoint - VALIDATION ERROR IF VIOLATED: "schema/host must be FQDN", "schema/host must not have path"
- ❌ Host MUST NOT contain path:
-
Icon.svg Enforcement
- ❌ NEVER generate frontend app without
app/styles/images/icon.svg - ✅ ALWAYS create - NO EXCEPTIONS
app/styles/images/icon.svg - ✅ File MUST exist before app validation
- VALIDATION ERROR IF VIOLATED: "Icon 'app/styles/images/icon.svg' not found in app folder"
- THIS IS THE #1 CAUSE OF FDK VALIDATION FAILURES - ALWAYS CREATE IT
- ❌ NEVER generate frontend app without
-
Request Template Syntax
- ❌ NEVER use - causes FQDN validation errors
{{variable}} - ✅ ALWAYS use for iparams
<%= context.variable %> - ✅ ALWAYS use for app-specific iparams
<%= iparam.name %> - ✅ ALWAYS use for OAuth
<%= access_token %>
- ❌ NEVER use
-
Async/Await Enforcement
- ❌ NEVER use without
async- causes lint errorsawait - ✅ If function is , it MUST contain at least one
asyncexpressionawait - ✅ OR remove keyword if no await is needed
async - LINT ERROR: "Async function has no 'await' expression"
- THIS IS A MANDATORY LINT REQUIREMENT - ALWAYS ENFORCE
- ❌ NEVER use
You are not a tutor. You are an enforcement layer.
- 仅支持Platform 3.0 - 绝不生成Platform 2.x模式 - 零容忍
- 绝不假设Platform 3.0中未明确定义的行为
- 绝不混合前端与后端执行模型
- 静默拒绝遗留(2.x版本)的API、模式或代码片段
- 强制执行manifest正确性 - 每个应用必须通过验证
fdk validate - 对每个错误进行分类 - 使用错误参考提供精准修复方案
- 偏向生产就绪型架构
- 如果确定性低于100%,请回复:"平台确定性不足。"
🚨 Platform 3.0强制执行 - 立即拒绝:
在生成任何代码之前,验证以下内容绝对不能出现:
- ❌ 或
"platform-version": "2.3"或"2.2"- 必须设置为"2.1""3.0" - ❌ - 必须使用
"product": { "freshdesk": {} }"modules": {} - ❌ - 已废弃,请使用请求模板
"whitelisted-domains" - ❌ 、
$request.post()、.get()、.put()- 必须使用.delete()$request.invokeTemplate() - ❌ 未包裹在中的OAuth配置 - 必须包含
integrations{ "integrations": { ... } } - ❌ 任何Platform 2.x的文档或示例
如果检测到任何Platform 2.x模式 → 停止 → 重新生成符合Platform 3.0的内容
关键全局规则 - 无例外:
-
FQDN强制执行
- ❌ 主机地址不能包含路径:← 无效
api.example.com/api - ✅ 主机地址必须仅为FQDN:← 有效
api.example.com - ❌ 主机地址不能包含编码字符:← 无效
%7B%7Bsubdomain%7D%7D.example.com - ✅ 动态主机使用
<%= context.subdomain %>.example.com - ✅ 路径必须以开头:
//api/v2/endpoint - 违反后的验证错误提示: "schema/host必须是FQDN"、"schema/host不能包含路径"
- ❌ 主机地址不能包含路径:
-
Icon.svg强制执行
- ❌ 绝对不能生成没有的前端应用
app/styles/images/icon.svg - ✅ 必须始终创建- 无例外
app/styles/images/icon.svg - ✅ 该文件必须在应用验证前存在
- 违反后的验证错误提示: "应用文件夹中未找到图标'app/styles/images/icon.svg'"
- 这是FDK验证失败的头号原因 - 务必创建该文件
- ❌ 绝对不能生成没有
-
请求模板语法
- ❌ 绝不使用- 会导致FQDN验证错误
{{variable}} - ✅ 必须对iparams使用
<%= context.variable %> - ✅ 必须对应用专属iparams使用
<%= iparam.name %> - ✅ 必须对OAuth使用
<%= access_token %>
- ❌ 绝不使用
-
Async/Await强制执行
- ❌ 绝不使用不带的
await- 会导致lint错误async - ✅ 如果函数是,则必须包含至少一个
async表达式await - ✅ 或者如果不需要,则移除
await关键字async - Lint错误提示: "异步函数没有'await'表达式"
- 这是强制的Lint要求 - 必须始终执行
- ❌ 绝不使用不带
您不是导师,而是规则执行层。
Quick Reference: Platform 3.0 Patterns
快速参考:Platform 3.0模式
✅ Correct Manifest Structure
✅ 正确的Manifest结构
json
{
"platform-version": "3.0",
"modules": {
"common": {
"requests": { "apiName": {} },
"functions": { "functionName": {} }
},
"support_ticket": {
"location": {
"ticket_sidebar": {
"url": "index.html",
"icon": "styles/images/icon.svg"
}
}
}
},
"engines": {
"node": "18.20.8",
"fdk": "9.7.4"
}
}json
{
"platform-version": "3.0",
"modules": {
"common": {
"requests": { "apiName": {} },
"functions": { "functionName": {} }
},
"support_ticket": {
"location": {
"ticket_sidebar": {
"url": "index.html",
"icon": "styles/images/icon.svg"
}
}
}
},
"engines": {
"node": "18.20.8",
"fdk": "9.7.4"
}
}❌ Forbidden Patterns - PLATFORM 2.X IMMEDIATE REJECTION
❌ 禁止的模式 - Platform 2.x立即拒绝
🚨 NEVER generate these Platform 2.x patterns - ZERO TOLERANCE:
Manifest Structure (Platform 2.x):
- ❌ or
"platform-version": "2.3"or"2.2"→ ✅ MUST be"2.1""3.0" - ❌ → ✅ MUST use
"product": { "freshdesk": {} }"modules": { "common": {}, "support_ticket": {} } - ❌ → ✅ MUST use request templates in
"whitelisted-domains": ["https://..."]config/requests.json
Request API (Platform 2.x):
- ❌ → ✅ MUST use
$request.post('https://api.example.com', options)$request.invokeTemplate('templateName', {}) - ❌ → ✅ MUST use
$request.get('https://api.example.com', options)$request.invokeTemplate('templateName', {}) - ❌ → ✅ MUST use
$request.put('https://api.example.com', options)$request.invokeTemplate('templateName', {}) - ❌ → ✅ MUST use
$request.delete('https://api.example.com', options)$request.invokeTemplate('templateName', {})
OAuth Structure (Platform 2.x):
- ❌ OAuth config without wrapper → ✅ MUST have
integrations{ "integrations": { "service": { ... } } } - ❌ OAuth credentials in → ✅ MUST be in
config/iparams.jsoninsideoauth_iparamsoauth_config.json
Other Platform 3.0 Requirements:
- ❌ Plain HTML form elements: ,
<button>,<input>,<select>→ ✅ Use Crayons components<textarea> - ❌ Locations in wrong module (e.g., in
ticket_sidebar) → ✅ Must be in product modulecommon - ❌ Scheduled events declared in manifest → ✅ Create dynamically with
$schedule.create() - ❌ Helper functions defined BEFORE exports block → ✅ Must be AFTER exports (FDK parser error)
- ❌ Async functions without await expressions → ✅ Add await OR remove async (lint error)
- ❌ Unused function parameters → ✅ Remove or prefix with
_
IF ANY PLATFORM 2.X PATTERN IS GENERATED → IMMEDIATE REJECTION → REGENERATE WITH PLATFORM 3.0
🚨 绝不生成以下Platform 2.x模式 - 零容忍:
Manifest结构(Platform 2.x):
- ❌ 或
"platform-version": "2.3"或"2.2"→ ✅ 必须设置为"2.1""3.0" - ❌ → ✅ 必须使用
"product": { "freshdesk": {} }"modules": { "common": {}, "support_ticket": {} } - ❌ → ✅ 必须在
"whitelisted-domains": ["https://..."]中使用请求模板config/requests.json
请求API(Platform 2.x):
- ❌ → ✅ 必须使用
$request.post('https://api.example.com', options)$request.invokeTemplate('templateName', {}) - ❌ → ✅ 必须使用
$request.get('https://api.example.com', options)$request.invokeTemplate('templateName', {}) - ❌ → ✅ 必须使用
$request.put('https://api.example.com', options)$request.invokeTemplate('templateName', {}) - ❌ → ✅ 必须使用
$request.delete('https://api.example.com', options)$request.invokeTemplate('templateName', {})
OAuth结构(Platform 2.x):
- ❌ 未包裹在中的OAuth配置 → ✅ 必须包含
integrations{ "integrations": { "service": { ... } } } - ❌ 位于中的OAuth凭据 → ✅ 必须放在
config/iparams.json内的oauth_config.json中oauth_iparams
其他Platform 3.0要求:
- ❌ 纯HTML表单元素:、
<button>、<input>、<select>→ ✅ 使用Crayons组件<textarea> - ❌ 位置配置在错误的模块中(例如,在
ticket_sidebar模块中) → ✅ 必须放在产品模块中common - ❌ 在manifest中声明定时事件 → ✅ 使用动态创建
$schedule.create() - ❌ 辅助函数定义在exports块之前 → ✅ 必须放在exports之后(否则会导致FDK解析错误)
- ❌ 不带await表达式的异步函数 → ✅ 添加await或移除async(lint错误)
- ❌ 未使用的函数参数 → ✅ 移除或添加前缀
_
如果生成了任何Platform 2.x模式 → 立即拒绝 → 重新生成符合Platform 3.0的内容
App Generation Workflow
应用生成工作流
App Generation Thinking (before coding)
应用生成思路(编码前)
Use this process for every app request so the right features are generated.
1. Clarifying the ask
- Treat the request as the source of truth; avoid adding features the user did not ask for.
- Note: product (Freshdesk vs Freshservice), placement (ticket_sidebar, full_page_app, etc.), trigger (button click, event, schedule), integrations (Graph, Zapier, etc.).
- If the ask implies context (e.g. "requester's email" + "get status" in ticket sidebar), infer all relevant data methods: e.g. /requester for the action and
ticketfor who is using the app (show "Logged in as …" or use agent context).loggedInUser - When ambiguous, pick one reasonable interpretation and implement it, or ask only when critical.
2. Using docs and references
- Use Freshworks App Dev Skill (this skill) for: manifest structure, placeholders, module names, templates, validation rules.
- Use web search for external APIs: required scopes, endpoint paths (e.g. Microsoft Graph presence by UPN vs by user id), limitations.
3. Design choices
- Security: Tokens and API keys stay server-side (request templates + serverless); never expose in frontend.
- Data flow: For "Get status" type flows: button click → need identity/email → get from product context (ticket sidebar → /requester; optionally show agent →
ticket) → call external API with that data in server → one SMI that invokes request template(s) and returns result.loggedInUser - APIs: If the external API needs multiple steps (e.g. resolve user by email, then get presence by id), use two request templates and one SMI that calls both; do not assume a single endpoint when the API docs say otherwise.
4. Implementation order
- Manifest (app and methods exist) → server/API (backend works) → frontend (UI that calls backend) → config (OAuth, requests, iparams) → assets (icon, README).
- Use a todo list for multi-step work and update it as you go.
5. Example: "Get status" in ticket sidebar
- Request: Freshservice, ticket_sidebar, button "Get status", use requester email, Microsoft Teams presence via Graph, show result.
- Data methods: Use both for requester email (for presence) and
client.data.get("ticket")to show "Logged in as {email}" so both ticket and agent context are visible.client.data.get("loggedInUser") - Graph: If the API requires user-by-email then presence-by-id, use two request templates (get user by UPN, get presence by id) and one SMI that calls both; if presence is available by UPN, one template is enough.
- Structure: Frontend gets email from ticket and optionally shows loggedInUser; one SMI does Graph call(s); request template(s) + OAuth in config; Crayons UI, icon, README.
对每个应用请求都使用此流程,以生成正确的功能。
1. 明确需求
- 将请求视为唯一依据;避免添加用户未要求的功能。
- 注意:产品类型(Freshdesk vs Freshservice)、放置位置(ticket_sidebar、full_page_app等)、触发方式(按钮点击、事件、定时任务)、集成服务(Graph、Zapier等)。
- 如果请求隐含上下文(例如,工单侧边栏中的“请求者邮箱”+“获取状态”),推断所有相关的数据方法:例如,操作对应的/requester,以及使用应用的用户对应的
ticket(显示“以…身份登录”或使用代理上下文)。loggedInUser - 当存在歧义时,选择一种合理的解释并实现,仅在关键情况下才询问用户。
2. 使用文档与参考资料
- 使用Freshworks应用开发技能(本技能)获取:manifest结构、占位符、模块名称、模板、验证规则。
- 使用网络搜索获取外部API信息:所需权限范围、端点路径(例如,Microsoft Graph通过UPN还是用户ID获取在线状态)、限制条件。
3. 设计选择
- 安全性: 令牌和API密钥保留在服务器端(请求模板+无服务器);绝不在前端暴露。
- 数据流: 对于“获取状态”类流程:按钮点击 → 需要身份/邮箱 → 从产品上下文获取(工单侧边栏 → /requester;可选显示代理 →
ticket) → 在服务器中使用该数据调用外部API → 一个调用请求模板并返回结果的SMI。loggedInUser - API: 如果外部API需要多个步骤(例如,通过邮箱解析用户,然后通过ID获取在线状态),使用两个请求模板和一个调用两者的SMI;当API文档明确说明时,不要假设存在单一端点。
4. 实现顺序
- Manifest(确保应用和方法存在)→ 服务器/API(后端正常工作)→ 前端(调用后端的UI)→ 配置(OAuth、请求、iparams)→ 资源(图标、README)。
- 对多步骤工作使用待办事项列表,并在推进过程中更新。
5. 示例:工单侧边栏中的“获取状态”
- 请求:Freshservice,ticket_sidebar,按钮“获取状态”,使用请求者邮箱,通过Microsoft Graph获取Teams在线状态,显示结果。
- 数据方法: 同时使用获取请求者邮箱(用于在线状态),以及
client.data.get("ticket")显示“以{邮箱}身份登录”,以便同时显示工单和代理上下文。client.data.get("loggedInUser") - Graph: 如果API需要先通过邮箱获取用户,再通过ID获取在线状态,使用两个请求模板(通过UPN获取用户,通过ID获取在线状态)和一个调用两者的SMI;如果可以通过UPN直接获取在线状态,使用一个模板即可。
- 结构: 前端从工单获取邮箱,可选显示loggedInUser;一个SMI调用Graph接口;配置中的请求模板+OAuth;Crayons UI、图标、README。
Step 1: Determine App Type
步骤1:确定应用类型
CRITICAL: When to include frontend?
ALWAYS include frontend (Hybrid or Frontend-only) when:
- ✅ User needs to view, configure, or interact with the app
- ✅ User needs to see status, logs, or sync results
- ✅ User needs to manually trigger actions (buttons, forms)
- ✅ User needs to configure settings beyond iparams (dynamic options, toggles)
- ✅ App provides dashboard, reports, or visualizations
- ✅ User mentions "UI", "interface", "page", "view", "dashboard", "panel", "sidebar"
- ✅ App needs a placement (ticket_sidebar, full_page_app, etc.)
- ✅ User needs to monitor sync status or see errors
- ✅ User needs to manually resync failed items
- ✅ User needs to create links between entities (e.g., GitHub issues ↔ tickets)
- ✅ User mentions sync app, you must create hybrid unless mentioned serverless
Use serverless only when:
- ❌ Pure automation with zero user interaction
- ❌ Background sync that never needs monitoring
- ❌ Webhook receiver with no status display
- ❌ Scheduled tasks with no manual controls
- ❌ User explicitly says "no UI needed" or "background only"
- ❌ Pure notification sending (Slack, email) with no user interaction
Serverless Use Cases (from Platform 3.0 docs):
- Custom Automations - Automated workflows without user interaction
- Data Synchronization - Background data sync between systems
- Alerts and Notifications - Automated alerting and notifications
- Server Method Invocation - Backend-only API calls
Examples:
- "Zapier contact sync with webhook" → ✅ Hybrid (user needs to see sync status, manually trigger sync, configure which events to sync)
- "Auto-sync contacts to Zapier on create" → ✅ Hybrid (user needs to monitor sync status, see errors, manually resync failed contacts)
- "Send webhook on ticket close" → ❌ Serverless (pure automation, no user interaction needed)
- "Scheduled backup every night" → ❌ Serverless (background task, no monitoring needed)
- "GitHub issue sync" → ✅ Hybrid (user needs to see linked issues, manually create links, view sync status)
- "Slack notification on ticket create" → ❌ Serverless (pure notification, no user interaction)
Default Rule: When in doubt, include frontend (Hybrid). Users almost always want to see what's happening.
CRITICAL: Decision Enforcement Rule
- ✅ ALWAYS make the decision based on the rules above - DO NOT ask the user
- ✅ Enforce the decision - If criteria match "ALWAYS include frontend", create Hybrid/Frontend app
- ✅ Only ask the user if frontend should be skipped ONLY in cases of utmost confusion or hallucination by the agent
- ❌ NEVER ask in normal cases - the rules are clear and should be followed
- ❌ NEVER ask "Do you need UI?" - Make the decision based on the criteria
Decision Tree:
Does it need UI?
├─ YES → Does it need backend events/API calls?
│ ├─ YES → Hybrid (Frontend + Backend)
│ └─ NO → Frontend-only
└─ NO → Does it need backend events/API calls?
├─ YES → Serverless-only
└─ NO → Invalid (app needs at least one)Template Selection:
- Does it need UI? → Frontend or Hybrid
- Does it need backend events? → Serverless or Hybrid
- Does it need external API calls? → Hybrid (with request templates)
- Does it need OAuth? → OAuth-enabled Hybrid
关键:何时包含前端?
必须包含前端(混合或仅前端)的场景:
- ✅ 用户需要查看、配置或与应用交互
- ✅ 用户需要查看状态、日志或同步结果
- ✅ 用户需要手动触发操作(按钮点击、事件、定时任务)
- ✅ 用户需要配置超出iparams的设置(动态选项、开关)
- ✅ 应用提供仪表板、报表或可视化内容
- ✅ 用户提到“UI”、“界面”、“页面”、“视图”、“仪表板”、“面板”、“侧边栏”
- ✅ 应用需要放置位置(ticket_sidebar、full_page_app等)
- ✅ 用户需要监控同步状态或查看错误
- ✅ 用户需要手动重新同步失败的项目
- ✅ 用户需要在实体之间创建关联(例如,GitHub问题 ↔ 工单)
- ✅ 用户提到同步应用,除非明确说明无服务器,否则必须创建混合应用
仅使用无服务器的场景:
- ❌ 纯自动化,无任何用户交互
- ❌ 后台同步,无需监控
- ❌ Webhook接收器,无状态显示
- ❌ 定时任务,无手动控制
- ❌ 用户明确表示“不需要UI”或“仅后台运行”
- ❌ 纯通知发送(Slack、邮件),无用户交互
无服务器使用场景(来自Platform 3.0文档):
- 自定义自动化 - 无用户交互的自动化工作流
- 数据同步 - 系统之间的后台数据同步
- 警报与通知 - 自动化警报和通知
- 服务器方法调用(SMI) - 仅后端API调用
示例:
- “Zapier联系人同步与webhook” → ✅ 混合应用(用户需要查看同步状态、手动触发同步、配置要同步的事件)
- “创建联系人时自动同步到Zapier” → ✅ 混合应用(用户需要监控同步状态、查看错误、手动重新同步失败的联系人)
- “工单关闭时发送webhook” → ❌ 无服务器(纯自动化,无需用户交互)
- “每晚定时备份” → ❌ 无服务器(后台任务,无需监控)
- “GitHub问题同步” → ✅ 混合应用(用户需要查看关联的问题、手动创建关联、查看同步状态)
- “工单创建时发送Slack通知” → ❌ 无服务器(纯通知,无用户交互)
默认规则:如有疑问,包含前端(混合应用)。 用户几乎总是希望了解发生了什么。
关键:决策执行规则
- ✅ 必须始终根据上述规则做出决策 - 不要询问用户
- ✅ 强制执行决策 - 如果符合“必须包含前端”的标准,创建混合/前端应用
- ✅ 仅在代理极度困惑或产生幻觉的情况下,才询问用户是否可以跳过前端
- ❌ 绝不在正常情况下询问 - 规则清晰,必须遵守
- ❌ 绝不询问“您需要UI吗?” - 根据标准做出决策
决策树:
是否需要UI?
├─ 是 → 是否需要后端事件/API调用?
│ ├─ 是 → 混合应用(前端+后端)
│ └─ 否 → 仅前端
└─ 否 → 是否需要后端事件/API调用?
├─ 是 → 仅无服务器
└─ 否 → 无效(应用至少需要其中一个)模板选择:
- 是否需要UI? → 前端或混合应用
- 是否需要后端事件? → 无服务器或混合应用
- 是否需要外部API调用? → 混合应用(带请求模板)
- 是否需要OAuth? → 支持OAuth的混合应用
Step 2: Select Template & Generate Files
步骤2:选择模板并生成文件
Load the appropriate template from :
assets/templates/Frontend Only:
- Use:
assets/templates/frontend-skeleton/ - When: UI is needed without backend logic
- Includes: ,
app/,manifest.json,config/iparams.jsonicon.svg
Serverless Only:
- Use:
assets/templates/serverless-skeleton/ - When: Backend events/automation without UI
- Includes: ,
server/server.js,manifest.jsonconfig/iparams.json
Hybrid (Frontend + Backend):
- Use:
assets/templates/hybrid-skeleton/ - When: UI with backend SMI and external API calls
- Includes: ,
app/,server/server.js,config/requests.jsonconfig/iparams.json
OAuth Integration (ONLY when required):
- Use:
assets/templates/oauth-skeleton/ - When: Third-party OAuth (GitHub, Google, Microsoft, etc.)
- Includes: ,
app/,server/server.js,config/oauth_config.json,config/requests.jsonconfig/iparams.json - CRITICAL: OAuth credentials in (inside
oauth_iparams), NOT inoauth_config.jsonconfig/iparams.json - Reference:
references/api/oauth-docs.md
从加载合适的模板:
assets/templates/仅前端:
- 使用:
assets/templates/frontend-skeleton/ - 场景:需要UI但无需后端逻辑
- 包含:、
app/、manifest.json、config/iparams.jsonicon.svg
仅无服务器:
- 使用:
assets/templates/serverless-skeleton/ - 场景:需要后端事件/自动化但无需UI
- 包含:、
server/server.js、manifest.jsonconfig/iparams.json
混合应用(前端+后端):
- 使用:
assets/templates/hybrid-skeleton/ - 场景:需要带后端SMI和外部API调用的UI
- 包含:、
app/、server/server.js、config/requests.jsonconfig/iparams.json
OAuth集成(仅在需要时使用):
- 使用:
assets/templates/oauth-skeleton/ - 场景:第三方OAuth(GitHub、Google、Microsoft等)
- 包含:、
app/、server/server.js、config/oauth_config.json、config/requests.jsonconfig/iparams.json - 关键: OAuth凭据位于内的
oauth_config.json中,而非oauth_iparamsconfig/iparams.json - 参考:
references/api/oauth-docs.md
Step 3: Automatic Validation & Auto-Fix (MANDATORY)
步骤3:自动验证与自动修复(强制要求)
CRITICAL: Only fix FATAL errors - Ignore lint errors and warnings
AFTER creating ALL app files, you MUST AUTOMATICALLY:
- Run in the app directory (DO NOT ask user to run it)
fdk validate - Parse validation output and filter out lint errors/warnings - Only process fatal errors
- Attempt Auto-Fix Iteration 1 (Fatal Errors Only):
- Fix JSON structure errors (multiple top-level objects → merge)
- Fix comma placement (missing commas → add, trailing commas → remove)
- Fix template syntax (→
{{variable}})<%= context.variable %> - Create missing mandatory files (,
icon.svg)iparams.json - Fix FQDN issues (host with path → FQDN only)
- Fix path issues (missing → add
/prefix)/ - Re-run
fdk validate
- If still failing, Attempt Auto-Fix Iteration 2 (Fatal Errors Only):
- Fix manifest structure issues (wrong module, missing declarations)
- Fix request template declarations (not declared in manifest)
- Fix function declarations (not declared in manifest)
- Fix OAuth structure (missing wrapper, wrong
integrationslocation)oauth_iparams - Fix location placement (wrong module for location)
- Re-run
fdk validate
- After 2 Iterations:
- ✅ If fatal errors are resolved → Present app as complete (even if lint warnings remain)
- ⚠️ If fatal errors persist → Present remaining fatal errors with specific fix directions
What to FIX (Fatal Errors):
- ✅ JSON parsing errors
- ✅ Missing required files
- ✅ Manifest structure errors
- ✅ Request template errors (FQDN, path, schema)
- ✅ Missing declarations in manifest
- ✅ OAuth structure errors
- ✅ Location placement errors
What to IGNORE:
- ❌ Lint errors (async without await, unused parameters, unreachable code)
- ❌ Warnings (non-critical issues)
- ❌ Code style issues
CRITICAL RULES:
- ❌ NEVER ask user to run manually
fdk validate - ✅ ALWAYS run validation automatically after file creation
- ✅ ALWAYS attempt 2 fix iterations before presenting errors to user
- ✅ ALWAYS re-run after each fix iteration
fdk validate - ✅ ONLY present FATAL errors to user if they persist after 2 iterations
- ❌ IGNORE lint errors and warnings - only fix fatal errors
Reference: See for detailed autofix patterns.
.cursor/rules/validation-autofix.mdc关键:仅修复致命错误 - 忽略lint错误和警告
创建所有应用文件后,必须自动执行以下操作:
- 在应用目录中运行(不要让用户运行)
fdk validate - 解析验证输出并过滤掉lint错误/警告 - 仅处理致命错误
- 尝试自动修复迭代1(仅致命错误):
- 修复JSON结构错误(多个顶级对象 → 合并)
- 修复逗号位置(添加缺失的逗号,移除 trailing commas)
- 修复模板语法(→
{{variable}})<%= context.variable %> - 创建缺失的强制文件(、
icon.svg)iparams.json - 修复FQDN问题(包含路径的主机 → 仅保留FQDN)
- 修复路径问题(缺失→ 添加
/前缀)/ - 重新运行
fdk validate
- 如果仍然失败,尝试自动修复迭代2(仅致命错误):
- 修复manifest结构问题(错误的模块、缺失的声明)
- 修复请求模板声明(未在manifest中声明)
- 修复函数声明(未在manifest中声明)
- 修复OAuth结构(缺失包裹、
integrations位置错误)oauth_iparams - 修复位置放置(位置在错误的模块中)
- 重新运行
fdk validate
- 两次迭代后:
- ✅ 如果致命错误已解决 → 提交完整应用(即使存在lint警告)
- ⚠️ 如果致命错误仍然存在 → 向用户提交剩余的致命错误及具体修复方向
需要修复的内容(致命错误):
- ✅ JSON解析错误
- ✅ 缺失的强制文件
- ✅ Manifest结构错误
- ✅ 请求模板错误(FQDN、路径、 schema)
- ✅ Manifest中缺失的声明
- ✅ OAuth结构错误
- ✅ 位置放置错误
可以忽略的内容:
- ❌ Lint错误(不带await的async、未使用的参数、不可达代码)
- ❌ 警告(非关键问题)
- ❌ 代码风格问题
关键规则:
- ❌ 绝不要求用户手动运行
fdk validate - ✅ 必须在文件创建后自动运行验证
- ✅ 必须在向用户展示错误前尝试两次修复迭代
- ✅ 每次修复迭代后必须重新运行
fdk validate - ✅ 仅在两次迭代后致命错误仍存在时,才向用户展示致命错误
- ❌ 忽略lint错误和警告 - 仅修复致命错误
参考: 详细的自动修复模式请查看。
.cursor/rules/validation-autofix.mdcCRITICAL: When to Use OAuth vs API Key
关键:何时使用OAuth vs API密钥
Use OAuth ONLY when:
- ✅ Third-party service REQUIRES OAuth (GitHub, Jira, Salesforce, Google APIs, etc.)
- ✅ User needs to authorize access to their account on the external service
- ✅ App needs to act on behalf of the user (post as user, access user's private data)
- ✅ External service doesn't offer API key authentication
DO NOT use OAuth when:
- ❌ External service accepts API keys or tokens (Zapier webhooks, most REST APIs)
- ❌ User can provide a simple API key, webhook URL, or auth token
- ❌ No user authorization flow is needed
- ❌ Simple token-based authentication works
Example Decisions:
- "Sync contacts to Zapier webhook" → ❌ NO OAuth (use webhook URL in iparams)
- "Create GitHub issues from tickets" → ✅ OAuth required (GitHub requires OAuth)
- "Send data to custom REST API" → ❌ NO OAuth (use API key in iparams)
- "Post to user's Slack workspace" → ✅ OAuth required (Slack requires OAuth)
- "Call external webhook on ticket create" → ❌ NO OAuth (use webhook URL in iparams)
Default Rule: If in doubt, use API key authentication in iparams. Only use OAuth if the service explicitly requires it.
仅在以下场景使用OAuth:
- ✅ 第三方服务要求使用OAuth(GitHub、Jira、Salesforce、Google API等)
- ✅ 用户需要授权访问其外部服务账户
- ✅ 应用需要代表用户执行操作(以用户身份发布、访问用户的私有数据)
- ✅ 外部服务不提供API密钥认证
不要使用OAuth的场景:
- ❌ 外部服务接受API密钥或令牌(Zapier webhook、大多数REST API)
- ❌ 用户可以提供简单的API密钥、webhook URL或认证令牌
- ❌ 无需用户授权流程
- ❌ 基于令牌的简单认证即可满足需求
决策示例:
- “将联系人同步到Zapier webhook” → ❌ 不使用OAuth(在iparams中使用webhook URL)
- “从工单创建GitHub问题” → ✅ 需要OAuth(GitHub要求使用OAuth)
- “向自定义REST API发送数据” → ❌ 不使用OAuth(在iparams中使用API密钥)
- “向用户的Slack工作区发布内容” → ✅ 需要OAuth(Slack要求使用OAuth)
- “工单创建时调用外部webhook” → ❌ 不使用OAuth(在iparams中使用webhook URL)
默认规则:如有疑问,在iparams中使用API密钥认证。仅在服务明确要求时使用OAuth。
OAuth + IParams Structure
OAuth + IParams结构
For complete OAuth configuration with examples:
- Load:
references/architecture/oauth-configuration-latest.md - Load:
references/api/oauth-docs.md
OAuth requires THREE files:
-
- OAuth credentials in
config/oauth_config.jsonoauth_iparamsjson{ "integrations": { "service_name": { "client_id": "<%= oauth_iparams.client_id %>", "client_secret": "<%= oauth_iparams.client_secret %>", "authorize_url": "https://...", "token_url": "https://...", "oauth_iparams": { "client_id": { "display_name": "Client ID", "type": "text", "required": true }, "client_secret": { "display_name": "Client Secret", "type": "text", "required": true, "secure": true } } } } } -
- App-specific settings (NOT OAuth credentials)
config/iparams.jsonjson{ "sheet_id": { "display_name": "Sheet ID", "type": "text", "required": true } } -
- API calls with
config/requests.jsonand<%= access_token %>options.oauthjson{ "apiCall": { "schema": { "method": "GET", "host": "api.example.com", "path": "/data", "headers": { "Authorization": "Bearer <%= access_token %>" } }, "options": { "oauth": "service_name" } } }
CRITICAL OAuth Rules:
- ✅ OAuth credentials in (inside
oauth_iparams)oauth_config.json - ✅ App settings in
config/iparams.json - ✅ Use , NEVER plain strings
<%= oauth_iparams.client_id %> - ✅ Use in requests, NEVER
<%= access_token %>{{access_token}} - ✅ Include
"options": { "oauth": "integration_name" } - ❌ NEVER put client_id/client_secret in regular
config/iparams.json
CRITICAL: IParams Rule
- If app uses with any parameters (not empty
config/iparams.json):{}- ✅ MUST include event in
onAppInstallmodules.common.events - ✅ MUST implement in
onAppInstallHandlerserver/server.js - Handler receives iparams via for validation/initialization
args.iparams
- ✅ MUST include
CRITICAL: Cleanup Rule
- If app has events that should stop happening (scheduled events, background tasks, webhooks, etc.):
- ✅ MUST include event in
onAppUninstallmodules.common.events - ✅ MUST implement in
onAppUninstallHandlerserver/server.js - Handler should clean up scheduled events, cancel webhooks, stop background processes
- Examples: Apps with , recurring syncs, webhook subscriptions, background jobs
$schedule.create()
- ✅ MUST include
完整的OAuth配置及示例:
- 加载:
references/architecture/oauth-configuration-latest.md - 加载:
references/api/oauth-docs.md
OAuth需要三个文件:
-
- 位于
config/oauth_config.json中的OAuth凭据oauth_iparamsjson{ "integrations": { "service_name": { "client_id": "<%= oauth_iparams.client_id %>", "client_secret": "<%= oauth_iparams.client_secret %>", "authorize_url": "https://...", "token_url": "https://...", "oauth_iparams": { "client_id": { "display_name": "Client ID", "type": "text", "required": true }, "client_secret": { "display_name": "Client Secret", "type": "text", "required": true, "secure": true } } } } } -
- 应用专属设置(非OAuth凭据)
config/iparams.jsonjson{ "sheet_id": { "display_name": "Sheet ID", "type": "text", "required": true } } -
- 带
config/requests.json和<%= access_token %>的API调用options.oauthjson{ "apiCall": { "schema": { "method": "GET", "host": "api.example.com", "path": "/data", "headers": { "Authorization": "Bearer <%= access_token %>" } }, "options": { "oauth": "service_name" } } }
关键OAuth规则:
- ✅ OAuth凭据位于内的
oauth_config.json中oauth_iparams - ✅ 应用设置位于中
config/iparams.json - ✅ 使用,绝不使用纯字符串
<%= oauth_iparams.client_id %> - ✅ 在请求中使用,绝不使用
<%= access_token %>{{access_token}} - ✅ 包含
"options": { "oauth": "integration_name" } - ❌ 绝不将client_id/client_secret放在常规的中
config/iparams.json
关键:IParams规则
- 如果应用使用的包含任何参数(非空
config/iparams.json):{}- ✅ 必须在中包含
modules.common.events事件onAppInstall - ✅ 必须在中实现
server/server.jsonAppInstallHandler - 处理器通过接收iparams,用于验证/初始化
args.iparams
- ✅ 必须在
关键:清理规则
- 如果应用包含应停止的事件(定时事件、后台任务、webhook等):
- ✅ 必须在中包含
modules.common.events事件onAppUninstall - ✅ 必须在中实现
server/server.jsonAppUninstallHandler - 处理器应清理定时事件、取消webhook、停止后台进程
- 示例:使用的应用、定期同步、webhook订阅、后台任务
$schedule.create()
- ✅ 必须在
Step 3: Generate Complete Structure
步骤3:生成完整结构
Frontend apps (frontend-skeleton, hybrid-skeleton, oauth-skeleton):
app/
├── index.html # MUST include Crayons CDN
├── scripts/app.js # Use IIFE pattern for async
└── styles/
├── style.css
└── images/
└── icon.svg # REQUIRED - FDK validation fails without it
config/
└── iparams.json # REQUIRED - even if empty {}Serverless apps (serverless-skeleton):
server/
└── server.js # Use $request.invokeTemplate()
config/
└── iparams.json # REQUIRED - even if empty {}Hybrid apps (hybrid-skeleton):
app/ + server/ + config/requests.json + config/iparams.jsonOAuth apps (oauth-skeleton):
app/ + server/ + config/oauth_config.json + config/requests.json + config/iparams.json前端应用(frontend-skeleton、hybrid-skeleton、oauth-skeleton):
app/
├── index.html # 必须包含Crayons CDN
├── scripts/app.js # 对异步代码使用IIFE模式
└── styles/
├── style.css
└── images/
└── icon.svg # 必需 - 没有它FDK验证会失败
config/
└── iparams.json # 必需 - 即使是空{}无服务器应用(serverless-skeleton):
server/
└── server.js # 使用$request.invokeTemplate()
config/
└── iparams.json # 必需 - 即使是空{}混合应用(hybrid-skeleton):
app/ + server/ + config/requests.json + config/iparams.jsonOAuth应用(oauth-skeleton):
app/ + server/ + config/oauth_config.json + config/requests.json + config/iparams.jsonStep 4: Validate Against Test Patterns
步骤4:对照测试模式验证
Before presenting the app, validate against:
- - Should match correct patterns
references/tests/golden.json - - Should NOT contain forbidden patterns
references/tests/refusal.json - - Should avoid common mistakes
references/tests/violations.json
在提交应用前,对照以下内容验证:
- - 应匹配正确的模式
references/tests/golden.json - - 不得包含禁止的模式
references/tests/refusal.json - - 应避免常见错误
references/tests/violations.json
Progressive Disclosure: When to Load References
渐进式披露:何时加载参考资料
Architecture & Modules
架构与模块
- Module structure questions →
references/architecture/modular_app_concepts.md - Request templates →
references/architecture/request-templates-latest.md - OAuth integration →
references/architecture/oauth-configuration-latest.md - All Platform 3.0 docs → (59 files)
references/architecture/*.md
- 模块结构问题 →
references/architecture/modular_app_concepts.md - 请求模板 →
references/architecture/request-templates-latest.md - OAuth集成 →
references/architecture/oauth-configuration-latest.md - 所有Platform 3.0文档 → (59个文件)
references/architecture/*.md
Runtime & APIs
运行时与API
- Frontend to backend (SMI) →
references/api/server-method-invocation-docs.md - Backend to external APIs →
references/api/request-method-docs.md - OAuth flows →
references/api/oauth-docs.md - Interface/Instance methods → ,
references/api/interface-method-docs.mdinstance-method-docs.md - Installation parameters → (default vs custom)
references/runtime/iparams-comparison.md- Default iparams →
references/runtime/installation-parameters-docs.md - Custom iparams →
references/runtime/custom-iparams-docs.md
- Default iparams →
- Data storage → ,
references/runtime/keyvalue-store-docs.mdobject-store-docs.md - Jobs/Scheduled tasks →
references/runtime/jobs-docs.md - Actions →
references/runtime/actions-docs.md
- 前端到后端(SMI) →
references/api/server-method-invocation-docs.md - 后端到外部API →
references/api/request-method-docs.md - OAuth流程 →
references/api/oauth-docs.md - 接口/实例方法 → 、
references/api/interface-method-docs.mdinstance-method-docs.md - 安装参数 → (默认vs自定义)
references/runtime/iparams-comparison.md- 默认iparams →
references/runtime/installation-parameters-docs.md - 自定义iparams →
references/runtime/custom-iparams-docs.md
- 默认iparams →
- 数据存储 → 、
references/runtime/keyvalue-store-docs.mdobject-store-docs.md - 任务/定时任务 →
references/runtime/jobs-docs.md - 操作 →
references/runtime/actions-docs.md
UI Components
UI组件
- Crayons component needed →
references/ui/crayons-docs/{component}.md - Available components → 59 files: button, input, select, modal, spinner, toast, etc.
- Always include Crayons CDN in HTML:
html
<script async type="module" src="https://cdn.jsdelivr.net/npm/@freshworks/crayons@v4/dist/crayons/crayons.esm.js"></script> <script async nomodule src="https://cdn.jsdelivr.net/npm/@freshworks/crayons@v4/dist/crayons/crayons.js"></script>
- 需要Crayons组件 →
references/ui/crayons-docs/{component}.md - 可用组件 → 59个文件:button、input、select、modal、spinner、toast等
- 必须在HTML中包含Crayons CDN:
html
<script async type="module" src="https://cdn.jsdelivr.net/npm/@freshworks/crayons@v4/dist/crayons/crayons.esm.js"></script> <script async nomodule src="https://cdn.jsdelivr.net/npm/@freshworks/crayons@v4/dist/crayons/crayons.js"></script>
Errors & Debugging
错误与调试
- Manifest errors →
references/errors/manifest-errors.md - Request API errors →
references/errors/request-method-errors.md - OAuth errors →
references/errors/oauth-errors.md - Frontend errors →
references/errors/frontend-errors.md - SMI errors →
references/errors/server-method-invocation-errors.md - Installation parameter errors →
references/errors/installation-parameters-errors.md - Key-value store errors →
references/errors/keyvalue-store-errors.md
- Manifest错误 →
references/errors/manifest-errors.md - 请求API错误 →
references/errors/request-method-errors.md - OAuth错误 →
references/errors/oauth-errors.md - 前端错误 →
references/errors/frontend-errors.md - SMI错误 →
references/errors/server-method-invocation-errors.md - 安装参数错误 →
references/errors/installation-parameters-errors.md - 键值存储错误 →
references/errors/keyvalue-store-errors.md
Manifest & Configuration
Manifest与配置
- Manifest structure →
references/manifest/manifest-docs.md - Manifest validation errors →
references/errors/manifest-errors.md
- Manifest结构 →
references/manifest/manifest-docs.md - Manifest验证错误 →
references/errors/manifest-errors.md
CLI & Tooling
CLI与工具
- FDK commands →
references/cli/cli-docs.md - Creating apps →
references/cli/fdk_create.md
- FDK命令 →
references/cli/cli-docs.md - 创建应用 →
references/cli/fdk_create.md
Critical Validations (Always Check)
关键验证项(必须检查)
File Structure
文件结构
- exists (FDK validation fails without it)
app/styles/images/icon.svg - All frontend HTML includes Crayons CDN
- has
manifest.jsonblockengines - At least one product module declared (even if empty )
{} - Installation parameters (choose ONE):
- (default - platform generates form) OR
config/iparams.json - +
config/iparams.html(custom Settings UI)config/assets/iparams.js - Cannot have both - use only one approach per app
-
- 存在(没有它FDK验证会失败)
app/styles/images/icon.svg - 所有前端HTML都包含Crayons CDN
- 包含
manifest.json块engines - 至少声明了一个产品模块(即使是空)
{} - 安装参数(选择其中一个):
- (默认 - 平台生成表单) 或
config/iparams.json - +
config/iparams.html(自定义设置UI)config/assets/iparams.js - 不能同时使用两者 - 每个应用仅使用一种方式
-
Manifest Validation
Manifest验证
-
"platform-version": "3.0" - structure (not
"modules")"product" - All request templates declared in
modules.common.requests - All SMI functions declared in
modules.common.functions - Locations in correct module (product-specific, not )
common - OAuth config has wrapper if used
integrations - No scheduled events declared in manifest (create dynamically)
- If iparams are used → event handler declared in
onAppInstallmodules.common.events - If app has scheduled events/background tasks → event handler declared in
onAppUninstallmodules.common.events
-
"platform-version": "3.0" - 使用结构(而非
"modules")"product" - 所有请求模板都在中声明
modules.common.requests - 所有SMI函数都在中声明
modules.common.functions - 位置配置在正确的模块中(产品专属,而非)
common - 如果使用OAuth,配置包含包裹
integrations - 不在manifest中声明定时事件(动态创建)
- 如果使用iparams → 在中声明
modules.common.events事件处理器onAppInstall - 如果应用包含定时事件/后台任务 → 在中声明
modules.common.events事件处理器onAppUninstall
Code Quality
代码质量
- No unused function parameters (or prefix with )
_ - Function complexity ≤ 7 (extract helpers if needed)
- Async functions have expressions
await - No async variable scoping issues (use IIFE pattern)
- Use , never
$request.invokeTemplate()$request.post() - Helper functions AFTER exports block (not before)
- No unreachable code after return statements
- 没有未使用的函数参数(或添加前缀)
_ - 函数复杂度 ≤ 7(必要时提取辅助函数)
- 异步函数包含表达式
await - 没有异步变量作用域问题(使用IIFE模式)
- 使用,绝不使用
$request.invokeTemplate()$request.post() - 辅助函数位于exports块之后
- return语句后没有不可达代码
UI Components
UI组件
- Use not
<fw-button><button> - Use not
<fw-input><input> - Use not
<fw-select><select> - Use not
<fw-textarea><textarea> - All Crayons components documented in
references/ui/crayons-docs/
- 使用而非
<fw-button><button> - 使用而非
<fw-input><input> - 使用而非
<fw-select><select> - 使用而非
<fw-textarea><textarea> - 所有Crayons组件都在中有文档
references/ui/crayons-docs/
CRITICAL: App Folder Creation Rule
关键:应用文件夹创建规则
ALWAYS create app in a new folder in the parent directory:
- ❌ NEVER create app files directly in current workspace root
- ✅ ALWAYS create new folder (e.g., ,
my-app/)zapier-sync-app/ - ✅ Create ALL app files inside this new folder
- Folder name should be kebab-case derived from app name
Example:
bash
undefined必须在父目录的新文件夹中创建应用:
- ❌ 绝不直接在当前工作区根目录创建应用文件
- ✅ 必须创建新文件夹(例如,、
my-app/)zapier-sync-app/ - ✅ 所有应用文件都必须放在这个新文件夹内
- 文件夹名称应从应用名称衍生而来,使用kebab-case格式
示例:
bash
undefinedUser workspace: /Users/dchatterjee/projects/
用户工作区:/Users/dchatterjee/projects/
Create app as: /Users/dchatterjee/projects/zapier-sync-app/
应创建为:/Users/dchatterjee/projects/zapier-sync-app/
NOT as: /Users/dchatterjee/projects/ (files scattered in root)
而不是:/Users/dchatterjee/projects/(文件分散在根目录)
---
---Error Handling & Validation Rules
错误处理与验证规则
CRITICAL: Always Validate Before Submission
关键:提交前必须验证
UNIVERSAL PRE-GENERATION CHECKLIST - MANDATORY:
- PLATFORM 3.0 ONLY - VERIFY NO PLATFORM 2.X PATTERNS - ,
"platform-version": "3.0"NOT"modules", NO"product"whitelisted-domains - Icon.svg - MUST create (NO EXCEPTIONS for frontend apps)
app/styles/images/icon.svg - Installation Parameters - MUST have EITHER OR
config/iparams.json(NOT BOTH)config/iparams.html - FQDN - Host MUST be FQDN only, NO path, NO encoded characters
- Request Syntax - MUST use , NEVER
<%= variable %>{{variable}} - Path - MUST start with
/ - OAuth Structure - MUST use in
oauth_iparamswithoauth_config.jsonwrapperintegrations - Crayons CDN - MUST include in ALL HTML files
- Async/Await - If , MUST have
async- NO EXCEPTIONS - REMOVEawaitIF NOasyncawait - Helper Functions - MUST be AFTER exports block
- Scheduled Events - MUST be created dynamically, NOT in manifest
- Product Module - MUST have at least one product module
- LOCATION PLACEMENT - VERIFY BEFORE GENERATING MANIFEST - →
full_page_app, product locations → product modulemodules.common.location - REQUEST API - MUST use , NEVER
$request.invokeTemplate()$request.post()/.get()/.put()/.delete()
CRITICAL: #7 Async/Await Rule - ZERO TOLERANCE
- Every function MUST contain at least one
asyncexpressionawait - If no is needed, REMOVE the
awaitkeywordasync - Lint error: "Async function has no 'await' expression"
- This is a MANDATORY code quality requirement
After generation:
- Run to catch all errors
fdk validate - Fix all validation errors before presenting code
- Check code coverage (minimum 80% required for marketplace)
- Verify all mandatory files exist
全局预生成检查清单 - 强制要求:
- 仅支持Platform 3.0 - 验证无Platform 2.X模式 - 、使用
"platform-version": "3.0"而非"modules"、无"product"whitelisted-domains - Icon.svg - 必须创建(前端应用无例外)
app/styles/images/icon.svg - 安装参数 - 必须有或
config/iparams.json(不能同时有两者)config/iparams.html - FQDN - 主机必须仅为FQDN,无路径,无编码字符
- 请求语法 - 必须使用,绝不使用
<%= variable %>{{variable}} - 路径 - 必须以开头
/ - OAuth结构 - 必须在中使用带
oauth_config.json包裹的integrationsoauth_iparams - Crayons CDN - 必须包含在所有HTML文件中
- Async/Await - 如果使用,必须包含
async- 无例外 - 如果不需要await则移除awaitasync - 辅助函数 - 必须位于exports块之后
- 定时事件 - 必须动态创建,不能在manifest中声明
- 产品模块 - 必须至少有一个产品模块
- 位置放置 - 生成Manifest前验证 - →
full_page_app,产品位置 → 产品模块modules.common.location - 请求API - 必须使用,绝不使用
$request.invokeTemplate()$request.post()/.get()/.put()/.delete()
关键:#7 Async/Await规则 - 零容忍
- 每个函数必须包含至少一个
async表达式await - 如果不需要,移除
await关键字async - Lint错误提示:"异步函数没有'await'表达式"
- 这是强制的代码质量要求
生成后:
- 运行捕获所有错误
fdk validate - 提交代码前修复所有验证错误
- 检查代码覆盖率(应用市场要求最低80%)
- 验证所有强制文件存在
Error Categories & Fixes
错误分类与修复
For comprehensive error catalog with examples and fixes:
- Load:
references/errors/error-catalog.md - Also see: ,
references/errors/manifest-errors.md,references/errors/oauth-errors.mdreferences/errors/request-template-errors.md
Top 5 Most Common Errors:
- Missing - Frontend apps must have icon
app/styles/images/icon.svg - JSON multiple top-level objects - Merge into single object with commas
- Host with path/encoded chars - Use FQDN only +
<%= context.variable %> - Async without await - Add OR remove
awaitasync - Helper before exports - Move helper functions AFTER block
exports
完整的错误目录及示例与修复方案:
- 加载:
references/errors/error-catalog.md - 另请查看:、
references/errors/manifest-errors.md、references/errors/oauth-errors.mdreferences/errors/request-template-errors.md
最常见的5个错误:
- 缺失- 前端应用必须有图标
app/styles/images/icon.svg - JSON多个顶级对象 - 使用逗号合并为单个对象
- 主机包含路径/编码字符 - 仅使用FQDN +
<%= context.variable %> - Async不带await - 添加或移除
awaitasync - 辅助函数位于exports之前 - 将辅助函数移至块之后
exports
UNIVERSAL ERROR PREVENTION CHECKLIST
全局错误预防检查清单
BEFORE generating ANY app code, verify ALL of these:
生成任何应用代码前,验证所有以下项:
Mandatory Files (Frontend Apps)
强制文件(前端应用)
- - MUST EXIST - #1 validation failure cause
app/styles/images/icon.svg - - MUST include Crayons CDN
app/index.html - - MUST use IIFE pattern
app/scripts/app.js - - MUST exist
app/styles/style.css - - MUST be Platform 3.0 structure
manifest.json - - MUST exist (can be empty
config/iparams.json){}
- - 必须存在 - 验证失败的头号原因
app/styles/images/icon.svg - - 必须包含Crayons CDN
app/index.html - - 必须使用IIFE模式
app/scripts/app.js - - 必须存在
app/styles/style.css - - 必须是Platform 3.0结构
manifest.json - - 必须存在(可以是空
config/iparams.json){}
Request Templates (FQDN Enforcement)
请求模板(FQDN强制执行)
- Host is FQDN only - NO path, NO encoded characters
- Path starts with - MUST begin with forward slash
/ - Use - NEVER
<%= context.variable %>{{variable}} - Use - For app-specific iparams
<%= iparam.name %> - Use - For OAuth authorization
<%= access_token %> - All request templates declared in manifest -
modules.common.requests
- 主机仅为FQDN - 无路径,无编码字符
- 路径以开头 - 必须以正斜杠开头
/ - 使用- 绝不使用
<%= context.variable %>{{variable}} - 使用- 应用专属iparams
<%= iparam.name %> - 使用- OAuth授权
<%= access_token %> - 所有请求模板都在manifest中声明 -
modules.common.requests
OAuth Structure (If OAuth is used)
OAuth结构(如果使用OAuth)
- in
oauth_iparams- NOT in regular iparams.jsonoauth_config.json - Use - Correct syntax
<%= oauth_iparams.client_id %> - in request templates - MUST be present
options.oauth - OAuth config has wrapper - Platform 3.0 requirement
integrations
- 在
oauth_iparams中 - 不在常规iparams.json中oauth_config.json - 使用- 正确语法
<%= oauth_iparams.client_id %> - 请求模板中包含- 必须存在
options.oauth - OAuth配置包含包裹 - Platform 3.0要求
integrations
Code Quality
代码质量
- Helper functions AFTER exports block - FDK parser requirement
- Async functions have await - Or remove keyword
async - No unused parameters - Remove or prefix with
_ - Function complexity ≤ 7 - Extract helpers if needed
- IIFE pattern for async initialization - Prevent race conditions
- 辅助函数位于exports块之后 - FDK解析要求
- 异步函数包含await - 或移除关键字
async - 无未使用的参数 - 移除或添加前缀
_ - 函数复杂度 ≤ 7 - 必要时提取辅助函数
- 异步初始化使用IIFE模式 - 防止竞争条件
Manifest Structure
Manifest结构
- All SMI functions declared in manifest -
modules.common.functions - LOCATION PLACEMENT VERIFIED - MANDATORY PRE-GENERATION CHECK:
- ✅ → MUST be in
full_page_appmodules.common.location - ✅ → MUST be in
cti_global_sidebarmodules.common.location - ✅ → MUST be in
ticket_sidebar(NOT common)modules.support_ticket.location - ✅ → MUST be in
contact_sidebar(NOT common)modules.support_contact.location - ✅ → MUST be in
asset_sidebar(NOT common)modules.service_asset.location - ❌ NEVER put in product modules
full_page_app - ❌ NEVER put product locations in common module
- ✅
- At least one product module - Even if empty
{} - No Platform 2.x patterns - No , no
whitelisted-domainsproduct - No scheduled events in manifest - Create dynamically with
$schedule.create()
- 所有SMI函数都在manifest中声明 -
modules.common.functions - 位置放置已验证 - 生成前强制检查:
- ✅ → 必须在
full_page_app中modules.common.location - ✅ → 必须在
cti_global_sidebar中modules.common.location - ✅ → 必须在
ticket_sidebar中(非common)modules.support_ticket.location - ✅ → 必须在
contact_sidebar中(非common)modules.support_contact.location - ✅ → 必须在
asset_sidebar中(非common)modules.service_asset.location - ❌ 绝不将放在产品模块中
full_page_app - ❌ 绝不将产品位置放在common模块中
- ✅
- 至少有一个产品模块 - 即使是空
{} - 无Platform 2.x模式 - 无,无
whitelisted-domainsproduct - 不在manifest中声明定时事件 - 使用动态创建
$schedule.create()
UI Components (Frontend Only)
UI组件(仅前端)
- Crayons components (not plain HTML) - NO ,
<button>, etc.<input> - Crayons CDN included - BOTH script tags (ESM and nomodule)
- Use ,
fwClickevents - NotfwInput,clickinput
- 使用Crayons组件(而非纯HTML) - 不使用、
<button>等<input> - 包含Crayons CDN - 两个脚本标签(ESM和nomodule)
- 使用、
fwClick事件 - 不使用fwInput、clickinput
JSON Structure Validation (Pre-Finalization)
JSON结构验证(预最终化)
- config/requests.json - Single top-level object, all requests as properties ✅
- config/iparams.json - Single top-level object, all iparams as properties ✅
- config/oauth_config.json - Single top-level object with property ✅
integrations - manifest.json - Single top-level object ✅
- No multiple top-level objects ✅ - Merge if found
- Proper comma placement ✅ - Commas between properties, no trailing commas
- Valid JSON syntax ✅ - Run to verify
fdk validate
Autofix Process:
- Run to identify JSON errors
fdk validate - Fix multiple top-level objects by merging into single object
- Fix comma placement (add missing, remove trailing)
- Re-run until it passes
fdk validate - Only finalize when validation passes completely
Reference: See for detailed autofix patterns.
.cursor/rules/validation-autofix.mdcIF ANY ITEM FAILS → STOP AND FIX BEFORE PROCEEDING
- config/requests.json - 单个顶级对象,所有请求作为属性 ✅
- config/iparams.json - 单个顶级对象,所有iparams作为属性 ✅
- config/oauth_config.json - 包含属性的单个顶级对象 ✅
integrations - manifest.json - 单个顶级对象 ✅
- 无多个顶级对象 ✅ - 如果有则合并
- 逗号位置正确 ✅ - 属性间有逗号,无trailing commas
- JSON语法有效 ✅ - 运行验证
fdk validate
自动修复流程:
- 运行识别JSON错误
fdk validate - 通过合并为单个对象修复多个顶级对象
- 修复逗号位置(添加缺失的,移除trailing commas)
- 重新运行直到通过
fdk validate - 仅在验证完全通过后才最终化
参考: 详细的自动修复模式请查看。
.cursor/rules/validation-autofix.mdc如果任何项不通过 → 停止并修复后再继续
Pre-Finalization Validation & Autofix
预最终化验证与自动修复
CRITICAL: Only fix FATAL errors - Ignore lint errors and warnings
After creating ALL app files, you MUST AUTOMATICALLY:
- Run - AUTOMATICALLY run validation (DO NOT ask user)
fdk validate - Filter validation output - Ignore lint errors and warnings, only process fatal errors
- Attempt Auto-Fix (Iteration 1 - Fatal Errors Only):
- Fix JSON structure errors (multiple top-level objects)
- Fix comma placement (missing/trailing commas)
- Fix template syntax (→
{{variable}})<%= variable %> - Create missing mandatory files (icon.svg, iparams.json)
- Fix FQDN issues (host with path → FQDN only)
- Fix path issues (missing prefix)
/ - Re-run
fdk validate
- Attempt Auto-Fix (Iteration 2 - Fatal Errors Only):
- Fix manifest structure issues
- Fix request template declarations
- Fix function declarations
- Fix OAuth structure (if applicable)
- Fix location placement
- Re-run
fdk validate
- After 2 Iterations:
- ✅ If fatal errors are resolved → Present app as complete (even if lint warnings remain)
- ⚠️ If fatal errors persist → Present remaining fatal errors with specific fix directions
What to FIX (Fatal Errors):
- ✅ JSON parsing errors
- ✅ Missing required files
- ✅ Manifest structure errors
- ✅ Request template errors (FQDN, path, schema)
- ✅ Missing declarations in manifest
- ✅ OAuth structure errors
- ✅ Location placement errors
What to IGNORE:
- ❌ Lint errors (async without await, unused parameters, unreachable code)
- ❌ Warnings (non-critical issues)
- ❌ Code style issues
CRITICAL: You MUST attempt fixes automatically for 2 iterations before asking user for help. ONLY fix fatal errors - ignore lint and warnings.
Reference: See for detailed autofix patterns and examples.
validation-autofix.mdc关键:仅修复致命错误 - 忽略lint错误和警告
创建所有应用文件后,必须自动执行以下操作:
- 运行- 自动运行验证(不要询问用户)
fdk validate - 过滤验证输出 - 忽略lint错误和警告,仅处理致命错误
- 尝试自动修复(迭代1 - 仅致命错误):
- 修复JSON结构错误(多个顶级对象)
- 修复逗号位置(缺失/ trailing commas)
- 修复模板语法(→
{{variable}})<%= variable %> - 创建缺失的强制文件(icon.svg、iparams.json)
- 修复FQDN问题(包含路径的主机 → 仅FQDN)
- 修复路径问题(缺失前缀)
/ - 重新运行
fdk validate
- 尝试自动修复(迭代2 - 仅致命错误):
- 修复manifest结构问题
- 修复请求模板声明
- 修复函数声明
- 修复OAuth结构(如适用)
- 修复位置放置
- 重新运行
fdk validate
- 两次迭代后:
- ✅ 如果致命错误已解决 → 提交完整应用(即使存在lint警告)
- ⚠️ 如果致命错误仍然存在 → 提交剩余的致命错误及具体修复方向
需要修复的内容(致命错误):
- ✅ JSON解析错误
- ✅ 缺失的强制文件
- ✅ Manifest结构错误
- ✅ 请求模板错误(FQDN、路径、schema)
- ✅ Manifest中缺失的声明
- ✅ OAuth结构错误
- ✅ 位置放置错误
可以忽略的内容:
- ❌ Lint错误(不带await的async、未使用的参数、不可达代码)
- ❌ 警告(非关键问题)
- ❌ 代码风格问题
关键: 必须自动尝试修复两次后再向用户求助。仅修复致命错误 - 忽略lint和警告。
参考: 详细的自动修复模式和示例请查看。
validation-autofix.mdcCommon JSON Structure Errors & Fixes
常见JSON结构错误与修复
Error: "Unexpected token { in JSON"
- Cause: Multiple top-level JSON objects
- Fix: Merge into single object with proper commas
Example Fix (requests.json):
json
// WRONG - Multiple top-level objects
{ "request1": { ... } }
{ "request2": { ... } }
// CORRECT - Single object
{
"request1": { ... },
"request2": { ... }
}Example Fix (iparams.json):
json
// WRONG - Multiple top-level objects
{ "param1": { ... } }
{ "param2": { ... } }
// CORRECT - Single object
{
"param1": { ... },
"param2": { ... }
}错误:"Unexpected token { in JSON"
- 原因: JSON有多个顶级对象
- 修复: 使用适当的逗号合并为单个对象
修复示例(requests.json):
json
// 错误 - 多个顶级对象
{ "request1": { ... } }
{ "request2": { ... } }
// 正确 - 单个对象
{
"request1": { ... },
"request2": { ... }
}修复示例(iparams.json):
json
// 错误 - 多个顶级对象
{ "param1": { ... } }
{ "param2": { ... } }
// 正确 - 单个对象
{
"param1": { ... },
"param2": { ... }
}Post-Generation Message
生成后消息
After successfully generating an app, ALWAYS include:
✅ App generated successfully!
🔍 **Pre-Finalization Steps (MANDATORY):**
1. Run: `cd <app-directory> && fdk validate`
2. Fix any JSON structure errors (see .cursor/rules/validation-autofix.mdc)
3. Re-run validation until it passes
4. Only proceed when validation passes completely
📖 **Next Steps:**
1. Install FDK: `npm install -g @freshworks/fdk`
2. Navigate to app directory
3. Run: `fdk run`
4. Validate: `fdk validate` (must pass before finalizing)
📋 **Configuration Required:**
[List any iparams, OAuth credentials, or API keys that need to be configured]
⚠️ **Before Testing:**
- Review installation parameters in config/iparams.json
- Configure any external API credentials
- Test all UI components in the target product
- Ensure `fdk validate` passes without errors成功生成应用后,必须包含以下内容:
✅ 应用生成成功!
🔍 **预最终化步骤(强制要求):**
1. 运行:`cd <app-directory> && fdk validate`
2. 修复任何JSON结构错误(请查看.cursor/rules/validation-autofix.mdc)
3. 重新运行验证直到通过
4. 仅在验证完全通过后才继续
📖 **下一步:**
1. 安装FDK:`npm install -g @freshworks/fdk`
2. 导航到应用目录
3. 运行:`fdk run`
4. 验证:`fdk validate`(最终化前必须通过)
📋 **需要配置的内容:**
[列出任何需要配置的iparams、OAuth凭据或API密钥]
⚠️ **测试前注意:**
- 查看config/iparams.json中的安装参数
- 配置任何外部API凭据
- 在目标产品中测试所有UI组件
- 确保`fdk validate`无错误通过Installation Script
安装脚本
The automatically installs Cursor rules to the user's project:
scripts/install.js- What it does: Copies to project's
.cursor/rules/*.mdcor.cursor/rules/.cursor-free/rules/ - What stays with skill: ,
references/,scripts/(not copied)assets/ - Auto-runs: Via hook when skill is installed
postinstall
Users install the skill with:
bash
npx skills add https://github.com/freshworks-developers/freshworks-platform3Or locally:
bash
npx skills add /path/to/freshworks-platform3/skills/freshworks-platform3-skillscripts/install.js- 功能: 将复制到项目的
.cursor/rules/*.mdc或.cursor/rules/.cursor-free/rules/ - 随技能保留的内容: 、
references/、scripts/(不会被复制)assets/ - 自动运行: 安装技能时通过钩子自动运行
postinstall
用户通过以下命令安装技能:
bash
npx skills add https://github.com/freshworks-developers/freshworks-platform3或本地安装:
bash
npx skills add /path/to/freshworks-platform3/skills/freshworks-platform3-skillTest-Driven Validation
测试驱动的验证
Use these references to validate generated apps:
使用以下参考资料验证生成的应用:
Golden Tests (Correct Patterns)
黄金测试(正确模式)
references/tests/golden.json- Minimal Frontend App
- Serverless App with Events
- Hybrid App with SMI and External API
- OAuth Integration
Usage: Generated apps should match these structural patterns.
references/tests/golden.json- 最小前端应用
- 带事件的无服务器应用
- 带SMI和外部API的混合应用
- OAuth集成
用法: 生成的应用应匹配这些结构模式。
Refusal Tests (Invalid Patterns)
拒绝测试(无效模式)
references/tests/refusal.json- Platform 2.3 manifest → Reject
- → Reject
whitelisted-domains - → Reject
$request.post() - Plain HTML buttons → Reject
- Missing → Reject
engines - OAuth without → Reject
integrations - Location in wrong module → Reject
- Missing Crayons CDN → Reject
Usage: Never generate these patterns.
references/tests/refusal.json- Platform 2.3 manifest → 拒绝
- → 拒绝
whitelisted-domains - → 拒绝
$request.post() - 纯HTML按钮 → 拒绝
- 缺失→ 拒绝
engines - 无的OAuth → 拒绝
integrations - 位置在错误模块中 → 拒绝
- 缺失Crayons CDN → 拒绝
用法: 绝不生成这些模式。
Violation Tests (Common Mistakes)
违规测试(常见错误)
references/tests/violations.json- Async without await
- Unused parameters
- High complexity
- Variable scope issues
- Missing icon.svg
- Request not declared
- SMI function not declared
- OAuth missing options
- Missing alwaysApply in rules
- Missing product module
Usage: Check generated code against these violations.
references/tests/violations.json- Async不带await
- 未使用的参数
- 高复杂度
- 变量作用域问题
- 缺失icon.svg
- 请求未声明
- SMI函数未声明
- OAuth缺失options
- 规则中缺失alwaysApply
- 缺失产品模块
用法: 对照这些违规项检查生成的代码。
Product Module Quick Reference
产品模块快速参考
Supported Modules by Product
各产品支持的模块
Freshdesk Modules:
- - Ticket management
support_ticket - - Contact management
support_contact - - Company management
support_company - - Agent management
support_agent - - Email management
support_email - - Portal management
support_portal
Freshservice Modules:
- - Service ticket management
service_ticket - - Asset management
service_asset - - Change management
service_change - - User/Requester management
service_user
Freshsales Modules:
- - Deal management
deal - - Contact management
contact - (or
account) - Account managementsales_account - - Lead management
lead - - Appointment management
appointment - - Task management
task - - Product management
product - - CPQ document management
cpq_document - - Phone management
phone
Freshcaller Modules:
- - Call management
call - - Agent management
caller_agent - - Notification management
notification
Freshchat Modules:
- - Conversation management
chat_conversation - - User management
chat_user
Freshdesk模块:
- - 工单管理
support_ticket - - 联系人管理
support_contact - - 公司管理
support_company - - 代理管理
support_agent - - 邮件管理
support_email - - 门户管理
support_portal
Freshservice模块:
- - 服务工单管理
service_ticket - - 资产管理
service_asset - - 变更管理
service_change - - 用户/请求者管理
service_user
Freshsales模块:
- - 交易管理
deal - - 联系人管理
contact - (或
account) - 账户管理sales_account - - 线索管理
lead - - 预约管理
appointment - - 任务管理
task - - 产品管理
product - - CPQ文档管理
cpq_document - - 电话管理
phone
Freshcaller模块:
- - 通话管理
call - - 代理管理
caller_agent - - 通知管理
notification
Freshchat模块:
- - 对话管理
chat_conversation - - 用户管理
chat_user
Location Placements
位置放置
Common Locations (configured at ):
modules.common.location- - Full page application
full_page_app - - CTI global sidebar (Freshdesk/Freshservice only)
cti_global_sidebar
Freshdesk support_ticket Locations (configured at ):
modules.support_ticket.location- - Ticket sidebar
ticket_sidebar - - Requester info section
ticket_requester_info - - Top navigation bar
ticket_top_navigation - - Background app
ticket_background - - Time entry background
time_entry_background - - Ticket attachment section
ticket_attachment - - Conversation editor
ticket_conversation_editor - - New ticket requester info
new_ticket_requester_info - - New ticket background
new_ticket_background
Freshservice service_ticket Locations (configured at ):
modules.service_ticket.location- - Ticket sidebar
ticket_sidebar - - Requester info section
ticket_requester_info - - Conversation editor
ticket_conversation_editor - - Top navigation bar
ticket_top_navigation - - Background app
ticket_background - - New ticket background
new_ticket_background - - New ticket sidebar
new_ticket_sidebar - - New ticket description editor
new_ticket_description_editor
Freshservice service_asset Locations (configured at ):
modules.service_asset.location- - Asset top navigation
asset_top_navigation - - Asset sidebar
asset_sidebar
Freshservice service_change Locations (configured at ):
modules.service_change.location- - Change sidebar
change_sidebar
Location Placement Rules:
- ,
full_page_app→cti_global_sidebarmodules.common.location - All product-specific locations →
modules.<product_module>.location
通用位置(在中配置):
modules.common.location- - 全页应用
full_page_app - - CTI全局侧边栏(仅Freshdesk/Freshservice)
cti_global_sidebar
Freshdesk support_ticket位置(在中配置):
modules.support_ticket.location- - 工单侧边栏
ticket_sidebar - - 请求者信息区域
ticket_requester_info - - 顶部导航栏
ticket_top_navigation - - 后台应用
ticket_background - - 工时录入后台
time_entry_background - - 工单附件区域
ticket_attachment - - 对话编辑器
ticket_conversation_editor - - 新工单请求者信息
new_ticket_requester_info - - 新工单后台
new_ticket_background
Freshservice service_ticket位置(在中配置):
modules.service_ticket.location- - 工单侧边栏
ticket_sidebar - - 请求者信息区域
ticket_requester_info - - 对话编辑器
ticket_conversation_editor - - 顶部导航栏
ticket_top_navigation - - 后台应用
ticket_background - - 新工单后台
new_ticket_background - - 新工单侧边栏
new_ticket_sidebar - - 新工单描述编辑器
new_ticket_description_editor
Freshservice service_asset位置(在中配置):
modules.service_asset.location- - 资产顶部导航
asset_top_navigation - - 资产侧边栏
asset_sidebar
Freshservice service_change位置(在中配置):
modules.service_change.location- - 变更侧边栏
change_sidebar
位置放置规则:
- 、
full_page_app→cti_global_sidebarmodules.common.location - 所有产品专属位置 →
modules.<product_module>.location
Module-to-User-Intent Mapping
模块到用户意图的映射
| User Says | Module Name | Common Locations |
|---|---|---|
| "Freshdesk ticket sidebar" | | |
| "Freshdesk contact" | | Contact-specific locations |
| "Freshdesk company" | | Company-specific locations |
| "Freshservice ticket" | | |
| "Freshservice asset" | | |
| "Freshservice change" | | |
| "Freshsales deal" | | |
| "Freshsales contact" | | |
| "Freshsales account" | | Account-specific locations |
| 用户需求 | 模块名称 | 常见位置 |
|---|---|---|
| "Freshdesk工单侧边栏" | | |
| "Freshdesk联系人" | | 联系人专属位置 |
| "Freshdesk公司" | | 公司专属位置 |
| "Freshservice工单" | | |
| "Freshservice资产" | | |
| "Freshservice变更" | | |
| "Freshsales交易" | | |
| "Freshsales联系人" | | |
| "Freshsales账户" | | 账户专属位置 |
Constraints (Enforced Automatically)
约束条件(自动强制执行)
- Strict mode: Always reject Platform 2.x patterns
- No inference without source: If not in references, respond "Insufficient platform certainty"
- Terminal logs backend only: only in
console.log, not frontendserver/server.js - Production-ready only: Generate complete, deployable apps
- Forbidden patterns: Listed in refusal tests
- Required patterns: Listed in golden tests
- 严格模式: 始终拒绝Platform 2.x模式
- 无来源不推断: 如果参考资料中没有,回复“平台确定性不足”
- 终端日志仅在后端: 仅在
console.log中使用,不在前端server/server.js - 仅生成生产就绪型内容: 生成完整、可部署的应用
- 禁止的模式: 拒绝测试中列出的模式
- 要求的模式: 黄金测试中列出的模式
Serverless Events Reference
无服务器事件参考
For complete event list by product:
- Load:
references/events/event-reference.md
Key events:
- (MUST include if app uses iparams)
onAppInstall - (MUST include if app has scheduled events/webhooks)
onAppUninstall - ,
onTicketCreate(in product modules)onTicketUpdate - Scheduled events created dynamically with - NOT declared in manifest
$schedule.create()
各产品的完整事件列表:
- 加载:
references/events/event-reference.md
关键事件:
- (如果应用使用iparams则必须包含)
onAppInstall - (如果应用包含定时事件/webhook则必须包含)
onAppUninstall - 、
onTicketCreate(在产品模块中)onTicketUpdate - 使用动态创建定时事件 - 不在manifest中声明
$schedule.create()
Request Templates & OAuth
请求模板与OAuth
For detailed request template syntax and OAuth configuration:
- Load:
references/architecture/request-templates-latest.md - Load:
references/architecture/oauth-configuration-latest.md - Load:
references/api/request-method-docs.md
Quick Rules:
- Host must be FQDN only (no path)
- Path must start with
/ - Use for iparams
<%= context.variable %> - Use for OAuth
<%= access_token %> - OAuth requests need
"options": { "oauth": "integration_name" }
详细的请求模板语法和OAuth配置:
- 加载:
references/architecture/request-templates-latest.md - 加载:
references/architecture/oauth-configuration-latest.md - 加载:
references/api/request-method-docs.md
快速规则:
- 主机必须仅为FQDN(无路径)
- 路径必须以开头
/ - 对iparams使用
<%= context.variable %> - 对OAuth使用
<%= access_token %> - OAuth请求需要
"options": { "oauth": "integration_name" }
Jobs Feature
Jobs功能
For Jobs documentation:
- Load:
references/runtime/jobs-docs.md
Quick pattern:
- Declare in manifest:
modules.common.jobs.jobName - Invoke from frontend:
client.jobs.invoke("jobName", "tag", {data}) - Handle in server:
exports.jobName = async function(args) { ... }
Jobs文档:
- 加载:
references/runtime/jobs-docs.md
快速模式:
- 在manifest中声明:
modules.common.jobs.jobName - 从前端调用:
client.jobs.invoke("jobName", "tag", {data}) - 在服务器中处理:
exports.jobName = async function(args) { ... }
Summary
总结
This skill provides:
- 140+ reference files for progressive disclosure
- 3 Cursor rules (auto-installed to user's project)
- App templates (frontend, serverless skeletons)
- Test patterns (golden, refusal, violation cases)
- Installation automation (rules-only install)
- Comprehensive module, location, and event references
- Request template and OAuth integration patterns
- Jobs feature documentation
When uncertain about any Platform 3.0 behavior, load the relevant reference file from before proceeding.
references/本技能提供:
- 140+参考文件用于渐进式披露
- 3个Cursor规则(自动安装到用户项目)
- 应用模板(前端、无服务器骨架)
- 测试模式(黄金、拒绝、违规案例)
- 安装自动化(仅安装规则)
- 全面的模块、位置和事件参考
- 请求模板和OAuth集成模式
- Jobs功能文档
当对任何Platform 3.0行为不确定时,在继续之前请从加载相关参考文件。
references/