setup-portless

GitHub

配置 Portless 工具,将 localhost:端口替换为稳定的 .localhost 域名,解决本地开发中的端口冲突、Cookie 碰撞及多服务路由问题。

.claude/skills/setup-portless/SKILL.md qdhenry/Claude-Command-Suite

Trigger Scenarios

配置本地开发环境 解决端口冲突 设置 monorepo 开发路由

Install

npx skills add qdhenry/Claude-Command-Suite --skill setup-portless -g -y
More Options

Non-standard path

npx skills add https://github.com/qdhenry/Claude-Command-Suite/tree/main/.claude/skills/setup-portless -g -y

Use without installing

npx skills use qdhenry/Claude-Command-Suite@setup-portless

指定 Agent (Claude Code)

npx skills add qdhenry/Claude-Command-Suite --skill setup-portless -a claude-code -g -y

安装 repo 全部 skill

npx skills add qdhenry/Claude-Command-Suite --all -g -y

预览 repo 内 skill

npx skills add qdhenry/Claude-Command-Suite --list

SKILL.md

Frontmatter
{
    "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."
}
Set up [Portless](https://github.com/vercel-labs/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.

<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>

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 workspaces field, or pnpm-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.projectname for backend
  • web.projectname or projectname for frontend
  • docs.projectname for 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

<common_patterns>

**Single application:**
{
  "scripts": {
    "dev": "portless myapp next dev"
  }
}

Access at: http://myapp.localhost:1355

**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:1355
  • http://api.myapp.localhost:1355
  • http://docs.myapp.localhost:1355
**Custom proxy port (e.g., port 80 for clean URLs):**
sudo portless proxy start -p 80
# Then: http://myapp.localhost (no port needed)

</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>

The proxy auto-starts when you run `portless `, so there is no need to manually start it. Only use `portless proxy start` for custom port configuration. Portless does not support Windows. Only set up on macOS or Linux. Portless requires Node.js 20+. Do not attempt installation on older versions.

</anti_patterns>

<success_criteria> Setup is complete when:

  • Portless is installed globally (portless --version succeeds)
  • Project package.json dev script(s) are wrapped with portless <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>

Version History

  • e89b2f0 Current 2026-08-20 06:58

Same Skill Collection

.claude/skills/audit-env-variables/SKILL.md
.claude/skills/bigcommerce-api/SKILL.md
.claude/skills/elevenlabs-transcribe/SKILL.md
.claude/skills/extract-video-frames/SKILL.md
.claude/skills/file-watcher/SKILL.md
.claude/skills/remove-dead-code/SKILL.md
.claude/skills/setup-agent-tail/SKILL.md
.claude/skills/webmcp/SKILL.md

Metadata

Files
0
Version
e89b2f0
Hash
7f68473a
Indexed
2026-08-20 06:58

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-22 04:20
浙ICP备14020137号-1 $mapa de visitantes$