Imported from kevinzeroCode/final-project-kevinzeroCode (
skills/code-author-kevinzeroCode/SKILL.md). Install upstream withnpx skills add kevinzeroCode/final-project-kevinzeroCode --skill code-author-kevinzeroCode. Copyright stays with the author.
Code Author Skill (Pairwise Track)
When to Use
When the user sends a JSON payload with task_description, constraints (entry_function, max_loc, imports_forbidden), and task_id. The skill must produce a Python implementation that:
- defines exactly the entry function named in
constraints.entry_function, - does not exceed
constraints.max_locsource lines (measured byradon raw), - does not import anything in
constraints.imports_forbidden, - handles realistic edge cases (empty input, single element, extremes — see Pitfalls).
Trigger example:
/code-author-kevinzeroCode {"task_id":"task_042",
"task_description":"Implement merge_intervals(intervals): merge overlapping intervals, empty input returns [].",
"constraints":{"entry_function":"merge_intervals","max_loc":500,"imports_forbidden":["os","sys"]}}
Procedure
Script paths — read first. When this skill loads, Hermes prints its absolute location as
[Skill directory: <DIR>]. The terminal's working directory is not<DIR>, so a barescripts/selftest.pywill fail (No such file). Always invoke scripts with the absolute skill-directory path, e.g.python3 "<DIR>/scripts/selftest.py" '<json>'. Substitute the real<DIR>Hermes showed.
- Parse the task description and write down the exact edge cases it implies before coding — e.g. empty input, single element, first/last index, 1-based vs 0-based, duplicates,
k/size bounds (k<1,k>len),m<=0/n<=0, negative/zero. You will self-test each of these in step 3. - Draft a Python implementation defining
constraints.entry_function. Keep code idiomatic; do not over-engineer. - Self-test by running
python3 "<DIR>/scripts/selftest.py"(absolute skill-dir path, see note above) with the candidate code + constraints + a small set of edge inputs (empty list, single element, extremes). The script returns{passed, failed, errors, sloc, import_violations}.- If any check fails: read the error, fix the code, retry (up to 3 rounds).
- Emit the contract by running
python3 "<DIR>/scripts/run.py". Write your program to a RELATIVE filesolution.pyin the current directory, and run the heredoc + run.py as ONE command so they share the same working directory:
⚠️ Critical — keepcat > solution.py <<'PYEOF' <your full program, with real newlines> PYEOF python3 "<DIR>/scripts/run.py" --task_id "<id>" --code-file solution.py --loc <int> --self_test_passed <int> --self_test_failed <int> --confidence 0.9solution.pya bare relative name; do NOT give it an absolute path (no Windows drive-letter path, no leading-slash absolute path). Only the scripts (selftest.py / run.py) take the absolute<DIR>path — the solution file must be relative and written in the same command. Ifsolution.pylands in a different directory (or an absolute path the bash terminal mangles), run.py can't find it and silently emits emptycode→ every test case fails. After run.py printswritten ok -> ..., you are done. Fallback (inline):--code "<full python source>"as one double-quoted argument (run.py restores escaped newlines). The grader reads the result file (AIASE_RESULT_PATH, else./aiase_result.json) — running run.py is your final action; no need to print any JSON.
Pitfalls
- Missing empty-input handling — the most common Pairwise failure. Always test
[]/""/0. - Off-by-one in loops / slicing — test both endpoints (first, last) explicitly.
- Forbidden imports —
os,sys,subprocessetc. The harness will flag them; don't import anything not strictly needed. - LoC limit —
radon rawcounts source lines (excludes blank + pure-comment). The grader re-runsradonindependently of your reportedloc. Keep code lean. - No network / no filesystem outside cwd in sandbox (see spec §2.3). Don't read files, don't call APIs.
Examples (few-shot)
Mirror this style: define exactly constraints.entry_function, guard empty/edge inputs
first, keep it lean, import nothing forbidden.
Task: Implement chunk(items, n): split items into consecutive sublists of length
n (the last may be shorter); empty items or n <= 0 returns [].
def chunk(items, n):
if not items or n <= 0:
return []
return [items[i:i + n] for i in range(0, len(items), n)]
The empty / n <= 0 guard comes first (the single most common Pairwise failure), and the
function name matches the requested entry function exactly.
Task: Implement binary_search(arr, target) on a sorted list: 0-based index of target, else -1; empty → -1; O(log n).
def binary_search(arr, target):
lo, hi = 0, len(arr) - 1
while lo <= hi: # <= (not <): a one-element range must still be checked
mid = (lo + hi) // 2
if arr[mid] == target:
return mid
if arr[mid] < target:
lo = mid + 1
else:
hi = mid - 1
return -1
The boundary while lo <= hi is the key edge: with <, a single-element array whose only
element is the target wrongly returns -1. Enumerate the boundary (first/last/single) and
self-test it explicitly — generic "empty/large" inputs miss this class of off-by-one.
Verification
scripts/run.py writes the result file (read by the grader via AIASE_RESULT_PATH) with:
task_id(must equal input)code(string, valid Python definingentry_function)loc(integer — what your harness measured)self_test_results(object withpassedandfailedcounts at minimum)rationale(string)confidence(number in[0.0, 1.0])