ai-skills/skills/valdi-compiler/skill.md
Applies to: Swift files in /compiler/compiler/
The Valdi compiler consists of two parts:
.valdimodule fileslet over var when possible/compiler/compiler/ - Main Swift compiler implementation.valdimodule files (binary format read by runtime)// Follow existing visitor patterns
class MyASTVisitor: ASTVisitor {
func visit(_ node: Node) -> Result {
// Visit logic
}
}
// Use proper error types
enum CompilerError: Error {
case invalidSyntax(String)
case typeError(String)
}
Tests are critical - add tests for new features and error cases. The update_compiler.sh script runs tests automatically.
cd compiler/compiler
./scripts/update_compiler.sh ../../bin/compiler
This script:
swift test automaticallybin/compiler/macos/valdi_compiler (or linux/valdi_compiler)Open compiler/compiler/Compiler/Package.swift in Xcode, let it resolve dependencies, then build.
The companion is a TypeScript service that works alongside the Swift compiler. It handles TypeScript compilation, type checking, and provides debugging support.
cd compiler/companion
./scripts/update_companion.sh ../../bin/compiler_companion
This script:
npm installnpm run testbazel build //compiler/companion:bundlebin/compiler_companionNote: Once built, the companion is automatically invoked by the compiler during compilation. You don't need to run it manually - it's part of the compiler process.
/compiler/compiler/README.md/AGENTS.md