AGENT SKILL

fork-policy

Enforce clean-main branch policy on forked repositories. Use when the repository has more than one remote, when starting or finishing issue work in a fork, before any commit there, or when the user says "feature branch", "never commit to main", "fork policy" or "clean main". Do not use for a repository with a single remote, where trunk-based commits on main are correct.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 1
Forks
0

01 前言 Front Matter

name
fork-policy
license
MIT
metadata
{ "scope": "git", "category": "policy" }
description
Enforce clean-main branch policy on forked repositories. Use when the repository has more than one remote, when starting or finishing issue work in a fork, before any commit there, or when the user says "feature branch", "never commit to main", "fork policy" or "clean main". Do not use for a repository with a single remote, where trunk-based commits on main are correct.
compatibility
opencode

03 SKILL.md 正文

Fork Policy Skill

Purpose

Enforce a strict clean-main policy on forked repositories. When active, no commits may land on main or master — all work happens on feature branches.

Core Rule

NEVER commit directly to main or master on a forked repository.

All changes must be made on a feature branch. This keeps the fork's main branch clean for syncing with upstream and allows multiple feature branches to coexist without conflicts.

Rationale

  • Forks often need to rebase or merge changes from the upstream repository. A dirty main branch makes this significantly harder.
  • Multiple feature branches may be in progress simultaneously. Each branch should be independently reviewable and mergeable via pull request.
  • A clean main branch provides a known-good baseline at all times.

Branch Naming Convention

Feature branches must follow this pattern:

feat/issue-N-short-description
fix/issue-N-short-description
chore/issue-N-short-description

Examples:

  • feat/issue-42-add-login-page
  • fix/issue-17-null-pointer-handling
  • chore/issue-8-update-dependencies

The issue number must be included in the branch name. If no issue exists yet, create one first before branching.

Fork Detection

A repository is treated as a fork if it has more than one remote.

remote_count=$(git remote | wc -l)

If remote_count is greater than 1 (typically origin + upstream), the policy applies. No further analysis needed.

Safety Check

Before every commit, the agent must verify:

  1. The current branch is not main or master.
  2. If the repo is detected as a fork and the current branch is main/master, the agent must abort and inform the user.

The check sequence:

# Determine current branch
current_branch=$(git branch --show-current)

# If on main/master and repo is a fork, abort
if [[ "$current_branch" == "main" || "$current_branch" == "master" ]]; then
  echo "ABORT: fork-policy forbids commits on $current_branch"
  echo "Create a feature branch first: git checkout -b feat/issue-N-description"
  exit 1
fi

Integration with Issue Workflow

When both fork-policy and issue-workflow are active:

  • When the agent recognizes an issue start intent (natural language), it must create an appropriately named feature branch before beginning any implementation work.
  • Before committing (issue commit checkpoint), the agent must verify the branch policy is satisfied.
  • When finishing an issue, the agent must push the feature branch and create or update a pull request rather than merging to main directly.

Done when

  • [ ] Fork status was decided by remote count: git remote | wc -l greater than 1 means the policy applies.
  • [ ] A feature branch named feat|fix|chore/issue-N-<description> existed before implementation started, with an issue behind the number.
  • [ ] git branch --show-current was checked before every commit, and a commit on main/master in a fork was aborted, not forced.
  • [ ] Finishing pushed the feature branch and opened or updated a pull request instead of merging into main.

Activation

This skill is loaded on demand. To activate it for a project, reference it from the project's AGENTS.md:

## Active Policies

- **fork-policy**: This is a forked repository. Always use feature branches.
  Never commit to main/master.

Or load it explicitly via a skill invocation.

04 同仓库更多 Skills

georgernstgraf
georgernstgraf/opencode-helpers

codebase-audit

One-shot, interactive assessment of a whole codebase (a Git repository) across four axes: security (in depth), structure and clean layers, coupling and entanglement (Wartbarkeit), and architecture (deep modules). Fans out parallel sub-agents, lets the user steer scope and importance, then files one epic with formally linked sub-issues. Use when the user asks for a full repo audit, workflow health check, whole-project security review, maintainability assessment, or says "audit the codebase", "codebase audit", "assess this repo".

★ 1
georgernstgraf
georgernstgraf/opencode-helpers

orchestration

Coordinate large work as a pure orchestrator: decompose into sub-issues and delegate implementation to sub-agents behind a hard verification gate. Use when the work spans more than one session, needs more than one sub-issue, touches multiple dependent files or concerns, or the user says "orchestrate this", "split this into sub-issues", "delegate this" or "coordinate the work". Do not use for a single focused change — delegation costs more than the change.

★ 1
georgernstgraf
georgernstgraf/opencode-helpers

teach

Teach the user a new skill or concept, within this workspace.

★ 1
georgernstgraf
georgernstgraf/opencode-helpers

sync-upstream-skills

Re-transplant owned skills from their mattpocock upstream after a git pull, applying upstream content changes while preserving opencode-native frontmatter. Also checks for duplicate skill names and dangling cross-skill references. Use when the user says "sync skills", "refresh from upstream", "pull matt's skills", "sync upstream", "update the transplanted skills", or wants to bring the owned transplanted skills up to date. Do not use to add or rename a transplanted skill — that stays manual.

★ 1
georgernstgraf
georgernstgraf/opencode-helpers

repograde

Grade student repositories with optional date filtering in single-repo or bulk mode. Use when the user says "repograde", "grade the repos", "grade this repo since <date>", "bewerte die Abgaben", "korrigiere die Repos", or asks for a repo grading run over a class folder or a single student repository. Do not use for project grading with issues and PRs (use projectgrade) or for knowledge-check exams (use knowledge-assessment).

★ 1
georgernstgraf
georgernstgraf/opencode-helpers

projectgrade

Grade student project repositories based on Git commits, GitHub Issues, and Pull Requests. Use when the user says "projectgrade", "grade the project", "bewerte das Projekt", "Projektarbeit benoten", or asks for a holistic grading of a collaborative repository from inside it, based on commits, issues, reviews and PRs. Do not use for per-lesson assignments (use repograde) or for knowledge-check exams (use knowledge-assessment).

★ 1