# KCode Kingdee Spec Template

> Reusable Trellis spec template installed by KCode for Kingdee business projects.

---

## What This Template Is

This template is the starting `.trellis/spec/` knowledge base for projects using KCode as a Kingdee development assistant. It records reusable engineering rules, platform boundaries, minimum examples, and review checklists for:

- Kingdee Cosmic / BOS Java development
- Kingdee Enterprise C# plugin development
- Kingdee Enterprise IronPython plugin development
- KSQL and metadata-driven data fixes
- OpenAPI and integration contracts

It is a project starting point. After installation, the target project owns its copy and should keep it aligned with real source code, metadata, and product behavior.

---

## What Belongs Here

Put these in spec:

- Stable engineering conventions and platform constraints
- Directory/module boundaries
- API, KSQL, testing, error-handling, and review rules
- Short, sanitized examples that show the correct shape
- Routing tables that tell agents which KCode skill or extension to use

Do not put these in spec:

- Secrets, internal URLs, customer data, private incident records
- `.trellis/tasks/`, runtime task state, or handoff state
- Long skill tutorials or full generated plugin templates
- Repository-specific PRDs that only apply to one project

---

## Directory Map

| Directory | Purpose |
| --- | --- |
| [shared/project-context.md](./shared/project-context.md) | Product profile, platform routing, assistant behavior |
| [shared/](./shared/kcode-skills.md) | Cross-platform KCode skill routing, metadata verification, review checklist |
| [backend/cosmic-java/](./backend/cosmic-java/index.md) | Cosmic/BOS Java plugin, API, KSQL, tests, review rules |
| [backend/enterprise/](./backend/enterprise/index.md) | Enterprise C#, IronPython, OpenAPI, tests |
| [guides/](./guides/index.md) | Cross-layer, reuse, and cross-platform thinking guides |
| `.kcode/agents/kcode-kingdee-expert.md` | Read-only Kingdee domain expert sub-agent that follows the confirmed product profile |

---

## How Agents Should Use It

1. Read [shared/project-context.md](./shared/project-context.md) for the product profile written by `kcode init`.
2. Read [shared/kcode-skills.md](./shared/kcode-skills.md) to choose the right KCode skill or extension.
3. Read the platform index for the current task.
4. Load only the specific rule files needed for the change.
5. Use skills for execution workflow and large examples; use spec for confirmed project constraints and acceptance rules.

---

## Template Maintenance

When updating this template:

- Keep examples short and sanitized.
- Prefer links to KCode skills over duplicating long procedures.
- Update indexes when adding or moving files.
- Test installation through `kcode init` / kcode-pi template tests.
- Treat template IDs and directory names as public API for downstream projects.
