# Accurate Environment Model

> Use when defining global types. Use when augmenting window. Use when typing environment variables. Use when working with build-time constants. Use when configuring type definitions.

- Skill: `marius-townhouse/accurate-environment-model` (Agent Skill)
- Install (CLI): `npx skillmds@latest add marius-townhouse/accurate-environment-model`
- Raw SKILL.md: https://api.skillmd.com/api/skills/marius-townhouse/accurate-environment-model/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: marius-townhouse (https://skillmd.com/u/marius-townhouse)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/marius-townhouse/accurate-environment-model

---


# Create 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

```typescript
// 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

