.agents/skills/writing-roc-lang/SKILL.md
Writes Roc code with strong static types, helpful compiler errors, and functional programming. Use when the user wants Roc code, mentions Roc, functional programming with types, or needs .roc files. Covers both full applications and one-off Roc scripts with shebangs.
npx skillsauth add jeninh/ampskills-dotfile writing-roc-langInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Write code in Roc, a functional language with strong types, helpful compiler errors, and no runtime. Compiles to standalone binaries.
# Lambda syntax
add = |a, b| a + b
# Multi-line with indentation
process = |text|
trimmed = Str.trim(text)
Str.to_upper(trimmed)
# Type signatures (optional but helpful)
greet : Str -> Str
greet = |name| "Hello, ${name}!"
when value is
Ok(content) -> process(content)
Err(NotFound) -> "not found"
Err(_) -> "other error"
# Records
user = { name: "Alice", age: 30 }
user.name # Access field
# Tags (algebraic data types)
Color : [Red, Green, Blue, Custom Str]
my_color = Custom("purple")
Roc uses Result types, not exceptions. Use ? to short-circuit:
main! = |_args|
content = File.read_utf8!(path)? # Returns early if error
Stdout.line!("Success!")
Or explicit pattern matching:
when result is
Ok(content) -> Stdout.line!("Read: ${content}")
Err(err) -> Err(Exit(1, "Failed: ${Inspect.to_str(err)}"))
numbers = [1, 2, 3, 4, 5]
evens = List.keep_if(numbers, |n| n % 2 == 0)
doubled = List.map(evens, |n| n * 2)
sum = List.walk(doubled, 0, Num.add)
text = Str.concat("Hello", " World")
words = Str.split(text, " ")
trimmed = Str.trim(" spaces ")
replaced = Str.replace_each(text, "World", "Roc")
roc format script.roc # Auto-format code
roc check script.roc # Type check without running
roc test script.roc # Run expect expressions
add = |a, b| a + b
expect add(2, 3) == 5
expect add(0, 0) == 0
Result for errors; no try/catch|param| expression syntaxRoc is pre-1.0. Core features work well, but expect:
tools
Fetches a Linear issue and creates a comprehensive plan for implementation.
development
Preview and screenshot local dev servers and storybooks. Use when asked to view UI components, take screenshots of storybooks, or inspect the web/server apps.
tools
Instructions for using tmux to spawn multiple processes, inspect them, and capture their output. Useful for running servers or long-running tasks in the background.
development
Creates executable Go scripts with shebang-like behavior. Use when the user wants Go scripts, mentions Go scripting, or needs executable .go files. If working in a Go project, do NOT use unless explicitly requested.