Skip to content

Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations.

refactor: Merge user rules into skill rules, convert to globs format

Jezc6d216184d3b
diff --git a/skills/clerk-auth/rules/clerk-auth.md b/skills/clerk-auth/rules/clerk-auth.md
index e5c64f68..f5205b9a 100644
--- a/skills/clerk-auth/rules/clerk-auth.md
+++ b/skills/clerk-auth/rules/clerk-auth.md
@@ -1,11 +1,20 @@
---
-paths: "**/*clerk*.ts", "**/*middleware*.ts", "**/*auth*.ts", src/app/api/**/*.ts
+globs: ["**/*clerk*.ts", "**/*middleware*.ts", "**/*auth*.ts", "src/app/api/**/*.ts"]
---
# Clerk Auth Corrections
Claude's training may reference older Clerk patterns. This project uses **Clerk v6+**.
+## API Version (CRITICAL)
+
+Clerk deprecated Session Token JWT v1 on **April 14, 2025**. Projects using `@clerk/[email protected]` require API version `2025-04-10` or later.
+
+| If using... | Required API Version |
+|-------------|---------------------|
+| `@clerk/[email protected]` | 2025-04-10+ (v2 tokens) |
+| `@clerk/[email protected]` | 2025-04-10+ (v2 tokens) |
+
## Next.js v6: auth() is Async
```typescript
@@ -28,6 +37,55 @@ auth.protect()
await auth.protect()
```
+## Token Verification
+
+Use the `@clerk/backend` SDK's `verifyToken` function for backend token verification.
+
+```typescript
+import { verifyToken } from '@clerk/backend';
+
+// Verify JWT from Authorization header
+const token = request.headers.get('Authorization')?.replace('Bearer ', '');
+const payload = await verifyToken(token, {
+ secretKey: env.CLERK_SECRET_KEY,
+ authorizedParties: ['https://yourdomain.com'], // REQUIRED for Cloudflare Workers
+});
+```
+
+**Cloudflare Workers**: Always set `authorizedParties` to prevent CSRF vulnerabilities.
+
+## Custom JWT Template
+
+Use a custom JWT template in Clerk Dashboard with email and metadata claims:
+
+```json
+{
+ "user_id": "{{user.id}}",
+ "email": "{{user.primary_email_address}}",
+ "role": "{{user.public_metadata.role}}"
+}
+```
+
+This avoids extra API calls to fetch user data.
+
+## JWT Size Limit: 1.2KB
+
+Custom claims in session cookies are limited to **1.2KB**. Browsers cap cookies at 4KB; Clerk reserves 2.8KB for defaults.
+
+**Symptom**: Authentication silently fails if custom claims exceed 1.2KB.
+
+| If Claude suggests... | Use instead... |
+|----------------------|----------------|
+| Large custom claim objects | Keep claims minimal, fetch extra data via API |
+| Storing full user profiles in claims | Store IDs only, fetch profiles on demand |
+
+## JWT vs Session Token
+
+| Token Type | Purpose | Custom Claims |
+|------------|---------|---------------|
+| **Session Token** | Default auth, includes `sid`, `v` claims | Can add via Dashboard → Sessions → Customize |
+| **Custom JWT** | Machine-to-machine, API auth | Cannot include session-tied claims (`sid`, `v`, `pla`, `fea`) |
+
## API Version 2025-11-10 Changes
```typescript
@@ -44,40 +102,6 @@ GET /v1/commerce/plans
GET /v1/billing/plans
```
-## Cloudflare Workers: authorizedParties Required
-
-```typescript
-import { verifyToken } from '@clerk/backend'
-
-/* ❌ CSRF vulnerability */
-const { data } = await verifyToken(token, {
- secretKey: c.env.CLERK_SECRET_KEY,
-})
-
-/* ✅ Always set authorizedParties */
-const { data } = await verifyToken(token, {
- secretKey: c.env.CLERK_SECRET_KEY,
- authorizedParties: ['https://yourdomain.com'],
-})
-```
-
-## JWT Size Limit: 1.2KB
-
-```json
-// ❌ Exceeds limit (large metadata)
-{
- "bio": "{{user.public_metadata.bio}}",
- "all_metadata": "{{user.public_metadata}}"
-}
-
-// ✅ Keep claims minimal
-{
- "user_id": "{{user.id}}",
- "email": "{{user.primary_email_address}}",
- "role": "{{user.public_metadata.role}}"
-}
-```
-
## Vite Dev Mode: 431 Error Fix
```json
diff --git a/skills/cloudflare-vectorize/rules/cloudflare-vectorize.md b/skills/cloudflare-vectorize/rules/cloudflare-vectorize.md
index 08200443..527293b0 100644
--- a/skills/cloudflare-vectorize/rules/cloudflare-vectorize.md
+++ b/skills/cloudflare-vectorize/rules/cloudflare-vectorize.md
@@ -1,5 +1,5 @@
---
-paths: "**/*.ts", "**/*vector*.ts", wrangler.jsonc
+globs: ["**/*.ts", "**/*vector*.ts", "wrangler.jsonc"]
---
# Cloudflare Vectorize Corrections
@@ -46,6 +46,27 @@ await env.VECTORIZE.insert([{ id: '1', values, metadata: { category: 'A' } }])
// Now filtering works
```
+**Symptoms of missing index**:
+- Query returns 0 matches despite vectors existing
+- Same query without filter returns results
+- No error thrown
+
+**Key insight**: Creating the index doesn't retroactively index existing vectors. You must re-embed/re-insert vectors after creating the index.
+
+## Metadata Index Types
+
+| Type | Use for |
+|------|---------|
+| `string` | Text fields, IDs, categories |
+| `number` | Integers, scores, timestamps |
+| `boolean` | True/false flags |
+
+```bash
+# Create metadata index
+npx wrangler vectorize create-metadata-index my-index --property-name=type --type=string
+npx wrangler vectorize create-metadata-index my-index --property-name=score --type=number
+```
+
## Match Embedding Dimensions
```typescript
diff --git a/skills/snowflake-platform/rules/snowflake-native-apps.md b/skills/snowflake-platform/rules/snowflake-native-apps.md
index 98c78e74..7e8cb36f 100644
--- a/skills/snowflake-platform/rules/snowflake-native-apps.md
+++ b/skills/snowflake-platform/rules/snowflake-native-apps.md
@@ -90,6 +90,52 @@ Include all 5 statuses:
- `REJECTED` - Failed
- `MANUAL_REVIEW` - Human reviewing (can take business days)
+## Development Cycle
+
+- `snow app deploy` - Upload files to stage
+- `snow app run` - Create/upgrade application (needed after deploy to see changes)
+
+## Publishing Workflow
+
+1. Create version: `snow app version create v1_0 --skip-git-check --force`
+2. Set distribution: `ALTER APPLICATION PACKAGE pkg_name SET DISTRIBUTION = 'EXTERNAL'`
+3. Wait for security scan: Check `review_status` in `SHOW VERSIONS IN APPLICATION PACKAGE pkg_name`
+4. Set release directive: `snow app release-directive set default --version V1_0 --patch 0 --channel DEFAULT`
+5. Create listing in Snowsight Provider Studio (UI only, not CLI)
+6. Attach package, fill details, submit for review
+
+## External Database Access (shared_data Pattern)
+
+When your Native App needs to access data from an external database (not bundled with the app):
+
+**Error without proper setup:**
+> "A view that is added to the shared content cannot reference objects from other databases"
+
+**Solution:**
+```sql
+-- 1. Create shared_data schema in app package
+CREATE SCHEMA IF NOT EXISTS MY_APP_PKG.SHARED_DATA;
+
+-- 2. Create views that reference external database
+CREATE OR REPLACE VIEW MY_APP_PKG.SHARED_DATA.MY_VIEW AS
+SELECT * FROM EXTERNAL_DB.SCHEMA.TABLE;
+
+-- 3. Grant REFERENCE_USAGE on the source database (CRITICAL!)
+GRANT REFERENCE_USAGE ON DATABASE EXTERNAL_DB
+ TO SHARE IN APPLICATION PACKAGE MY_APP_PKG;
+
+-- 4. Grant access to share
+GRANT USAGE ON SCHEMA MY_APP_PKG.SHARED_DATA
+ TO SHARE IN APPLICATION PACKAGE MY_APP_PKG;
+GRANT SELECT ON ALL VIEWS IN SCHEMA MY_APP_PKG.SHARED_DATA
+ TO SHARE IN APPLICATION PACKAGE MY_APP_PKG;
+```
+
+| If Claude suggests... | Use instead... |
+|----------------------|----------------|
+| Direct reference to external DB in setup_script | Reference `shared_data.view_name` |
+| Skipping REFERENCE_USAGE grant | Always grant REFERENCE_USAGE before `snow app run` |
+
## Provider Studio
- Description field uses WYSIWYG editor - cannot paste raw HTML