# Enterprise Development Guidelines

> Best practices for Kingdee Enterprise C#, IronPython, and integration contract development.

---

## Scope

Use this layer for Kingdee Enterprise / K3 Cloud style projects that use C# plugins, dynamic form/bill/list plugins, operation/service plugins, IronPython scripts, or OpenAPI-style integration documents.

Do not use this layer for Cosmic/BOS Java plugin work; use `backend/cosmic-java/` instead.

---

## Guidelines Index

| Guide | Description | When to Read |
| --- | --- | --- |
| [csharp-conventions.md](./csharp-conventions.md) | C# plugin base classes, naming, lifecycle, service patterns | Any Enterprise C# change |
| [csharp-testing.md](./csharp-testing.md) | Unit/integration test strategy for C# plugins and services | Adding or changing tests |
| [python-plugin.md](./python-plugin.md) | IronPython script plugin conventions and deployment safety | Python plugin/script changes |
| [openapi-design.md](./openapi-design.md) | OpenAPI contract design, versioning, examples, compatibility | REST/API/integration work |

---

## Related KCode Skills

| Scenario | Skill / extension |
| --- | --- |
| Enterprise C# plugin implementation | kd-enterprise-csharp |
| Enterprise IronPython plugin implementation | kd-enterprise-python-plugin |
| Enterprise OpenAPI/integration work | kd-enterprise-openapi |
| Metadata (readonly SQL + LLM parse) | `skills/_shared/metadata-db-query.md` |

| Community/API knowledge | kd_cosmic_qa tool |

Read [../../shared/kcode-skills.md](../../shared/kcode-skills.md) for the full routing table.

---

## Platform Routing

| Task shape | Read first |
| --- | --- |
| Form/bill/list plugin behavior | [csharp-conventions.md](./csharp-conventions.md) |
| Save/submit/audit operation behavior | [csharp-conventions.md](./csharp-conventions.md) and [csharp-testing.md](./csharp-testing.md) |
| Script plugin quick automation | [python-plugin.md](./python-plugin.md) |
| External system contract | [openapi-design.md](./openapi-design.md) |
| Validation, error, or transaction behavior | C# conventions + local source examples |

---

## Pre-Development Checklist

- [ ] Confirm the target platform is Enterprise/K3 Cloud, not Cosmic Java.
- [ ] Search for the same plugin type and bill/form in the existing project.
- [ ] Verify form IDs, field keys, operation keys, enum values, and base data references.
- [ ] Identify transaction/operation boundaries before data-changing code.
- [ ] Choose validation command: Visual Studio build, `dotnet test`, MSBuild, or project script.

---

## Core Rules Summary

| Rule | Reference |
| --- | --- |
| Choose the narrowest Kingdee plugin base class for the lifecycle you need | [csharp-conventions.md](./csharp-conventions.md) |
| Keep UI plugins focused on UI/model interaction; move business logic to services | [csharp-conventions.md](./csharp-conventions.md) |
| Verify metadata before using field keys or dynamic object properties | [csharp-conventions.md](./csharp-conventions.md) |
| Do not swallow operation failures; preserve rollback semantics | [csharp-conventions.md](./csharp-conventions.md) |
| OpenAPI contracts must include schemas, examples, error codes, and compatibility notes | [openapi-design.md](./openapi-design.md) |
| IronPython plugins should be thin, explicit, and deployment-safe | [python-plugin.md](./python-plugin.md) |
| Tests should cover lifecycle branches, validation, and operation failure paths | [csharp-testing.md](./csharp-testing.md) |

---

## Quality Check

Before delivering Enterprise work:

1. Run `git diff --name-only` and map each file to the relevant guide.
2. Run the target build/test command, for example:

```bash
dotnet test
# or
msbuild /t:Build
```

3. If the project requires Visual Studio/Kingdee runtime and cannot be tested locally, report the exact limitation and perform source-level review against these specs.


