repo-structure-navigate
Original:🇺🇸 English
Translated
Navigate the Valibot repository structure. Use when looking for files, understanding the codebase layout, finding schema/action/method implementations, locating tests, API docs, or guide pages. Covers monorepo layout, library architecture, file naming conventions, and quick lookups.
11installs
Sourceopen-circle/valibot
Added on
NPX Install
npx skill4agent add open-circle/valibot repo-structure-navigateTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Valibot Repository Structure
Monorepo Layout
valibot/
├── library/ # Core valibot package (zero dependencies)
├── packages/
│ ├── i18n/ # Translated error messages (25+ languages)
│ └── to-json-schema/ # JSON Schema converter
├── codemod/
│ ├── migrate-to-v0.31.0/ # Version migration
│ └── zod-to-valibot/ # Zod converter
├── website/ # valibot.dev (Qwik + Vite)
├── brand/ # Brand assets
├── skills/ # Agent skills (this folder)
└── prompts/ # Legacy AI agent guidesCore Library (/library/src/
)
/library/src/Directory Structure
| Directory | Purpose | Examples |
|---|---|---|
| Data type validators | |
| Validation & transformation | |
| High-level API | |
| TypeScript definitions | |
| Internal helpers (prefixed | |
| Global state | Config, message storage |
Schema Categories
- Primitives: ,
string,number,boolean,bigint,date,symbol,blobfile - Objects: ,
object,strictObject,looseObjectobjectWithRest - Arrays: ,
array,tuple,strictTuple,looseTupletupleWithRest - Advanced: ,
union,variant,intersect,record,map,set,lazycustom - Modifiers: ,
optional,nullable,nullish,nonNullable,nonNullishnonOptional
Action Types
Validation (return issues): , , , , , ,
emailurluuidregexminLengthmaxValuecheckTransformation (modify data): , , , ,
trimtoLowerCasetoUpperCasemapItemstransformMetadata: , , , ,
brandflavormetadatadescriptiontitleFile Naming Convention
Each schema/action/method has its own directory:
schemas/string/
├── string.ts # Implementation
├── string.test.ts # Runtime tests
├── string.test-d.ts # Type tests
└── index.ts # Re-exportCore Patterns
Schemas define data types:
typescript
export interface StringSchema<TMessage> extends BaseSchema<...> {
readonly kind: 'schema';
readonly type: 'string';
// ...
}Actions validate/transform in pipelines:
typescript
export interface EmailAction<TInput, TMessage> extends BaseValidation<...> {
readonly kind: 'validation';
readonly type: 'email';
// ...
}Methods provide API functions:
typescript
export function parse<TSchema>(
schema: TSchema,
input: unknown
): InferOutput<TSchema>;Key Types
- ,
BaseSchema,BaseValidation- Base interfacesBaseTransformation - ,
InferOutput<T>,InferInput<T>- Type inferenceInferIssue<T> - ,
Config,ErrorMessage<T>- Configuration and errorsBaseIssue<T> - property - Standard Schema compatibility
'~standard'
Website (/website/src/routes/
)
/website/src/routes/API Documentation
routes/api/
├── (schemas)/string/ # Schema docs
│ ├── index.mdx # MDX content
│ └── properties.ts # Type definitions
├── (actions)/email/ # Action docs
├── (methods)/parse/ # Method docs
├── (types)/StringSchema/ # Type docs
└── menu.md # NavigationGuides
routes/guides/
├── (get-started)/ # Intro, installation
├── (main-concepts)/ # Schemas, pipelines, parsing
├── (schemas)/ # Objects, arrays, unions
├── (advanced)/ # Async, i18n, JSON Schema
├── (migration)/ # Version upgrades
└── menu.md # NavigationDevelopment
Playground
Use for quick experimentation.
library/playground.tsAdding a Schema/Action
- Create directory:
library/src/schemas/yourSchema/ - Create files: ,
yourSchema.ts,yourSchema.test.ts,yourSchema.test-d.tsindex.ts - Follow existing patterns (copy similar implementation)
- Export from category
index.ts - Run
pnpm -C library test
Modifying Core Types
⚠️ Changes to affect the entire library. Always run full test suite.
library/src/types/Quick Lookups
| Looking for... | Location |
|---|---|
| Schema implementation | |
| Action implementation | |
| Method implementation | |
| Type definitions | |
| Internal utilities | |
| Error messages (i18n) | |
| API docs page | |
| Guide page | |
| Tests | Same directory as source, |
| Type tests | Same directory as source, |
Commands
bash
# Library
pnpm -C library build # Build
pnpm -C library test # Run tests
pnpm -C library lint # Lint
pnpm -C library format # Format
# Website
pnpm -C website dev # Dev server
pnpm -C website build # Production build
# Root
pnpm install # Install all
pnpm format # Format allKey Principles
- Modularity - Small, focused functions; one per file
- Zero dependencies - Core library has no runtime deps
- 100% test coverage - Required for library
- Tree-shakable - Use annotation
// @__NO_SIDE_EFFECTS__ - Type-safe - Full TypeScript with strict mode
- ESM only - Imports include extensions
.ts
Do's and Don'ts
Do:
- Follow existing code patterns
- Write runtime and type tests
- Add JSDoc documentation
- Keep functions small and focused
- Check bundle size impact
Don't:
- Add external dependencies
- Modify core types without full test run
- Skip tests
- Create large multi-purpose functions
- Modify generated files (,
dist/)coverage/