Universal AI Lib
cd ../skills

Resource Data Management Skill

Use when adding, editing, or organizing resources (skills, agents, commands, rules, MCP servers, hooks).

````instructions
# Resource Data Management Skill

## When to Use
Use when adding, editing, or organizing resources (skills, agents, commands, rules, MCP servers, hooks).

## Rules

1. **Follow the Resource interface** — every entry must match the `Resource` type from `src/lib/types.ts`
2. **Use readonly arrays** — `readonly Resource[]` for exports, `readonly TechStack[]` for stacks
3. **Slug = URL** — slug becomes the `/browse/[slug]` URL; use kebab-case, unique across ALL sections
4. **Tag tech stacks** — add all relevant stacks so filtering works; use `'general'` for cross-stack resources
5. **Category accuracy** — pick the most specific category from the 12 available
6. **Content quality** — markdown content with headings, code blocks, examples, anti-patterns, checklists
7. **Date format** — ISO date string (YYYY-MM-DD) for `lastUpdated`

## Data Architecture

All resources are stored in PostgreSQL (Neon) via Prisma ORM.

- **Schema:** `packages/db/prisma/schema.prisma` — `Resource` model
- **Queries:** `src/server/queries.ts` — all database query functions
- **Seeding:** `content/resources/*.json` + `scripts/content-sync.ts`

Key query functions in `src/server/queries.ts`:
- `getAllResources()` — fetch all resources sorted by title
- `getResourceBySlug(slug)` — single resource lookup
- `getResourcesBySection(section)` — filter by section
- `searchResources(query, filters)` — full-text search with optional filters
- `getSectionCounts()` — counts per section
- `createSubmission(data)` — user-submitted resources (reviewed by admins)

## Pattern: Adding a New Resource

Three ways to add resources:

### 1. Via Submission Form (users)
Submit via the form on `/contribute`. The resource is saved with `status: 'pending'` and reviewed by admins at `/admin`.

### 2. Via Prisma (developers)
```typescript
import { db } from '@veinpal-agentic/db';

await db.resource.create({
  data: {
    slug: 'my-new-skill',
    title: 'My New Skill',
    description: 'Brief explanation of what this skill teaches AI agents.',
    section: 'skill',
    category: 'backend',
    difficulty: 'intermediate',
    stacks: ['typescript', 'nodejs'],
    tags: ['tag1', 'tag2', 'tag3'],
    author: 'Your Name',
    content: '# My New Skill\n\n## When to Use\n...',
  },
});
```

### 3. Via Seed Script (bulk)
```bash
npx tsx scripts/seed-github-skills.ts    # Seeds from GitHub repo
npx tsx scripts/content-sync.ts          # Syncs from content/resources/*.json
```

## Validation

After adding a resource:
1. Run `pnpm build` — confirms type safety and static generation
2. Check the build output shows the correct number of static pages
3. Verify the resource appears at `/webapp/agentic-library/browse/your-slug`

## Anti-Patterns

### Duplicate slugs
```typescript
// BAD — slug already used in agents.ts
{ slug: 'code-reviewer', ... }  // Also exists in commands.ts!

// GOOD — unique slug with section prefix if needed
{ slug: 'code-reviewer-agent', ... }
```

### Empty stacks
```typescript
// BAD — resource won't appear in any stack filter
{ stacks: [], ... }

// GOOD — always include at least 'general'
{ stacks: ['general'], ... }
```

## Checklist
- [ ] Slug is unique across ALL data files
- [ ] Section matches the data file
- [ ] At least one stack assigned
- [ ] Content has proper markdown structure
- [ ] Build passes cleanly

````

How to use this skill

  1. Click "Copy" to copy the skill content.
  2. Create a folder at .github/skills/resource-data-management/ in your repository.
  3. Paste the content into SKILL.md inside the folder.
  4. Reference the skill name in your AI agent's instructions or copilot config.