Guardrails That Keep Your
Agentic Code Generation
Aligned With Your Domain
Get started in seconds:
npm install -g @blocksai/cliblocks run my-block$schema: "blocks/v2"
philosophy:
- "Blog posts must include humor"
domain:
semantics:
humor_score:
description: "How funny is this content?"
validators:
- schema
- name: domain
config:
rules:
- id: humor_required
description: "Must include wit"
blocks:
validator.blog_post:
description: "Validates blog content"
path: "validators/blog"Not Locking Down Code—Giving You a Semantic Compass
Blocks doesn't restrict who can edit code. Instead, it detects when either humans or AI introduce drift from the spec.
Humans Write Code
You're free to modify any block. Write, refactor, experiment—Blocks won't stop you.
AI Agents Write Code
Any AI coding assistant can modify blocks. LLM agnostic—works with all providers.
Blocks Detects Drift
Run validation. Blocks reports drift and helps you decide: fix code or update spec.
The Validation Loop
Human or AI writes code
Run blocks run <name>
Validators run—built-in or custom. Check types, structure, semantics, or anything (screenshots, contrast, performance, security...)
Drift detected? You decide: fix code or update spec
Iterate until both code and spec align
The Feedback Loop in Action
Watch how an AI agent uses Blocks to iterate until code meets your spec.
The agent sees validation output, understands the issues, and fixes them autonomously.
Multi-Layer Validation
Catch issues at every level: from schema validation to semantic analysis with AI.
Schema
Fast, deterministic validation of inputs, outputs, and data types using Zod schemas.
Shape
Verify file structure, exports, and conventions to maintain consistent block organization.
Domain
AI-powered semantic analysis that understands your domain concepts and validates against them.
Fully Extensible Validator System
schema, shape, and domain are just the built-in validators we recommend. You can add any number of custom validators, override the defaults, or build your own validation pipeline.
# Mix built-in and custom validatorsvalidators:- schema- domain- name: security_scanrun: "security.audit"- name: perf_checkrun: "perf.benchmark"Live Examples
Explore real-world examples built to discover what Blocks should be. Each example explores different domain patterns.
Resume Themes
Template Rendering
Validates resume themes for semantic HTML, accessibility, and responsive design using DRY domain rules.
Blog Validator
Content Quality
Validates markdown posts for humor and conversational tone using AI-powered semantic analysis.
HR Engine
Production-Ready
Complete recommendation system with scoring, ranking, and filtering. Shows multi-block composition.
Each example helped shape the Blocks specification through practical discovery.
Explore All ExamplesReady to Add Guardrails to Your AI Codebase?
Create a feedback loop where AI agents run validation until all code aligns with your domain requirements.