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.
npx agentmods add rules/prisma/prisma-next/config-validation-and-normalizationgit clone --depth 1 https://github.com/prisma/prisma-nextWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.00932 |
| Opus 5 | $0.00000 | $0.00466 |
| Sonnet 5 | $0.00000 | $0.00186 |
| Haiku 4.5 | $0.00000 | $0.00093 |
Grade A, and why
config-validation-and-normalization 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 2d 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.
How it starts
The opening of the file, as written. The whole thing — 122 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Config Validation and Normalization
When implementing config files (e.g. prisma-next.config.ts), use Arktype for validation and
normalization. This gives type safety, clear error messages, and sensible defaults.
Pattern: Validate + Normalize in defineConfig()
import { type } from 'arktype';
import { join, dirname } from 'node:path';
const ConfigSchema = type({
required: 'string',
'optional?': 'string',
nested: type({ 'nestedOptional?': 'number' }),
});
export function defineConfig(config: ConfigInput): ConfigOutput {
// 1. Validate structure with Arktype
const validated = ConfigSchema(config);
if (validated instanceof type.errors) {
const messages = validated.map((p: { message: string }) => p.message).join('; ');
throw new Error(`Config validation failed: ${messages}`);
}
// 2. Normalize by applying defaults
const normalized: ConfigOutput = {
...config,
optional: config.optional ?? 'default-value',
nested: { ...config.nested, nestedOptional: config.nested?.nestedOptional ?? 42 },
};
// 3. Return the normalized IR (not the raw input)
return normalized;
}
Validation catches structural errors early with clear messages; normalization applies defaults in one place; Arktype keeps structure aligned with TypeScript types.
Normalization Responsibilities
defineConfig() is the ONLY place normalization happens. It validates structure, applies
defaults for optional fields, returns the normalized config IR, and throws on invalid structure. It
should always output a fully normalized config. All other components assume configs are already
normalized:
- Config loader — loading only. Loads the config file (c12 or similar) and calls
defineConfig()to validate/normalize, then returns the result. Does NOT set defaults or normalize structure. - Command handlers — using only. Use normalized values directly, accessing fields without checking for defaults. Do NOT set defaults or normalize structure.
- Validators. Never normalize.
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.
- 2d ago First seen · 122 lines · 0 tokens per session scan A 807e0069048e
config-validation-and-normalization is a cursor rule published in the GitHub repository prisma/prisma-next (420 stars, last pushed 7d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 932 tokens. 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-08-30.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.
coolify-ai-docs
Master reference to all Coolify AI documentation in .ai/ directory.
python_lib
Tips and guidelines specific to the development of the Streamlit Python library, not applicable to scripts and e2e tests.
specs
This directory contains product and tech specs for Streamlit features.