_format — промпт для Claude Code: формат доков по edit-операциям
Промпт _format задаёт формат файлов ops/*.md, которые описывают канонические edit-операции для редактора слайдов genoffice.
Apache-2.0 ★ 12 746 обновлён 2026-10-29
.claude/commands/_format.mdЧто делает _format
Промпт фиксирует структуру файлов ops/*.md: один файл на группу операций (text, element, insert, table, slide, deck), блок на каждую операцию начинается с ### <opName>, сразу за которым идёт сигнатура в обратных кавычках. Суффиксы (not-ai-callable) и (pending) в заголовке скрывают операцию из словаря модели и индекса сигнатур.
Каждый пример внутри json-блока прогоняется тестами через runTxn(dryRun) на фикстурной колоде из двух слайдов с id s_1 и s_2, с плейсхолдерами вида e_TEXT, e_SHAPE, e_TABLE для конкретных элементов. Файлы ops/*.md парсит shared/op-docs.ts в OP_DOCS, из которого строятся opVocabulary(), opUsage(), opSignatureIndex() и opGuide() — то есть сам этот гайд в промпт модели не попадает, он задаёт правила для людей, пишущих документацию операций.
Тесты в apps/slides/tests/op-docs.test.ts проверяют, что доки совпадают с реестром операций, что примеры валидны и что в файлах нет иероглифов CJK — значит, писать разделы и примеры нужно только на английском.
Какие задачи решает
- описать новую edit-операцию в формате, который парсит op-docs.ts
- задать сигнатуру и таблицу полей для операции
- пометить операцию как
not-ai-callableилиpending - подготовить json-примеры, проходящие тест runTxn(dryRun)
- соблюсти лимит размера файла группы операций
Примеры запросов агенту
- Добавь описание новой операции в
ops/table.mdпо формату из_format - Проверь, что мой блок
### insertRowсоответствует правилам_format - Разбей файл группы операций на под-файлы по правилам из
_format
Как установить _format
Вручную: положить файлы
.claude/commands/_format.mdКак использовать
Вставьте текст в начало диалога или в инструкции проекта
Вопросы о _format
Как установить _format в Claude Code?
Поместите файл в .claude/commands/_format.md.
Что делает _format?
Это гайд по формату файлов ops/*.md, описывающих канонические edit-операции редактора слайдов genoffice: структура блоков, сигнатуры, флаги и правила написания примеров.
Почему в файлах ops/*.md нельзя использовать иероглифы?
Тесты op-docs.test.ts проверяют отсутствие CJK-текста в файлах, а правила промпта требуют писать только на английском, включая текст примеров.
Исходный текст
_format.md · Apache-2.0
# Op documentation format (authoring guide — not loaded into any prompt) The `ops/*.md` files are the single source of truth for what the model knows about canonical edit ops. `shared/op-docs.ts` parses them at import time into `OP_DOCS`; `opVocabulary()` / `opUsage()` / `opSignatureIndex()` / `opGuide()` are all derived from the parse. Tests in `apps/slides/tests/op-docs*.test.ts` assert that the docs track the op registry exactly, that every example validates against a fixture deck, and that the files contain no CJK text. ## File layout ``` # <Group title> > <one-line summary shown in the load_guide catalog> <optional group-level prose: addressing, units, conventions> ### <opName> `<signature>` <prose, field table, examples, common mistakes, related ops> ### <nextOpName> (not-ai-callable) `<signature>` ... ``` - One file per group; the file name is the group id (`text`, `element`, `insert`, `table`, `slide`, `deck`). - A block starts at `### <opName>`; `opName` must match a registered op. - The first non-empty line after the heading is the **signature**, wrapped in single backticks. It is emitted verbatim as `Usage: <opName> <signature>` in guided errors, so keep it compact and free of backticks. - Heading suffixes in parentheses set flags: `(not-ai-callable)` hides the op from the vocabulary and the signature index (byte / clipboard / part-path payloads the model cannot produce); `(pending)` hides it entirely until the registering branch lands. Combine as `(not-ai-callable, pending)`. - Every ```json fenced block inside an AI-callable op block is an example that the test suite runs through `runTxn(dryRun)`. Use the placeholder ids below; the test substitutes real ids from its fixture deck. ## Placeholder ids for examples | Placeholder | Fixture element | | ------------ | ------------------------------- | | `e_TEXT` | a text box on slide 0 | | `e_SHAPE` | a rounded rectangle on slide 0 | | `e_PICTURE` | a picture on slide 0 | | `e_TABLE` | a 2x2 table on slide 0 | | `e_CHART` | a bar chart on slide 0 | | `e_LINE` | a straight connector on slide 0 | | `e_GROUP` | a group on slide 0 | | `e_CHILD` | a direct child of that group | | `SECTION_ID` | an existing section GUID | The fixture deck has exactly two slides (indices 0 and 1; durable ids `s_1` and `s_2`). ## Writing rules - English only. Example text content (titles, labels, categories) is English too. - Units are document-space EMU unless a field name says otherwise (`...Pt`, `...Pct`, `...Deg`). Say so in the field table. - Field tables list every field the op's `validate` / `apply` reads, not only the ones in the signature. - "Common mistakes" entries describe what the model tends to get wrong and the corrective action, in the same voice as the guided errors. - Keep each group file under roughly 8 KB; split a group into sub-files (and add a catalog entry) rather than exceeding that.
© genspark-ai · Apache-2.0 · genspark-ai/genoffice