hassanzohdy/mongez-config/typing

Claude Code and agent skill by hassanzohdy/mongez-config

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

TypeScript patterns for `@mongez/config` — using `ConfigurationsList`, declaring a project `AppConfig` shape, typing boot-time `config.set` calls, narrowing `config.get` results at the call site, and building a thin `getConfig` wrapper for stronger inference.

Install

npx vskill@latest install hassanzohdy/mongez-config/typing

SKILL.md

Typing

The shipped ConfigurationsList type is permissive on purpose:

ts
export type ConfigurationsList = Record<string, any>;

The package doesn't want to constrain how you shape your tree. For type-safe reads in your project, declare your own shape and use it at the call site.

Declare an AppConfig shape

ts
// src/config-types.ts
export type AppConfig = {
api: {
url: string;
timeout: number;
headers?: Record<string, string>;
};
features: {
darkMode: boolean;
beta: boolean;
};
i18n: {
defaultLocale: "en" | "ar" | "fr";
languages: Record<string, { name: string; direction: "ltr" | "rtl" }>;
};
};

Type the boot-time set

ts
import config from "@mongez/config";
import type { AppConfig } from "./config-types";
const appConfig: AppConfig = {
api: { url: "https://api.example.com", timeout: 5000 },
features: { darkMode: true, beta: false },
i18n: {
defaultLocale: "en",
languages: {
en: { name: "English", direction: "ltr" },
ar: { name: "العربية", direction: "rtl" },
},
},
};
config.set(appConfig);

The object literal is checked against AppConfig — typos and missing keys are caught at boot.

Type the read at the call site

config.get returns any because the tree's shape is unknown to the package. It is not a TypeScript generic — passing a type argument (config.get<string>(...)) is a compile error. Narrow at the call site by annotating the variable or using as:

ts
const url: string = config.get("api.url");
const timeout: number = config.get("api.timeout", 30000);
const flags = config.get("features") as AppConfig["features"];

Wrap it for stronger inference

For real-world apps, a thin typed wrapper is worth the 15 lines:

ts
// src/config-helper.ts
import config from "@mongez/config";
import type { AppConfig } from "./config-types";
// Type-narrow only the small surface you actually use.
export function getConfig<K extends keyof AppConfig>(key: K): AppConfig[K];
export function getConfig<T>(path: string, defaultValue?: T): T;
export function getConfig(path: string, defaultValue?: any) {
return config.get(path, defaultValue);
}

Then:

ts
import { getConfig } from "./config-helper";
const api = getConfig("api"); // typed as AppConfig["api"]
const timeout = getConfig<number>("api.timeout", 30000);

Going further (typed dotted paths against AppConfig) is possible with the Path / PathValue helpers in @mongez/reinforcements, but is overkill for most projects. Start with the wrapper above and only deepen if it pays off.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
2
7-day trend score
10

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/hassanzohdy/mongez-config/typing/badge)](https://verified-skill.com/skills/hassanzohdy/mongez-config/typing)

Something wrong with this skill or its page? Tell us.