# AI Skills Nix Flake

This repository now provides a Nix flake for declarative deployment of AI agent skills to Claude Code and OpenCode.

## Quick Start

```nix
# In your flake.nix
{
  inputs.ai-skills.url = "path:/home/dan/proj/skills";
  # or when published: "github:yourusername/skills";
  
  outputs = { ai-skills, ... }: {
    homeConfigurations.youruser = {
      imports = [ ai-skills.homeManagerModules.ai-skills ];
      
      services.ai-skills = {
        enable = true;
        skillsPath = "${ai-skills}/skills";
        skills = [ "worklog" "screenshot-latest" "tufte-press" ];
      };
    };
  };
}
```

## What This Provides

### Home Manager Module
Declaratively deploy skills to `~/.claude/skills/` and `~/.config/opencode/skills/` with:
- Automatic `opencode-skills` plugin installation
- Per-skill configuration
- Support for both agents (Claude Code + OpenCode)

### Packages
Individual skill packages for custom deployment:
- `packages.x86_64-linux.worklog`
- `packages.x86_64-linux.screenshot-latest`  
- `packages.x86_64-linux.tufte-press`
- `packages.x86_64-linux.update-spec-kit`
- `packages.x86_64-linux.all-skills` (combined)

### Development Shell
```bash
nix develop
# Provides: bash, shellcheck, jq
# Plus validation helpers
```

## Available Skills

Current skills (only existing ones are packaged):
- ✅ `worklog` - Create org-mode worklogs
- ✅ `update-spec-kit` - Update spec-kit ecosystem
- ⏸️ `screenshot-latest` - Find latest screenshots (not yet in git)
- ⏸️ `tufte-press` - Generate study card JSON (not yet in git)
- ⏸️ `niri-window-capture` - Window screenshots (not yet in git)

Skills marked ⏸️ are developed but not committed to git yet.

## Files

- **flake.nix** - Main flake definition
- **modules/ai-skills.nix** - Home Manager module
- **NIX-FLAKE-USAGE.md** - Complete usage documentation
- **skills/** - Individual skill directories

## Usage

See [NIX-FLAKE-USAGE.md](NIX-FLAKE-USAGE.md) for:
- Detailed configuration options
- Integration examples
- Troubleshooting guide
- Advanced usage patterns

## Testing

```bash
# Check flake
nix flake check

# Show outputs
nix flake show

# Enter dev shell
nix develop

# Build a skill
nix build .#worklog
```

## Example: Using in dotfiles

```nix
# ~/proj/dotfiles/flake.nix
{
  inputs.ai-skills.url = "path:/home/dan/proj/skills";
  
  outputs = { ai-skills, ... }: {
    homeConfigurations.dan = {
      imports = [ ai-skills.homeManagerModules.ai-skills ];
      
      services.ai-skills = {
        enable = true;
        skillsPath = "${ai-skills}/skills";
        skills = [ "worklog" ];
        enableClaudeCode = true;
        enableOpenCode = true;
        installOpencodePlugin = true;
      };
    };
  };
}
```

Then:
```bash
cd ~/proj/dotfiles
home-manager switch --flake .#dan
```

## Status

- ✅ Flake structure created
- ✅ Home Manager module implemented
- ✅ Package outputs working
- ✅ Documentation complete
- ⏸️ Not yet tested in consuming repository
- ⏸️ opencode-skills plugin installation needs testing

## Next Steps

1. Test module in dotfiles repo
2. Verify opencode-skills plugin installs correctly
3. Add remaining skills to git
4. Publish to GitHub for remote access
