Typescript Functions logo

Typescript Functions

Community
mkosir
typescript-functions

Apply, review, and explain TypeScript function conventions. Use automatically for tasks involving function responsibility, statelessness, purity, side effects, function arguments, function API design, or return types.

Overview

Publishermkosir
Repositorytypescript-style-guide
Skill nametypescript-functions
Stars
783
Forks
37
Bundled files
Instructions only
LicenseMIT
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.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

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

Installation

Install the Typescript Functions 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/mkosir/typescript-style-guide/tree/main/skills/typescript-functions
  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/mkosir/typescript-style-guide.git /tmp/typescript-style-guide
mkdir -p .claude/skills
cp -r /tmp/typescript-style-guide/skills/typescript-functions .claude/skills/typescript-functions
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Typescript Functions 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 Typescript Functions 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 Typescript Functions 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.

Functions

Apply the TypeScript Style Guide's function conventions in the context of the current task.

Workflow

  1. Inspect the consuming repository's conventions and configuration.
  2. Let explicit repository conventions take precedence over this opinionated guidance.
  3. Apply, review, or explain only the guidance relevant to the task.
  4. State important tradeoffs when the appropriate design depends on context or judgment.

Boundaries

  • Keep TypeScript and ESLint responsible for checks they can enforce automatically.
  • Do not introduce unrelated TypeScript Style Guide conventions merely because this skill is active.

Related Guidance

Function Arguments

For detailed guidance on mutually exclusive function arguments, use typescript-discriminated-unions when it is available.

Functions

Function conventions should be followed as much as possible (some derive from basic functional programming concepts):

General

Prefer functions that:

  • have a single responsibility.
  • make dependencies explicit through arguments.
  • return a value when they calculate or transform data.
  • avoid side effects when practical.

A stateless function does not retain data between calls. A deterministic function returns the same result for the same inputs. A pure function is deterministic and has no observable side effects, making it easier to understand, test, and reuse.

Not every function can be pure. Network requests, storage, logging, and UI updates require side effects. Keep these functions small and isolate side effects from pure business logic.

Single Object Arg

When a function accepts several related parameters, prefer a single object parameter. Named properties make call sites easier to understand and allow the function API to evolve without relying on argument order.

Keep positional parameters when their meaning and order are obvious, or when a conventional signature is clearer, such as isNumber(value) or a callback.

ts
// ❌ Multiple arguments make this call difficult to understand
transformUserInput('client', false, 60, 120, null, true, 2000);

// ✅ An object makes each argument explicit
transformUserInput({
  method: 'client',
  isValidated: false,
  minLines: 60,
  maxLines: 120,
  defaultInput: null,
  shouldLog: true,
  timeout: 2000,
});

Required & Optional Args

Strive to have the majority of arguments required and use optional arguments sparingly.
If the function becomes too complex, it probably should be broken into smaller pieces.
An exaggerated example: implementing 10 focused functions with 5 required arguments each is preferable to implementing one "do-it-all" function with 50 optional arguments.

When function arguments represent mutually exclusive cases, use discriminated unions.

Return Types

Requiring explicit return types improves safety, catches errors early, and helps with long-term maintainability. However, excessive strictness can slow development and add unnecessary redundancy.

As a rule of thumb, be explicit on the outside, implicit on the inside. For example, when building APIs or libraries, always type everything explicitly to avoid accidental breaking changes. For internal logic, let TypeScript infer its defaults, which will provide strong type safety without added verbosity.

Consider the advantages of explicitly defining the return type of a function:

  • Improves Readability: Clearly specifies what type of value the function returns, making the code easier to understand for those calling the function.
  • Avoids Misuse: Ensures that calling code does not accidentally attempt to use an undefined value when no return value is intended.
  • Surfaces Type Errors Early: Helps catch potential type errors during development, especially when code changes unintentionally alter the return type.
  • Simplifies Refactoring: Ensures that any variable assigned to the function's return value is of the correct type, making refactoring safer and more efficient.
  • Encourages Design Discussions: Similar to Test-Driven Development (TDD), explicitly defining function arguments and return types promotes discussions about a function's functionality and interface ahead of implementation.
  • Can Improve Compilation Performance: Explicit return types can reduce the work TypeScript needs to do, especially for complex inferred types.

As context matters, use explicit return types when they add clarity and safety.

<Rule prefix="Require explicit return types at module boundaries" href="https://typescript-eslint.io/rules/explicit-module-boundary-types/"

{"@typescript-eslint/explicit-module-boundary-types": "error"}

Frequently asked questions

What does the Typescript Functions AI skill do?

Apply, review, and explain TypeScript function conventions. Use automatically for tasks involving function responsibility, statelessness, purity, side effects, function arguments, function API design, or return types.

Why use Typescript Functions on TypingMind?

Because you install it once and use it with any model. Typescript Functions 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 Typescript Functions in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/mkosir/typescript-style-guide/tree/main/skills/typescript-functions. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Typescript Functions?

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 Typescript Functions?

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

Is the Typescript Functions AI skill free?

Yes. It is published on GitHub by mkosir under the MIT 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 👇