
Lovstudio Project Port
- 10 installs
- Updated August 4, 2026
- lovstudio/dev-skills
Helps with ai & agent building tasks.
About
lovstudio-project-port is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- lovstudio-project-port
- AI & Agent Building
- AI-coding skill
Lovstudio Project Port by the numbers
- 10 all-time installs (skills.sh)
- +2 installs in the week ending Aug 2, 2026 (Skillselion tracking)
- Ranked #11,959 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/lovstudio/dev-skills --skill lovstudio-project-portAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 10 |
|---|---|
| Last updated | August 4, 2026 |
| Repository | lovstudio/dev-skills ↗ |
What it does
Helps with ai & agent building tasks.
Files
Project Port Generator
为项目生成稳定唯一的端口号(范围 3000-8999),同一项目名永远返回相同端口。
端口生成算法
def generate_port(project_name: str) -> int:
hash_value = sum(ord(c) * (i + 1) for i, c in enumerate(project_name))
return 3000 + (hash_value % 6000)使用场景
1. 查询项目端口
用户询问端口时,直接计算并告知:
项目 "lovstudio" 的端口号是:79652. 更新项目配置
检测并更新项目中的端口配置文件:
| 文件 | 配置方式 |
|---|---|
.env / .env.local | PORT=<port> |
package.json | scripts 中的 --port <port> |
vite.config.ts | server.port: <port> |
next.config.js | 通常使用 .env |
更新时优先使用 .env 方式,最小侵入性。
3. 启动开发服务器
PORT=$(scripts/hashport.sh) pnpm dev脚本
运行 scripts/hashport.sh [project-name] 生成端口:
# 使用当前目录名
./scripts/hashport.sh
# 输出: 7965
# 指定项目名
./scripts/hashport.sh my-project
# 输出: 5123端口冲突处理
若端口被占用: 1. 提示用户哪个进程占用了端口 2. 建议使用 lsof -i :<port> 查看 3. 可追加后缀生成备用端口:generate_port("project-dev")
Changelog
All notable changes to this skill are documented here. Format: Keep a Changelog · Versioning: SemVer
[0.1.1] - 2026-05-07
Fixed
- standardize Agent Skills metadata and README
- document stable project port algorithm and install surface
lovstudio:project-port
Generate a stable project-specific development port in the 3000-8999 range, then help wire it into .env, package scripts, Vite, or other dev-server config.
Part of lovstudio dev skills — by lovstudio.ai
Install
npx lovstudio skills add project-port -g -yUsage
./scripts/hashport.sh
./scripts/hashport.sh my-projectThe script prints the port to stdout and reports occupancy to stderr when lsof is available.
Algorithm
port = 3000 + (sum(ord(c) * (i + 1) for i, c in enumerate(project_name)) % 6000)The same project name always maps to the same port.
Common Targets
| File | Update |
|---|---|
.env / .env.local | PORT=<port> |
package.json | add or update --port <port> in dev scripts |
vite.config.ts | set server.port |
License
MIT
#!/bin/bash
# 基于项目名生成稳定端口号
# Usage: hashport.sh [project-name]
# 如不指定项目名,使用当前目录名
name="${1:-$(basename "$PWD")}"
# 计算哈希值
hash=0
for ((i=0; i<${#name}; i++)); do
char="${name:$i:1}"
ord=$(printf '%d' "'$char")
hash=$((hash + ord * (i + 1)))
done
# 生成端口 (范围 3000-8999)
port=$((3000 + (hash % 6000)))
# 检查端口状态
if command -v lsof &>/dev/null && lsof -i :"$port" &>/dev/null; then
proc=$(lsof -i :"$port" | awk 'NR==2 {print $1}')
echo "$port ← $name (occupied by $proc)" >&2
else
echo "$port ← $name" >&2
fi
echo "$port"