Skip to content

LeoYeAI/agent-master-skills / skills/backstage

backstage

Verified

Anti-drift protocol script. Ensures parity between docs and system. Triggers: 'bom dia PROJECT' / 'good morning PROJECT' (load project context with health checks)

FileKindSize
SKILL.mdskill md21.6 KB
_meta.jsonconfig813 B
backstage.shscript1.6 KB
checks.shscript7.1 KB
contract.htmlother7.3 KB
parse-roadmap.shscript727 B
update-backstage.shscript3.8 KB
#!/bin/bash
# checks.sh - Unified policies/ + checks/ enforcement
# Executes checks FIRST, then reads policies

set -e

PROJECT_ROOT="${1:-.}"
MODE="${2:-start}" # start or end

cd "$PROJECT_ROOT"

echo "πŸ” Running backstage enforcement (mode: $MODE)..."
echo ""

# ============================================================================
# STEP 1: Execute ALL checks (deterministic - bash domain)
# ============================================================================

echo "πŸ” Executing checks/ (deterministic)..."
echo ""

GLOBAL_CHECKS_DIR="$HOME/Documents/backstage/backstage/checks/global"
LOCAL_CHECKS_DIR="backstage/checks/local"

CHECKS_PASS=true
CHECKS_RUN=0
ROADMAP_STATUS="" # Capture roadmap-tasks output

