### Git Branching and Commit Message Examples Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/commit/SKILL.md Demonstrates how to check the current git branch, create a new feature branch, and provides examples of well-formatted commit messages for different scenarios (fix, feat, ref, breaking change, revert) according to Sentry conventions. Includes examples of issue references and AI co-authorship. ```bash # Check current branch git branch --show-current ``` ```bash # Create and switch to a new branch git checkout -b / ``` ```git fix(api): Handle null response in user endpoint The user API could return null for deleted accounts, causing a crash in the dashboard. Add null check before accessing user properties. Fixes SENTRY-5678 Co-Authored-By: Claude ``` ```git feat(alerts): Add Slack thread replies for alert updates When an alert is updated or resolved, post a reply to the original Slack thread instead of creating a new message. This keeps related notifications grouped together. Refs GH-1234 ``` ```git ref: Extract common validation logic to shared module Move duplicate validation code from three endpoints into a shared validator class. No behavior change. ``` ```git feat(api)!: Remove deprecated v1 endpoints Remove all v1 API endpoints that were deprecated in version 23.1. Clients should migrate to v2 endpoints. BREAKING CHANGE: v1 endpoints no longer available Fixes SENTRY-9999 ``` ```git revert: feat(api): Add new endpoint This reverts commit abc123def456. Reason: Caused performance regression in production. ``` -------------------------------- ### Install Sentry Skills via Claude Marketplace Source: https://github.com/getsentry/skills/blob/main/README.md Installs the Sentry skills plugin for Claude Code by first adding the Sentry marketplace and then installing the specific plugin. Requires restarting Claude Code after installation. ```bash # Add the marketplace claude plugin marketplace add getsentry/skills # Install the plugin claude plugin install sentry-skills@sentry-skills ``` -------------------------------- ### Install Sentry Skills from Local Clone Source: https://github.com/getsentry/skills/blob/main/README.md Installs the Sentry skills plugin for Claude Code from a local repository clone. This involves cloning the repository, adding the local clone as a marketplace, and then installing the plugin. Requires restarting Claude Code. ```bash # Clone the repository git clone git@github.com:getsentry/skills.git ~/sentry-skills # Install the marketplace from the local clone claude plugin marketplace add ~/sentry-skills # Install the plugin directly claude plugin install sentry-skills ``` -------------------------------- ### Install Sentry Skills Plugin Locally Source: https://github.com/getsentry/skills/blob/main/CONTRIBUTING.md Instructions to install the Sentry Skills plugin from a local clone using the 'claude' command-line tool. This is a prerequisite for local testing of skill changes. ```bash claude plugin marketplace add ~/path/to/sentry-skills claude plugin install sentry-skills ``` -------------------------------- ### Example AGENTS.md Structure Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/agents-md/SKILL.md A comprehensive example of the AGENTS.md file structure, incorporating various sections like Package Manager, Commit Attribution, API Routes, Database, Testing, and CLI commands. ```markdown # Agent Instructions ## Package Manager Use **pnpm**: `pnpm install`, `pnpm dev` ## Commit Attribution AI commits MUST include: ``` Co-Authored-By: (the agent model's name and attribution byline) ``` ## API Routes [Template code block] ## Database Use `db-migrate` skill. See `.claude/skills/db-migrate/SKILL.md` ## Testing Use `write-tests` skill. See `.claude/skills/write-tests/SKILL.md` ## CLI | Command | Description | |---------|-------------| | `pnpm cli sync` | Sync data | ``` -------------------------------- ### Package Manager Section Example Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/agents-md/SKILL.md Example Markdown snippet for the 'Package Manager' section in AGENTS.md. It specifies the package manager (pnpm) and lists essential commands. ```markdown ## Package Manager Use **pnpm**: `pnpm install`, `pnpm dev`, `pnpm test` ``` -------------------------------- ### Local Skills Reference Example Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/agents-md/SKILL.md Example Markdown snippet demonstrating how to reference local skills within AGENTS.md. It shows the format for referencing a skill and its location. ```markdown ## Database Use `db-migrate` skill for schema changes. See `.claude/skills/db-migrate/SKILL.md` ## Testing Use `write-tests` skill. See `.claude/skills/write-tests/SKILL.md` ``` -------------------------------- ### Commit Attribution Section Example Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/agents-md/SKILL.md Example Markdown snippet for the 'Commit Attribution' section in AGENTS.md. It mandates the inclusion of AI commit attribution, providing the required format and an example. ```markdown ## Commit Attribution AI commits MUST include: ``` Co-Authored-By: (the agent model's name and attribution byline) ``` Example: `Co-Authored-By: Claude Sonnet 4 ` ``` -------------------------------- ### Security SQL Injection Prevention Pattern Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/code-review/SKILL.md Highlights a critical security vulnerability: SQL injection. The 'bad' example shows a direct string format leading to injection risks. The 'good' example demonstrates the secure practice of using parameterized queries, which separates SQL code from user-provided data, preventing malicious input from altering database commands. ```python # Bad: SQL injection risk cursor.execute(f"SELECT * FROM users WHERE id = {user_id}") # Good: Parameterized query cursor.execute("SELECT * FROM users WHERE id = %s", [user_id]) ``` -------------------------------- ### Sentry Skill SKILL.md Template Source: https://github.com/getsentry/skills/blob/main/README.md Defines the structure and required fields for a Sentry skill's SKILL.md file, including name, description, instructions, examples, and guidelines. It also outlines optional fields like license, model, and compatibility. ```yaml --- name: my-skill description: A clear description of what this skill does and when to use it. Include keywords that help agents identify when this skill is relevant. --- # My Skill Name ## Instructions Step-by-step guidance for the agent. ## Examples Concrete examples showing expected input/output. ## Guidelines - Specific rules to follow - Edge cases to handle ``` -------------------------------- ### Get Full Git Diff Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/find-bugs/SKILL.md Retrieves the complete difference between the default branch and the current HEAD. This is the initial step to gather all changes for review. It relies on the 'gh' CLI tool to determine the default branch name. ```bash git diff $(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')...HEAD ``` -------------------------------- ### Get Inline Code Review Comments using GitHub API Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/iterate-pr/SKILL.md Retrieves inline code review comments for a specific pull request using the GitHub API. This requires constructing the correct API endpoint with owner, repository, and pull request number. ```bash gh api repos/{owner}/{repo}/pulls/{pr_number}/comments ``` -------------------------------- ### TypeScript/React useEffect Dependency Pattern Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/code-review/SKILL.md Illustrates a common pitfall in TypeScript/React's `useEffect` hook where a dependency is missed, leading to stale data or incorrect behavior. The example shows the 'bad' case with an empty dependency array and the 'good' case where the necessary `userId` is included, ensuring the effect re-runs when `userId` changes. ```typescript // Bad: Missing dependency in useEffect useEffect(() => { fetchData(userId); }, []); // userId not in deps // Good: Include all dependencies useEffect(() => { fetchData(userId); }, [userId]); ``` -------------------------------- ### Get PR Conversation Comments using GitHub API Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/iterate-pr/SKILL.md Retrieves all comments on a pull request's conversation thread, including those from automated bots, using the GitHub API. This is useful for gathering all feedback in one place. ```bash gh api repos/{owner}/{repo}/issues/{pr_number}/comments ``` -------------------------------- ### Fetch PR Template (Bash) Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/create-pr/SKILL.md This command fetches the Pull Request template from the GitHub repository. If a template exists, it should be used as a structure for the PR description. ```bash # Fetch PR template from GitHub gh repo view --json pullRequestTemplates --jq '.pullRequestTemplates[0].body' ``` -------------------------------- ### Detect Repository Structure with Bash Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/claude-settings-audit/SKILL.md These bash commands help in detecting the repository structure by listing files and searching for common configuration and lock files. They are useful for identifying the project's technology stack and build tools. ```bash ls -la find . -maxdepth 2 ( -name "*.toml" -o -name "*.json" -o -name "*.lock" -o -name "*.yaml" -o -name "*.yml" -o -name "Makefile" -o -name "Dockerfile" -o -name "*.tf" ) 2>/dev/null | head -50 ``` -------------------------------- ### Commit and Push Changes using Git Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/iterate-pr/SKILL.md Stages all changes, commits them with a descriptive message, and pushes the changes to the current branch on the remote repository. This is the standard workflow for saving and sharing code modifications. ```bash git add -A git commit -m "fix: " git push origin $(git branch --show-current) ``` -------------------------------- ### View PR Reviews and Comments using GitHub CLI Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/iterate-pr/SKILL.md Fetches review comments, general comments, and the review decision for a pull request. This is crucial for gathering human and bot feedback that needs to be addressed. ```bash gh pr view --json reviews,comments,reviewDecision ``` -------------------------------- ### Verify Branch State and History (Bash) Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/create-pr/SKILL.md These commands help verify the current branch's state and its history relative to the default branch. They are crucial for ensuring the branch is up-to-date and all changes are committed before proceeding with PR creation. ```bash # Detect the default branch BASE=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name') # Check current branch and status git status git log $BASE..HEAD --oneline ``` -------------------------------- ### Sentry Skill SKILL.md with Optional Fields Source: https://github.com/getsentry/skills/blob/main/README.md Demonstrates a Sentry skill's SKILL.md file including optional fields such as license, model, and allowed tools. This allows for more specific configuration of the skill's behavior and requirements. ```yaml --- name: my-skill description: What this skill does license: Apache-2.0 model: sonnet allowed-tools: Read Grep Glob --- ``` -------------------------------- ### View Specific CI Run Logs using GitHub CLI Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/iterate-pr/SKILL.md Displays the logs for a specific CI run, focusing on failed steps. This is essential for diagnosing the root cause of CI failures. ```bash gh run view --log-failed ``` -------------------------------- ### Analyze Changes for PR (Bash) Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/create-pr/SKILL.md These commands allow you to review the commits and the full diff that will be included in the pull request. Understanding the scope and purpose of changes is essential before writing the PR description. ```bash # See all commits that will be in the PR git log $BASE..HEAD # See the full diff git diff $BASE...HEAD ``` -------------------------------- ### View PR Details using GitHub CLI Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/iterate-pr/SKILL.md Retrieves essential information about the current pull request, including its number, URL, head branch name, and base branch name. This is the first step in identifying the PR to work on. ```bash gh pr view --json number,url,headRefName,baseRefName ``` -------------------------------- ### Check Existing Claude Settings with Bash Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/claude-settings-audit/SKILL.md This bash command checks for the existence of a `.claude/settings.json` file in the current directory. If the file is found, its content is displayed; otherwise, it indicates that no existing settings were found. ```bash cat .claude/settings.json 2>/dev/null || echo "No existing settings" ``` -------------------------------- ### Baseline Claude Settings Permissions Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/claude-settings-audit/SKILL.md A JSON array representing baseline read-only bash and GitHub CLI commands that should always be included in Claude Code settings. These commands are essential for basic repository inspection and interaction. ```json [ "Bash(ls:*)", "Bash(pwd:*)", "Bash(find:*)", "Bash(file:*)", "Bash(stat:*)", "Bash(wc:*)", "Bash(head:*)", "Bash(tail:*)", "Bash(cat:*)", "Bash(tree:*)", "Bash(git status:*)", "Bash(git log:*)", "Bash(git diff:*)", "Bash(git show:*)", "Bash(git branch:*)", "Bash(git remote:*)", "Bash(git tag:*)", "Bash(git stash list:*)", "Bash(git rev-parse:*)", "Bash(gh pr view:*)", "Bash(gh pr list:*)", "Bash(gh pr checks:*)", "Bash(gh pr diff:*)", "Bash(gh issue view:*)", "Bash(gh issue list:*)", "Bash(gh run view:*)", "Bash(gh run list:*)", "Bash(gh run logs:*)", "Bash(gh repo view:*)", "Bash(gh api:*)" ] ``` -------------------------------- ### YAML Frontmatter for Sentry Agent Skill Source: https://github.com/getsentry/skills/blob/main/AGENTS.md This snippet shows the required and optional YAML frontmatter fields for a Sentry Agent Skill's SKILL.md file. It includes fields like name, description, model, allowed_tools, license, and compatibility, which define the skill's behavior and metadata. ```yaml --- name: example-skill description: What this skill does and when to use it. Include trigger keywords. model: sonnet allowed-tools: Read Grep Glob Bash --- # Example Skill Instructions for the agent. ``` -------------------------------- ### List Recent CI Runs using GitHub CLI Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/iterate-pr/SKILL.md Lists recent CI runs for the current branch, including their database ID, name, status, and conclusion. This is useful for identifying specific runs to investigate when CI checks fail. ```bash gh run list --branch $(git branch --show-current) --limit 5 --json databaseId,name,status,conclusion ``` -------------------------------- ### Linear MCP Server Configuration Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/claude-settings-audit/SKILL.md Configuration for the Linear MCP server, to be added to the .mcp.json file. This utilizes the @linear/mcp-server package and requires a LINEAR_API_KEY environment variable. ```json { "mcpServers": { "linear": { "command": "npx", "args": ["-y", "@linear/mcp-server"], "env": { "LINEAR_API_KEY": "${LINEAR_API_KEY}" } } } } ``` -------------------------------- ### Stack-Specific Claude Settings Commands Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/claude-settings-audit/SKILL.md JSON arrays containing Claude settings permissions for various programming languages and build tools. These commands are conditionally included based on the detected tech stack of the repository. ```json [ "python --version", "python3 --version" ] ``` ```json [ "poetry show", "poetry env info" ] ``` ```json [ "uv pip list", "uv tree" ] ``` ```json [ "pipenv graph" ] ``` ```json [ "pip list", "pip show", "pip freeze" ] ``` ```json [ "node --version" ] ``` ```json [ "pnpm list", "pnpm why" ] ``` ```json [ "yarn list", "yarn info", "yarn why" ] ``` ```json [ "npm list", "npm view", "npm outdated" ] ``` ```json [ "tsc --version" ] ``` ```json [ "go version", "go list", "go mod graph", "go env" ] ``` ```json [ "rustc --version", "cargo --version", "cargo tree", "cargo metadata" ] ``` ```json [ "ruby --version", "bundle list", "bundle show" ] ``` ```json [ "java --version", "mvn --version", "mvn dependency:tree" ] ``` ```json [ "java --version", "gradle --version", "gradle dependencies" ] ``` ```json [ "docker --version", "docker ps", "docker images" ] ``` ```json [ "docker-compose ps", "docker-compose config" ] ``` ```json [ "terraform --version", "terraform providers", "terraform state list" ] ``` ```json [ "make --version", "make -n" ] ``` -------------------------------- ### Discover Local Skills Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/agents-md/SKILL.md Commands to discover local skills by searching for SKILL.md files within the project's skill directories. These commands help identify skills that can be referenced in AGENTS.md. ```bash find .claude/skills -name "SKILL.md" 2>/dev/null ls plugins/*/skills/*/SKILL.md 2>/dev/null ``` -------------------------------- ### Python/Django N+1 Query Pattern Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/code-review/SKILL.md Demonstrates the common 'N+1 query' problem in Python/Django and its solution using `prefetch_related`. This pattern occurs when iterating over a queryset and accessing related objects, leading to multiple database queries. `prefetch_related` optimizes this by fetching related objects in a single query. ```python # Bad: N+1 query for user in users: print(user.profile.name) # Separate query per user # Good: Prefetch related users = User.objects.prefetch_related('profile') ``` -------------------------------- ### Create Pull Request (Bash) Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/create-pr/SKILL.md This command creates a pull request using the GitHub CLI. It requires a title following conventional commit formats and a body, which can be provided via a heredoc. ```bash gh pr create --title "(): " --body "$(cat <<'EOF' EOF )" ``` -------------------------------- ### Check for Existing .mcp.json Configuration Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/claude-settings-audit/SKILL.md A bash command to check if a .mcp.json file already exists in the current directory. If it does not exist, it will output 'No existing .mcp.json'. ```bash cat .mcp.json 2>/dev/null || echo "No existing .mcp.json" ``` -------------------------------- ### Sentry MCP Server Configuration Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/claude-settings-audit/SKILL.md Configuration for the Sentry MCP server, to be added to the .mcp.json file. This requires specifying your Sentry organization and project slugs. ```json { "mcpServers": { "sentry": { "type": "http", "url": "https://mcp.sentry.dev/mcp/{org-slug}/{project-slug}" } } } ``` -------------------------------- ### Define a New Sentry Skill Source: https://github.com/getsentry/skills/blob/main/CONTRIBUTING.md YAML frontmatter required for a new skill, including its name and a brief description with trigger keywords. This metadata is essential for the skill to be recognized and utilized. ```yaml --- name: skill-name description: What this skill does. Include trigger keywords. --- ``` -------------------------------- ### Update Existing PR via GitHub API (Bash) Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/create-pr/SKILL.md These commands demonstrate how to update an existing pull request's title and/or body using the GitHub API via the `gh api` command. This is the recommended method for editing PRs as `gh pr edit` has known issues. ```bash # Update PR description gh api -X PATCH repos/{owner}/{repo}/pulls/PR_NUMBER -f body="$(cat <<'EOF' Updated description here EOF )" # Update PR title gh api -X PATCH repos/{owner}/{repo}/pulls/PR_NUMBER -f title='new: Title here' # Update both gh api -X PATCH repos/{owner}/{repo}/pulls/PR_NUMBER \ -f title='new: Title' \ -f body='New description' ``` -------------------------------- ### Check CI Status with GitHub CLI Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/iterate-pr/SKILL.md Checks the status of CI checks associated with a pull request. It retrieves the name, state, bucket (pass/fail/pending), link, and workflow for each check. This helps in understanding the current state of automated tests and quality gates. ```bash gh pr checks --json name,state,bucket,link,workflow ``` -------------------------------- ### Watch CI Checks for Completion using GitHub CLI Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/iterate-pr/SKILL.md Continuously monitors CI checks for a pull request at a specified interval (30 seconds in this case) until they all complete. It provides an exit code indicating success (0) or failure (1). ```bash gh pr checks --watch --interval 30 ``` -------------------------------- ### Poll CI Checks Manually using GitHub CLI and jq Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/iterate-pr/SKILL.md Manually polls the CI checks for a pull request and filters the output using `jq` to show only checks that did not pass. This allows for more granular control over monitoring CI status. ```bash gh pr checks --json name,state,bucket | jq '.[] | select(.bucket != "pass")' ``` -------------------------------- ### Always Include Sentry Domains Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/claude-settings-audit/SKILL.md These domains are always included in Sentry skills configurations. They are essential for Sentry to monitor documentation and CLI interactions across different platforms. ```json [ "WebFetch(domain:docs.sentry.io)", "WebFetch(domain:develop.sentry.dev)", "WebFetch(domain:docs.github.com)", "WebFetch(domain:cli.github.com)" ] ``` -------------------------------- ### Configure Claude Settings for Sentry Skills Source: https://github.com/getsentry/skills/blob/main/CONTRIBUTING.md JSON snippet to add a Sentry skill to the Claude settings file. This enables Claude to recognize and potentially invoke the specified skill. ```json "Skill(sentry-skills:skill-name)" ``` -------------------------------- ### Check for Uncommitted Changes (Bash) Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/create-pr/SKILL.md This command checks the Git repository's status to identify any uncommitted changes. It's a prerequisite step before creating a pull request to ensure all work is properly committed. ```bash git status --porcelain ``` -------------------------------- ### Sentry Skills Permissions for Claude Source: https://github.com/getsentry/skills/blob/main/plugins/sentry-skills/skills/claude-settings-audit/SKILL.md A JSON array listing specific Sentry skills that can be included in Claude Code settings. These are relevant for projects integrated with Sentry, enabling advanced Sentry-related functionalities. ```json [ "Skill(sentry-skills:commit)", "Skill(sentry-skills:create-pr)", "Skill(sentry-skills:code-review)", "Skill(sentry-skills:find-bugs)", "Skill(sentry-skills:iterate-pr)", "Skill(sentry-skills:claude-settings-audit)", "Skill(sentry-skills:agents-md)", "Skill(sentry-skills:brand-guidelines)" ] ```