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/detect-utilities.sh
View on GitHub#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Netresearch DTT GmbH
# Detect utility files and libraries to prevent reinvention
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"
# Check if git is available
if ! project_git rev-parse --git-dir > /dev/null 2>&1; then
echo ""
exit 0
fi
# Get project language
PROJECT_INFO=$(bash "$(dirname "$0")/detect-project.sh" "$PROJECT_DIR" 2>/dev/null || echo '{"language":"unknown"}')
LANGUAGE=$(echo "$PROJECT_INFO" | jq -r '.language')
# Common utility directory names
UTIL_DIRS=("utils" "util" "helpers" "helper" "lib" "shared" "common" "pkg")
# Find utility directories
find_util_dirs() {
for dir in "${UTIL_DIRS[@]}"; do
[ -d "$dir" ] && echo "$dir"
[ -d "src/$dir" ] && echo "src/$dir"
[ -d "internal/$dir" ] && echo "internal/$dir"
done
}
# Extract exports from TypeScript index file
extract_ts_exports() {
local file="$1"
grep -oE "export \{ [^}]+ \}" "$file" 2>/dev/null | \
sed 's/export { //; s/ }//; s/,/\n/g' | \
tr -d ' ' | head -10
}
# Extract function names from Go file
extract_go_exports() {
local dir="$1"
find "$dir" -name "*.go" -type f 2>/dev/null | while read -r file; do
grep -oE "^func [A-Z][a-zA-Z0-9_]*" "$file" 2>/dev/null | \
sed 's/func //' | head -5
done | sort -u | head -10
}
# Extract function names from Python file
extract_py_exports() {
local dir="$1"
find "$dir" -name "*.py" ! -name "__*" -type f 2>/dev/null | while read -r file; do
grep -oE "^def [a-z_][a-z0-9_]*" "$file" 2>/dev/null | \
sed 's/def //' | head -5
done | sort -u | head -10
}
# Infer utility purpose from name
infer_purpose() {
local name="$1"
case "$name" in
*date*|*time*|*format*Date*) echo "date/time formatting" ;;
*http*|*fetch*|*api*|*client*) echo "HTTP requests" ;;
*log*) echo "logging" ;;
*valid*|*check*) echo "validation" ;;
*parse*) echo "parsing" ;;
*format*) echo "formatting" ;;
*error*) echo "error handling" ;;
*auth*|*token*) echo "authentication" ;;
*cache*) echo "caching" ;;
*config*) echo "configuration" ;;
*string*|*str*) echo "string manipulation" ;;
*file*|*path*) echo "file operations" ;;
*) echo "utility" ;;
esac
}
# Generate output
output=""
while IFS= read -r dir; do
[ -z "$dir" ] && continue
case "$LANGUAGE" in
"typescript")
# Check for index.ts barrel export
if [ -f "$dir/index.ts" ]; then
while IFS= read -r export; do
[ -z "$export" ] && continue
purpose=$(infer_purpose "$export")
output="$output| $purpose | \`$export\` | \`$dir/\` |\n"
done < <(extract_ts_exports "$dir/index.ts")
fi
;;
"go")
while IFS= read -r func; do
[ -z "$func" ] && continue
purpose=$(infer_purpose "$func")
output="$output| $purpose | \`$func\` | \`$dir/\` |\n"
done < <(extract_go_exports "$dir")
;;
"python")
while IFS= read -r func; do
[ -z "$func" ] && continue
purpose=$(infer_purpose "$func")
output="$output| $purpose | \`$func\` | \`$dir/\` |\n"
done < <(extract_py_exports "$dir")
;;
"php")
# List PHP utility classes
while read -r file; do
class=$(grep -oE "class [A-Z][a-zA-Z0-9_]+" "$file" 2>/dev/null | head -1 | sed 's/class //')
[ -n "$class" ] && {
purpose=$(infer_purpose "$class")
relpath="${file#./}"
output="$output| $purpose | \`$class\` | \`$relpath\` |\n"
}
done < <(find "$dir" -name "*.php" -type f 2>/dev/null | head -20)
;;
esac
done < <(find_util_dirs)
# Check for common utility files at root or src
for util_file in "utils.ts" "utils.js" "helpers.ts" "helpers.js" "utils.py" "helpers.py"; do
for prefix in "" "src/"; do
file="${prefix}${util_file}"
[ -f "$file" ] && output="$output| utilities | \`$file\` | \`$file\` |\n"
done
done
# Output (remove empty lines, duplicates)
echo -e "$output" | sed '/^$/d' | sort -u | head -15
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 |