Every time I ask AI to "write a function to validate coupons," I get a different result. Different function names, different return types, different edge cases handled. Three developers, three AI tools, three incompatible implementations.
So I built Runestone — an open-source specification pattern called RUNE that acts as a contract between what you want and what AI generates.
The idea
Instead of describing what you want in plain English and hoping for the best, you write a short spec:
RUNE: validate_coupon
SIGNATURE: |
def validate_coupon(code: str, coupons: list[dict], date: str) -> tuple[bool, str]
BEHAVIOR:
- WHEN code is empty THEN return (False, "Coupon code cannot be empty")
- WHEN code not found (case-insensitive) THEN return (False, "Not found")
- WHEN coupon has expired THEN return (False, "Expired")
- OTHERWISE return (True, matching_coupon)
TESTS:
- "validate_coupon('SAVE10', [...], '2025-01-15')[0] == True"
- "validate_coupon('', [], '2025-01-15')[0] == False"
- "validate_coupon('OLD', [...], '2025-01-15')[0] == False"
Give this to any AI tool — Claude, ChatGPT, Cursor, Copilot... and the generated code has the same behavior. Same signature. Same edge cases. Same error messages. Same tests.
What it includes
- A pattern (not a framework) that works as YAML files or Markdown sections
- 7 skills you can load into any AI tool:
- Writer — create specs and implement code
- Validator — check spec completeness
- Refiner — suggest improvements
- Test Generator — generate real test files from specs
- Diff — detect drift between spec and code
- From Code — reverse-engineer specs from existing functions
- Multi-Lang — same spec, multiple languages
- Works with any programming language
- No installation, no runtime, no dependencies
What it doesn't do
It doesn't generate identical code character-by-character. Variable names and internal style may vary between AI tools. What stays consistent is the behavior: same inputs, same outputs, same edge case handling, same error messages. The tests from the spec pass regardless of which AI generated the code.
Try it
- Copy
skills/rune-writer.mdinto your AI tool - Describe a function you need
- Get a RUNE spec
- Implement from the spec
- Do it again with a different AI tool — compare the results
GitHub: https://github.com/vict00r99/Rune-stone
Would love feedback. What would make this useful for your workflow?
Top comments (0)