agentsclimarketplace

Ailang debug

Skill sunholo-data/ailang_bootstrap/skills/ailang-debug

Debug AILANG code errors. Use when you encounter type errors, parse errors, or runtime failures in AILANG programs.From its SKILL.md

Install
npx -y skills add sunholo-data/ailang_bootstrap --skill ailang-debug

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.6 KB, as published. Nobody here has run it

AILANG Debug

Fix common AILANG errors quickly.

Quick Reference

ErrorCauseFix
undefined variable: printNot in entry moduleUse entry module or import std/io (print)
undefined variable: printlnWrong function nameUse print not println
undefined variable: mapNot importedimport std/list (map) or write recursive
No instance for Num[string]print(42)Use print(show(42))
expected }, got letMissing semicolonAdd ; between statements
unexpected token: forNo loops in AILANGUse recursion instead
unexpected token: inNo for x in xsUse match xs { ... }

Decision Tree

Error message?
│
├─ "undefined variable: X"
│   └─ Is X a builtin?
│       ├─ Yes → Import it: ailang builtins list | grep X
│       └─ No → Check spelling, define it
│
├─ "expected }, got ..."
│   └─ Missing semicolon between statements
│       Fix: let x = 1; let y = 2; x + y
│
├─ "No instance for Num[string]"
│   └─ Passing number to string function
│       Fix: print(show(42)) not print(42)
│
├─ "unexpected token: for/while/in"
│   └─ AILANG has no loops!
│       Fix: Use recursion with match
│
└─ Parse error with braces
    └─ Unmatched { } or missing expression
        Fix: Check all blocks are closed

Common Fixes

1. Missing Semicolons

-- WRONG
export func main() -> () ! {IO} {
  let x = 10
  let y = 20
  print(show(x + y))
}

-- CORRECT (semicolons between statements)
export func main() -> () ! {IO} {
  let x = 10;
  let y = 20;
  print(show(x + y))
}

2. Print Needs String

-- WRONG: print expects string
print(42)

-- CORRECT: convert with show()
print(show(42))

3. No Loops - Use Recursion

-- WRONG: no for loops
for i in range(5) { print(show(i)) }

-- CORRECT: recursive function
export func printRange(n: int) -> () ! {IO} {
  if n <= 0 then () else {
    print(show(n));
    printRange(n - 1)
  }
}

4. Import Standard Library

-- WRONG: map not in scope
let doubled = map(\x. x * 2, nums)

-- CORRECT: import from std/list
import std/list (map)
let doubled = map(\x. x * 2, nums)

-- OR: write it yourself (recursion)
export func myMap[a,b](f: func(a) -> b, xs: [a]) -> [b] {
  match xs {
    [] => [],
    hd :: tl => f(hd) :: myMap(f, tl)
  }
}

Debugging Workflow

  1. Type-check first (faster feedback):

    ailang check file.ail
    
  2. Read error location - line:column tells you where

  3. Check the pattern above for your error type

  4. Use REPL for quick tests:

    ailang repl
    > show(42)
    > 1 + 2
    > :type \x. x * 2
    
  5. List builtins to find imports (CLI is source of truth):

    # SOURCE OF TRUTH: Full documentation with examples
    ailang builtins list --verbose --by-module
    
    # Search for specific function with full docs
    ailang builtins list --verbose | grep -A 10 "map"
    
    # See a specific module's functions
    ailang builtins list --verbose --by-module | grep -A 30 "std/list"
    

Resources

Always prefer CLI commands (ailang prompt, ailang builtins list --verbose) over static docs - they're always up-to-date.

See resources/error_catalog.md for additional error patterns.

Docs: https://ailang.sunholo.com/docs/reference/language-syntax

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.