ClawSkills logoClawSkills

Project Scaffold

生成具有标准化结构、工具链和配置的新项目,适用于 Web、API、移动端、CLI 或浏览器扩展应用。

介绍

# project-scaffold

使用最佳实践的结构、工具和配置搭建新项目。

## 用法

当 Colt(或你)需要启动一个新项目时,使用此技能生成完整的样板代码。

## 决策树

询问或推断项目类型:

### Web 应用 (React / Next.js) ``` my-app/ ├── src/ │ ├── app/ # Next.js app router │ ├── components/ # Reusable UI components │ ├── lib/ # Utilities, helpers, API clients │ ├── styles/ # Global styles, Tailwind config │ └── types/ # TypeScript type definitions ├── public/ # Static assets ├── tests/ # Test files ├── .gitignore ├── .eslintrc.json ├── tailwind.config.ts ├── tsconfig.json ├── package.json └── README.md ```

**初始化命令:** ```bash npx create-next-app@latest my-app --typescript --tailwind --eslint --app --src-dir cd my-app && npm install ```

### API / 后端 (FastAPI) ``` my-api/ ├── app/ │ ├── __init__.py │ ├── main.py # FastAPI app entry │ ├── routers/ # Route modules │ ├── models/ # Pydantic models / DB models │ ├── services/ # Business logic │ └── config.py # Settings / env vars ├── tests/ ├── .gitignore ├── pyproject.toml ├── requirements.txt └── README.md ```

**初始化命令:** ```bash mkdir my-api && cd my-api uv init && uv pip install fastapi uvicorn ```

### 移动应用 (SwiftUI) ``` MyApp/ ├── MyApp/ │ ├── App.swift │ ├── ContentView.swift │ ├── Models/ │ ├── Views/ │ ├── ViewModels/ │ └── Services/ ├── MyAppTests/ ├── MyAppUITests/ └── README.md ```

**初始化:** 使用 Xcode 或 `swift package init --type executable`

### CLI 工具 (Node / Python) ``` my-cli/ ├── src/ │ └── index.ts # Entry point ├── bin/ │ └── my-cli # Executable wrapper ├── tests/ ├── .gitignore ├── tsconfig.json ├── package.json └── README.md ```

### 浏览器扩展 ``` my-extension/ ├── src/ │ ├── background.ts │ ├── content.ts │ ├── popup/ │ │ ├── popup.html │ │ ├── popup.ts │ │ └── popup.css │ └── options/ ├── icons/ ├── manifest.json ├── .gitignore ├── tsconfig.json ├── package.json └── README.md ```

## 搭建后检查清单

生成结构后: 1. `git init && git add -A && git commit -m "Initial scaffold"` 2. 创建适合项目类型的 `.gitignore` 3. 设置代码检查 配置 (ESLint / Ruff) 4. 添加包含项目名称和安装说明的基本 README 5. 添加基本的测试文件以验证测试运行程序是否正常工作

## 资产模板

### .gitignore (通用基础) ``` node_modules/ __pycache__/ .env .env.local dist/ build/ .next/ *.pyc .DS_Store *.log coverage/ ```

更多产品