---
name: kd-gen
description: Generate Kingdee product-specific Java/C# plugin code using verified SDK patterns and the active harness plan.
---

# Kingdee Code Generation

Use this skill when generating Kingdee product-specific plugin code.

Inputs to establish before coding:

- Kingdee product, version, and tech stack.
- Plugin type and correct base class.
- Target bill/entity/form and lifecycle event.
- Business rule and acceptance criteria.
- Relevant SDK/table facts from `kd_sdk_signature`, `kd_search`, `kd_table`, or product metadata tools.

Rules:

- Generate code only after the active run has a `PLAN.md`.
- Use the correct base class only when verified for the target product family.
- Verify uncertain Java/C# class names, base classes, methods, and overloads against current project SDK jars/dlls with `kd_sdk_signature`; bundled knowledge is not enough for final signature facts.
- For 星空旗舰版, generate or edit product code only under the real target path selected in `PLAN.md` after project inspection. Follow the existing layout, whether it uses `code/`, app modules, cloud modules, or no module split; never create demo/sample code or root-level `src/main/java` by guesswork.
- Use `kd.bos.*` style packages for Cosmic-family Java code and `Kingdee.BOS.*` style namespaces for enterprise C# code.
- Do not reuse Cosmic/Xinghan/Cangqiong APIs for enterprise C#.
- Do not reuse enterprise C# namespaces or lifecycle assumptions for Java products.
- Add Chinese comments only for business logic or non-obvious Kingdee lifecycle behavior.
- Handle exceptions with logging or business exceptions; do not leave empty catch blocks.
- Avoid magic values; promote status values, field keys, operation codes, and table names to constants.
- Avoid database calls inside loops.

Output expectations:

- Keep code changes scoped to the plan.
- Update `.pi/kd/runs/<run-id>/EXECUTION.md` with changed files and any deviations.
- Do not claim completion until `kd-verify` has collected evidence.
