Thank you for your interest in contributing! This document provides guidelines for contributing to PAI-OpenCode.
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
- Assume good intentions
Before creating an issue:
- Search existing issues to avoid duplicates
- Verify the issue exists on the latest version
- Gather relevant information (OS, OpenCode version, error logs)
Good Issue Template:
**Description:** Brief summary of the issue
**Steps to Reproduce:**
1. Step one
2. Step two
3. What happened
**Expected Behavior:** What should happen
**Environment:**
- OS: macOS 14.5
- OpenCode version: v0.9.3
- Bun version: 1.0.22
**Logs/Screenshots:** Attach relevant outputFeature requests are welcome! Include:
- Problem: What problem does this solve?
- Solution: Proposed implementation
- Alternatives: Other approaches considered
- Impact: Who benefits from this feature?
- Check existing work: Search issues and PRs to avoid duplication
- Discuss major changes: Open an issue first for significant features
- Fork the repository: Work on your own fork
# Fork and clone
git clone https://github.com/YOUR-USERNAME/pai-opencode.git
cd pai-opencode
# Install dependencies
bun install
# Create feature branch
git checkout -b feature/your-feature-nameTypeScript Conventions:
- Use TypeScript for all plugins and tools
- Follow existing patterns in
.opencode/plugins/and.opencode/tools/ - Add JSDoc comments for public functions
- Use type annotations (avoid
any)
Markdown Style:
- Use ATX-style headers (
#not===) - Code blocks with language specifiers
- Add blank line before/after code blocks
YAML Frontmatter (Skills):
---
name: SkillName
description: USE WHEN trigger keywords...
---Follow conventional commits:
type(scope): subject
- feat(skills): Add new Research skill
- fix(plugins): Resolve security validator false positive
- docs(readme): Update installation instructions
- chore(deps): Update Bun to v1.0.23
Types:
feat: New featurefix: Bug fixdocs: Documentation changeschore: Maintenance (deps, config)refactor: Code restructuring
- Update documentation: Add/update relevant docs
- Test thoroughly: Verify your changes work
- Create PR:
- Clear title following commit convention
- Description linking to issue (
Closes #123) - Screenshots/logs if applicable
.opencode/
├── skills/ # Skill definitions — hierarchical Category/SkillName/
│ ├── Category/ # e.g. Security/, Research/, Agents/
│ │ └── SkillName/
│ │ └── SKILL.md
│ └── StandaloneSkill/ # Top-level skills with no category
│ └── SKILL.md
├── agents/ # Agent configurations (PascalCase)
├── plugins/ # Lifecycle plugins (TypeScript)
├── MEMORY/ # Execution history (not in git)
├── PAISECURITYSYSTEM/ # Security patterns
├── PAISYSTEM/ # System documentation
└── settings.json # Configuration
When upgrading PAI-OpenCode to a new PAI version (e.g., 2.4 → 2.5), follow the mapping guide:
📖 PAI-to-OpenCode Mapping Guide
This document covers:
- Architecture differences (
.claude/→.opencode/, hooks → plugins) - Component mapping rules (Skills, Agents, CORE, MEMORY)
- What NOT to import (Observability, VoiceServer, lib/)
- Common import errors (nested SKILL.md, long descriptions, color format)
- Pre/During/Post import checklists
Critical rules:
- Skills are hierarchical:
skills/Category/SkillName/SKILL.md(e.g.skills/Security/Pentesting/SKILL.md) - Top-level standalone skills:
skills/SkillName/SKILL.md(only when no category fits) - Agent colors must be hex format:
#00FFFF(NOTcyan) - YAML descriptions must be <220 characters
- Fabric patterns go only in
skills/Fabric/Patterns/
- Identify the category (e.g.
Security,Research,Agents,Documents) - Create directory:
.opencode/skills/Category/YourSkill/ - Add
SKILL.mdwith frontmatter:--- name: YourSkill description: USE WHEN user says "trigger keywords"... ---
- Add skill content (instructions, examples)
- Test: Search for your skill and verify it loads
- Create handler in
.opencode/plugins/handlers/your-handler.ts - Export handler function
- Add event subscription to
plugins/pai-unified.ts - Use
fileLog()instead ofconsole.log()
- Runtime: Always use Bun (never npm/yarn/pnpm)
- Language: TypeScript preferred
- Package Manager:
bun install,bun add,bun run - Formatting: Follow existing patterns
- Open a Discussion
- Check docs/ for architecture details
- Review existing code for patterns
Thank you for contributing to PAI-OpenCode!