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/lib/summary.sh
View on GitHub#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Netresearch DTT GmbH
# Summary output formatting helpers
# Colors (only if terminal supports it)
if [[ -t 1 ]]; then
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
# shellcheck disable=SC2034 # part of the palette; kept so the colour and
# no-colour branches stay symmetric rather than losing one entry.
BLUE='\033[0;34m'
CYAN='\033[0;36m'
GRAY='\033[0;90m'
BOLD='\033[1m'
NC='\033[0m' # No Color
else
GREEN=''
YELLOW=''
# shellcheck disable=SC2034 # see the palette comment above
BLUE=''
CYAN=''
GRAY=''
BOLD=''
NC=''
fi
# Summary data storage
# shellcheck disable=SC2034 # written by add_summary below and read by nothing
# in this repository — the provenance it records has no consumer yet. Left in
# place rather than deleted, but it buys no trust until something reads it.
declare -A SUMMARY_SOURCES
declare -a SUMMARY_RULES
declare -a SUMMARY_WARNINGS
# Initialize summary
init_summary() {
SUMMARY_SOURCES=()
SUMMARY_RULES=()
SUMMARY_WARNINGS=()
}
# Record a detected value with its source
# Usage: record_detection "category" "value" "source_file" "source_detail"
record_detection() {
local category="$1"
local value="$2"
local source_file="$3"
local source_detail="${4:-}"
if [[ -n "$source_detail" ]]; then
SUMMARY_SOURCES["$category"]="$value (from $source_file: $source_detail)"
else
# shellcheck disable=SC2034 # see the declaration comment above
SUMMARY_SOURCES["$category"]="$value (from $source_file)"
fi
}
# Record an extracted rule
# Usage: record_rule "rule_type" "rule_value" "source"
record_rule() {
local rule_type="$1"
local rule_value="$2"
local source="$3"
SUMMARY_RULES+=("$rule_type: $rule_value [$source]")
}
# Record a warning
# Usage: record_warning "message"
record_warning() {
local message="$1"
SUMMARY_WARNINGS+=("$message")
}
# Print the extraction summary
print_summary() {
local project_info="$1"
local scopes_info="$2"
local commands_info="$3"
local docs_info="${4:-{}}"
local platform_info="${5:-{}}"
local ide_info="${6:-{}}"
local agent_info="${7:-{}}"
echo ""
echo -e "${BOLD}═══════════════════════════════════════════════════════════════${NC}"
echo -e "${BOLD} EXTRACTION SUMMARY ${NC}"
echo -e "${BOLD}═══════════════════════════════════════════════════════════════${NC}"
echo ""
# Project Detection
echo -e "${CYAN}▸ Project Detection${NC}"
echo -e " ${GRAY}────────────────────────────────────────${NC}"
local lang
lang=$(echo "$project_info" | jq -r '.language')
local version
version=$(echo "$project_info" | jq -r '.version')
local ptype
ptype=$(echo "$project_info" | jq -r '.type')
local framework
framework=$(echo "$project_info" | jq -r '.framework')
local build_tool
build_tool=$(echo "$project_info" | jq -r '.build_tool')
local test_fw
test_fw=$(echo "$project_info" | jq -r '.test_framework')
local ci
ci=$(echo "$project_info" | jq -r '.ci')
local docker
docker=$(echo "$project_info" | jq -r '.has_docker')
# Determine source file
local lang_source=""
case "$lang" in
go) lang_source="go.mod" ;;
php) lang_source="composer.json" ;;
typescript) lang_source="package.json" ;;
python) lang_source="pyproject.toml" ;;
esac
printf " %-16s ${GREEN}%s${NC} ${GRAY}(from %s)${NC}\n" "Language:" "$lang" "$lang_source"
[[ "$version" != "unknown" ]] && printf " %-16s ${GREEN}%s${NC}\n" "Version:" "$version"
[[ "$ptype" != "unknown" ]] && printf " %-16s %s\n" "Project type:" "$ptype"
[[ "$framework" != "none" ]] && printf " %-16s %s\n" "Framework:" "$framework"
printf " %-16s %s\n" "Build tool:" "$build_tool"
[[ "$test_fw" != "unknown" ]] && printf " %-16s %s\n" "Test framework:" "$test_fw"
[[ "$ci" != "none" ]] && printf " %-16s %s\n" "CI/CD:" "$ci"
[[ "$docker" == "true" ]] && printf " %-16s %s\n" "Docker:" "yes"
# Quality Tools
local tools
tools=$(echo "$project_info" | jq -r '.quality_tools | join(", ")')
if [[ -n "$tools" && "$tools" != "" ]]; then
echo ""
echo -e "${CYAN}▸ Quality Tools Detected${NC}"
echo -e " ${GRAY}────────────────────────────────────────${NC}"
printf " %s\n" "$tools"
fi
# IDE Configs (from ide_info)
local detected_ides
detected_ides=$(echo "$ide_info" | jq -r '.detected_ides | join(", ")' 2>/dev/null || echo "")
if [[ -n "$detected_ides" && "$detected_ides" != "" ]]; then
echo ""
echo -e "${CYAN}▸ IDE Configurations${NC}"
echo -e " ${GRAY}────────────────────────────────────────${NC}"
printf " %s\n" "$detected_ides"
# Show editorconfig details if present
local indent
indent=$(echo "$ide_info" | jq -r '.editorconfig.indent_style // ""' 2>/dev/null || echo "")
if [[ -n "$indent" ]]; then
local indent_size
indent_size=$(echo "$ide_info" | jq -r '.editorconfig.indent_size // ""' 2>/dev/null || echo "")
printf " ${GRAY}→ indent: %s (%s)${NC}\n" "$indent" "$indent_size"
fi
fi
# AI Agent Configs (from agent_info)
local detected_agents
detected_agents=$(echo "$agent_info" | jq -r '.detected_agents | join(", ")' 2>/dev/null || echo "")
if [[ -n "$detected_agents" && "$detected_agents" != "" ]]; then
echo ""
echo -e "${CYAN}▸ AI Agent Configurations${NC}"
echo -e " ${GRAY}────────────────────────────────────────${NC}"
printf " %s\n" "$detected_agents"
fi
# Documentation Files (from docs_info)
local has_contributing
has_contributing=$(echo "$docs_info" | jq -r '.contributing.file // ""' 2>/dev/null || echo "")
local has_security
has_security=$(echo "$docs_info" | jq -r '.security.file // ""' 2>/dev/null || echo "")
local has_changelog
has_changelog=$(echo "$docs_info" | jq -r '.changelog.file // ""' 2>/dev/null || echo "")
local has_coc
has_coc=$(echo "$docs_info" | jq -r '.code_of_conduct.exists // false' 2>/dev/null || echo "false")
if [[ -n "$has_contributing" || -n "$has_security" || -n "$has_changelog" || "$has_coc" == "true" ]]; then
echo ""
echo -e "${CYAN}▸ Documentation Files${NC}"
echo -e " ${GRAY}────────────────────────────────────────${NC}"
[[ -n "$has_contributing" ]] && printf " ✓ %s\n" "$has_contributing"
[[ -n "$has_security" ]] && printf " ✓ %s\n" "$has_security"
[[ -n "$has_changelog" ]] && printf " ✓ %s\n" "$has_changelog"
[[ "$has_coc" == "true" ]] && printf " ✓ CODE_OF_CONDUCT.md\n"
fi
# Platform Files (from platform_info)
local platform
platform=$(echo "$platform_info" | jq -r '.platform // "none"' 2>/dev/null || echo "none")
if [[ "$platform" != "none" ]]; then
local pr_template
pr_template=$(echo "$platform_info" | jq -r '.pull_request.template_file // ""' 2>/dev/null || echo "")
local codeowners
codeowners=$(echo "$platform_info" | jq -r '.codeowners.file // ""' 2>/dev/null || echo "")
local dependabot
dependabot=$(echo "$platform_info" | jq -r '.dependency_updates.dependabot.file // ""' 2>/dev/null || echo "")
if [[ -n "$pr_template" || -n "$codeowners" || -n "$dependabot" ]]; then
echo ""
echo -e "${CYAN}▸ Platform Files (${platform})${NC}"
echo -e " ${GRAY}────────────────────────────────────────${NC}"
[[ -n "$pr_template" ]] && printf " ✓ PR template: %s\n" "$pr_template"
[[ -n "$codeowners" ]] && printf " ✓ CODEOWNERS: %s\n" "$codeowners"
[[ -n "$dependabot" ]] && printf " ✓ Dependabot: %s\n" "$dependabot"
fi
fi
# Commands Extracted
echo ""
echo -e "${CYAN}▸ Commands Extracted${NC}"
echo -e " ${GRAY}────────────────────────────────────────${NC}"
local typecheck
typecheck=$(echo "$commands_info" | jq -r '.typecheck')
local lint
lint=$(echo "$commands_info" | jq -r '.lint')
local format
format=$(echo "$commands_info" | jq -r '.format')
local test_cmd
test_cmd=$(echo "$commands_info" | jq -r '.test')
local build
build=$(echo "$commands_info" | jq -r '.build')
local dev
dev=$(echo "$commands_info" | jq -r '.dev')
[[ -n "$typecheck" && "$typecheck" != "" ]] && printf " %-12s ${YELLOW}%s${NC}\n" "typecheck:" "$typecheck"
[[ -n "$lint" && "$lint" != "" ]] && printf " %-12s ${YELLOW}%s${NC}\n" "lint:" "$lint"
[[ -n "$format" && "$format" != "" ]] && printf " %-12s ${YELLOW}%s${NC}\n" "format:" "$format"
[[ -n "$test_cmd" && "$test_cmd" != "" ]] && printf " %-12s ${YELLOW}%s${NC}\n" "test:" "$test_cmd"
[[ -n "$build" && "$build" != "" ]] && printf " %-12s ${YELLOW}%s${NC}\n" "build:" "$build"
[[ -n "$dev" && "$dev" != "" ]] && printf " %-12s ${YELLOW}%s${NC}\n" "dev:" "$dev"
# Scopes Detected
local scope_count
scope_count=$(echo "$scopes_info" | jq '.scopes | length')
if [[ "$scope_count" -gt 0 ]]; then
echo ""
echo -e "${CYAN}▸ Scopes Detected ($scope_count)${NC}"
echo -e " ${GRAY}────────────────────────────────────────${NC}"
echo "$scopes_info" | jq -r '.scopes[] | " \(.path)/ (\(.files) files) → \(.type)"'
fi
# Files to Generate
echo ""
echo -e "${CYAN}▸ Files to Generate${NC}"
echo -e " ${GRAY}────────────────────────────────────────${NC}"
echo " AGENTS.md (root)"
if [[ "$scope_count" -gt 0 ]]; then
echo "$scopes_info" | jq -r '.scopes[] | " \(.path)/AGENTS.md"'
fi
# Warnings
if [[ ${#SUMMARY_WARNINGS[@]} -gt 0 ]]; then
echo ""
echo -e "${YELLOW}▸ Warnings${NC}"
echo -e " ${GRAY}────────────────────────────────────────${NC}"
for warning in "${SUMMARY_WARNINGS[@]}"; do
echo -e " ${YELLOW}⚠${NC} $warning"
done
fi
echo ""
echo -e "${BOLD}═══════════════════════════════════════════════════════════════${NC}"
echo ""
}
# Print a compact summary (for non-verbose mode)
print_compact_summary() {
local project_info="$1"
local scopes_info="$2"
local lang
lang=$(echo "$project_info" | jq -r '.language')
local ptype
ptype=$(echo "$project_info" | jq -r '.type')
local scope_count
scope_count=$(echo "$scopes_info" | jq '.scopes | length')
echo "Detected: $lang ($ptype), $((scope_count + 1)) AGENTS.md file(s) to generate"
}
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: 469k | 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: 197k | 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: 197k | 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: 197k | Updated | Claude CodeCodex | Verified | Install |