| name | clarion-benchmark |
| description | Benchmark Clarion code generation quality by running test prompts and scoring the output. Measures improvement over time. Triggers on '/clarion-benchmark', 'benchmark clarion', 'test clarion code quality'. |
| version | 1.0.0 |
Clarion Code Generation Benchmark
Tests Claude's Clarion code generation against known-good patterns and scores the output. Run before and after skill updates to measure improvement.
Instructions
Step 1: Run Test Cases
Generate Clarion code for each test case below. Do NOT look at the expected patterns first — generate naturally, then compare.
For each test case:
- Generate the code as if a developer asked you to write it
- Score it against the checklist
- Record pass/fail for each check
Test Cases
Test 1: Simple Procedure with Local Variables
Prompt: "Write a Clarion procedure called CalculateTotal that takes a QUEUE of items with Price and Quantity fields, loops through them, and returns the total as a DECIMAL."
Score checklist:
Test 2: .clw File with CLASS Method Implementation
Prompt: "Write a .clw implementation file for a class called CustomerManager with methods Init, Kill, and FindByName that searches a FILE."
Score checklist:
Test 3: Window with ACCEPT Loop
Prompt: "Write a Clarion window procedure with a button, a list box, and an ACCEPT loop that handles button click and list selection events."
Score checklist:
Test 4: QUEUE Operations
Prompt: "Write Clarion code that declares a QUEUE, adds 3 records, sorts them by name, loops through to display each, then frees the queue."
Score checklist:
Test 5: COM Control Integration
Prompt: "Write Clarion code that creates a COM control using an OLE control, sets some properties, calls a method, and handles an event."
Score checklist:
Test 6: CLASS Declaration (.inc file)
Prompt: "Write a .inc file declaring a Clarion CLASS called ReportBuilder with properties, methods, a constructor, and a destructor."
Score checklist:
Step 2: Calculate Score
Score = (total checks passed) / (total checks) * 100
Rating:
- 90-100%: Excellent — /clarion skill is working well
- 75-89%: Good — minor patterns to add
- 60-74%: Fair — significant gaps to address
- Below 60%: Poor — major skill revision needed
Step 3: Log Results
Use the log_skill_update tool to record the benchmark:
log_skill_update(
pattern_name="benchmark-run",
action="benchmark",
reason="Score: X% (Y/Z checks passed). Test 1: A/B, Test 2: C/D, ..."
)
Step 4: Compare with Previous
Query previous benchmark results:
SELECT timestamp, code_snippet
FROM clarion_traces
WHERE trace_type = 'code_generation' AND tool_name = 'skill_update'
AND code_snippet LIKE '%benchmark-run%'
ORDER BY timestamp DESC
LIMIT 5
Report the trend: improving, stable, or regressing.
Step 5: Recommendations
Based on which checks failed:
- Identify the top 3 most-failed checks across all tests
- Check if the /clarion skill covers these patterns
- If not, recommend running
/clarion-analyze to generate fixes
- If yes, the skill wording may need strengthening
Ratchet Mode
For autonomous improvement cycles, run this sequence repeatedly:
/clarion-benchmark — measure current score
/clarion-analyze — find and apply improvements
/clarion-benchmark — measure again
- Compare: if score improved, keep changes. If regressed, revert.
To revert: use git to restore the previous version of the skill file:
git checkout HEAD~1 -- ~/.claude/skills/clarion/SKILL.md