Skip to content

Commit 710b68b

Browse files
committed
feat: refactor SKILL.md into modular reference files (#319)
Split the monolithic 824-line SKILL.md into a compact index (~300 lines) with agent guidance + command summaries, and 12 per-group reference files with full flag/example details. Changes: - Create docs/src/content/docs/agent-guidance.md with operational guidance for AI coding agents (context window tips, safety rules, workflow patterns, common mistakes) - Refactor script/generate-skill.ts to produce SKILL.md index + references/*.md files + auto-generate index.json - Update script/check-skill.ts to verify all generated files (not just SKILL.md) - Update src/lib/agent-skills.ts to fetch and install SKILL.md + reference files (with graceful degradation) - Add directory symlinks for .cursor/ and docs/.well-known/ - Update CI workflow to git add entire skill directory - Update tests for new multi-file API The SKILL.md remains the primary entry point for Claude Code and other agents. Reference files provide full command details that agents can read on-demand when they need specifics about a command group.
1 parent 629012c commit 710b68b

File tree

23 files changed

+1741
-936
lines changed

23 files changed

+1741
-936
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../plugins/sentry-cli/skills/sentry-cli/references

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
echo "Nightly version: ${VERSION}"
8686
8787
check-skill:
88-
name: Check SKILL.md
88+
name: Check skill files
8989
needs: [changes]
9090
if: needs.changes.outputs.skill == 'true'
9191
runs-on: ubuntu-latest
@@ -112,22 +112,22 @@ jobs:
112112
run: bun install --frozen-lockfile
113113
- name: Generate API Schema
114114
run: bun run generate:schema
115-
- name: Check SKILL.md
115+
- name: Check skill files
116116
id: check
117117
run: bun run check:skill
118118
continue-on-error: true
119-
- name: Auto-commit regenerated SKILL.md
119+
- name: Auto-commit regenerated skill files
120120
if: steps.check.outcome == 'failure' && steps.token.outcome == 'success'
121121
run: |
122122
git config user.name "github-actions[bot]"
123123
git config user.email "github-actions[bot]@users.noreply.github.com"
124-
git add plugins/sentry-cli/skills/sentry-cli/SKILL.md
125-
git commit -m "chore: regenerate SKILL.md"
124+
git add plugins/sentry-cli/skills/sentry-cli/ docs/public/.well-known/skills/index.json
125+
git commit -m "chore: regenerate skill files"
126126
git push
127-
- name: Fail for fork PRs with stale SKILL.md
127+
- name: Fail for fork PRs with stale skill files
128128
if: steps.check.outcome == 'failure' && steps.token.outcome != 'success'
129129
run: |
130-
echo "::error::SKILL.md is out of date. Run 'bun run generate:skill' locally and commit the result."
130+
echo "::error::Skill files are out of date. Run 'bun run generate:skill' locally and commit the result."
131131
exit 1
132132
133133
lint:

AGENTS.md

Lines changed: 46 additions & 35 deletions
Large diffs are not rendered by default.

docs/public/.well-known/skills/index.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,21 @@
33
{
44
"name": "sentry-cli",
55
"description": "Guide for using the Sentry CLI to interact with Sentry from the command line. Use when the user asks about viewing issues, events, projects, organizations, making API calls, or authenticating with Sentry via CLI.",
6-
"files": ["SKILL.md"]
6+
"files": [
7+
"SKILL.md",
8+
"references/api.md",
9+
"references/auth.md",
10+
"references/dashboards.md",
11+
"references/events.md",
12+
"references/issues.md",
13+
"references/logs.md",
14+
"references/organizations.md",
15+
"references/projects.md",
16+
"references/setup.md",
17+
"references/teams.md",
18+
"references/traces.md",
19+
"references/trials.md"
20+
]
721
}
822
]
923
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../plugins/sentry-cli/skills/sentry-cli/references
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
title: Agent Guidance
3+
description: Operational guidance for AI coding agents using the Sentry CLI
4+
---
5+
6+
Best practices and operational guidance for AI coding agents using the Sentry CLI.
7+
8+
## Design Principles
9+
10+
The `sentry` CLI follows conventions from well-known tools — if you're familiar with them, that knowledge transfers directly:
11+
12+
- **`gh` (GitHub CLI) conventions**: The `sentry` CLI uses the same `<noun> <verb>` command pattern (e.g., `sentry issue list`, `sentry org view`). Flags follow `gh` conventions: `--json` for machine-readable output, `--fields` to select specific fields, `-w`/`--web` to open in browser, `-q`/`--query` for filtering, `-n`/`--limit` for result count.
13+
- **`sentry api` mimics `curl`**: The `sentry api` command provides direct API access with a `curl`-like interface — `--method` for HTTP method, `--data` for request body, `--header` for custom headers. It handles authentication automatically. If you know how to call a REST API with `curl`, the same patterns apply.
14+
15+
## Context Window Tips
16+
17+
- Use `--fields id,title,status` on list commands to reduce output size
18+
- Use `--json` when piping output between commands or processing programmatically
19+
- Use `--limit` to cap the number of results (default is usually 10–100)
20+
- Prefer `sentry issue view PROJECT-123` over listing and filtering manually
21+
- Use `sentry api` for endpoints not covered by dedicated commands
22+
23+
## Safety Rules
24+
25+
- Always confirm with the user before running destructive commands: `project delete`, `trial start`
26+
- Verify the org/project context is correct before mutations — use `sentry auth status` to check defaults
27+
- Never store or log authentication tokens — use `sentry auth login` and let the CLI manage credentials
28+
- When in doubt about the target org/project, use explicit `<org>/<project>` arguments instead of auto-detection
29+
30+
## Workflow Patterns
31+
32+
### Investigate an Issue
33+
34+
```bash
35+
# 1. Find the issue
36+
sentry issue list my-org/my-project --query "is:unresolved" --limit 5
37+
38+
# 2. Get details
39+
sentry issue view PROJECT-123
40+
41+
# 3. Get AI root cause analysis
42+
sentry issue explain PROJECT-123
43+
44+
# 4. Get a fix plan
45+
sentry issue plan PROJECT-123
46+
```
47+
48+
### Explore Traces and Performance
49+
50+
```bash
51+
# 1. List recent traces
52+
sentry trace list my-org/my-project --limit 5
53+
54+
# 2. View a specific trace with span tree
55+
sentry trace view my-org/my-project/abc123def456...
56+
57+
# 3. View spans for a trace
58+
sentry span list my-org/my-project/abc123def456...
59+
60+
# 4. View logs associated with a trace
61+
sentry trace logs my-org/abc123def456...
62+
```
63+
64+
### Stream Logs
65+
66+
```bash
67+
# Stream logs in real-time
68+
sentry log list my-org/my-project --follow
69+
70+
# Filter logs by severity
71+
sentry log list my-org/my-project --query "severity:error"
72+
```
73+
74+
### Arbitrary API Access
75+
76+
```bash
77+
# GET request (default)
78+
sentry api /api/0/organizations/my-org/
79+
80+
# POST request with data
81+
sentry api /api/0/organizations/my-org/projects/ --method POST --data '{"name":"new-project","platform":"python"}'
82+
```
83+
84+
## Common Mistakes
85+
86+
- **Wrong issue ID format**: Use `PROJECT-123` (short ID), not the numeric ID `123456789`. The short ID includes the project prefix.
87+
- **Forgetting authentication**: Run `sentry auth login` before any other command. Check with `sentry auth status`.
88+
- **Missing `--json` for piping**: Human-readable output includes formatting. Use `--json` when parsing output programmatically.
89+
- **Org/project ambiguity**: Auto-detection scans for DSNs in `.env` files and source code. If the project is ambiguous, specify explicitly: `sentry issue list my-org/my-project`.
90+
- **Confusing `--query` syntax**: The `--query` flag uses Sentry search syntax (e.g., `is:unresolved`, `assigned:me`), not free text search.
91+
- **Not using `--web`**: View commands support `-w`/`--web` to open the resource in the browser — useful for sharing links.

0 commit comments

Comments
 (0)