name: Claude Code Review

on:
  pull_request:
    types: [opened, ready_for_review]
  issue_comment:
    types: [created]

permissions:
  id-token: write
  contents: read
  pull-requests: write
  issues: write

jobs:
  review:
    if: |
      github.event_name == 'pull_request' ||
      (github.event_name == 'issue_comment' &&
       github.event.issue.pull_request &&
       startsWith(github.event.comment.body, '@claude review'))
    uses: Gemma-Analytics/.github/.github/workflows/claude-review.yml@main
    with:
      additional_instructions: |
        This is the gemma-agentic-toolkit repo — a Claude Code plugin marketplace
        containing 7 plugins with skills, agents, and scripts.

        CRITICAL — apply these checks strictly to every changed file under plugins/:

        ## Plugin structure
        - Every plugin directory MUST have .claude-plugin/plugin.json with name,
          description, version, author, keywords
        - plugin.json name MUST match the directory name exactly
        - version MUST be valid semver (MAJOR.MINOR.PATCH)
        - All component directories (skills/, agents/) MUST be at the plugin root,
          NOT inside .claude-plugin/

        ## SKILL.md compliance
        - Every SKILL.md MUST start with YAML frontmatter (--- delimiters)
          containing at minimum a description field
        - If name is present in frontmatter, it MUST match the skill directory
          name (kebab-case)
        - description MUST be a clear one-sentence explanation — vague descriptions
          like 'Manages stuff' are [BLOCKING]
        - Task skills with side effects (setup-*, create-*, migrate-*, trigger-*,
          run-*, containerize-*, contribute-*, rotate-*, generate-*) MUST have
          disable-model-invocation: true — missing this is [BLOCKING]
        - Reference/cookbook skills that Claude should auto-load (debug-*, test-*,
          add-remove-*) must NOT have disable-model-invocation: true
        - Skills with bundled scripts MUST reference scripts using the
          CLAUDE_SKILL_DIR variable (the standard skill directory placeholder),
          not bare relative paths — bare paths break after installation [BLOCKING]
        - Skills accepting parameters MUST use the ARGUMENTS variable placeholder
          (the standard skill arguments placeholder) in the body and SHOULD
          have argument-hint in frontmatter
        - SKILL.md SHOULD be under 500 lines — if over, detailed content should
          be in references/ files linked from the SKILL.md
        - Skills SHOULD NOT duplicate content that belongs in references/

        ## Agent file compliance
        - Agent .md files MUST have YAML frontmatter with name, description fields
        - name MUST be kebab-case
        - description MUST explain when Claude should delegate to this agent
        - SHOULD have tools field restricting to minimum necessary tools
        - SHOULD have model field (sonnet, opus, haiku, or inherit)

        ## marketplace.json compliance
        - Every plugin directory MUST have a corresponding entry in
          .claude-plugin/marketplace.json
        - Plugin names in marketplace.json MUST match plugin directory names
        - Every marketplace plugin entry MUST have name, source, and description

        ## Consistency checks
        - All skills within a plugin MUST follow the same structural pattern
        - No secrets, connection strings, or real credentials in any file
        - No Cursor-specific syntax (@file references, non-standard frontmatter)
        - Conventional commit style in PR title scoped to the plugin:
          feat(gemma-dlt): ..., fix(gemma-snowflake): ...
    secrets: inherit
