SuperAPI AI Directory

informat-script

Coding & development

View repository

Updated 10-16 08:49

About this skill

Informat Script

Used to convert natural-language business requirements into Informat / Zhixin platform script code.

Reading order first

Read in this order:

  1. references/script-sdk.md
  2. references/script-safety.md
  3. references/script-platform-lifecycle.md
  4. references/script-output-management.md
  5. references/script-file-header.md
  6. references/script-types.md
  7. references/script-examples.md

When determining whether a method actually exists, first check back with ../../sources/informat.script.md. When the requirement involves edge capabilities, type details, or signature differences, continue checking:

  • ../../sources/informat.script.md
  • ../../sources/informat.d.ts
  • ../../sources/informat.client.d.ts

If the user asks for example assets, saved samples, or "show a local script example", first check:

  • ../../examples/generated_scripts/

Applicable scenarios

When the user wants to do the following, prioritize using this skill:

  • Write Zhixin / Informat platform scripts
  • Query data by department, role, application member, or team member
  • Handle account、company、dept、user、app -related logic
  • Write JavaScript logic in platform automation
  • Use platform capabilities such as storage, questionnaires, transactions, and file transfer
  • Use type definitions to supplement capabilities such as workflows, AI Agent, WeCom, PDF, Excel, encrypted signatures, and JDBC stored procedures
  • Write export functions that will be called by automation, APIs, controls, AI Agent, or scheduled tasks
  • Save, edit, execute, or bind Zhixin platform script files

If the user wants to write expressions, approval conditions, transition conditions, or formulas, use instead informat-expression。

Working approach

  1. First determine whether the user wants a complete script, a function snippet, or a single core logic block.
  2. Confirm whether the required capability exists in the known Informat SDK.
  3. First check whether there are source conflicts, such as inconsistencies in namespaces, parameter names, or return value types.
  4. If the function will be called by automation, APIs, controls, AI Agent, or scheduled tasks, use export function to export explicitly.
  5. Before outputting, perform a syntax self-check on the code, at least checking whether parentheses and braces are paired, strings and templates are closed, commas and semicolons are missing, and whether theif/for/function/try-catch structure is complete.
  6. When it cannot be fully implemented, clearly point out the missing SDK capabilities, source conflicts, or unknown fields, and explain which part the user needs to fill in.
  7. Unless the user explicitly requests it, do not write a long explanation first.

Strong constraints

  • Only two types of capabilities are allowed:
    • Native JavaScript capabilities
    • Informat SDK that explicitly exists in the source materials
  • Do not fabricate objects, namespaces, methods, or field structures.
  • Platform built-in APIs are uniformly called through the global informat ; writing $informat。
  • Functions that will be called by automation, APIs, controls, AI Agent, or scheduled tasks must use ES Module exports, for example export function run() {}。
  • It is forbidden to use CommonJS module.exports or exports to export platform-callable functions.
  • Unexported functions can only serve as private methods inside the script and are not allowed to serve as platform binding or execution entry points.
  • informat.system.* and informat.company.* similar methods must be distinguished by semantics and must not be mixed up.
  • When field names, module identifiers, and role identifiers come from the business context but are not provided in the materials, use placeholder names and clearly remind the user to replace them.
  • If a requirement depends on an undocumented API, directly state "based on the available materials, it cannot be confirmed/cannot be implemented"; do not speculate.
  • If different sources describe the same API's return value or signature inconsistently, do not rely on the behavior of the conflicting parts.
  • For write operations, if there is a source conflict regarding the return value, prefer writing the safe version that "does not rely on the return value," and if necessary confirm the result through a subsequent query.
  • When informat.system.* and informat.company.* or other similar APIs may all match, you must first select the correct namespace based on semantics, then generate the code.
  • storage、survey、FtpClient、jdbc, transactions, workflows, AI Agents, WeCom, PDF, Excel, and encryption/signature-related capabilities must have their original signatures checked back before generation.
  • When outputting code, prioritize ensuring it is "valid, constrained, and modifiable"; do not add fabricated logic just to make it look complete.

Platform script saving, editing, and execution

