stacks-path

$npx mdskill add stacksjs/stacks/stacks-path

Provides 100+ framework-aware path builder functions for Stacks projects.

  • Builds absolute paths to any framework directory like app, config, or database.
  • Depends on @stacksjs/path and Node.js path utilities.
  • Selects the correct path function based on the requested directory name.
  • Returns absolute file paths for use in scripts or tooling.

SKILL.md

.github/skills/stacks-pathView on GitHub ↗
---
name: stacks-path
description: Use when working with file paths in Stacks — 100+ framework-aware path builder functions for every directory in the project (actions, app, config, database, models, routes, storage, etc.), plus Node.js path utilities (join, resolve, basename, dirname, etc.). Covers @stacksjs/path.
license: MIT
compatibility: Bun >= 1.3.0, TypeScript
allowed-tools: Read Edit Write Bash Grep Glob
---

# Stacks Path

100+ path builder functions for every framework directory.

## Key Path
- Core package: `storage/framework/core/path/src/`

## Node.js Path Re-exports
`basename`, `delimiter`, `dirname`, `extname`, `isAbsolute`, `join`, `normalize`, `parse`, `relative`, `resolve`, `sep`, `toNamespacedPath`

## Framework Path Builders

All accept an optional relative path suffix and return absolute paths.

### Application Paths
```typescript
appPath('Models')                  // ~/app/Models
userActionsPath()                  // ~/app/Actions
userComponentsPath()               // ~/app/Components
userViewsPath()                    // ~/app/Views
userFunctionsPath()                // ~/app/Functions
userJobsPath()                     // ~/app/Jobs
userControllersPath()              // ~/app/Controllers
userListenersPath()                // ~/app/Listeners
userMiddlewarePath()               // ~/app/Middleware
userModelsPath()                   // ~/app/Models
userNotificationsPath()            // ~/app/Notifications
userDatabasePath()                 // ~/database
userMigrationsPath()               // ~/database/migrations
userEventsPath()                   // ~/app/Events.ts
```

### Framework Paths
```typescript
actionsPath()                      // ~/storage/framework/core/actions
buddyPath()                        // ~/storage/framework/core/buddy
runtimePath()                      // ~/storage/framework/core/buddy
buildPath()                        // ~/storage/framework/core/build
cachePath()                        // ~/storage/framework/cache
cloudPath()                        // ~/cloud
frameworkCloudPath()               // ~/storage/framework/cloud
libsPath()                         // ~/storage/framework/libs
```

### Package Paths (one per core package)
```typescript
aiPath()         analyticsPath()    aliasPath()
arraysPath()     authPath()         browserPath()
cliPath()        chatPath()         collectionsPath()
configPath()     databasePath()     datetimePath()
dnsPath()        docsPath()         emailPath()
enumsPath()      envPath()          errorHandlingPath()
eventsPath()     fakerPath()        gitPath()
healthPath()     httpPath()         i18nPath()
lintPath()       loggingPath()      notificationsPath()
objectsPath()    ormPath()          pathPath()
paymentsPath()   pluginsPath()      pushPath()
queuePath()      realtimePath()     routerPath()
schedulerPath()  searchEnginePath() securityPath()
serverPath()     shellPath()        slugPath()
smsPath()        socialsPath()      storagePath()
stringsPath()    testingPath()      tinkerPath()
tunnelPath()     typesPath()        uiPath()
utilsPath()      validationPath()   whoisPath()
```

### Resource Paths
```typescript
assetsPath()                       // ~/resources/assets
resourcesPath()                    // ~/resources
publicPath()                       // ~/public
localesPath()                      // ~/locales
routesPath()                       // ~/routes
```

### Build & Output Paths
```typescript
buildEnginePath()
libsEntriesPath()
frameworkPath()                    // ~/storage/framework
corePath()                         // ~/storage/framework/core
defaultsPath()                     // ~/storage/framework/defaults
defaultsAppPath()
defaultsResourcesPath()
```

