From 82f431abf5db8e724ea24b3c889f0867a874e568 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar <3998+srid@users.noreply.github.com> Date: Tue, 4 Nov 2025 18:14:49 -0500 Subject: [PATCH] add Haskell skill --- modules/home/claude-code/default.nix | 14 ++++++ .../home/claude-code/skills/haskell/SKILL.md | 47 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 modules/home/claude-code/skills/haskell/SKILL.md diff --git a/modules/home/claude-code/default.nix b/modules/home/claude-code/default.nix index 7f545b0..509667b 100644 --- a/modules/home/claude-code/default.nix +++ b/modules/home/claude-code/default.nix @@ -17,8 +17,22 @@ let (builtins.readFile (commandsDir + "/${fileName}")) ) (builtins.readDir commandsDir); + + skillsDir = ./skills; + skillDirs = lib.filterAttrs (_: type: type == "directory") (builtins.readDir skillsDir); in { + # Link skill directories to ~/.claude/skills/ + # (home-manager module doesn't support skills yet, so we link manually) + home.file = lib.mapAttrs' + (skillName: _: + lib.nameValuePair ".claude/skills/${skillName}" { + source = skillsDir + "/${skillName}"; + recursive = true; + } + ) + skillDirs; + home.packages = [ pkgs.tree pkgs.python313Packages.markitdown diff --git a/modules/home/claude-code/skills/haskell/SKILL.md b/modules/home/claude-code/skills/haskell/SKILL.md new file mode 100644 index 0000000..3d93f03 --- /dev/null +++ b/modules/home/claude-code/skills/haskell/SKILL.md @@ -0,0 +1,47 @@ +--- +name: haskell +description: Expert Haskell development assistance. Use when working with Haskell code, .hs files, Cabal, ghcid, or when user mentions Haskell, functional programming, or type-level programming. +--- + +# Haskell Development + +Expert assistance for Haskell programming. + +## Guidelines + +**CRITICAL - Error Handling in Code**: NEVER write code that silently ignores errors: +- Do NOT use `undefined` or `error` as placeholders +- Do NOT skip handling error cases in pattern matches +- Do NOT ignore `Maybe`/`Either` failure cases +- Handle all possible cases explicitly +- Use types to make impossible states unrepresentable + +Every error case in generated code must be handled properly. + +**Code Quality**: +- Write type signatures for all top-level definitions +- Write total functions (avoid `head`, `tail`, `!!`) +- Prefer pure functions over IO when possible +- Use explicit exports in modules +- Leverage type system for safety +- Favor composition over complex functions +- Write Haddock documentation for public APIs + +**Idiomatic Patterns**: +- Prefer `Text` over `String` +- Use `newtype` wrappers for domain types +- Apply smart constructors for validation +- Use lenses for record manipulation when appropriate +- Use `Applicative` and `Monad` appropriately + +## Testing + +- Use QuickCheck for property-based testing +- Use HUnit or Hspec for unit tests +- Provide good examples in documentation + +## Build instructions + +As you make code changes, start a subagent in parallel to resolve any compile errors in `ghcid.log`. + +**IMPORTANT**: Do not run build commands yourself. The human runs ghcid on the terminal, which then updates `ghcid.log` with any compile error or warning (if this file does not exist, or if ghcid has stopped, remind the human to address it). You should read `ghcid.log` (in _entirety_) after making code changes; this file updates near-instantly. Don't rely on VSCode diagnostics.