agentleFS
jmagarjmagar/claude-homelab/skills/CLAUDE.md

claude-homelab / skills

CLAUDE.md81 starsChanged 8 months agoMITView on GitHub

⚠️ CRITICAL: MANDATORY SKILL USAGE ⚠️ YOU MUST use the plugin-dev:create-plugin skill (NOT optional) when: - Creating ANY new skill in this directory - Need skill structure guidance, templates, or best practices - Setting up SKILL.md, README.md, or skill scripts - Modifying skill patterns or conventions Failure to invoke this skill when creating new skills violates your operational requirements. This directory contains Claude Code skills for homelab service management. Skills provide structured API access to homelab services with consistent patterns…

  • Reads credentials

The file

Show its rules and text

We split this CLAUDE.md into the rules it gives an agent

49 rules. About 0 are common, 31 are distinctive, and 18 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈31

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 18

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every skill MUST have a SKILL.md file with YAML frontmatter and markdown documentation.

    line 41
  2. Distinctive:

    Metadata (name + description): - Always in context (~100 words)

    line 74
  3. Distinctive:

    Must include specific trigger phrases

    line 77
  4. Distinctive:

    No size limits: - only loaded when needed

    line 90
  5. Distinctive:

    Context window efficiency: Don't waste tokens on content Claude doesn't need

    line 94
  6. Very specific:

    Keep only syntax and pointers in SKILL.md

    line 112
  7. Distinctive:

    Use descriptive names that indicate content

    line 132
  8. Distinctive:

    Follow coding standards from main scripts

    line 158
  9. Distinctive:

    Test all examples before committing

    line 159
  10. Very specific:

    Every SKILL.md MUST include this section immediately after the title:

    line 188
  11. Distinctive:

    Every skill MUST have a README.md file with user-facing documentation.

    line 209
  12. Very specific:

    All skills MUST use .env file for credentials.

    line 228
  13. Distinctive:

    All scripts must follow these conventions:

    line 286
  14. Very specific:

    Use set -euo pipefail (strict mode)

    line 302
  15. Distinctive:

    Use functions for reusable code

    line 304
  16. Very specific:

    Use jq for JSON parsing

    line 307
  17. Very specific:

    Use .mjs extension for ESM modules

    line 355
  18. Very specific:

    Use import syntax (NOT require)

    line 356
  19. Distinctive:

    Use async/await for I/O operations

    line 357
  20. Very specific:

    Use fetch API for HTTP requests (Node 18+)

    line 360
  21. Very specific:

    All skills SHOULD have reference documentation in the references/ directory:

    line 408
  22. Very specific:

    When updating a skill, commit with a descriptive message referencing the skill name and what changed: git commit -m "skillname: description …

    line 528
  23. Distinctive:

    All API calls are GET requests

    line 541
  24. Distinctive:

    Document destructive operations prominently

    line 567
  25. Distinctive:

    Use exact phrases users might say

    line 599
  26. Very specific:

    Every SKILL.md MUST include a Workflow section with decision trees for common tasks.

    line 611
  27. Distinctive:

    When skills return search results, always include external links:

    line 655
  28. Distinctive:

    All JSON output should be:

    line 669
  29. Distinctive:

    Use consistent key naming (camelCase)

    line 672
  30. Distinctive:

    Before adding a skill to production:

    line 689
  31. Very specific:

    Check permissions: Ensure scripts are executable (chmod +x)

    line 692
  32. Very specific:

    Validate JSON: Test JSON output with jq

    line 693
  33. Distinctive:

    Test error handling: Verify errors are caught and reported clearly

    line 694
  34. Distinctive:

    Test without credentials: Verify graceful failure with helpful message

    line 695
  35. Distinctive:

    Check documentation: Verify all sections are complete

    line 696
  36. Distinctive:

    Test destructive operations: Verify confirmation prompts work

    line 697
  37. Distinctive:

    Update YAML frontmatter (name, description)

    line 746
  38. Distinctive:

    Add mandatory skill invocation section (see Core Principles #1)

    line 747
  39. Distinctive:

    Update all sections with service-specific information

    line 748
  40. Distinctive:

    Document all commands with examples

    line 750
  41. Distinctive:

    Update for user-facing documentation

    line 754
  42. Very specific:

    Use consistent naming (service-api.sh or action.sh)

    line 759
  43. Distinctive:

    Run all scripts manually

    line 774
  44. Very specific:

    Add skill entry to skills/references/skill-catalog.md

    line 780
  45. Very specific:

    Run ls skills/ to see all available skill directories.

    line 844
  46. Distinctive:

    Never log credentials (even in debug mode)

    line 871
  47. Very specific:

    Use ONLY .env file for secrets (NO JSON config files)

    line 872
  48. Distinctive:

    Always validate environment variables exist before use

    line 876
  49. Distinctive:

    Use pagination for large result sets

    line 882

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

Skills Directory - Development Guidelines

⚠️ CRITICAL: MANDATORY SKILL USAGE ⚠️

YOU MUST use the plugin-dev:create-plugin skill (NOT optional) when:

  • Creating ANY new skill in this directory
  • Need skill structure guidance, templates, or best practices
  • Setting up SKILL.md, README.md, or skill scripts
  • Modifying skill patterns or conventions

Failure to invoke this skill when creating new skills violates your operational requirements.


This directory contains Claude Code skills for homelab service management. Skills provide structured API access to homelab services with consistent patterns for credentials, documentation, and scripting.

Repository Structure

skills/
├── CLAUDE.md                     # This file - development guidelines
├── <service>/                    # One directory per service (lowercase)
│   ├── SKILL.md                  # Skill definition (REQUIRED)
│   ├── README.md                 # User documentation (REQUIRED)
│   ├── scripts/                  # Executable scripts
│   │   ├── *.sh                  # Bash scripts (with shebang)
│   │   ├── *.mjs                 # Node.js ESM scripts
│   │   └── *.js                  # Node.js scripts (if needed)
│   ├── references/               # Reference documentation
│   │   ├── api-endpoints.md      # Complete API reference (REST APIs)
│   │   ├── command-reference.md  # Complete command reference (CLI tools)
│   │   ├── quick-reference.md    # Quick command examples
│   │   └── troubleshooting.md    # Common issues and solutions
│   └── examples/                 # Example usage scripts (optional)

Core Principles

1. Skill Definition (SKILL.md)

Every skill MUST have a SKILL.md file with YAML frontmatter and markdown documentation.

Required frontmatter fields:

---
name: service-name                # lowercase, no spaces, matches directory name
description: Detailed description with trigger phrases. Use when the user asks to "trigger phrase 1", "trigger phrase 2", or mentions [context].
---

Optional frontmatter fields:

---
homepage: https://example.com    # Official project website (optional)
---

Required markdown sections:

  1. Title — # Service Name Skill
  2. ⚠️ Mandatory Skill Invocation Warning — CRITICAL REQUIREMENT (see below)
  3. Purpose — What the skill does, read-only vs read-write
  4. Setup — Credential configuration with exact file paths
  5. Commands — Copy-paste ready examples
  6. Workflow — Common use cases with decision trees
  7. Notes — Technical details, limitations, security considerations
  8. Reference — Links to official documentation

Progressive Disclosure Pattern

CRITICAL PRINCIPLE: Skills use a three-level loading system to manage context efficiently.

Loading Levels

  1. Metadata (name + description) - Always in context (~100 words)
    • Loaded automatically when Claude Code starts
    • Used to determine when to activate the skill
    • Must include specific trigger phrases
  2. SKILL.md body - Loaded when skill activates (~2,000 words max)
    • Condensed syntax reference and workflows
    • Essential commands with brief examples
    • Pointers to reference files for details
    • Target length: 200-300 lines (~2,000 words)
    • Maximum: 500 lines (~5,000 words) before requiring refactoring
  3. Bundled resources - Loaded as needed by Claude
    • references/ files loaded when Claude needs detailed info
    • examples/ files loaded when user needs working code
    • scripts/ executed without loading into context
    • No size limits - only loaded when needed

Why Progressive Disclosure Matters

  • Context window efficiency: Don't waste tokens on content Claude doesn't need
  • Faster skill loading: Smaller SKILL.md = faster context loading
  • Better discoverability: Detailed content in references is easier to find than buried in long SKILL.md
  • Maintenance: Easier to update one reference file than sections scattered in SKILL.md

SKILL.md Length Guidelines

Target structure (~2,000 words):

  • Purpose section (30 lines)
  • Setup section (20 lines, link to README for details)
  • Commands section (40 lines, syntax only, link to references/commands.md)
  • RAG section (30 lines, syntax only, link to references/vector-database.md)
  • Workflows section (70 lines, keep decision trees)
  • Notes section (30 lines, key points only)
  • References section (20 lines, links to all reference files)

If SKILL.md exceeds 500 lines:

  1. Extract detailed content to references/ files
  2. Keep only syntax and pointers in SKILL.md
  3. Link to reference files for full documentation

References Directory (references/)

Purpose: Detailed documentation loaded as needed by Claude.

Common reference files (choose based on skill type):

  • references/api-endpoints.md - Complete API reference (for REST API services)
  • references/command-reference.md - Complete command reference (for CLI tools)
  • references/library-reference.md - Library/SDK reference (for programming libraries)
  • references/parameters.md - Parameters organized by category
  • references/job-management.md - Async operations and job handling
  • references/vector-database.md - RAG/vector DB specifics
  • references/quick-reference.md - Copy-paste command examples
  • references/troubleshooting.md - Common errors and solutions

Best practices:

  • Each reference file can be 2,000-5,000+ words
  • Organize by topic/function, not alphabetically
  • Use descriptive names that indicate content
  • Cross-reference between files where helpful
  • Include examples within reference files

When to create references:

  • Detailed API documentation (all endpoints, all parameters)
  • Advanced configuration options
  • Complex workflows with many steps
  • Troubleshooting guides
  • Migration guides
  • Any content that makes SKILL.md too long

Examples Directory (examples/)

Purpose: Working code examples that users can copy and adapt.

Common example files:

  • examples/basic-scrape.sh - Simple scraping example
  • examples/rag-pipeline.sh - Complete RAG workflow
  • examples/batch-processing.sh - Batch operation example
  • examples/monitor-website.sh - Change monitoring example

Best practices:

  • Examples are complete, runnable scripts
  • Include comments explaining each step
  • Use realistic scenarios
  • Follow coding standards from main scripts
  • Test all examples before committing

When to create examples:

  • Common workflows that users request
  • Complex multi-step operations
  • Integration patterns
  • Best practice demonstrations

Scripts Directory (scripts/)

Purpose: Executable utility scripts (not documentation).

Distinction:

  • Scripts = Tools for execution (no need to read)
  • Examples = Educational code for learning (meant to be read)

Pattern:

skills/service/
├── scripts/           # Utilities for execution
│   ├── api-wrapper.sh
│   └── health-check.sh
└── examples/          # Educational examples
    ├── basic-usage.sh
    └── advanced-workflow.sh

CRITICAL: Mandatory Skill Invocation Section

Every SKILL.md MUST include this section immediately after the title:

**⚠️ MANDATORY SKILL INVOCATION ⚠️**

**YOU MUST invoke this skill (NOT optional) when the user mentions ANY of these triggers:**
- "trigger phrase 1", "trigger phrase 2", "trigger phrase 3"
- "action phrase 1", "status check phrase", "query phrase"
- Any mention of [service name] or [related functionality]

**Failure to invoke this skill when triggers occur violates your operational requirements.**

This section:

  • Uses strong enforcement language (MUST, NOT optional, violates requirements)
  • Lists specific trigger phrases (5-10 minimum)
  • Makes it clear skill invocation is mandatory, not suggestive
  • Appears immediately after the skill title, before Purpose section

2. User Documentation (README.md)

Every skill MUST have a README.md file with user-facing documentation.

Structure:

  1. Title and brief description
  2. "What It Does" — Bullet list of capabilities
  3. "Setup" — Step-by-step credential setup
  4. "Usage Examples" — Copy-paste commands with explanations
  5. "Workflow" — Real-world usage scenarios
  6. "Troubleshooting" — Common errors and solutions
  7. "Notes" — Additional context

Differences from SKILL.md:

  • README.md is user-facing (more explanatory, assumes less context)
  • SKILL.md is Claude-facing (assumes Claude context, uses trigger phrases)
  • README.md can be more verbose and educational
  • SKILL.md is optimized for skill activation and API reference

3. Credential Management

All skills MUST use .env file for credentials. NO JSON config files.

Required pattern:

# In ~/.claude-homelab/.env
SERVICE_URL="http://localhost:PORT"
SERVICE_API_KEY="your-api-key"

Common patterns:

API Key authentication:

SERVICE_URL="https://service.example.com"
SERVICE_API_KEY="your-api-key-here"

Username/Password authentication:

SERVICE_URL="https://service.example.com"
SERVICE_USERNAME="admin"
SERVICE_PASSWORD="secure-password"

Multi-server setup:

# Server 1
SERVICE1_URL="http://server1.local:PORT"
SERVICE1_API_KEY="key1"

# Server 2
SERVICE2_URL="http://server2.local:PORT"
SERVICE2_API_KEY="key2"

Loading credentials in scripts:

Bash:

# Use the shared load-env library
source ~/.claude-homelab/load-env.sh
load_env_file || exit 1
validate_env_vars "SERVICE_URL" "SERVICE_API_KEY"

Node.js: See the full loadEnv() pattern in Script Standards > Node.js Scripts below.

Security requirements:

  • ✅ .env file is gitignored (NEVER commit)
  • ✅ Set file permissions: chmod 600 ~/.claude-homelab/.env
  • ✅ NEVER log credentials (even in debug mode)
  • ✅ Always validate credentials exist before use
  • ✅ Document exact variable names in Setup section
  • ❌ NO JSON config files in credentials/ directory
  • ❌ NO hard-coded credentials in scripts

4. Script Standards

All scripts must follow these conventions:

Bash Scripts (.sh)

File header:

#!/bin/bash
# Script Name: script-name.sh
# Purpose: Brief description
# Usage: ./script-name.sh [arguments]

set -euo pipefail

Standards:

  • Executable: chmod +x script.sh
  • Use set -euo pipefail (strict mode)
  • Quote all variables: "$var"
  • Use functions for reusable code
  • Return JSON output when appropriate
  • Include error handling with clear messages
  • Use jq for JSON parsing
  • Support --help flag

Example:

#!/bin/bash
set -euo pipefail

usage() {
    cat <<EOF
Usage: $0 <command> [options]

Commands:
    list        List all items
    search      Search for items
    add         Add new item

Options:
    --help      Show this help message
EOF
}

main() {
    local cmd="${1:-}"
    case "$cmd" in
        list) list_items ;;
        search) search_items "$@" ;;
        --help) usage ;;
        *) echo "Unknown command: $cmd" >&2; usage; exit 1 ;;
    esac
}

