netresearch/agent-rules-skill / skills/agent-rules
agent-rules
FlaggedUse when creating or updating AGENTS.md files, .github/copilot-instructions.md, or other AI agent rule files, onboarding AI agents to a project, standardizing agent documentation, or when anyone mentions AGENTS.md, agent rules, project onboarding, or codebase documentation for AI agents.
scripts/extract-github-settings.sh
View on GitHub#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Netresearch DTT GmbH
# Extract GitHub repository settings via gh CLI
# Returns {} silently if gh unavailable, not authenticated, or not a GitHub repo
set -euo pipefail
# shellcheck source-path=SCRIPTDIR
# shellcheck disable=SC1091 # the pre-commit hook runs shellcheck without
# -x, so it cannot follow this source no matter how the path is written.
source "$(dirname "${BASH_SOURCE[0]}")/lib/git.sh"
PROJECT_DIR="${1:-.}"
cd "$PROJECT_DIR"
# Silent exit with empty JSON if prerequisites not met
bail() { echo "{}"; exit 0; }
# Check gh CLI available
command -v gh &>/dev/null || bail
# Check authenticated
gh auth status &>/dev/null 2>&1 || bail
# Check this is a git repo with a remote
REMOTE_URL=$(project_git remote get-url origin 2>/dev/null) || bail
# Check it's a GitHub repo
[[ "$REMOTE_URL" =~ github\.com ]] || bail
# Extract owner/repo from URL (handles both HTTPS and SSH)
OWNER_REPO=$(echo "$REMOTE_URL" | sed -E 's|.*github\.com[:/]([^/]+/[^/.]+)(\.git)?.*|\1|')
[[ -n "$OWNER_REPO" ]] || bail
# Fetch repo settings
REPO_INFO=$(gh api "repos/$OWNER_REPO" 2>/dev/null) || bail
# Extract merge strategies
ALLOW_SQUASH=$(echo "$REPO_INFO" | jq -r '.allow_squash_merge // false')
ALLOW_MERGE=$(echo "$REPO_INFO" | jq -r '.allow_merge_commit // false')
ALLOW_REBASE=$(echo "$REPO_INFO" | jq -r '.allow_rebase_merge // false')
DEFAULT_BRANCH=$(echo "$REPO_INFO" | jq -r '.default_branch // "main"')
DELETE_BRANCH=$(echo "$REPO_INFO" | jq -r '.delete_branch_on_merge // false')
# Build merge strategies array
STRATEGIES="[]"
[ "$ALLOW_SQUASH" = "true" ] && STRATEGIES=$(echo "$STRATEGIES" | jq '. + ["squash"]')
[ "$ALLOW_MERGE" = "true" ] && STRATEGIES=$(echo "$STRATEGIES" | jq '. + ["merge"]')
[ "$ALLOW_REBASE" = "true" ] && STRATEGIES=$(echo "$STRATEGIES" | jq '. + ["rebase"]')
# Fetch branch protection (may fail if not configured or no access)
# Note: gh api returns error JSON to stdout on 404, so we check for error message
PROTECTION=$(gh api "repos/$OWNER_REPO/branches/$DEFAULT_BRANCH/protection" 2>/dev/null || true)
if echo "$PROTECTION" | jq -e '.message' &>/dev/null; then
# API returned an error (e.g., "Branch not protected")
PROTECTION="{}"
fi
# Extract protection settings
REQUIRED_APPROVALS=0
REQUIRED_CHECKS="[]"
REQUIRE_UP_TO_DATE=false
DISMISS_STALE=false
if [ "$PROTECTION" != "{}" ]; then
# Required approving reviews
REQUIRED_APPROVALS=$(echo "$PROTECTION" | jq -r '.required_pull_request_reviews.required_approving_review_count // 0')
DISMISS_STALE=$(echo "$PROTECTION" | jq -r '.required_pull_request_reviews.dismiss_stale_reviews // false')
# Required status checks
REQUIRED_CHECKS=$(echo "$PROTECTION" | jq -r '.required_status_checks.contexts // []')
# Require up-to-date branch
REQUIRE_UP_TO_DATE=$(echo "$PROTECTION" | jq -r '.required_status_checks.strict // false')
fi
# Output JSON
jq -n \
--arg default_branch "$DEFAULT_BRANCH" \
--argjson merge_strategies "$STRATEGIES" \
--argjson required_approvals "$REQUIRED_APPROVALS" \
--argjson required_checks "$REQUIRED_CHECKS" \
--argjson require_up_to_date "$REQUIRE_UP_TO_DATE" \
--argjson dismiss_stale "$DISMISS_STALE" \
--argjson delete_branch "$DELETE_BRANCH" \
'{
available: true,
default_branch: $default_branch,
merge_strategies: $merge_strategies,
required_approvals: $required_approvals,
required_checks: $required_checks,
require_up_to_date: $require_up_to_date,
dismiss_stale_reviews: $dismiss_stale,
delete_branch_on_merge: $delete_branch
}'
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 467k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 196k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |