Logo Hor External Api Client

Hor External Api Client

Tổ chức
openreachtech
hor-external-api-client

Implement a client for an external HTTP/REST API using `@openreachtech/mentsu-rocket-client` (the Launcher / Payload / Capsule three-class structure). Use this skill whenever the user asks to add or change an external API integration — a new service client, a new API operation, request/response key conversion, authorization headers, or wrapping a vendor SDK — under `app/<serviceName>Client/`. For the raw source guide see the doc linked at the bottom.

Tổng quan

Nhà phát hànhopenreachtech
Kho mãhora-skills-ort-renchan
Tên kỹ nănghor-external-api-client
Sao
32
Bản fork
0
Tệp đi kèm
9
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 9 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được openreachtech công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Hor External Api Client trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-external-api-client
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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-external-api-client .claude/skills/hor-external-api-client
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Hor External Api Client trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Hor External Api Client ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Hor External Api Client không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

External API Client

How to implement a client for an external HTTP/REST API with @openreachtech/mentsu-rocket-client (rocket-client from here on). One external request is split across three classes — Launcher / Payload / Capsule. The conventions are divided into the detail files listed at the bottom; read the one that matches what you are doing.

First principle: confine every difference from the external API to Payload / Capsule (anti-corruption layer)

Every convention in this skill follows from one goal: an external API's interface differences must stay out of application code. Key names, value formats, paths, authentication and response shapes of an external API can all change, and they disagree with our own naming conventions anyway. Confine those differences to a single layer (the anti-corruption layer) so the caller (a resolver or a job) never has to know about them.

  • Differences on the way in (key names, value formats, path, query, authentication) belong to Payload.
  • Differences on the way out (response key names, nesting, missing fields) belong to Capsule's extractXxx().
  • The caller only builds a Payload and pulls values out of a Capsule. If the external API's raw shape reaches the caller, this layer has failed.
  • Why: without this layer — or with a thin one — every change to the external API forces edits in resolvers and jobs, and the reach of a change becomes impossible to see. Collecting the differences in one place is what keeps a spec change contained to Payload / Capsule. When an individual rule leaves you unsure, decide it by extending this principle: which class owns this difference?

Cross-cutting rules (they apply to every layer)

HTTP goes through the native fetch only — no axios, no HTTP client of your own

In the direct-HTTP pattern, communication is handled by the Node.js native fetch built into BaseLauncher. Do not add another HTTP client module such as axios, and do not implement an HTTP client or Fetcher class of your own. Wrap an SDK only when the vendor publishes an official one (sdk-wrapper.md — an interim implementation).

  • Why: because the transport is centralized in BaseLauncher, retries, error conversion and swapping in a stub for tests all take effect in one place. If each client brings its own axios, that benefit is gone and the transport ends up implemented differently per operation.

Decide failure with capsule.hasError(), not try-catch

launchRequest() catches fetch exceptions and body-parse failures internally and returns the Capsule for the corresponding error kind. The caller writes no try-catch and decides failure from the returned capsule.hasError().

  • Why: funnelling missing authentication, invalid input, network failure, parse failure and a status >= 400 into one path — the "error Capsule" — is this module's design. A caller that adds try-catch on top handles errors through two channels, the caught exception and the Capsule, and a case will fall through the gap.

Return null (or an empty array) for a missing value, never undefined

When an extractXxx() or a getter cannot produce a value, return null — or an empty array for something that returns an array, or whatever the intended default is — not undefined.

  • Why: undefined cannot be told apart from "undefined behaviour / not implemented yet". null (or an empty array) states the intent: the value was looked for and was not there. Details in capsule.md.

Write comments in code in English

Comments in the real code you generate (.js) — //, /* */, JSDoc — are written in English, to match the rest of the codebase. The js blocks in this skill are real code too, so their JSDoc and comments are shown in English as well.

Naming, and one class per file

One class per file, with a single export default. Name a derived launcher <Operation>Launcher, and the payload and capsule <Operation>Payload / <Operation>Capsule, so the operation is readable from the name. Pick the verb of a retrieval method by where the value comes from (fetch~ = external API, find~ = the database, extract~ = pulled out of a Capsule). The remaining general coding conventions are in conventions.md.

Detail files

  • architecture.md — the whole picture (the three classes, the data flow, directory layout, the classes the module provides)
  • launcher.md — Launcher (base and derived / direct HTTP, the members of BaseLauncher)
  • payload.md — Payload (input definition, method/pathname, schema, key conversion)
  • capsule.md — Capsule (the response wrapper, extractXxx(), null guards)
  • authorization.md — authentication (AuthorizationBuilderCtor / authorizationApiKey)
  • sdk-wrapper.md — the SDK-wrapping pattern (an interim implementation that overrides launchRequest())
  • usage.md — the implementation steps, and use from the caller (resolver / job), DI and hooks
  • testing.md — unit tests for Payload / Capsule / Launcher
  • conventions.md — the naming and coding convention checklist

This skill was made from the repository's external API client implementation guide. For reference material — rocket-client's own export list, its type definitions, examples of existing clients — see the "reference files" section at the end of that guide.

Tệp đi kèm

Mô hình đọc các tệp này khi cần trong lúc kỹ năng được tải. Các tệp được cung cấp ở dạng có thể đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Hor External Api Client làm được gì?

Implement a client for an external HTTP/REST API using `@openreachtech/mentsu-rocket-client` (the Launcher / Payload / Capsule three-class structure). Use this skill whenever the user asks to add or change an external API integration — a new service client, a new API operation, request/response key conversion, authorization headers, or wrapping a vendor SDK — under `app/<serviceName>Client/`. For the raw source guide see the doc linked at the bottom.

Vì sao nên dùng Hor External Api Client trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Hor External Api Client là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Hor External Api Client trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-external-api-client. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Hor External Api Client?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Hor External Api Client với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Hor External Api Client với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Hor External Api Client có miễn phí không?

Có. Kỹ năng này được openreachtech phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