---
name: k-doc
description: Create or update ProjectK documentation per Documentation-Rules — ADR (architecture) / DDR (design-art decision) with numbering scan, system docs with required sections, frontmatter, link-not-duplicate. Use when asked to write an ADR, DDR, decision record, or any Docs/ page.
argument-hint: "[adr|ddr|system|guide] [title]"
allowed-tools: Read, Glob, Grep, Write, Edit
---

# k-doc — every doc has one shape and one home

Authoritative rules: [Docs/Rules/Documentation-Rules.md](../../../Docs/Rules/Documentation-Rules.md)
(read the relevant § before writing). English only. Link, never duplicate
(§23: one source of truth).

## adr / ddr — decision records (§28)

1. Scan `Docs/Decisions/` for the next free number in the RIGHT sequence:
   `ADR-NNNN-*` (architecture/technical) or `DDR-NNNN-*` (design/art/creative
   trade-offs — e.g. budgets, visual direction).
2. Frontmatter: `title, status ("accepted"|"draft"), date, author "Ewerton Melo",
   related_tasks, related_code, tags` (note: decisions use `date`, not
   created/updated).
3. Sections, exactly: `## Context`, `## Decision`, `## Consequences`,
   `## Alternatives Considered`, `## AI Notes`.
4. Link the driving task in `related_tasks`; update the task's `adrs` field.

## system — Docs/Systems/<Name>/OVERVIEW.md

Frontmatter per §29 + required sections: summary/shape, `## AI Notes` (§30),
`## Do` / `## Do Not` (§31), `## Testing Requirements` (§36),
`## Dependency Rules` (§38). Then add the one-line entry to
[Docs/AI/SYSTEM_INDEX.md](../../../Docs/AI/SYSTEM_INDEX.md).

## guide — anything else under Docs/

Frontmatter per §29 (`title, description, status, created, updated, author,
related_tasks, related_code, tags, ai_context_priority`); place it by purpose
(§24); keep it short and link deeper sources.

## Checks before finishing

- Frontmatter complete (the post-edit hook flags §29 violations — heed it).
- Every fact appears in ONE place; everything else links to it.
- `Docs/AI/AI_CONTEXT.md` updated only if entry points changed.
- Task files are NOT created here — that is /k-task-new (§44).

---
**Standing rules:** Editor MCP = `http://127.0.0.1:8000/mcp` (server `unreal`
in the root `.mcp.json`; in-editor, loopback-only). Editor lifecycle only via
`Scripts/Editor/` and only on explicit user request. **Never assume** — verify
against code, `Docs/`, or official UE 5.8 docs (`?application_version=5.8`),
and if still uncertain, ask the user. Cited project docs win over this skill.
