Skip to content

feat: add OpenCode skills configuration and generation pipeline (fixes #74)#98

Open
hnshah wants to merge 1 commit intohuggingface:mainfrom
hnshah:feat/opencode-integration-74
Open

feat: add OpenCode skills configuration and generation pipeline (fixes #74)#98
hnshah wants to merge 1 commit intohuggingface:mainfrom
hnshah:feat/opencode-integration-74

Conversation

@hnshah
Copy link
Copy Markdown

@hnshah hnshah commented Mar 22, 2026

Summary

Adds first-class OpenCode integration for this repository so OpenCode can discover and load all skills consistently with other agents.

Fixes #74


Changes

1. New Generator Script

scripts/generate_opencode_config.py

  • Discovers all skills from skills/*/SKILL.md
  • Extracts names, descriptions, and paths from YAML frontmatter
  • Reuses .claude-plugin/plugin.json for metadata (version, description)
  • Pulls MCP server URL from gemini-extension.json
  • Generates opencode.json with complete configuration
  • Supports --check flag for validation

Follows same pattern as generate_cursor_plugin.py:

  • PEP 723 script format
  • Self-contained, no dependencies
  • Run with uv run scripts/generate_opencode_config.py

2. Generated Configuration

opencode.json includes:

  • Skill discovery settings (skills/ directory, agent-skills format)
  • All 13 skill entries with full metadata
  • AGENTS context file reference (agents/AGENTS.md)
  • MCP server configuration (aligned with Gemini/Cursor)

Structure:

{
  "name": "huggingface-skills",
  "version": "1.0.1",
  "skills": {
    "discovery": { "locations": ["skills/"], "format": "agent-skills" },
    "entries": [ /* all 13 skills */ ]
  },
  "context": { "agentsFile": "agents/AGENTS.md" },
  "mcpServers": { /* HF MCP server */ }
}

3. Updated Generation Pipeline

scripts/publish.sh

  • Added opencode.json to GENERATED_FILES array
  • Integrated generate_opencode_config.py into run_generate()
  • Added --check validation for OpenCode artifacts
  • Updated help text to list opencode.json

4. Documentation

README.md

  • New "OpenCode" section after Cursor
  • Explains auto-generated configuration
  • Lists what’s included (discovery, entries, context, MCP)
  • Documents regeneration with ./scripts/publish.sh
  • Notes consistency with other agent formats

Design Goals (from issue #74)

Reproducible: Auto-generated from single source of truth
Consistent: Aligned with Claude/Cursor/Gemini integrations
Validated: --check flag prevents drift
Documented: Clear README section for users/contributors
Maintainable: Follows existing generator patterns


Testing

Generation:

./scripts/publish.sh
# Generated: /tmp/hf-skills/opencode.json
# Publish artifacts generated successfully.

Validation:

./scripts/publish.sh --check
# All generated artifacts are up to date.

Output verification:

  • ✅ JSON structure valid
  • ✅ All 13 skills included with correct metadata
  • ✅ MCP server URL matches gemini-extension.json
  • ✅ AGENTS context file referenced correctly
  • ✅ Skill paths resolve to actual directories

Benefits

For OpenCode users:

  • Automatic skill discovery from this repository
  • Consistent experience with other coding agents
  • Access to all 13 Hugging Face skills

For contributors:

  • No manual opencode.json maintenance
  • Validation prevents accidental drift
  • Same workflow as other agent configurations

For maintainers:

  • Reduced onboarding friction
  • Single source of truth (SKILL.md frontmatter)
  • Easy to keep in sync with skill additions/changes

Implementation Notes

Generator follows established patterns:

  • Reuses parse_frontmatter() pattern from generate_cursor_plugin.py
  • Self-contained PEP 723 script (no external deps)
  • Clean error handling with meaningful messages
  • JSON output with pretty formatting

Integration is minimal:

  • 3 lines added to publish.sh generation
  • 2 lines added to validation check
  • 1 new entry in help text
  • No changes to existing skills or infrastructure

Checklist

  • Added scripts/generate_opencode_config.py
  • Generated opencode.json with all skills
  • Updated scripts/publish.sh (generate + check + help)
  • Documented OpenCode usage in README.md
  • Tested generation and validation
  • Verified JSON structure and content
  • Followed existing code patterns
  • No breaking changes to existing workflows

Ready for review! 🚀

…huggingface#74)

**Adds:**
1. scripts/generate_opencode_config.py - Generator for opencode.json
2. opencode.json - Generated OpenCode configuration (13 skills)
3. Updated scripts/publish.sh - Integrated OpenCode generation
4. Updated README.md - OpenCode usage documentation

**Configuration includes:**
- Skill discovery settings (skills/ directory, agent-skills format)
- All 13 skill entries with names, descriptions, and paths
- AGENTS context file reference (agents/AGENTS.md)
- MCP server configuration aligned with gemini-extension.json

**Generation Pipeline:**
- Reuses .claude-plugin/plugin.json as primary metadata source
- Discovers skills from skills/*/SKILL.md frontmatter
- Extracts MCP server URL from gemini-extension.json
- Validates with --check flag (integrated into CI workflow)
- Follows same pattern as generate_cursor_plugin.py

**Design Goals (from issue huggingface#74):**
✅ First-class OpenCode integration
✅ Reproducible and consistent with other agents
✅ Auto-generated to avoid manual drift
✅ Validation via --check flow
✅ Documentation in README

**Testing:**
- Generated opencode.json with all 13 skills
- Verified JSON structure
- Ran ./scripts/publish.sh successfully
- Tested --check validation

**Benefits:**
- OpenCode can discover and load all skills consistently
- Reduces onboarding friction for OpenCode users
- Keeps configuration in sync with Claude/Cursor/Gemini
- Follows Agent Skills standard

Fixes huggingface#74
Copy link
Copy Markdown
Collaborator

@burtenshaw burtenshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: add OpenCode skills configuration and generation pipeline

2 participants