enum-normalize-over-legacy-data
Installation
SKILL.md
Read the marker the source declares — then normalize it
An unstable source usually does state what a thing is, in one place, in its own vocabulary. The mistake is not reading it: without that, every screen invents its own label for the same column and nothing can ask "what kind is this?" and get a true answer.
Read it, and put the comparison in one small object rather than at each call site:
// adapted — the marker family, its prefix and the field name are renamed to neutral equivalents;
// the source's provider-specific constants are not reproduced. Every body is otherwise unchanged.
object ItemKind {
private const val PREFIX = "ITEM_KIND_"
/** Keeps [value] only if it is one of the source's own markers, otherwise null. */
fun normalize(value: String?): String? = value?.takeIf { it.startsWith(PREFIX) }
/** Whether the source reported a kind at all. */
fun isKnown(value: String?): Boolean = normalize(value) != null