When the user requests operating on script files in the Zhixin platform, rather than only saving to local generated_scripts/ , handle according to the following rules:

  1. Before saving a platform script, you must first confirm the script SDK and query the existing script list.
  2. When adding a new script, do not pass id; when editing, modifying, or supplementing an existing script, you must pass the real id。
  3. The real id can only come from the platform script list, script content query results, or the script idalready obtained in this conversation; fabricating it yourself is prohibited.
  4. When editing an existing script,content must pass the complete modified file content, and must not pass only a diff or fragment.
  5. If the script is placed under a directory,parentId must come from the script directory query results; after creating a new directory, the script list must be queried again.
  6. When a single platform script file exceeds 300 lines or 8000 characters, it must be proactively split into multiple script files.
  7. Execution in the designer environment is only for debugging unpublished scripts; the published runtime environment only executes the script version released with the application.
  8. The execution tool can only call real functions exported through export in the script; it will not create temporary scripts, nor will it modify script content.
  9. When binding scripts to APIs, scheduled tasks, toolbar buttons, etc., the script ID must be the script file ID, not a directory ID, file name, or function name; the function name is filled in separately in the platform's corresponding function name field.

Source conflict handling rules

When the original materials conflict, handle according to the following conservative rules:

  1. First confirm whether the API clearly exists in at least one authoritative source.
  2. If multiple sources all have it, but the return values are inconsistent:
    • Do not rely on the return value
    • Use side-effect invocation + re-query verification as the preferred approach
  3. If multiple sources all have it, but the parameter naming is inconsistent:
    • Preserve the call order
    • State in the explanation that "parameter names are subject to the on-site SDK"
  4. If multiple namespaces have similar methods:
    • informat.system.* Prefer for system/cross-team semantics
    • informat.company.* Prefer for the current team context
    • When it cannot be determined, clearly state that ambiguity exists; do not force a decision

High-risk scenarios

These scenarios are the easiest to get wrong and must be extra conservative:

  • addCompanyMember: there are at least two sets of namespaces and parameter semantics
  • updateUserRole: the return values in the source conflict, so you cannot assume it definitely returns number or void
  • Any write operation: do not assume "call succeeded = data has definitely changed"; if confirmation is needed, add a query step
  • Externally callable script entry point not export: platform execution, API, automation, controls, AI Agent, or scheduled tasks will not be able to recognize it
  • Use $informat or module.exports: conflicts with platform script execution and static parsing rules
  • Editing an existing platform script omits passing the real id: it will repeatedly create files with the same or similar names
  • Treating the script file name or directory ID as the script file ID: API, scheduled tasks, or button bindings will fail
  • Edge capabilities such as storage, transactions, FTP, and questionnaires: if they appear only in type definitions, go back and check the original signature before writing
  • AI Agent, WeCom, PDF, Excel, cryptographic signatures, JDBC stored procedures, workflow version switching: you must go back and check the original signature before writing
  • Custom modules, fields, role keys, department OIDs: when the materials do not provide them, always use placeholders and prompt for replacement

Output format

By default, output in this order:

  1. Final code
  2. Syntax self-check results
  3. Necessary replacement notes
  4. If there are source conflicts or uncertainties, list them separately
  5. If there are implementation limitations, list the limitation points separately

If the user explicitly asks to "only give code," then only give code, but you must still complete the syntax self-check before outputting.

Syntax self-check requirements

Before the final output, at least complete the following checks:

  • Brackets () [] {} are they fully paired
  • Whether strings, template strings, and comments are correctly closed
  • Whether commas, semicolons, and object property separators are obviously missing
  • if / else / for / while / function / try-catch Is the structure complete
  • Whether expression ${...} DSL or other non-JavaScript syntax is mixed in
  • Whether placeholder names still maintain a legal JavaScript identifier form
  • Whether the external entry function uses export function
  • Whether $informat、module.exports or CommonJS exports

If it is not "only give code" mode, it is recommended to explicitly add one sentence:

  • 语法自检:已检查括号闭合、字符串闭合与控制流结构。

Local save interaction

After generating the script, by default you must handle the "whether to save locally" interaction.

