A domain-specific language (DSL) is a computer language specialized to a particular application domain, trading the generality of a general-purpose language for expressiveness and clarity within a narrow problem space. Examples range from SQL and regular expressions to configuration and API-description languages.
DSL
DSL, a Domain-Specific Language, is a programming or specification language purpose-built for one problem domain rather than for general computation. Where a general-purpose language can express anything, a DSL deliberately narrows its vocabulary so that the things you do need to say become concise, readable, and hard to get wrong. SQL for queries, regular expressions for pattern matching, and CSS for styling are all DSLs people use every day.
- Domain focus - The language’s grammar and primitives map directly to concepts practitioners in the domain already know.
- Internal vs. external - A DSL can be embedded inside a host language (internal) or have its own standalone syntax and parser (external).
- Declarative expression - Many DSLs describe what is wanted rather than how to compute it, leaving execution to a dedicated engine.
- Reduced surface for error - A constrained vocabulary makes intent explicit and keeps out whole classes of mistakes.
In the API world, DSLs are everywhere the contract lives in a file: OpenAPI, JSON Schema, and Arazzo are declarative domain-specific languages for describing interfaces, validation, and workflows. Governance rulesets like Spectral are DSLs for expressing linting policy, and the same pattern now underpins how agents are configured — a small, precise language that lets a person or a model declare intent that tooling then executes reliably.