Логотип Hor Resolver Validator

Hor Resolver Validator

Організація
openreachtech
hor-resolver-validator

Implement input-validation classes for GraphQL resolvers under app/validator/forResolver/<endpoint>/{queries,mutations}/, extending BaseInputValidator and delegating value checks to @openreachtech/mentsu-value-inspector. Use this skill whenever the user asks to validate a resolver's input — presence, number, integer, pagination, enum/keyword checks — via a `*InputValidator` class whose failing predicate raises the matching InvalidXxx error.

Огляд

Видавецьopenreachtech
Репозиторійhora-skills-ort-renchan
Назва навичкиhor-resolver-validator
Зірки
32
Форки
0
Файли в пакеті
2
ЛіцензіяApache-2.0
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Файлів у комплекті: 2

    Скрипти, шаблони й довідкові матеріали, які модель може читати під час роботи. Файли доступні лише для читання й ніколи не виконуються.

  • Відкритий вихідний код

    Опубліковано на GitHub користувачем openreachtech. Перегляньте вихідний вміст перед установленням.

Встановлення

Установіть навичку ШІ Hor Resolver Validator у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до Плагіни → Навички.
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-resolver-validator
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Нова навичка → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/openreachtech/hora-skills-ort-renchan.git /tmp/hora-skills-ort-renchan
mkdir -p .claude/skills
cp -r /tmp/hora-skills-ort-renchan/kit/skills/hor-resolver-validator .claude/skills/hor-resolver-validator
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Hor Resolver Validator в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Hor Resolver Validator, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції Markdown, а не код для певного постачальника, тому навичка Hor Resolver Validator не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож невикористана навичка нічого не коштує.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

Resolver Validator

A skill for writing the *InputValidator classes that GraphQL resolvers use to reject bad input. A validator extends BaseInputValidator and declares a list of [predicate, ErrorConstructor] entries; the base runs them and, for the first predicate that returns false, raises that entry's error. Per-value checks (presence / number / integer / positive-integer …) are delegated to @openreachtech/mentsu-value-inspector, imported directly (it is a published module — use it from the package, not a local wrapper).

The support classes (BaseInputValidator, NormalPaginationInputValidator) ship with renchan-boilerplate under app/validator/forResolver/; the inspectors come from the @openreachtech/mentsu-value-inspector module.

Grand principle: declare [predicate, error] entries, let the base run them

