2026-01-27 20:09:05 +01:00
|
|
|
# Opencode Skills Repository
|
2026-01-06 05:52:07 +01:00
|
|
|
|
2026-01-27 20:09:05 +01:00
|
|
|
Configuration repository for Opencode Agent Skills, context files, and agent configurations. Deployed via Nix home-manager to `~/.config/opencode/`.
|
2026-01-06 05:52:07 +01:00
|
|
|
|
2026-01-26 20:42:05 +01:00
|
|
|
## Quick Commands
|
2026-01-06 05:52:07 +01:00
|
|
|
|
|
|
|
|
```bash
|
2026-01-27 20:09:05 +01:00
|
|
|
# Skill validation
|
2026-01-26 20:42:05 +01:00
|
|
|
./scripts/test-skill.sh --validate # Validate all skills
|
|
|
|
|
./scripts/test-skill.sh <skill-name> # Validate specific skill
|
2026-01-27 20:09:05 +01:00
|
|
|
./scripts/test-skill.sh --run # Test interactively
|
2026-01-26 20:42:05 +01:00
|
|
|
|
2026-01-27 20:09:05 +01:00
|
|
|
# Skill creation
|
|
|
|
|
python3 skills/skill-creator/scripts/init_skill.py <name> --path skills/
|
2026-01-06 05:52:07 +01:00
|
|
|
```
|
|
|
|
|
|
2026-01-26 20:42:05 +01:00
|
|
|
## Directory Structure
|
2026-01-06 05:52:07 +01:00
|
|
|
|
2026-01-26 20:42:05 +01:00
|
|
|
```
|
|
|
|
|
.
|
2026-03-03 19:38:48 +01:00
|
|
|
├── skills/ # Agent skills (15 modules)
|
2026-01-27 20:09:05 +01:00
|
|
|
│ └── skill-name/
|
|
|
|
|
│ ├── SKILL.md # Required: YAML frontmatter + workflows
|
|
|
|
|
│ ├── scripts/ # Executable code (optional)
|
|
|
|
|
│ ├── references/ # Domain docs (optional)
|
2026-03-03 19:38:48 +01:00
|
|
|
│ └── assets/ # Templates/files (optional)
|
|
|
|
|
├── rules/ # AI coding rules (languages, concerns, frameworks)
|
|
|
|
|
│ ├── languages/ # Python, TypeScript, Nix, Shell
|
|
|
|
|
│ ├── concerns/ # Testing, naming, documentation, etc.
|
|
|
|
|
│ └── frameworks/ # Framework-specific rules (n8n, etc.)
|
2026-01-26 20:42:05 +01:00
|
|
|
├── agents/ # Agent definitions (agents.json)
|
2026-01-27 20:09:05 +01:00
|
|
|
├── prompts/ # System prompts (chiron*.txt)
|
|
|
|
|
├── context/ # User profiles
|
|
|
|
|
├── commands/ # Custom commands
|
2026-02-10 20:00:42 +01:00
|
|
|
└── scripts/ # Repo utilities (test-skill.sh, validate-agents.sh)
|
2026-01-26 20:42:05 +01:00
|
|
|
```
|
2026-01-06 05:52:07 +01:00
|
|
|
|
2026-01-27 20:09:05 +01:00
|
|
|
## Code Conventions
|
2026-01-06 05:52:07 +01:00
|
|
|
|
2026-01-27 20:09:05 +01:00
|
|
|
**File naming**: hyphen-case (skills), snake_case (Python), UPPERCASE/sentence-case (MD)
|
|
|
|
|
|
|
|
|
|
**SKILL.md structure**:
|
|
|
|
|
```yaml
|
|
|
|
|
---
|
|
|
|
|
name: skill-name
|
|
|
|
|
description: "Use when: (1) X, (2) Y. Triggers: a, b, c."
|
|
|
|
|
compatibility: opencode
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Overview (1 line)
|
|
|
|
|
## Core Workflows (step-by-step)
|
|
|
|
|
## Integration with Other Skills
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Python**: `#!/usr/bin/env python3` + docstrings + emoji feedback (✅/❌)
|
|
|
|
|
**Bash**: `#!/usr/bin/env bash` + `set -euo pipefail`
|
|
|
|
|
**Markdown**: YAML frontmatter, ATX headers, `-` lists, language in code blocks
|
|
|
|
|
|
|
|
|
|
## Anti-Patterns (CRITICAL)
|
|
|
|
|
|
|
|
|
|
**Frontend Design**: NEVER use generic AI aesthetics, NEVER converge on common choices
|
2026-03-03 19:38:48 +01:00
|
|
|
**Excalidraw**: NEVER use `label` property (use boundElements + text element pairs instead)
|
2026-01-27 20:09:05 +01:00
|
|
|
**Debugging**: NEVER fix just symptom, ALWAYS find root cause first
|
|
|
|
|
**Excel**: ALWAYS respect existing template conventions over guidelines
|
|
|
|
|
**Structure**: NEVER place scripts/docs outside scripts/references/ directories
|
|
|
|
|
|
|
|
|
|
## Testing Patterns
|
|
|
|
|
|
|
|
|
|
**Unique conventions** (skill-focused, not CI/CD):
|
|
|
|
|
- Manual validation via `test-skill.sh`, no automated CI
|
|
|
|
|
- Tests co-located with source (not separate test directories)
|
|
|
|
|
- YAML frontmatter validation = primary quality gate
|
|
|
|
|
- Mixed formats: Python unittest, markdown pressure tests, A/B prompt testing
|
|
|
|
|
|
|
|
|
|
**Known deviations**:
|
|
|
|
|
- `systematic-debugging/test-*.md` - Academic/pressure testing in wrong location
|
|
|
|
|
- `pdf/forms.md`, `pdf/reference.md` - Docs outside references/
|
|
|
|
|
|
|
|
|
|
## Deployment
|
|
|
|
|
|
2026-03-03 19:38:48 +01:00
|
|
|
**Nix flake pattern**:
|
2026-01-06 05:52:07 +01:00
|
|
|
```nix
|
2026-01-11 13:06:32 +01:00
|
|
|
agents = {
|
|
|
|
|
url = "git+https://code.m3ta.dev/m3tam3re/AGENTS";
|
2026-03-03 19:38:48 +01:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs"; # Optional but recommended
|
2026-01-06 05:52:07 +01:00
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2026-03-03 19:38:48 +01:00
|
|
|
**Exports:**
|
|
|
|
|
- `packages.skills-runtime` — composable runtime with all skill dependencies
|
|
|
|
|
- `devShells.default` — dev environment for working on skills
|
|
|
|
|
|
2026-01-27 20:09:05 +01:00
|
|
|
**Mapping** (via home-manager):
|
|
|
|
|
- `skills/`, `context/`, `commands/`, `prompts/` → symlinks
|
|
|
|
|
- `agents/agents.json` → embedded into config.json
|
|
|
|
|
- Agent changes: require `home-manager switch`
|
|
|
|
|
- Other changes: visible immediately
|
2026-01-06 05:52:07 +01:00
|
|
|
|
2026-03-03 19:38:48 +01:00
|
|
|
## Rules System
|
|
|
|
|
|
|
|
|
|
Centralized AI coding rules consumed via `mkOpencodeRules` from m3ta-nixpkgs:
|
|
|
|
|
|
|
|
|
|
```nix
|
|
|
|
|
# In project flake.nix
|
|
|
|
|
m3taLib.opencode-rules.mkOpencodeRules {
|
|
|
|
|
inherit agents;
|
|
|
|
|
languages = [ "python" "typescript" ];
|
|
|
|
|
frameworks = [ "n8n" ];
|
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
See `rules/USAGE.md` for full documentation.
|
|
|
|
|
|
2026-01-27 20:09:05 +01:00
|
|
|
## Notes for AI Agents
|
|
|
|
|
|
|
|
|
|
1. **Config-only repo** - No compilation, no build, manual validation only
|
|
|
|
|
2. **Skills are documentation** - Write for AI consumption, progressive disclosure
|
|
|
|
|
3. **Consistent structure** - All skills follow 4-level deep pattern (skills/name/ + optional subdirs)
|
|
|
|
|
4. **Cross-cutting concerns** - Standardized SKILL.md, workflow patterns, delegation rules
|
2026-03-03 19:38:48 +01:00
|
|
|
5. **Always push** - Session completion workflow: commit + git push
|
2026-01-06 05:52:07 +01:00
|
|
|
|
|
|
|
|
## Quality Gates
|
|
|
|
|
|
2026-01-26 20:42:05 +01:00
|
|
|
Before committing:
|
2026-01-27 20:09:05 +01:00
|
|
|
1. `./scripts/test-skill.sh --validate`
|
|
|
|
|
2. Python shebang + docstrings check
|
|
|
|
|
3. No extraneous files (README.md, CHANGELOG.md in skills/)
|
2026-03-03 19:38:48 +01:00
|
|
|
4. If skill has scripts with external dependencies → verify `flake.nix` is updated (see skill-creator Step 4)
|
|
|
|
|
5. Git status clean
|