stacksjs/postline/stacks-slug
Claude Code and agent skill by stacksjs/postline
- community
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/postline/stacks-slugSKILL.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)
How Collision Detection Works
- Slugifies the input string
- Queries the database for existing slug
- If collision found, appends
-2,-3, etc. - Returns the first available slug
Basic Slugify (No Database Check)
@stacksjs/slug exports only uniqueSlug. The sync helpers live in @stacksjs/strings: slug() lowercases and strips punctuation, while the lower-level slugify() defaults to lower: false and keeps case.
Model Usage
Models typically use slugs via the slug attribute:
SlugifyOptions
Gotchas
- Omitting either table or column returns the base slug with no query.
- A title with no letters or digits at all (
!!!, an emoji) gets a random
eight-character slug from uniqueSlug(), never ""; slug() still returns "".
- The check and insert are separate: keep a UNIQUE index and handle/retry an
insert conflict. A helper cannot reserve the returned slug against a race.
- Collision attempts are bounded; after repeated conflicts the helper returns
a cryptographically randomized suffix instead of looping forever.
- Declaring a slug attribute does not itself populate it from the title.
uniqueSlug()is async - it queries the databaseslug()is sync - no database interaction- Collision detection appends
-2,-3, etc. (not random suffixes) - Unicode characters are transliterated (u → u, e → e, etc.) where ts-slug's charmap
romanizes the script (Latin, Greek, Cyrillic, Hebrew, Arabic, Devanagari, Georgian); any other script, such as Japanese, Chinese, Korean or Thai, keeps its letters (日本語のタイトル stays as it is; percent-encoded in a URL)
- Any dash separates words: an em or en dash becomes a hyphen
- For string-only slugification without DB, use
slug()from@stacksjs/stringsinstead - Tags and Categories both use unique slugs by default
- Slug columns should have a unique index in the database
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingstorage/framework/defaults/ai/skills/stacks-slug/SKILL.md
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
[](https://verified-skill.com/skills/stacksjs/postline/stacks-slug)