A validator is a BaseInputValidator subclass whose only required override is generateValidationEntries() — it returns Array<[() => boolean, RenchanGraphqlErrorCtor]>. Each entry pairs a predicate (returns true when that rule passes) with the error constructor to raise when it fails. The base holds this.input and this.errorHash, iterates the entries, and throws the error of the first failing predicate.

  • Predicates are small isValidX() methods that read this.input and return a boolean. They use the inspector classes and/or composed sub-validators — they never throw.
  • Errors come from this.errorHash (the resolver's error hash, injected into the validator), so each InvalidXxx maps to the resolver's errorCodeHash code.
  • Reuse shared validators (e.g. pagination) by composing them inside entries, not by re-implementing limit/offset/sort.
js
import {
  IntegerValueInspector,
} from '@openreachtech/mentsu-value-inspector'

import BaseInputValidator from '../../BaseInputValidator.js'
import PaginationInputValidator from '../../NormalPaginationInputValidator.js'

const VALID_SORT_COLUMNS = [
  'labelName',
  'fieldPath',
]

/**
 * Class for validating input of the emailInsertableVariables query
 *
 * @extends {BaseInputValidator<ErrorHash, EmailInsertableVariablesInput>}
 */
export default class EmailInsertableVariablesInputValidator extends BaseInputValidator {
  /**
   * Generate validation entries
   *
   * @override
   * @returns {Array<[() => boolean, RenchanGraphqlErrorCtor]>}
   */
  generateValidationEntries () {
    const paginationInputValidator = this.createPaginationInputValidator()

    return [
      [
        () => paginationInputValidator.isValidLimit(),
        this.errorHash.InvalidPaginationLimit,
      ],
      [
        () => paginationInputValidator.isValidOffset(),
        this.errorHash.InvalidPaginationOffset,
      ],
      [
        () => paginationInputValidator.isValidSort(),
        this.errorHash.InvalidPaginationSort,
      ],
      [
        () => this.isValidKeyword(),
        this.errorHash.InvalidKeyword,
      ],
      [
        () => this.isValidOriginObjectCategoryId(),
        this.errorHash.InvalidOriginObjectCategoryId,
      ],
    ]
  }

  // ... isValidX() predicates + create*Inspector helpers (see validator-pattern.md) ...
}

Directory & naming

  • Validators: app/validator/forResolver/<endpoint>/<operation-kind>/<Operation>InputValidator.js
    • <endpoint> tracks the GraphQL endpoint the resolver belongs to (user, customer, admin, …) — it changes per endpoint.
    • <operation-kind> is queries or mutations.
    • e.g. app/validator/forResolver/user/queries/EmailInsertableVariablesInputValidator.js, app/validator/forResolver/user/mutations/CreateFooInputValidator.js.
  • Shared under app/validator/forResolver/: BaseInputValidator.js and reusable validators such as NormalPaginationInputValidator.js (default-exported, commonly imported as PaginationInputValidator).
  • Inspectors: imported directly from @openreachtech/mentsu-value-inspector (ValueInspector / NumberValueInspector / IntegerValueInspector) (inspector-api.md).
  • Class name = <Operation>InputValidator (PascalCase, matching the resolver's schema).

Predicates & the inspector

Each rule is an isValidX() method. For value-shape checks, build an inspector via a small create*ValueInspector({ value }) helper and call its methods:

js
isValidOriginObjectCategoryId () {
  const inspector = this.createIntegerValueInspector({
    value: this.input.originObjectCategoryId,
  })

  // the module has no isPositiveInteger — compose it (string-tolerant *Like)
  return inspector.isIntegerLike()
    && inspector.isPositiveNumberLike()
}

createIntegerValueInspector ({
  value,
}) {
  return IntegerValueInspector.create({
    value,
  })
}
  • Optional field idiom: return true early when the field is absent, then check the shape — e.g. if (!keyword) { return true } before return typeof keyword === 'string'.
  • The *Like methods accept numeric strings, which is what you want at the GraphQL boundary; there is no isPositiveInteger, so compose it (inspector-api.md).

Error hash & resolver wiring

The resolver declares the codes and passes its errorHash into the validator:

js
/** @override */
static get errorCodeHash () {
  return {
    ...super.errorCodeHash,

    InvalidKeyword: '400.C001.001',
    InvalidOriginObjectCategoryId: '400.C001.002',
    InvalidPaginationLimit: '400.C001.003',
    InvalidPaginationOffset: '400.C001.004',
    InvalidPaginationSort: '400.C001.005',
  }
}

/** @override */
async resolve ({
  variables: {
    input,
  },
  context,
}) {
  EmailInsertableVariablesInputValidator
    .create({
      input,
      errorHash: this.errorHash,
    })
    .validate()

  // ... input is now trusted ...
}

create({ input, errorHash }) and validate() come from BaseInputValidator. A resolver that decides itself when to throw calls validateInput(), which returns the error or null.

Testing

Predicates are pure booleans, so unit-test them (and generateValidationEntries) with the hoc-jest skill: feed inputs, assert isValidX() results and that invalid input raises the expected InvalidXxx.

Detail files

  • inspector-api.md — the @openreachtech/mentsu-value-inspector API (strict vs *Like, presence / number / integer, composing positive-integer, cheat sheet)
  • validator-pattern.md — the full validator template (generateValidationEntries, predicates, inspector helpers, composed pagination, typedefs), the BaseInputValidator contract, resolver wiring, and testing

Файли в пакеті

Модель читає ці файли за потреби, поки навичку завантажено. Вони доступні для читання й ніколи не виконуються.

Поширені запитання

Що робить навичка ШІ Hor Resolver Validator?

Implement input-validation classes for GraphQL resolvers under app/validator/forResolver/<endpoint>/{queries,mutations}/, extending BaseInputValidator and delegating value checks to @openreachtech/mentsu-value-inspector. Use this skill whenever the user asks to validate a resolver's input — presence, number, integer, pagination, enum/keyword checks — via a `*InputValidator` class whose failing predicate raises the matching InvalidXxx error.

Навіщо використовувати Hor Resolver Validator у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Hor Resolver Validator — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Hor Resolver Validator у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-resolver-validator. TypingMind прочитає файл SKILL.md, додасть супровідні файли та встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Hor Resolver Validator?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Hor Resolver Validator?

Зі скількома забажаєте. Якщо модель підтримує навички, ви можете використовувати з нею Hor Resolver Validator — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama та інші — усе в TypingMind із власними ключами API.

Чи безкоштовна навичка ШІ Hor Resolver Validator?

Так. Навичку опубліковано на GitHub: openreachtech, за ліцензією Apache-2.0. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це багаторазовий набір інструкцій, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти для виклику — код, який десь виконується й повертає результат. Натомість навичка ШІ надає моделі знання та порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