TypeScript & JavaScript Utilities – Professional Prompt Set

Clear professional description of the code solution

C
Christian Geimer
·Sep 27, 2026·
0 0 3
Free
Prompt
664 words

AdaptiveSchema: A Production‑Ready TypeScript Utility Suite

You are a senior TypeScript engineer with deep expertise in schema validation, immutable data handling, and type‑safe runtime type guards. Your mission is to design, implement, and fully document a self‑contained library named AdaptiveSchema that can be dropped into any Node.js or browser project without pulling in any third‑party dependencies other than the official TypeScript compiler. The library must be ready for production use, meaning it should be thoroughly typed, free of runtime errors, and accompanied by comprehensive documentation and tests.

Core Capabilities to Deliver

  1. Dynamic JSON Schema Validation

    • Accept any JSON‑serializable object at runtime.
    • Validate the object against a user‑supplied schema expressed in a lightweight, TypeScript‑friendly syntax (e.g., a subset of JSON Schema or a custom DSL).
    • Provide detailed, human‑readable error messages indicating the exact path and nature of each validation failure.
    • Return a strongly‑typed representation of the validated data that can be used safely in the rest of the application.
  2. Immutable Data Transformation

    • Offer utilities to perform deep, immutable updates on nested data structures.
    • Ensure that updates preserve type safety and do not mutate the original input.
    • Support common operations such as set, merge, delete, and patch with optional path expressions.
  3. Runtime Type Guards and Narrowing

    • Generate runtime type guard functions from the supplied schema that can be used in conditional statements to narrow types.
    • These guards should be pure functions returning boolean and should be compatible with TypeScript’s type narrowing system.

Deliverables

  • A single src/ directory containing all TypeScript source files (index.ts, validator.ts, immutable.ts, guards.ts, etc.).
  • A package.json that declares the library as an ES module with a main and types field, and includes scripts for building (tsc), linting (eslint), testing (jest), and documentation generation (typedoc).
  • A tsconfig.json tailored for library output (ES2020, "declaration": true, "module": "ESNext").
  • A README.md that explains:
    • Installation instructions (npm install adaptive-schema).
    • Quick start example showing schema definition, validation, and type guard usage.
    • API reference for the three core capabilities.
    • Performance considerations and best practices.
  • A comprehensive test suite (tests/ folder) that covers:
    • Successful validation of complex nested schemas.
    • Failure cases with precise error messages.
    • Immutable transformation correctness and immutability guarantees.
    • Runtime guard behavior in TypeScript type narrowing.
  • Optional: a small demo project or code snippet illustrating the library in a real‑world scenario (e.g., validating API responses).

Quality Criteria

  • Type Safety: All public APIs must be fully typed; no any should appear in the exported surface.
  • Zero Dependencies: Apart from the TypeScript compiler and the test/linters used in the dev environment, the library must not import any external packages.
  • Performance: Validation and transformation functions should run in linear time relative to input size and should avoid unnecessary allocations.
  • Documentation: Every public function/class should have JSDoc comments that are parsed by Typedoc.
  • Testing: Aim for >90% code coverage; tests must run deterministically in both Node.js and browser environments.
  • Build: The library should compile to both CommonJS and ES Module outputs without breaking type definitions.

Expected Output Format

Provide the complete source code as a single, well‑structured Git‑style repository snapshot:

adaptive-schema/
├─ src/
│  ├─ index.ts
│  ├─ validator.ts
│  ├─ immutable.ts
│  ├─ guards.ts
│  └─ types.ts
├─ tests/
│  ├─ validator.test.ts
│  ├─ immutable.test.ts
│  └─ guards.test.ts
├─ package.json
├─ tsconfig.json
├─ jest.config.js
├─ .eslintrc.js
├─ README.md
└─ typedoc.json

Include all files in a single code block, preserving directory structure and file separators. The README should be written in Markdown and include code fences for examples. The package.json should list "main": "dist/index.js" and "types": "dist/index.d.ts". The tsconfig.json should target ES2020 with "module": "ESNext" and "declaration": true. The Jest config should use ts-jest. The ESLint config should enforce strict TypeScript rules.

Your final response should be the entire repository content ready for cloning, building, and publishing. No additional commentary or explanation is required beyond the code and documentation.

Need help?

Connect with verified experts who can help you succeed.

Related Prompts

More prompts in Coding & Development

View All
Coding & Development
Universal

This Prompt Ads Sequential Function Calling To Models Other Than GPT 0613

This prompt ads sequential function calling to models other than GPT-0613

D
digitalmuse$2.99
39,910 89,588
Coding & Development
Universal

Create a personalized workout routine

Tailor a workout routine specifically designed for individual fitness goals

P
primequery$2.99
23,370 23,405
Coding & Development
Universal

GODMODE CHEATCODE

God Writes You a Letter Today. This is will help you find the perfect Bible Scripture that will guide you through a current problem you're facing.

S
signalcraft$3.99
13,574 13,622
Coding & Development
Universal

Creating a Personal Finance Tracker with [Technology/Tool]

Learn to create a personal finance tracker using [Technology/Tool]. Get code samples and budgeting tips.

F
focusqueryFree
376 385
Coding & Development
ChatGPT

Build an entire application using bubble.io with ChatGPT4

Build an entire app with bubble.io, assisted by chatGPT4, that knows bubble very well and is accurate 95% of the time. This prompt will help you maximize the quality of chatGPT assistance. Having detailed and step-by-step instructions is essential to progress fast with Bubble. This initial prompt will help you get started on a good basis. Follow it because I will make it even better.

P
promptframes$5.99
1,280 1,300
Coding & Development
Universal

Become LawyerGPT

Are you in a legal bind? This prompt can help you gain knowledge about how to handle your legal proceedings. DISCLAIMER: Please meet with a real lawyer to discuss your options.

P
promptbench$2.99
1,063 1,076