stacksjs/bench-review/stacks-slug

Claude Code and agent skill by stacksjs/bench-review

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when generating URL slugs in Stacks — creating unique slugs with database collision detection, the uniqueSlug function with table/column configuration, or basic slugification. Covers @stacksjs/slug.

Install

npx vskill@latest install stacksjs/bench-review/stacks-slug

SKILL.md

The same SKILL.md was published earlier as stacksjs/harness/stacks-slug.

Stacks Slug

URL-friendly slug generation with database uniqueness checking.

Key Paths

  • Core package: storage/framework/core/slug/src/

Unique Slug (with Database Check)

typescript
import { uniqueSlug } from '@stacksjs/slug'
// Basic usage — checks 'slug' column in inferred table
const slug = await uniqueSlug('My Blog Post Title')
// → 'my-blog-post-title'
// If 'my-blog-post-title' exists in DB:
// → 'my-blog-post-title-2'
// With options
const slug = await uniqueSlug('Product Name', {
table: 'products', // database table to check
column: 'slug' // column name (default: 'slug')
})
How Collision Detection Works
  1. Slugifies the input string
  2. Queries the database for existing slug
  3. If collision found, appends -2, -3, etc.
  4. Returns the first available slug

Basic Slugify (No Database Check)

typescript
import { slugify } from '@stacksjs/slug'
slugify('Hello World!') // 'hello-world'
slugify('Ünïcödé Têxt') // 'unicode-text'
slugify(' Extra Spaces ') // 'extra-spaces'

Re-exported from ts-slug — handles Unicode transliteration.

Model Usage

Models typically use slugs via the slug attribute:

typescript
defineModel({
name: 'Post',
attributes: {
title: { validation: { rule: schema.string() } },
slug: {
unique: true,
validation: { rule: schema.string() },
// Auto-generated from title via uniqueSlug()
}
}
})

SlugifyOptions

typescript
interface SlugifyOptions {
table?: string // database table for uniqueness check
column?: string // column name (default: 'slug')
}

Gotchas

  • uniqueSlug() is async — it queries the database
  • slugify() is sync — no database interaction
  • Collision detection appends -2, -3, etc. (not random suffixes)
  • Unicode characters are transliterated (u → u, e → e, etc.)
  • For string-only slugification without DB, use slug() from @stacksjs/strings instead
  • Tags and Categories both use unique slugs by default
  • Slug columns should have a unique index in the database

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/stacksjs/bench-review/stacks-slug/badge)](https://verified-skill.com/skills/stacksjs/bench-review/stacks-slug)

Something wrong with this skill or its page? Tell us.