Skip to content

Commit 40df14a

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 40df14a

File tree

22 files changed

+1684
-904
lines changed

22 files changed

+1684
-904
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:

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: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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+
## Context Window Tips
9+
10+
- Use `--fields id,title,status` on list commands to reduce output size
11+
- Use `--json` when piping output between commands or processing programmatically
12+
- Use `--limit` to cap the number of results (default is usually 10–100)
13+
- Prefer `sentry issue view PROJECT-123` over listing and filtering manually
14+
- Use `sentry api` for endpoints not covered by dedicated commands
15+
16+
## Safety Rules
17+
18+
- Always confirm with the user before running destructive commands: `project delete`, `trial start`
19+
- Verify the org/project context is correct before mutations — use `sentry auth status` to check defaults
20+
- Never store or log authentication tokens — use `sentry auth login` and let the CLI manage credentials
21+
- When in doubt about the target org/project, use explicit `<org>/<project>` arguments instead of auto-detection
22+
23+
## Workflow Patterns
24+
25+
### Investigate an Issue
26+
27+
```bash
28+
# 1. Find the issue
29+
sentry issue list my-org/my-project --query "is:unresolved" --limit 5
30+
31+
# 2. Get details
32+
sentry issue view PROJECT-123
33+
34+
# 3. Get AI root cause analysis
35+
sentry issue explain PROJECT-123
36+
37+
# 4. Get a fix plan
38+
sentry issue plan PROJECT-123
39+
```
40+
41+
### Explore Traces and Performance
42+
43+
```bash
44+
# 1. List recent traces
45+
sentry trace list my-org/my-project --limit 5
46+
47+
# 2. View a specific trace with span tree
48+
sentry trace view my-org/my-project/abc123def456...
49+
50+
# 3. View spans for a trace
51+
sentry span list my-org/my-project/abc123def456...
52+
53+
# 4. View logs associated with a trace
54+
sentry trace logs my-org/abc123def456...
55+
```
56+
57+
### Stream Logs
58+
59+
```bash
60+
# Stream logs in real-time
61+
sentry log list my-org/my-project --follow
62+
63+
# Filter logs by severity
64+
sentry log list my-org/my-project --query "severity:error"
65+
```
66+
67+
### Arbitrary API Access
68+
69+
```bash
70+
# GET request (default)
71+
sentry api /api/0/organizations/my-org/
72+
73+
# POST request with data
74+
sentry api /api/0/organizations/my-org/projects/ --method POST --data '{"name":"new-project","platform":"python"}'
75+
```
76+
77+
## Common Mistakes
78+
79+
- **Wrong issue ID format**: Use `PROJECT-123` (short ID), not the numeric ID `123456789`. The short ID includes the project prefix.
80+
- **Forgetting authentication**: Run `sentry auth login` before any other command. Check with `sentry auth status`.
81+
- **Missing `--json` for piping**: Human-readable output includes formatting. Use `--json` when parsing output programmatically.
82+
- **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`.
83+
- **Confusing `--query` syntax**: The `--query` flag uses Sentry search syntax (e.g., `is:unresolved`, `assigned:me`), not free text search.
84+
- **Not using `--web`**: View commands support `-w`/`--web` to open the resource in the browser — useful for sharing links.

0 commit comments

Comments
 (0)