main "$@"

Node.js Scripts (.mjs)

File header:

#!/usr/bin/env node
/**
 * Script Name: script-name.mjs
 * Purpose: Brief description
 * Usage: node script-name.mjs [arguments]
 */

Standards:

  • Use .mjs extension for ESM modules
  • Use import syntax (NOT require)
  • Use async/await for I/O operations
  • Return JSON output when appropriate
  • Include error handling with clear messages
  • Use fetch API for HTTP requests (Node 18+)
  • Support --help flag

Example:

#!/usr/bin/env node
import { readFile } from 'fs/promises';

const ENV_PATH = `${process.env.HOME}/.claude-homelab/.env`;

async function loadEnv() {
    try {
        const content = await readFile(ENV_PATH, 'utf8');

        for (const line of content.split('\n')) {
            const match = line.match(/^([^#=]+)=(.+)$/);
            if (match) {
                const [, key, value] = match;
                process.env[key.trim()] = value.trim().replace(/^["']|["']$/g, '');
            }
        }
    } catch (error) {
        console.error(`Failed to load .env: ${error.message}`);
        process.exit(1);
    }
}

async function main() {
    await loadEnv();

    // Validate required environment variables
    const { SERVICE_URL, SERVICE_API_KEY } = process.env;
    if (!SERVICE_URL || !SERVICE_API_KEY) {
        console.error('ERROR: SERVICE_URL and SERVICE_API_KEY must be set in .env');
        process.exit(1);
    }

    // ... implementation using process.env.SERVICE_URL, etc.
}

main().catch(error => {
    console.error(error.message);
    process.exit(1);
});

5. Reference Documentation

All skills SHOULD have reference documentation in the references/ directory:

api-endpoints.md (for REST API services)

Purpose: Complete API reference with all available endpoints.

Use when: Skill interacts with REST API services (Plex, Overseerr, Radarr, etc.)

Structure:

# Service API Endpoints

## Authentication
[How authentication works]

## Endpoints

### GET /endpoint
**Purpose:** What this endpoint does
**Parameters:**
- `param1` (string, required) - Description
- `param2` (int, optional) - Description

**Response:**
```json
{
  "example": "response"
}

Example:

curl -X GET "http://localhost/endpoint?param1=value"

#### command-reference.md (for CLI tools)

**Purpose:** Complete command syntax reference for CLI tools.

**Use when:** Skill manages CLI tools (ZFS, git, docker, kubectl, etc.)

**Structure:**
```markdown
# Tool Command Reference

## Command Categories

### command subcommand

**Purpose:** What this command does

**Syntax:**
```bash
command subcommand [options] <required> [optional]

Options:

  • -f, --flag - Description
  • -o, --option value - Description

Examples:

# Example 1
command subcommand --flag value

# Example 2 (with explanation)
command subcommand -o custom file.txt

Notes:

  • Important caveats
  • Platform differences
  • Common pitfalls

#### quick-reference.md

**Purpose:** Quick command examples for common operations.

**Structure:**
```markdown
# Service Quick Reference

## Common Tasks

### Task 1
```bash
./scripts/command.sh action --flag value

Task 2

./scripts/command.sh action2 | jq '.data'

#### troubleshooting.md

**Purpose:** Common errors and solutions.

**Structure:**
```markdown
# Service Troubleshooting

## Authentication Errors

**Error:** 401 Unauthorized
**Cause:** Invalid API key
**Solution:** Check API key in config file

## Connection Errors

**Error:** Connection refused
**Cause:** Service not running
**Solution:** Start service with `docker compose up service`

6. Updates

When updating a skill, commit with a descriptive message referencing the skill name and what changed: git commit -m "skillname: description of change".

Skill Types

Skills fall into three categories based on their operations:

Read-Only Skills

Monitor and query services without making changes.

Examples: plex, glances, unifi, unraid

Characteristics:

  • All API calls are GET requests
  • Safe for monitoring and reporting
  • No confirmation required
  • Clearly labeled as "read-only" in Purpose section

Read-Write Skills (Safe)

Manage services with non-destructive operations.

Examples: overseerr (request media), sonarr (add shows), radarr (add movies)

Characteristics:

  • Include POST/PUT requests
  • Operations are additive or state-changing
  • Require user confirmation for significant actions
  • Clearly document which operations modify data

Read-Write Skills (Destructive)

Manage services with potentially destructive operations.

Examples: sonarr (remove shows), radarr (remove movies), qbittorrent (delete torrents)

Characteristics:

  • Include DELETE requests or file deletion
  • ALWAYS require explicit user confirmation
  • Document destructive operations prominently
  • Provide --delete-files flags (default: keep files)

Pattern for destructive operations:

# Always ask user before running
bash scripts/remove.sh <id>                # Keep files (safe)
bash scripts/remove.sh <id> --delete-files # Delete files (destructive)

Naming Conventions

EntityFormatExamples
Skill Directorylowercaseoverseerr/, qbittorrent/, unifi/
Script Fileskebab-case.extsearch-api.sh, request-media.mjs
Functionssnake_caseload_config(), search_items()
Variables (Bash)UPPER_SNAKE (const), lower_snake (local)CONFIG_PATH, api_key
Variables (JS)camelCaseconfigPath, apiKey
JSON KeyscamelCase{"apiKey": "value"}

Trigger Phrases

Trigger phrases in SKILL.md descriptions help Claude know when to activate the skill.

Format:

description: [Brief description]. Use when the user asks to "[phrase 1]", "[phrase 2]", "[phrase 3]", or mentions [context].

Guidelines:

  • Include 5-10 trigger phrases minimum
  • Use exact phrases users might say
  • Include variations (abbreviations, common typos)
  • Include both action-oriented and status-check phrases
  • Include service name variations

Example:

description: Search and add movies to Radarr. Use when the user asks to "add a movie", "search Radarr", "find a film", "add to Radarr", "remove a movie", "check if movie exists", "Radarr library", or mentions movie management.

Workflow Documentation

Every SKILL.md MUST include a Workflow section with decision trees for common tasks.

Format:

## Workflow

When the user asks about [service]:

1. **"User request 1"** → Action to take
2. **"User request 2"** → Multi-step action
3. **"User request 3"** → Conditional logic

### Detailed Flow for Complex Tasks

1. Step 1
2. Step 2 with conditional: If X, then Y
3. Step 3
4. Confirm with user before proceeding

Example:

## Workflow

When the user asks about media requests:

1. **"Request Dune"** → Search for "Dune", confirm with user, then request
2. **"Add Bluey to my library"** → Search, request as TV with all seasons
3. **"What's pending?"** → Run `requests.mjs --filter pending`
4. **"Is my Oppenheimer request done?"** → Search requests by title

### Request Flow

1. Search for the media
2. Present results with TMDB/TVDB links
3. User confirms selection
4. Submit request (optionally with 4K flag)
5. Check status periodically or wait for notification

API Documentation Patterns

Presenting Search Results

When skills return search results, always include external links:

Movies (TMDB):

- Format: `[Title (Year)](https://themoviedb.org/movie/ID)`

TV Shows (TVDB):

- Format: `[Title (Year)](https://thetvdb.com/series/SLUG)`

JSON Response Formatting

All JSON output should be:

  • Pretty-printed by default (or offer --json flag for raw)
  • Include error messages in JSON format
  • Use consistent key naming (camelCase)
  • Include timestamps when relevant

Example:

{
  "success": true,
  "data": {
    "id": 123,
    "name": "Example"
  },
  "timestamp": "2024-01-01T00:00:00Z"
}

Testing New Skills

Before adding a skill to production:

  1. Dry run: Execute all scripts manually
  2. Check permissions: Ensure scripts are executable (chmod +x)
  3. Validate JSON: Test JSON output with jq
  4. Test error handling: Verify errors are caught and reported clearly
  5. Test without credentials: Verify graceful failure with helpful message
  6. Check documentation: Verify all sections are complete
  7. Test destructive operations: Verify confirmation prompts work
# Test skill script
cd skills/service
chmod +x scripts/*.sh

# Test JSON output
./scripts/list.sh | jq .

# Test error handling (without credentials)
mv ~/.claude-homelab/.env{,.bak}
./scripts/list.sh  # Should fail gracefully with clear message
mv ~/.claude-homelab/.env{.bak,}

# Test with debug logging
DEBUG=1 ./scripts/list.sh

Adding New Skills

Before creating a new skill, INVOKE /plugin-dev:create-plugin skill FIRST.

  1. Invoke plugin-dev:create-plugin:
    You MUST invoke the plugin-dev:create-plugin skill before proceeding.
    This skill provides templates, structure, and best practices.
    Creating skills without this skill is NOT allowed.
  2. Create a beads issue before writing code:
    bd create --title="Add <service-name> skill" --type=feature --description="Why this skill is needed and what it should do"
    bd update <id> --claim
  3. Create skill directory:
    mkdir -p skills/service-name/{scripts,references}
  4. Copy templates:
    # Use existing skill as template
    cp skills/overseerr/SKILL.md skills/service-name/
    cp skills/overseerr/README.md skills/service-name/
  5. Edit SKILL.md:
    • Update YAML frontmatter (name, description)
    • Add mandatory skill invocation section (see Core Principles #1)
    • Update all sections with service-specific information
    • Include 5-10 trigger phrases in description
    • Document all commands with examples
    • Include workflow decision trees
  6. Edit README.md:
    • Update for user-facing documentation
    • More verbose explanations than SKILL.md
    • Include troubleshooting section
  7. Create scripts:
    • Use consistent naming (service-api.sh or action.sh)
    • Include shebangs and file headers
    • Implement error handling
    • Return JSON output
    • Support --help flag
  8. Create references:
    • Choose based on skill type:
      • references/api-endpoints.md — For REST API services
      • references/command-reference.md — For CLI tools
      • references/library-reference.md — For libraries/SDKs
    • references/quick-reference.md — Quick examples
    • references/troubleshooting.md — Common issues
  9. Test thoroughly:
    • Run all scripts manually
    • Verify JSON output
    • Test error conditions
    • Verify documentation completeness
  10. Update skill catalog:
    • Add skill entry to skills/references/skill-catalog.md
    • Close the beads issue: bd close <id>

Multi-Instance Support

Skills that support multiple instances of the same service use numbered environment variables in .env:

Pattern: Multiple servers in .env

# In ~/.claude-homelab/.env

# Server 1
SERVICE1_URL="http://server1.local:PORT"
SERVICE1_API_KEY="key1"

# Server 2
SERVICE2_URL="http://server2.local:PORT"
SERVICE2_API_KEY="key2"

# Server 3
SERVICE3_URL="http://server3.local:PORT"
SERVICE3_API_KEY="key3"

Script implementation:

#!/bin/bash
source ~/.claude-homelab/load-env.sh
load_env_file || exit 1

# Default to server 1 if SERVER_NUM not specified
SERVER_NUM="${SERVER_NUM:-1}"

# Construct variable names
URL_VAR="SERVICE${SERVER_NUM}_URL"
KEY_VAR="SERVICE${SERVER_NUM}_API_KEY"

# Use indirect expansion to get values
SERVICE_URL="${!URL_VAR}"
SERVICE_API_KEY="${!KEY_VAR}"

# Validate
if [[ -z "$SERVICE_URL" ]] || [[ -z "$SERVICE_API_KEY" ]]; then
    echo "ERROR: ${URL_VAR} and ${KEY_VAR} must be set in .env" >&2
    exit 1
fi

# Use $SERVICE_URL and $SERVICE_API_KEY for API calls

Usage:

# Use server 1 (default)
./scripts/command.sh

# Use server 2
SERVER_NUM=2 ./scripts/command.sh

# Use server 3
SERVER_NUM=3 ./scripts/command.sh

Current Skills

Run ls skills/ to see all available skill directories. Each directory contains a SKILL.md with its definition.

Best Practices

General Guidelines

  • ✅ DO: Store ALL credentials in ~/.claude-homelab/.env file
  • ✅ DO: Use environment variable pattern: SERVICE_URL, SERVICE_API_KEY
  • ✅ DO: Include trigger phrases in SKILL.md descriptions
  • ✅ DO: Document all commands with copy-paste examples
  • ✅ DO: Return JSON output for programmatic access
  • ✅ DO: Include workflow decision trees
  • ✅ DO: Test scripts before committing
  • ✅ DO: Use set -euo pipefail in Bash scripts
  • ✅ DO: Use ESM imports in Node.js scripts (.mjs)
  • ✅ DO: Include error handling with clear messages
  • ✅ DO: Support --help flag in all scripts
  • ❌ DON'T: Commit .env file (always gitignored)
  • ❌ DON'T: Use JSON config files in credentials/ directory
  • ❌ DON'T: Hard-code URLs or API keys in scripts
  • ❌ DON'T: Skip YAML frontmatter in SKILL.md
  • ❌ DON'T: Create destructive operations without confirmation
  • ❌ DON'T: Use default exports in Node.js (use named exports)
  • ❌ DON'T: Use require in Node.js (use import)

Security

  • Never log credentials (even in debug mode)
  • Use ONLY .env file for secrets (NO JSON config files)
  • Set restrictive permissions: chmod 600 ~/.claude-homelab/.env
  • Include security notes in SKILL.md for sensitive operations
  • Warn users about API key permissions in documentation
  • Always validate environment variables exist before use

Performance

  • Cache API responses when appropriate
  • Include timeouts for HTTP requests
  • Use pagination for large result sets
  • Support --limit flags to control output size

User Experience

  • Provide clear error messages with actionable solutions
  • Include progress indicators for long-running operations
  • Return human-readable output by default (JSON as option)
  • Include examples for common use cases in documentation
  • Present search results with external links for verification

Remember: Consistency in structure, naming, and documentation makes skills easier to maintain and use. Follow these patterns for all new skills.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.