### Relative Path Variants
Most paths have `relative*` variants:
```typescript
relativeActionsPath()
relativeAppPath()
```

## Path with Suffix

```typescript
appPath('Models/User.ts')           // ~/app/Models/User.ts
databasePath('migrations')          // ~/storage/framework/core/database/migrations
configPath('app.ts')                // ~/config/app.ts
```

## Gotchas
- Always use `@stacksjs/path` instead of Node's `path` for framework paths
- All paths resolve to absolute paths by default
- Most functions accept an optional relative path suffix
- `relative*` variants return paths relative to project root
- `user*Path()` functions point to application-level directories (app/)
- `built*Path()` functions point to compiled output directories
- Path is a dependency of almost every framework package
- Some paths accept `options` with `relative` flag

More from stacksjs/stacks

SkillDescription
stacks-actionsUse when working with Stacks server actions — creating actions in app/Actions/, auto-generated API actions from the useApi model trait, the 80+ default framework actions (auth, dashboard, commerce, content, deployment, jobs), action request/response handling, or action registration. Covers @stacksjs/actions and storage/framework/defaults/actions/.
stacks-aiUse when integrating AI capabilities into a Stacks application — using Anthropic/OpenAI/Ollama/AWS Bedrock drivers, image generation (DALL-E), vision analysis, RAG/vector search, embeddings, MCP (Model Context Protocol) clients, text summarization, sentiment analysis, content classification, personalization, or the buddy AI assistant. Covers @stacksjs/ai and config/ai.ts.
stacks-aliasUse when working with path aliases in a Stacks project — import resolution, module aliasing, or debugging import paths. Covers @stacksjs/alias which defines 260+ path mappings for the entire framework.
stacks-analyticsUse when adding analytics to a Stacks application — configuring Fathom or self-hosted analytics, generating tracking scripts, privacy-friendly analytics setup, or the analytics configuration. Covers @stacksjs/analytics and config/analytics.ts.
stacks-apiUse when building, modifying, or debugging API endpoints in a Stacks application — defining routes, handling requests, API middleware, working with the API server, HTTP client (fetcher), API resources, or OpenAPI generation. Covers both @stacksjs/api utilities and the stacks-api server implementation.
stacks-arraysUse when working with array utilities in Stacks — statistical operations (average, median, mode, standard deviation, z-score, percentile, covariance), array manipulation (unique, flatten, partition, shuffle, sample, move), containment checks, or the Arr facade. Covers @stacksjs/arrays.
stacks-authUse when implementing authentication, authorization, passkeys, TOTP/2FA, RBAC, gates, policies, session auth, token management, email verification, password resets, or rate limiting in a Stacks application. Covers the @stacksjs/auth package, config/auth.ts, app/Gates.ts, and app/Middleware/.
stacks-auto-importsUse when working with the Stacks auto-import system — understanding how browser and server auto-imports work, configuring auto-imported functions/models/composables, the auto-import manifests, type generation, or how globals are injected. Covers the auto-import pipeline at storage/framework/auto-imports/.
stacks-brandkitUse when defining or exploring a brand identity for a Stacks project and you want premium brand-kit REFERENCE IMAGES first - logo directions, palettes, typography specimens, identity boards, and application/mockup decks. Generates IMAGES ONLY, never code. Trained for minimalist, cinematic, editorial, dark-tech, luxury, cultural, security, gaming, developer-tool, and consumer-app brand systems with intentional logo concepting, sparse type, strong symbolic meaning, and disciplined palettes a coding step can build against.
stacks-browseUse for headless browser QA on Stacks applications — navigation, screenshots, responsive testing, console/network monitoring, and accessibility snapshots. Dependency-free: drives a system browser over the Chrome DevTools Protocol using only Bun (no Playwright/Puppeteer). Invoke with /stacks-browse.