Hor Resolver Validator logo

Hor Resolver Validator

Organization
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.

Overview

Publisheropenreachtech
Repositoryhora-skills-ort-renchan
Skill namehor-resolver-validator
Stars
32
Forks
0
Bundled files
2
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by openreachtech on GitHub. Read the source before you install it.

Installation

Install the Hor Resolver Validator AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-resolver-validator
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Hor Resolver Validator in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Hor Resolver Validator on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Hor Resolver Validator is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Hor Resolver Validator AI skill do?

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.

Why use Hor Resolver Validator on TypingMind?

Because you install it once and use it with any model. Hor Resolver Validator is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Hor Resolver Validator in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-resolver-validator. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Hor Resolver Validator?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Hor Resolver Validator?

As many as you like. As long as a model supports skills, you can use Hor Resolver Validator with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Hor Resolver Validator AI skill free?

Yes. It is published on GitHub by openreachtech under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