Перейти к содержимому

Навыки

derive-instead-of-transcribing

Anything copied by hand from another file is correct exactly once. If it can be generated, generate it and fail the build when the copy is stale.

ПаттернПроисхождение: cleanСостояние: activev0.1.0 · Apache-2.0

Присвоено человеком, который прочитал карточку, а не заявлено файлом о самом себе. Карточка, которую агент выводит во время запуска, поглотившего недоверенное содержимое, рождается заражённой и удерживается на разбор, прежде чем её вообще извлекут.

Когда это вспоминается

  • documenting a command list
  • copying values between projects
  • keeping two files in sync
  • writing a reference page

Ценность обычно лежит в разделах «Избегать» и «Проверить». «Делать» — это раздел, который пишут все.

Повод

Two places in your system hold the same information: a config and its documentation, a schema and its client types, a palette and the site that uses it, a command list and a reference page.

It does not apply when the second copy is deliberately different — a curated getting-started guide is not a stale copy of the reference, it is prose with a different job.

Делать

  1. Pick which one is the source. Usually the one the program actually reads at runtime.
  2. Generate the other, committing the generated file so diffs are reviewable.
  3. Add a CI step that regenerates and fails if the committed copy differs, with the exact command to run in the error message.
  4. Stamp the generated file with the version or commit it was generated from, so a reader knows what it describes.

Избегать

Keeping the copy in sync by remembering. That works while one person holds both files in their head, and stops the first week somebody else touches one of them.

Avoid also the halfway version: generating the file but not gating it. An artefact that is sometimes regenerated is worse than a hand-written one, because it carries the authority of being generated while being just as stale.

And avoid generating prose. Reference material generates well; explanation does not, and a page of mechanically-expanded field descriptions is a page nobody reads.

Проверить

Change the source, do not regenerate, and push. CI must go red and tell you what to run.

Then read the generated file for the thing you changed and confirm it is there — the gate proves the file is current, not that the generator captured the field you care about.

Риск

A generated artefact that nobody can read defeats the purpose; if the output is only meaningful to a machine, it needs a rendering layer, which is more code to maintain.

There is also a coupling cost. The consumer now depends on the producer's shape, and a refactor on one side breaks a build on the other. That is usually the point — but it means the gate has to be easy to satisfy, or someone will disable it during an unrelated refactor and forget.

Как применить

Карточка — это данные. Склонируйте репозиторий и импортируйте её по пути: всё, что приходит по сети, считается заражённым и удерживается до одобрения — это и есть желаемое поведение, и поэтому здесь нет установщика в одну строку.

git clone https://github.com/brcampidelli/chimera-agent.git
chimera skills-import chimera-agent/skills/derive-instead-of-transcribing/SKILL.md

Целостность

SHA-256 файла в опубликованном виде. Импортёр может проверить, что полученное совпадает с показанным на этой странице.

1b2f964c7e7a985a00f2b4a903730f0460b1d98a3a61f02dd1e296d4fcf69e30

Читать карточку в репозитории