define-a-type-safe-configuration-schema

define-a-type-safe-configuration-schema is a cursor rule for Cursor from PaulJPhilp/EffectPatterns. It costs 267 tokens per session, scanned A, original, MIT.

A typed configuration definition for reading settings such as a server host and port from a named source.

In plain words
What is it for?
Use it to describe environment variables and other application settings in TypeScript Effect programs.
Why use it?
It makes missing or incorrectly formatted configuration easier to catch before the program runs.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to describe environment variables and other application settings in TypeScript Effect programs.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/pauljphilp/effectpatterns/define-a-type-safe-configuration-schema
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/PaulJPhilp/EffectPatterns

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for define-a-type-safe-configuration-schema

README.md
[![agentmods](https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/define-a-type-safe-configuration-schema/github.svg)](https://agentmods.dev/rules/pauljphilp/effectpatterns/define-a-type-safe-configuration-schema)
Your own site
<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/define-a-type-safe-configuration-schema"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/define-a-type-safe-configuration-schema/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for define-a-type-safe-configuration-schema

Your own site · 80×15
<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/define-a-type-safe-configuration-schema"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/define-a-type-safe-configuration-schema.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 267 This file is loaded in full into every session.
When invoked 267 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00267 $0.00267
Opus 5.5 $0.00107 $0.00107
Sonnet 5.5 $0.00053 $0.00053
Haiku 4.5 $0.00027 $0.00027

Measured 2mo ago against content hash 90b7dd570d62, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

define-a-type-safe-configuration-schema scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

content/published/rules/cursor/define-a-type-safe-configuration-schema.mdc · 42 lines

What it actually says

description: Define a type-safe configuration schema. globs: "**/*.ts" alwaysApply: true

Define a Type-Safe Configuration Schema

Rule: Define a type-safe configuration schema.

Example

import { Config, Effect, ConfigProvider, Layer } from "effect";

const ServerConfig = Config.nested("SERVER")(
  Config.all({
    host: Config.string("HOST"),
    port: Config.number("PORT"),
  })
);

// Example program that uses the config
const program = Effect.gen(function* () {
  const config = yield* ServerConfig;
  yield* Effect.logInfo(`Server config loaded: ${JSON.stringify(config)}`);
});

// Create a config provider with test values
const TestConfig = ConfigProvider.fromMap(
  new Map([
    ["SERVER.HOST", "localhost"],
    ["SERVER.PORT", "3000"],
  ])
);

// Run with test config
Effect.runPromise(Effect.provide(program, Layer.setConfigProvider(TestConfig)));

Explanation:
This schema ensures that both host and port are present and properly typed, and that their source is clearly defined.

Explanation:
This creates a single, type-safe source of truth for your configuration, eliminating runtime errors from missing or malformed environment variables and making the required configuration explicit.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 42 lines · 267 tokens per session scan A 90b7dd570d62

Subscribe to this mod's changes

define-a-type-safe-configuration-schema is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (806 stars, last pushed 4mo ago), licensed MIT. It adds 267 tokens to every session, about $0.0011 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

define-a-type-safe-configuration-schema compared with cursor rules from other repositories

define-a-type-safe-configuration-schema next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
define-a-type-safe-configuration-schemaPaulJPhilp/EffectPatternsCursor rule8064mo agoMITA267Cursor
django-pythonPostHog/posthogCursor rule41kyesterdaynoneA1,586Cursor
python--typescript-guide-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k5mo agoCC0-1.0A226Cursor
nestjs-best-practicesepam/ai-dial-chatCursor rule501yesterdayApache-2.0A14Cursor
standard-nestjs-module-hierarchyPackmindHub/packmindCursor rule3219d agoApache-2.0A314Cursor
nestjssanjeed5/awesome-cursor-rules-mdcCursor rule3.6k5mo agoCC0-1.0A2,058Cursor
react-and-typescript-general-rulesWebDevPeterGriffin/The-VibeCode-BibleCursor rule422d agononeA142Cursor