setup-portless
Sets up Portless for a project to replace port numbers with stable named .localhost URLs. Use when configuring local development routing, fixing port conflicts, or setting up monorepo dev environments.
- License 许可
- MIT
- 最近更新
- 2026-05-18
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- setup-portless
- description
- Sets up Portless for a project to replace port numbers with stable named .localhost URLs. Use when configuring local development routing, fixing port conflicts, or setting up monorepo dev environments.
03 SKILL.md 正文
<objective>
Set up Portless for the current project. Portless replaces localhost:PORT with stable named URLs like myapp.localhost:1355, eliminating port conflicts, cookie collisions, and port-guessing issues for both developers and AI agents.
Requirements: Node.js 20+, macOS or Linux. </objective>
<quick_start> Run these commands to get started:
# Install globally
npm install -g portless
# Start the proxy daemon
portless proxy start
# Run your app with a named route
portless myapp next dev
# => http://myapp.localhost:1355
</quick_start>
<process>
Step 1: Verify prerequisites
Check Node.js version is 20+ and platform is macOS or Linux:
node --version
uname -s
If Node.js < 20, inform the user they need to upgrade before proceeding.
Step 2: Detect project context
Read package.json to understand:
- Project name (use as default app name)
- Existing dev scripts (to know what command to wrap)
- Whether this is a monorepo (look for
workspacesfield, orpnpm-workspace.yaml,turbo.json,lerna.json) - Framework in use (Next.js, Vite, Express, etc.) from dependencies
Step 3: Install Portless
npm install -g portless
Step 4: Choose app name(s)
Ask the user what name they want for their app URL. Suggest based on project name.
For monorepos, suggest subdomain naming:
api.projectnamefor backendweb.projectnameorprojectnamefor frontenddocs.projectnamefor documentation
Step 5: Update package.json scripts
Wrap the existing dev script with portless. For example, if the current script is:
{ "dev": "next dev" }
Update to:
{ "dev": "portless myapp next dev" }
For monorepos, update each workspace's package.json similarly.
Step 6: Verify setup
Run the dev script and confirm the app is accessible at the named URL:
npm run dev
The proxy auto-starts if not already running. Confirm output shows the .localhost:1355 URL.
Verify routes are registered:
portless list
</process>
<common_patterns>
<pattern name="single-app"> Single application:
{
"scripts": {
"dev": "portless myapp next dev"
}
}
Access at: http://myapp.localhost:1355
</pattern>
<pattern name="monorepo"> Monorepo with multiple services:
# In packages/web/package.json
"dev": "portless web.myapp next dev"
# In packages/api/package.json
"dev": "portless api.myapp node server.js"
# In packages/docs/package.json
"dev": "portless docs.myapp next dev"
Access at:
http://web.myapp.localhost:1355http://api.myapp.localhost:1355http://docs.myapp.localhost:1355</pattern>
<pattern name="custom-proxy-port"> Custom proxy port (e.g., port 80 for clean URLs):
sudo portless proxy start -p 80
# Then: http://myapp.localhost (no port needed)
</pattern>
</common_patterns>
<environment_variables>
| Variable | Purpose | Default |
|---|---|---|
PORTLESS=0 or PORTLESS=skip |
Bypass portless, use default port | (not set) |
PORTLESS_PORT |
Override proxy port | 1355 |
PORTLESS_STATE_DIR |
Custom state directory | ~/.portless or /tmp/portless |
</environment_variables>
<cli_reference>
| Command | Purpose |
|---|---|
portless <name> <cmd> [args...] |
Run app with named route |
portless list |
Show active routes |
portless proxy start |
Start daemon proxy on port 1355 |
portless proxy start -p <port> |
Start on custom port |
portless proxy start --foreground |
Run in foreground (debugging) |
portless proxy stop |
Stop the proxy daemon |
</cli_reference>
<anti_patterns>
<pitfall name="forgetting-proxy">
The proxy auto-starts when you run portless <name> <cmd>, so there is no need to manually start it. Only use portless proxy start for custom port configuration.
</pitfall>
<pitfall name="windows"> Portless does not support Windows. Only set up on macOS or Linux. </pitfall>
<pitfall name="old-node"> Portless requires Node.js 20+. Do not attempt installation on older versions. </pitfall>
</anti_patterns>
<success_criteria> Setup is complete when:
- Portless is installed globally (
portless --versionsucceeds) - Project
package.jsondev script(s) are wrapped withportless <name> - Running
npm run dev(or equivalent) shows the app accessible at<name>.localhost:1355 - For monorepos, each workspace has its own named route </success_criteria>
04 同仓库更多 Skills
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
web-design-guidelines
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
vercel-react-view-transitions
Guide for implementing smooth, native-feeling animations using React's View Transition API (`<ViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components, animate list reorder, implement directional (forward/back) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.
vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
vercel-composition-patterns
React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.
vercel-cli-with-tokens
Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".