- Home
- Skills
- Prompt & Skill Engineering
- spec first language engineering
spec first language engineering
A specification-first workflow for AI agents building and changing programming languages, compilers, parsers, interpreters, type systems, and language tooling.
$12
Works with the AI Agents you already use
spec first language engineering
Example session with this skill installed
Add a language feature without breaking the language contract
Add a new match expression feature to an existing programming language implementation.
Before changing code
- inspect the language specification and existing syntax/semantic rules;
- identify the parser, AST, semantic analysis, and execution/code-generation paths involved;
- establish the current baseline;
- identify any pre-existing changes and preserve them.
Define the feature contract before implementation, including valid syntax, invalid syntax, evaluation semantics, error behavior, and compatibility with existing programs.
Implement the smallest complete change required.
Do not redesign unrelated compiler components, rewrite working parser code, or introduce unrelated refactors.
After implementation, verify the feature against the contract using focused positive and negative cases, existing regression tests, and the project's normal validation commands.
Inspect the final change scope and report exactly what changed, what was verified, and any limitations.
- Read your context and instructions
- Compiled the spec first language
Change Contract
** Feature
**Add match expressions to an existing programming language.
Required behavior
- Valid
matchsyntax must parse according to the language grammar. - Invalid forms must produce the language's normal syntax errors.
- The AST must represent the new construct explicitly.
- Semantic analysis must validate the construct according to the language's existing type/name rules.
- Runtime or code-generation behavior must follow the defined evaluation semantics.
- Existing language behavior must remain unchanged outside the feature.
Protected scope
- Existing syntax rules
- Existing parser architecture
- Existing AST conventions
- Existing semantic-analysis behavior
- Existing runtime/code-generation behavior unrelated to
match - Pre-existing user changes
Baseline
Before editing, the agent should inspect:
- The language specification.
- Existing grammar/parser definitions.
- AST node definitions.
- Semantic-analysis or type-checking logic.
- Runtime or code-generation handling.
- Existing positive and negative tests.
- Repository status and current validation commands.
Pre-existing changes are treated as protected and are not reset, stashed, overwritten, or silently incorporated into the feature.
Implementation Plan
The feature is implemented in the smallest complete sequence:
- Define the syntax and semantic contract.
- Extend the grammar/parser.
- Add the corresponding AST representation.
- Add semantic validation.
- Add runtime or code-generation behavior.
- Add focused positive and negative tests.
- Run the existing project validation.
- Inspect the final diff for unrelated changes.
No unrelated refactor is required.
Verification Evidence
Syntax
Verify valid match programs parse successfully.
Negative syntax
Verify malformed match expressions fail with the expected diagnostic behavior.
Semantics
Verify valid and invalid patterns, branches, names, and types according to the language specification.
Execution
Verify representative match expressions produce the expected result.
Regression
Run the project's existing test suite or equivalent validation and confirm unrelated language behavior remains intact.
Scope
Inspect the final diff and confirm that only files required for the feature changed.
Final Report
The agent should finish by reporting
- Changed: the exact parser, AST, semantic, runtime/code-generation, and test changes made.
- Verified: the exact commands and focused cases used for validation.
- Scope: what was deliberately not changed.
- Evidence: test/build/conformance results and final diff inspection.
- Limitations: any behavior that could not be verified.
- Recovery: how the change can be isolated or reverted through the repository's normal version-control workflow.
The skill does not treat a successful compilation as proof of language correctness. The implementation is considered complete only when the specified behavior and its conformance evidence have been established.
Connects securely to your tools. The creator never sees your data.
About this skill
Language engineering projects often fail when AI agents generate plausible code that silently breaks grammar rules, precedence, or type safety. This skill enforces a specification-first workflow to ensure every change to a compiler, interpreter, or parser is verified against explicit language contracts.
What it does
- Define language contracts by establishing behavior for accepted forms, rejected forms, and precedence before any code is edited.
- Map implementation layers to identify exactly which components—from lexers and AST nodes to semantic analysis and code generation—require modification.
- Generate executable examples that serve as the ground truth for positive, negative, and boundary cases.
- Perform multi-layer verification including lexical, parsing, AST, and semantic checks to confirm the fix works across the entire pipeline.
- Protect against regressions by testing interactions with nearby syntax, keywords, and existing control flow structures.
How it works
- Establish the contract by identifying the source of truth, such as EBNF definitions or language specifications, and documenting the required behavior.
- Trace the impact across the implementation layers to find the smallest coherent set of changes needed.
- Draft conformance tests that turn the language rule into reproducible examples before modifying the codebase.
- Execute and verify the change using specific checks for diagnostics, AST invariants, and runtime behavior.
Frameworks & tools
This skill is tool-agnostic and works with any language engineering stack, including LLVM, Tree-sitter, ANTLR, Bison/Yacc, or custom hand-written recursive descent parsers and type checkers.
Why this beats prompting it yourself
Standard prompts often lead to "fix-and-check" loops where the agent fixes one syntax error only to break operator precedence or type inference elsewhere. This skill forces a rigorous engineering discipline that treats the language specification as the authoritative guide, preventing silent architectural drift and broken invariants.
Use cases
- Adding new syntax like a pipe operator or destructuring assignment while maintaining correct associativity.
- Modifying type systems to support new narrowings, coercions, or inference rules without breaking existing code.
- Refactoring parsers to improve error recovery or diagnostic messages for invalid inputs.
- Porting compilers between intermediate representations while verifying semantic equivalence.
Known limitations
Does not replace formal verification tools, CI systems, or human design review. It cannot resolve ambiguities in a specification without user clarification.
Requires an existing specification or authoritative reference. Cannot resolve specification ambiguities without user input. Does not replace formal verification or CI systems.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed today
Permissions
File Scopes
This skill requires project file read/write access and terminal access to inspect language specifications, implement bounded language changes, run existing validation and conformance tests, and inspect the final change scope. It does not require external accounts, credentials, browser access, network access, environment variables, or third-party services.