- Rename skill/ to skills/ for consistency with naming conventions - Rename agent/ to agents/ and command/ to commands/ - Update AGENTS.md with all directory references - Update scripts/test-skill.sh paths - Update prompts/athena.txt documentation This aligns with best practices of using plural directory names and updates all documentation to reflect the new structure.
5.1 KiB
5.1 KiB
Agent Instructions - Opencode Skills Repository
Configuration repository for Opencode Agent Skills, context files, and agent configurations. Files deploy to ~/.config/opencode/ via Nix flake + home-manager.
Quick Commands
Testing Skills
# List or validate all skills
./scripts/test-skill.sh # List all development skills
./scripts/test-skill.sh --validate # Validate all skills
./scripts/test-skill.sh <skill-name> # Validate specific skill
# Test in Opencode (interactive)
./scripts/test-skill.sh --run # Launch session with dev skills
Creating Skills
python3 skills/skill-creator/scripts/init_skill.py <skill-name> --path skills/
python3 skills/skill-creator/scripts/quick_validate.py skills/<skill-name>
Running Tests
# Run single test file
python3 -m unittest skills/pdf/scripts/check_bounding_boxes_test.py
# Run all tests in a module
python3 -m unittest discover -s skills/pdf/scripts -p "*_test.py"
Issue Tracking
bd ready # Find available work
bd create "title" # Create new issue
bd update <id> --status in_progress
bd close <id> # Complete work
bd sync # Sync with git
Code Style Guidelines
File Naming
- Skills: hyphen-case (e.g.,
task-management,skill-creator) - Python: snake_case (e.g.,
init_skill.py,quick_validate.py) - Markdown: UPPERCASE or sentence-case (e.g.,
SKILL.md,profile.md) - Config: Standard conventions (e.g.,
config.yaml,metadata.json)
Python Style
Shebang: Always #!/usr/bin/env python3
Docstrings:
"""
Brief description
Usage:
script.py <args>
Examples:
script.py my-skill --path ~/.config/opencode/skill
"""
Imports (standard → third-party → local):
import sys
import os
from pathlib import Path
import yaml
from . import utilities
Naming:
- Functions:
snake_case - Classes:
PascalCase - Constants:
UPPER_SNAKE_CASE - Private:
_leading_underscore
Error handling:
try:
# operation
except SpecificException as e:
print(f"❌ Error: {e}")
return None
User feedback:
print(f"✅ Success: {result}")
print(f"❌ Error: {error}")
Bash Style
Shebang: Always #!/usr/bin/env bash
Strict mode: set -euo pipefail
Functions: snake_case, descriptive names
Markdown Style
- YAML frontmatter between
---delimiters - ATX headers (
#,##,###) - Use
-for unordered lists - Specify language in code blocks (
python,bash, etc.)
YAML Style
name: skill-name
description: "Text with special chars in quotes"
compatibility: opencode
items:
- first
- second
Directory Structure
.
├── agents/ # Agent definitions (agents.json)
├── prompts/ # Agent system prompts
├── context/ # User profiles and preferences
├── commands/ # Custom command definitions
├── skills/ # Opencode Agent Skills
│ ├── skill-name/
│ │ ├── SKILL.md
│ │ ├── scripts/ # Executable code (optional)
│ │ ├── references/ # Documentation (optional)
│ │ └── assets/ # Templates/files (optional)
├── scripts/ # Repository utilities
└── AGENTS.md # This file
Nix Deployment
Flake input (non-flake):
agents = {
url = "git+https://code.m3ta.dev/m3tam3re/AGENTS";
flake = false;
};
Deployment mapping:
skills/→~/.config/opencode/skill/(symlink)context/→~/.config/opencode/context/(symlink)commands/→~/.config/opencode/command/(symlink)prompts/→~/.config/opencode/prompts/(symlink)agents/agents.json→ Embedded into opencode config.json (not symlinked)
Note: Agent changes require home-manager switch; other changes visible after rebuild.
Quality Gates
Before committing:
- Validate skills:
./scripts/test-skill.sh --validate - Validate YAML frontmatter:
python3 skills/skill-creator/scripts/quick_validate.py skills/<name> - Check Python scripts have proper shebang and docstrings
- Ensure no extraneous files (README.md, CHANGELOG.md in skills)
- Git status clean
Notes for AI Agents
- Config-only repo - No compilation, no build, minimal test infrastructure
- Validation is manual - Run scripts explicitly before committing
- Skills are documentation - Write for AI consumption, not humans
- Directory naming - Use
skills/(plural), notskill/;agents/(plural), notagent/ - Commands naming - Use
commands/(plural), notcommand/ - Nix deployment - Maintain structure expected by home-manager
- Always push - Follow session completion workflow
Optimization Opportunities
- Add Python linting - Configure ruff or black for consistent formatting
- Add pre-commit hooks - Auto-validate skills and run linters before commit
- Test coverage - Add pytest for skill scripts beyond PDF skill
- CI/CD - Add GitHub Actions to validate skills on PR
- Documentation - Consolidate README.md and AGENTS.md to reduce duplication