SuperAPI AI Directory

kingscript-code-generator

Coding & development

View repository

Updated 10-15 21:38

About this skill

Kingscript Expert (Claude Code entry point)

Use this skill as the entry point for Claude Code when handling Kingscript work.

Local resource discovery

This skill should not hardcode the path of any single machine. Each time you enter a Kingscript task, first resolve the local resource root directory in the following order:

  1. Prefer reading the local-paths.json
  2. If not present, then read the current workspace's CLAUDE.md、AGENTS.md or similar local instruction file to find the local resource path declared by the user
  3. If still not present, then try default directory discovery

Only when the path from the previous step actually exists may it continue to be used; if it does not exist, continue falling back, and do not directly assume the directory must be there.

local-paths.json convention

File location:

  • In the skill installation directory, local-paths.json

Suggested fields:

  • workspace_root
  • repo_root
  • references_root
  • docs_root
  • examples_root
  • sdk_root
  • templates_root
  • language_root
  • java_sample_jar
  • bos_docs_path

Default directory discovery

Only when local-paths.json and the workspace instruction file both fail to provide a usable path should you try in the following order:

  1. Whether the current workspace contains references/examples、references/sdk、references/templates
  2. The current workspace's kingscript-code-generator/references
  3. Whether a repository copy named kingscript-code-generator exists in the current workspace's parent or sibling directories

Read first

  1. First resolve references_root / docs_root / examples_root / sdk_root / templates_root / language_root
  2. If the user mentions KWC、脚本控制器、controller、REST API、Web API, first read <references_root>\docs\custom-development\脚本控制器开发指南.md
  3. Read <examples_root> the most relevant example in
  4. If a plugin skeleton is needed, read <templates_root>
  5. If an SDK is involved, first read <sdk_root>\README.md、<sdk_root>\strategy.md and <sdk_root>\indexes\
  6. If syntax or keywords are involved, read <language_root>\README.md
  7. If the materials in the repository are insufficient and an external knowledge disk is locally mounted, follow <sdk_root>\strategy.md to enter the external extension layer, and first read *-description.md, and when actual usage or pitfalls are needed, then read the accompanying *-example.md
  8. If local-paths.json is configured in bos_docs_path, treat it as the main entry point of the external knowledge disk; enter only when the materials in the repository are insufficient

Fallback search order

  1. First open README.md
  2. in the target directory
  3. Then see whether the file name can already directly locate it. <sdk_root>\indexes\
  4. When only the class name, method name, or event name is known, first return to <examples_root>\plugins\README.md When only the scenario is known, first return to
  5. and the corresponding "scenario breakdown" directory README <references_root> If it is still insufficient, then perform a keyword search on
  6. If the indexes and examples are both insufficient, then fall back to <sdk_root>\manifests\
  7. If still insufficient, then check the local .d.ts、jar decompilation results or the online Javadoc

Output conventions

By default includes:

  1. Scenario
  2. Assumptions
  3. Code or solution
  4. Risks
  5. Open questions to confirm

Security boundaries

  • Do not fabricate Kingscript APIs, event names, or context fields
  • Do not assume TypeScript declarations guarantee runtime availability
  • Do not ignore permissions, tenant isolation, account set boundaries, or lifecycle timing
  • Before generating code, you must confirm the real import paths of every external class, helper class, event class, enum, and utility class
  • Before the final output of code, you must self-check that all non-global symbols are explicitly imported and must not rely on IDE or editor autocompletion
  • If a symbol does not need to be imported, you must be able to explain that it is a runtime global, a local definition in the current file, or automatically injected by the framework
  • If information is missing, provide a bounded assumption-based approach, rather than a false definitive answer
  • When looking up the SDK, prioritize the route of "index -> target document" rather than scanning the entire directory
  • Methods related to page prompts, notifications, and message boxes must return to IFormView or the local declaration layer to confirm
  • Before calling obj.method() , you must confirm that method belongs to obj the current type or its declaration inheritance chain, and must not mix in methods from adjacent event parameters or context objects
  • It is not allowed to guess methods by "approximate name"; for example, if the declaration says addItemClickListeners(...), you must not arbitrarily write it as addItemClickService(...)
  • When generating code, you must not write the event parameter as any; if the declaration layer only provides BizDataEventArgs or $.java.util.EventObject, you must also use it exactly as declared
  • When the user points out that an example, template, or generated code contains an error, you must not only fix the current fragment; you must also determine whether this issue should be distilled into a reusable constraint, and write it back according to the scope of impact to the platform entry point, policy, knowledge card, index, template, or example entry point, to avoid repeated generation of the same type of issue