Logo di Card Endpoint Shape

Card Endpoint Shape

Organizzazione
LedgerHQ
card-endpoint-shape

Read this before adding or editing an endpoint in `domain/api/card-management/src/api.ts`, a credential-bearing one included.

Panoramica

Pubblicato daLedgerHQ
Repositoryledger-live
Nome della skillcard-endpoint-shape
Stelle
622
Fork
491
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da LedgerHQ su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Card Endpoint Shape in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/LedgerHQ/ledger-live/tree/develop/domain/api/card-management/.agents/skills/card-endpoint-shape
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/LedgerHQ/ledger-live.git /tmp/ledger-live
mkdir -p .claude/skills
cp -r /tmp/ledger-live/domain/api/card-management/.agents/skills/card-endpoint-shape .claude/skills/card-endpoint-shape
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Card Endpoint Shape in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Card Endpoint Shape non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Card Endpoint Shape non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Card endpoint shape

Every endpoint is a declaration. Four keys, always in this order:

typescript
someEndpoint: build.query<Canonical, Request>({
  query: (request) => ({
    url: "/v1/some/path",
    method: "GET",
  }),
  rawResponseSchema: SomeWireSchema, // the wire shape
  transformResponse: transformSome, // wire -> canonical
  responseSchema: SomeSchema, // what callers receive
});
KeyAnswersLives in
queryWhat we sendapi.ts
rawResponseSchemaWhat the backend promisedschema.ts
transformResponseHow it becomes ourstransforms.ts
responseSchemaWhat the caller getsschema.ts

Drop the keys you do not need. An endpoint whose wire shape is already canonical declares responseSchema alone — logout and getUser both do.

Return the wire contract, nothing more. A field the backend never sent does not belong on the answer. If a caller needs one of its own request values afterwards, it already has it.

Never use queryFn

queryFn is the escape hatch for endpoints that are not one HTTP call. None here is, and it costs more than it looks:

  • RTK Query skips transformResponse for a queryFn endpoint. getTransformCallbackForEndpoint in buildThunks is guarded by endpointDefinition.query &&. The mapper is silently ignored, so the mapping moves inside the function, by hand.
  • The baseQuery result is unknown, so the body needs a cast or a manual safeParse.
  • Every one brings its own if (response.error) return { error: response.error }.

Three lines of declaration become twenty of plumbing, and the endpoint stops reading like its neighbours.

An endpoint that handles a credential

The two OAuth2 grants are endpoints like any other, plus three rules. RTK Query puts the argument of a call on its pending action and the answer on its settled one, so a grant's credential travels through redux, and three controls keep it out of every reader:

  • extraOptions: { authenticated: false }, so the base query sends no Bearer and never renews. A grant presents its own credential, and a grant that renewed would loop on its own 401.
  • No hook. Export a hook for every other endpoint, and none for a grant.
  • track: false at every call site, so the answer never becomes a cache entry in redux state.

The apps add the last control: redactCardApiAction strips every Card action before the desktop logger, the desktop DevTools or the mobile DevTools relay reads one, and redactCardApiState strips a grant out of the state. A new grant must be added to CARD_GRANT_ENDPOINTS in @shared/api-services, which a test in api.test.ts checks.

Where configuration comes from

query receives the request argument and nothing else. It cannot reach the store, so:

  • The base query's business — base URL, x-client-key, Authorization, the 401 refresh — comes from cardApiExtra in @shared/api-services. Never restate it in an endpoint.
  • Everything else is a request argument. The OAuth client id and redirect URI are the app's to know, so they arrive on the oauthConfig prop and travel down as arguments. Reaching for queryFn to read them out of cardApiExtra is the trap this rule exists to close.

transformResponse does receive the request as its third argument, after the base query's meta. Use it to map, never to staple a request value back onto the answer.

When a credential must be captured before local state is cleared, keep it outside the Redux action and hide the opaque request behind a domain-owned initiation helper. The logout endpoint uses this pattern so callers and Redux readers never receive the access token.

Rules

  • Schemas are the only validation. No as on response.data, no hand-built PARSING_ERROR. A schema failure rejects the thunk and keeps the body out of the rejected action.
  • Keep the wire schema narrow. Zod drops undeclared keys, which is what keeps PII out of the cache. PayCardUserResponseSchema declares two fields on purpose. Do not widen it.
  • Transforms are named functions in transforms.ts, transformXxx, one test each. Never inline.
  • Types are z.infer in types.ts. Request-argument types are hand-written there too.
  • build.mutation for anything not idempotent, even a GET. A call that changes something on the backend, or that cannot be repeated safely, is a mutation.

Checklist

  • query, not queryFn
  • A credential-bearing endpoint: authenticated: false, no hook, track: false, and its name in CARD_GRANT_ENDPOINTS
  • No as and no try/catch in api.ts
  • Wire shape validated by a schema in schema.ts
  • Mapping in transforms.ts, with a test
  • Nothing the base query already sends is repeated in the endpoint

Domande frequenti

Cosa fa la skill IA Card Endpoint Shape?

Read this before adding or editing an endpoint in `domain/api/card-management/src/api.ts`, a credential-bearing one included.

Perché usare Card Endpoint Shape su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Card Endpoint Shape è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Card Endpoint Shape in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/LedgerHQ/ledger-live/tree/develop/domain/api/card-management/.agents/skills/card-endpoint-shape. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Card Endpoint Shape?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Card Endpoint Shape?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Card Endpoint Shape: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Card Endpoint Shape è gratuita?

Sì. È pubblicata su GitHub da LedgerHQ con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