onenote-debug-bundle
Generate comprehensive diagnostic bundles for OneNote Graph API issues with request tracing and token analysis. Use when debugging OneNote API failures, filing Microsoft support tickets, or analyzing permission issues. Trigger with "onenote debug", "onenote diagnostic", "onenote support ticket", "graph api troubleshoot onenote".
What this skill does
# OneNote Debug Bundle
## Overview
When OneNote API calls fail, you need the `request-id` response header (Microsoft support requires it), decoded JWT token claims (to verify granted scopes), the `x-ms-ags-diagnostic` header (internal Graph routing info), and the full error body — all correlated to a single request. This skill generates structured diagnostic bundles for self-diagnosis and Microsoft support ticket filing.
## Prerequisites
- Node.js 18+ or Python 3.10+
- An existing OneNote integration with Graph API calls
- `@microsoft/microsoft-graph-client` or `msgraph-sdk` installed
- Access token available (for token inspection)
## Instructions
### TypeScript Diagnostic Middleware
Intercept all Graph API calls and capture diagnostics automatically:
```typescript
// src/debug/diagnostic-middleware.ts
interface DiagnosticEntry {
timestamp: string; method: string; url: string; status: number;
requestId: string | null; agsDiagnostic: string | null;
retryAfter: string | null; duration_ms: number; error: any | null;
}
const diagnosticLog: DiagnosticEntry[] = [];
export function createDiagnosticMiddleware() {
return {
execute: async (context: any) => {
const start = Date.now();
const { url, method } = context.request || { url: "unknown", method: "GET" };
try {
await context.next();
const h = context.response?.headers;
diagnosticLog.push({
timestamp: new Date().toISOString(), method, url,
status: context.response?.status || 0,
requestId: h?.get?.("request-id") || null,
agsDiagnostic: h?.get?.("x-ms-ags-diagnostic") || null,
retryAfter: h?.get?.("retry-after") || null,
duration_ms: Date.now() - start, error: null,
});
} catch (err: any) {
diagnosticLog.push({
timestamp: new Date().toISOString(), method, url,
status: err?.statusCode || 0,
requestId: err?.headers?.["request-id"] || null,
agsDiagnostic: err?.headers?.["x-ms-ags-diagnostic"] || null,
retryAfter: err?.headers?.["retry-after"] || null,
duration_ms: Date.now() - start,
error: { code: err?.code, message: err?.message, body: err?.body },
});
throw err;
}
},
};
}
export function getDiagnosticLog(): DiagnosticEntry[] { return [...diagnosticLog]; }
export function clearDiagnosticLog(): void { diagnosticLog.length = 0; }
```
### Token Claims Inspection (No External Libraries)
Decode a JWT access token to inspect scopes and expiry using only built-in Base64:
```typescript
// src/debug/token-inspector.ts
export function decodeTokenClaims(accessToken: string): Record<string, any> {
const parts = accessToken.split(".");
if (parts.length !== 3) throw new Error("Invalid JWT: expected 3 dot-separated parts");
const base64 = parts[1].replace(/-/g, "+").replace(/_/g, "/");
const padded = base64 + "=".repeat((4 - (base64.length % 4)) % 4);
return JSON.parse(Buffer.from(padded, "base64").toString("utf-8"));
}
export function analyzePermissions(claims: Record<string, any>, required: string[]) {
const granted = claims.scp ? claims.scp.split(" ") : (claims.roles || []);
const missing = required.filter((s) => !granted.includes(s));
const now = Math.floor(Date.now() / 1000);
const isExpired = claims.exp < now;
const diff = Math.abs(claims.exp - now);
const expiresIn = isExpired ? `Expired ${diff}s ago` : `${Math.floor(diff / 60)}m remaining`;
return { granted, missing, isExpired, expiresIn };
}
```
### Python Diagnostic Context Manager
```python
# debug/diagnostic_capture.py
import json, base64, time
from datetime import datetime, timezone
from dataclasses import dataclass, asdict
from typing import Optional
@dataclass
class DiagnosticCapture:
timestamp: str; method: str; url: str; status: int
request_id: Optional[str]; ags_diagnostic: Optional[str]
retry_after: Optional[str]; duration_ms: float
error_code: Optional[str]; error_message: Optional[str]
class GraphDiagnostics:
def __init__(self):
self.captures: list[DiagnosticCapture] = []
async def capture_request(self, client, method: str, endpoint: str, **kwargs):
url = f"https://graph.microsoft.com/v1.0{endpoint}"
start = time.monotonic()
try:
response = await client.api(endpoint).get() if method == "GET" \
else await client.api(endpoint).post(kwargs.get("body"))
self.captures.append(DiagnosticCapture(
datetime.now(timezone.utc).isoformat(), method, url, 200,
None, None, None, round((time.monotonic()-start)*1000, 2), None, None))
return response
except Exception as e:
headers = getattr(e, "headers", {}) or {}
self.captures.append(DiagnosticCapture(
datetime.now(timezone.utc).isoformat(), method, url,
int(getattr(e, "status_code", 0)),
headers.get("request-id"), headers.get("x-ms-ags-diagnostic"),
headers.get("retry-after"), round((time.monotonic()-start)*1000, 2),
str(getattr(e, "code", type(e).__name__)), str(e)))
raise
def export_bundle(self, filepath: str, token: Optional[str] = None) -> str:
bundle = {"bundle_version": "1.0", "generated": datetime.now(timezone.utc).isoformat(),
"captures": [asdict(c) for c in self.captures]}
if token:
parts = token.split(".")
bundle["token_claims"] = json.loads(base64.urlsafe_b64decode(parts[1] + "=="))
with open(filepath, "w") as f:
json.dump(bundle, f, indent=2)
return filepath
```
### Microsoft Support Ticket Template
When filing a support case, include this from the diagnostic bundle:
```
Subject: OneNote Graph API - [Error Code] on [Endpoint]
1. Request ID: [from request-id response header]
2. Timestamp (UTC): [from diagnostic bundle]
3. Tenant ID: [from token claims tid]
4. App ID: [from token claims azp]
5. Endpoint: GET /me/onenote/notebooks
6. HTTP Status: 403
7. Error Code: ErrorAccessDenied
8. Error Message: Access is denied.
9. x-ms-ags-diagnostic: [full header value]
10. Token scopes granted: Notes.Read User.Read
11. Expected scopes: Notes.ReadWrite
12. SDK version: @microsoft/[email protected]
```
### Common Diagnostic Patterns
**"Why is my 403 happening?"** — Decode token, compare scopes:
```typescript
const claims = decodeTokenClaims(accessToken);
const { missing, isExpired, expiresIn } = analyzePermissions(claims, ["Notes.ReadWrite"]);
if (missing.length > 0) console.error(`Missing scopes: ${missing.join(", ")}`);
if (isExpired) console.error(`Token expired: ${expiresIn}`);
```
**"Which request failed in a batch?"** — Filter diagnostic log:
```typescript
const failures = getDiagnosticLog().filter((e) => e.status >= 400);
failures.forEach((f) => console.error(`[${f.requestId}] ${f.method} ${f.url} -> ${f.status}`));
```
## Output
- `src/debug/diagnostic-middleware.ts` — automatic Graph API call interception
- `src/debug/token-inspector.ts` — JWT decode and permission analysis (zero dependencies)
- `debug/diagnostic_capture.py` — Python diagnostic context manager with bundle export
- Diagnostic bundle JSON file with request-id, token claims, and error details
- Microsoft support ticket template with required fields
## Error Handling
| Debug Issue | Cause | Fix |
|------------|-------|-----|
| `request-id` is null | Response headers not captured | Use diagnostic middleware; direct `fetch` bypasses header capture |
| JWT decode fails | Token is opaque (v1) | Graph tokens should be v2 JWT; check `aud` matches `https://graph.microsoft.com` |
| `scp` claim empty | App-only token (no delegated scopes) | App-only auth deprecated March 2025; switch to delegated |
| `x-ms-ags-diagnostic` missing | Not all errors include it | Optional header; rely on `request-id` for support ticRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.