The rules are as follows:

  1. If the user clearly expresses the intent to save from the beginning, for example:
    • Save locally
    • Write to file
    • Persist to disk
    • Generate script file
    • Help me save it
    • Save after confirmation Then do not ask again; go directly into the save flow.
  2. If the user has not clearly expressed the intent to save, then after giving the script append one fixed question:
    • 是否需要我按本地目录规范保存到本地文件?
  3. Even if the user does not explicitly say "save," as long as they express the meaning of confirming saving, it is also regarded as consent to save.
  4. After saving, you must echo back:
    • Actual save path
    • File name
    • Directory category it belongs to
  5. If it is saved as a local file and the user has not requested pure code without comments, prioritize adding a brief file header comment to the file.

Local save rules

When a script needs to be saved locally:

  1. The default root directory is under the current working directory generated_scripts/
  2. First-level directories are categorized by business domain:
    • account
    • app
    • company
    • dept
    • user
    • storage
    • survey
    • transaction
    • other
  3. Second-level directories are categorized by month, in the format YYYY-MM
  4. The file extension is fixed as .js
  5. File names use lowercase underscore format snake_case
  6. Recommended file name patterns:
    • 动作_对象.js
    • 动作_对象_限定词.js
  7. If the user does not specify a file name, automatically generate the file name based on the script semantics
  8. If the user does not specify a directory category, automatically categorize it based on the script semantics
  9. If the script cannot be stably classified into an existing business domain, uniformly place it in the fallback directory other
  10. If saving as a file, prioritize using references/script-file-header.md the header template in

Example path:

  • generated_scripts/user/2026-03/update_user_role.js
  • generated_scripts/company/2026-03/add_company_member.js
  • generated_scripts/transaction/2026-03/update_user_role_with_transaction.js

Example asset

When the user requests to view, reference, or explain script samples in the repository, use the files under examples/generated_scripts/YYYY-MM/ :

  • Update user role:examples/generated_scripts/user/2026-03/update_user_role.js
  • Add team member:examples/generated_scripts/company/2026-03/add_company_member.js
  • Transaction update user role:examples/generated_scripts/transaction/2026-03/update_user_role_with_transaction.js
  • General runtime helper script:examples/generated_scripts/other/2026-03/generate_runtime_helper.js

If the date or month directory changes, first use the actual files in the current repository under examples/generated_scripts/ as the source of truth.

Code style

  • Default output JavaScript
  • Provide complete functions or complete script snippets whenever possible
  • Variable naming should closely reflect business meaning
  • When null values need to be validated in advance, handle it directly in the code
  • Avoid encapsulation unrelated to the requirements

Self-check list

Before output, check:

  • Whether only SDKs that exist in the source materials were used
  • Whether script and expression syntax were confused
  • Whether the global informat was used to call platform APIs instead of $informat
  • Whether externally callable functions use ES Module export
  • Whether module.exports / exports
  • Whether code was provided that the user can actually copy and adapt
  • Whether replacement hints were added for uncertain fields
  • Whether there is incorrect reliance on method return values that conflict in the source
  • Whether the wrong namespace was chosen between similar APIs
  • Whether the original signatures were rechecked for edge capabilities such as transactions, JDBC, storage, questionnaires, and FTP
  • Whether the original signatures were rechecked for newly added type capabilities such as AI Agent, WeCom, PDF, Excel, cryptographic signatures, and workflow version switching
  • Whether the code syntax self-check has been completed
  • If it is a platform save/edit script, whether the script list/content was queried first and the real id、parentId
  • If it is a platform execution script, whether the designer environment and the published environment are distinguished, and only exported real functions are executed
  • If the script is too long, whether it was split according to the 300-line or 8000-character threshold
  • Whether the interaction for "whether to save locally" was handled correctly
  • If saving is needed, whether the correct directory and file naming conventions were used
  • If it cannot be stably classified, whether it was correctly placed in other fallback directory
  • If it needs to be saved as a file, whether a file header comment was reasonably added or the reason for not adding one was explained
  • Whether the reason was clearly explained when it could not be implemented