push-policy

Determines whether pushing is appropriate based on a repository's collaboration, visibility, and branch protection policy.

4|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/laicluse/agent-fieldkit --skill push-policy-laicluse
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: push-policy
Source: https://github.com/laicluse/agent-fieldkit/tree/main/.agents/plugins/generated/git-discipline/skills/push-policy
Command: npx skills add https://github.com/laicluse/agent-fieldkit --skill push-policy-laicluse

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Coding agents often guess wrong about when to push: they either push shared or protected branches without permission, or leave finished work uncommitted and unpushed on solo repos. This Skill resolves a repository's publication policy into a concrete mode so every push decision follows the repo's actual rules instead of a generic ceremony. ## Core Features & Use Cases - Policy resolver script: Runs git-repo-policy against any repo to print facts (collaboration, visibility, default branch policy, push access) plus a derived mode and hygiene level, using git history and the GitHub CLI. - Five push modes: Classifies repos as local-only, auto-trunk, gated-trunk, pr-flow, or external, each with explicit rules about when pushing, branching, or opening a PR is appropriate. - Config overrides: Per-repo codingAgent.git.* git config values override auto-detection, with safe defaults (unknown visibility becomes public, unknown branch policy becomes pr-flow) when gh is unavailable. - Use Case: Before pushing work on an unfamiliar repository, run the resolver to learn it is a public shared repo with a protected default branch, then follow the pr-flow mode: branch, push the branch, and open a PR instead of pushing main directly. ## Quick Start Ask the agent to resolve this repository's push policy and tell you whether it is safe to push the current branch.

Frequently Asked Questions about push-policy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decide whether to push directly to the default branch?▼

Run the git-repo-policy resolver on the repository to derive its mode. Auto-trunk repos allow direct pushes to the default branch, gated-trunk repos require the operator's go, and pr-flow repos with protected defaults require a branch and pull request instead.

How does the push policy detect if a repo is solo or shared?▼

It counts distinct author names in the last 200 commits; one author means individual, more means shared. You can override detection with git config codingAgent.git.collaboration set to individual or shared.

What happens when the GitHub CLI is not installed?▼

The resolver falls back to safe defaults: unknown visibility becomes public, unknown default-branch policy resolves to pr-flow, and push access is checked against the global codingAgent.git.owners list before defaulting to external.

Can I override the detected push policy for a specific repo?▼

Yes, set per-repo git config values under the codingAgent.git.* namespace, such as codingAgent.git.visibility or codingAgent.git.defaultBranchPolicy. These overrides win over automatic detection and persist across sessions.

When is a force push allowed after a rebase?▼

A --force-with-lease push of your own branch after rebasing a branch that already has an upstream is treated as completing the rebase, not a new decision. The exception is a protected default branch, which is never force-pushed.