# Collect local check basenames (for override detection)
LOCAL_CHECKS=""
if [ -d "$LOCAL_CHECKS_DIR" ]; then
    for check in "$LOCAL_CHECKS_DIR"/*.sh; do
        if [ -f "$check" ]; then
            basename_check=$(basename "$check")
            LOCAL_CHECKS="$LOCAL_CHECKS $basename_check "
        fi
    done
fi

# Run global checks (skip if local has same name)
if [ -d "$GLOBAL_CHECKS_DIR" ]; then
    echo "  πŸ“‹ Global checks:"
    for check in "$GLOBAL_CHECKS_DIR"/*.sh; do
        if [ -f "$check" ]; then
            basename_check=$(basename "$check")
            
            # Skip if local overrides (check if basename is in LOCAL_CHECKS string)
            if echo "$LOCAL_CHECKS" | grep -q " $basename_check "; then
                echo "    ⏭️  $basename_check (local override)"
                continue
            fi
            
            # Run check
            CHECK_OUTPUT=$(bash "$check" 2>&1)
            if [ $? -eq 0 ]; then
                echo "    βœ… $basename_check"
                # Capture roadmap-tasks output if all tasks done
                if [ "$basename_check" = "roadmap-tasks.sh" ] && echo "$CHECK_OUTPUT" | grep -q "🚦 Ready for merge-to-main"; then
                    ROADMAP_STATUS="$CHECK_OUTPUT"
                fi
            else
                echo "    ❌ $basename_check (failed)"
                CHECKS_PASS=false
            fi
            CHECKS_RUN=$((CHECKS_RUN + 1))
        fi
    done
else
    echo "  ⚠️  No global checks found ($GLOBAL_CHECKS_DIR)"
fi

echo ""

# Run local checks (always run, overrides global if same name)
if [ -d "$LOCAL_CHECKS_DIR" ]; then
    echo "  πŸ“‹ Local checks:"
    for check in "$LOCAL_CHECKS_DIR"/*.sh; do
        if [ -f "$check" ]; then
            basename_check=$(basename "$check")
            
            # Run check
            if bash "$check" >/dev/null 2>&1; then
                echo "    βœ… $basename_check"
            else
                echo "    ❌ $basename_check (failed)"
                CHECKS_PASS=false
            fi
            CHECKS_RUN=$((CHECKS_RUN + 1))
        fi
    done
else
    echo "  ℹ️  No local checks found ($LOCAL_CHECKS_DIR)"
fi

echo ""
echo "  πŸ“Š Checks executed: $CHECKS_RUN"

# ============================================================================
# STEP 2: Read interpretive checks (.md files in checks/)
# ============================================================================

echo ""
echo "πŸ“‹ Reading interpretive checks/ (.md files - AI enforces)..."
echo ""

INTERPRETIVE_READ=0

# Collect local interpretive basenames (for override detection)
LOCAL_INTERPRETIVE=""
if [ -d "$LOCAL_CHECKS_DIR" ]; then
    for check in "$LOCAL_CHECKS_DIR"/*.md; do
        if [ -f "$check" ]; then
            basename_check=$(basename "$check")
            LOCAL_INTERPRETIVE="$LOCAL_INTERPRETIVE $basename_check "
        fi
    done
fi

# Read global interpretive checks (skip if local has same name)
if [ -d "$GLOBAL_CHECKS_DIR" ]; then
    echo "  πŸ“‹ Global interpretive:"
    for check in "$GLOBAL_CHECKS_DIR"/*.md; do
        if [ -f "$check" ]; then
            basename_check=$(basename "$check")
            
            # Skip README.md
            if [ "$basename_check" = "README.md" ]; then
                continue
            fi
            
            # Skip if local overrides
            if echo "$LOCAL_INTERPRETIVE" | grep -q " $basename_check "; then
                echo "    ⏭️  $basename_check (local override)"
                continue
            fi
            
            echo "    βœ… $basename_check (read)"
            INTERPRETIVE_READ=$((INTERPRETIVE_READ + 1))
        fi
    done
fi

echo ""

# Read local interpretive checks (always read, overrides global if same name)
if [ -d "$LOCAL_CHECKS_DIR" ]; then
    echo "  πŸ“‹ Local interpretive:"
    HAS_LOCAL_INTERPRETIVE=false
    for check in "$LOCAL_CHECKS_DIR"/*.md; do
        if [ -f "$check" ] && [ "$(basename "$check")" != "README.md" ]; then
            basename_check=$(basename "$check")
            echo "    βœ… $basename_check (read)"
            INTERPRETIVE_READ=$((INTERPRETIVE_READ + 1))
            HAS_LOCAL_INTERPRETIVE=true
        fi
    done
    if [ "$HAS_LOCAL_INTERPRETIVE" = false ]; then
        echo "  ℹ️  No local interpretive checks found"
    fi
else
    echo "  ℹ️  No local interpretive checks found"
fi

echo ""
echo "  πŸ“Š Interpretive checks read: $INTERPRETIVE_READ"

# ============================================================================
# STEP 3: Integrated report
# ============================================================================

echo ""
echo "πŸ“Š Integrated Enforcement Report:"
echo ""

# Show current branch + epic info
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")

if [[ "$CURRENT_BRANCH" == "main" ]]; then
    echo "🌿 Branch: main (read-only)"
elif [[ "$CURRENT_BRANCH" =~ ^v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
    VERSION="${BASH_REMATCH[1]}"
    # Extract epic title from ROADMAP
    if [[ -f backstage/ROADMAP.md ]]; then
        EPIC_TITLE=$(awk "/^## v$VERSION\$/,/^###/" backstage/ROADMAP.md | grep "^###" | head -1 | sed 's/^### //')
        if [[ -n "$EPIC_TITLE" ]]; then
            echo "🌿 Epic: v$VERSION - $EPIC_TITLE"
        else
            echo "🌿 Branch: $CURRENT_BRANCH"
        fi
    else
        echo "🌿 Branch: $CURRENT_BRANCH"
    fi
else
    echo "🌿 Branch: $CURRENT_BRANCH"
fi

echo ""

echo "πŸ” Checks (deterministic):"
if [ "$CHECKS_PASS" = true ]; then
    echo "  βœ… All checks passed ($CHECKS_RUN executed)"
else
    echo "  ❌ Some checks failed (see above)"
fi

echo ""
echo "πŸ“‹ Interpretive checks:"
echo "  βœ… All interpretive checks read ($INTERPRETIVE_READ total)"
echo "  πŸ€– AI will enforce contextual rules"

# Show roadmap status if epic complete
if [ -n "$ROADMAP_STATUS" ]; then
    echo ""
    echo "$ROADMAP_STATUS"
fi

echo ""

# ============================================================================
# STEP 4: Exit code (mode-aware)
# ============================================================================

if [ "$CHECKS_PASS" = true ]; then
    echo "βœ… Enforcement complete (all deterministic checks passed)"
    exit 0
else
    if [ "$MODE" = "start" ]; then
        echo "πŸ›‘ Enforcement failed (blocking commit - fix issues above)"
        exit 1
    else
        echo "⚠️  Enforcement soft fail (add issues to ROADMAP)"
        exit 0
    fi
fi
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: 472kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexUnverifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall