A
accurate-environment-model
About accurate-environment-model
A TypeScript skill for describing globals, environment variables, and platform-specific APIs in declaration files. It helps developers keep environment-dependent code accurately typed.
Key features
- 01Model globals with .d.ts files
- 02Augment window and globalThis types
- 03Type environment variables
- 04Define build-time constants
Use cases
- 01Typing application-wide configuration
- 02Adding platform-specific global types
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ marius-townhouse/ effective-typescript-skills --skill accurate-environment-modelAfter installing, type/accurate-environment-modelin Claude Code to confirm it loaded.
Details
From the project READMECreate an Accurate Model of Your Environment
Overview
Your TypeScript environment includes globals, environment variables, and platform-specific APIs. Create accurate type definitions for your environment using declaration files (.d.ts). This ensures type safety for platform-specific code and global variables.
When to Use This Skill
- Defining global types
- Augmenting window or globalThis
- Typing environment variables
- Working with build-time constants
- Configuring type definitions
The Iron Rule
Model your environment accurately with .d.ts files. Declare globals, window properties, and environment variables that your code depends on.
Example
// types/environment.d.ts
declare global {
interface Window {
APP_CONFIG: {
apiUrl: string;
version: string;
};
}
const BUILD_TIMESTAMP: number;
}
// Usage
console.log(window.APP_CONFIG.apiUrl);
console.log(BUILD_TIMESTAMP);
Reference
- Effective TypeScript, 2nd Edition by Dan Vanderkam
- Item 76: Create an Accurate Model of Your Environment
Comments
Markdown supported