fullstack-workspace-init
32
总安装量
32
周安装量
#6372
全站排名
安装命令
npx skills add https://github.com/shipshitdev/library --skill fullstack-workspace-init
Agent 安装分布
claude-code
25
opencode
22
gemini-cli
21
codex
21
cursor
18
Skill 文档
Full Stack Workspace Init
Create a production-ready monorepo with working MVP features:
- Frontend: NextJS 16 + React 19 + TypeScript + Tailwind + @agenticindiedev/ui
- Backend: NestJS 11 + MongoDB + Clerk Auth + Swagger
- Mobile: React Native + Expo (optional)
- Quality: Vitest (80% coverage) + Biome + Husky + GitHub Actions CI/CD
- Package Manager: bun
What Makes This Different
This skill generates working applications, not empty scaffolds:
- Complete CRUD operations for your main entities
- Clerk authentication configured and working
- Tests with 80% coverage threshold
- GitHub Actions CI/CD pipeline
- Runs immediately with
bun dev
Workflow
Phase 1: PRD Brief Intake
Ask the user for a 1-2 paragraph product description, then extract and confirm:
I'll help you build [Project Name]. Based on your description, I understand:
**Entities:**
- [Entity1]: [fields]
- [Entity2]: [fields]
**Features:**
- [Feature 1]
- [Feature 2]
**Routes:**
- / - Home/Dashboard
- /[entity] - List view
- /[entity]/[id] - Detail view
**API Endpoints:**
- GET/POST /api/[entity]
- GET/PATCH/DELETE /api/[entity]/:id
Is this correct? Any adjustments?
Phase 2: Auth Setup (Always Included)
Generate Clerk authentication:
Backend:
auth/guards/clerk-auth.guard.ts– Token verification guardauth/decorators/current-user.decorator.ts– User extraction decorator
Frontend:
providers/clerk-provider.tsx– ClerkProvider wrapperapp/sign-in/[[...sign-in]]/page.tsx– Sign in pageapp/sign-up/[[...sign-up]]/page.tsx– Sign up pagemiddleware.ts– Protected route middleware
Environment:
.env.examplewith all required variables
Phase 3: Entity Generation
For each extracted entity, generate complete CRUD with tests:
Backend (NestJS):
api/apps/api/src/collections/{entity}/
âââ {entity}.module.ts
âââ {entity}.controller.ts # Full CRUD + Swagger + ClerkAuthGuard
âââ {entity}.controller.spec.ts # Controller unit tests
âââ {entity}.service.ts # Business logic
âââ {entity}.service.spec.ts # Service unit tests
âââ schemas/
â âââ {entity}.schema.ts # Mongoose schema with userId
âââ dto/
âââ create-{entity}.dto.ts # class-validator decorators
âââ update-{entity}.dto.ts # PartialType of create
api/apps/api/test/
âââ {entity}.e2e-spec.ts # E2E tests with supertest
âââ setup.ts # Test setup with MongoDB Memory Server
Frontend (NextJS):
frontend/apps/dashboard/
âââ app/{entity}/
â âââ page.tsx # List view (protected)
â âââ [id]/page.tsx # Detail view (protected)
âââ src/test/
â âââ setup.ts # Test setup with Clerk mocks
âââ vitest.config.ts # Frontend test config (jsdom)
frontend/packages/components/
âââ {entity}-list.tsx
âââ {entity}-list.spec.tsx # Component tests
âââ {entity}-form.tsx
âââ {entity}-form.spec.tsx # Component tests
âââ {entity}-item.tsx
frontend/packages/hooks/
âââ use-{entities}.ts # React hook for state management
âââ use-{entities}.spec.ts # Hook tests
frontend/packages/services/
âââ {entity}.service.ts # API client with auth headers
Phase 4: Quality Setup
Vitest Configuration:
vitest.config.tsin each project- 80% coverage threshold for lines, functions, branches
@vitest/coverage-v8provider
GitHub Actions:
.github/workflows/ci.yml- Runs on push to main and PRs
- Steps: install â lint â test â build
Husky Hooks:
- Pre-commit:
lint-staged(Biome check) - Pre-push:
bun run typecheck
Biome:
biome.jsonin each project- 100 character line width
- Double quotes, semicolons
Phase 5: Verification
Run quality gate and report results:
â
Generation complete!
Quality Report:
- bun install: â succeeded
- bun run lint: â 0 errors
- bun run test: â 24 tests passed
- Coverage: 82% (threshold: 80%)
Ready to run:
cd [project]
bun dev
Usage
# Create workspace with PRD-style prompt
python3 ~/.claude/skills/fullstack-workspace-init/scripts/init-workspace.py \
--root ~/www/myproject \
--name "My Project" \
--brief "A task management app where users can create tasks with titles and due dates, organize them into projects, and mark them complete."
# Or interactive mode (prompts for brief)
python3 ~/.claude/skills/fullstack-workspace-init/scripts/init-workspace.py \
--root ~/www/myproject \
--name "My Project" \
--interactive
Generated Structure
myproject/
âââ .github/
â âââ workflows/
â âââ ci.yml # GitHub Actions CI/CD
âââ .husky/
â âââ pre-commit # Lint staged files
â âââ pre-push # Type check
âââ .agents/ # AI documentation
âââ package.json # Workspace root
âââ biome.json # Root linting config
â
âââ api/ # NestJS backend
â âââ apps/api/src/
â â âââ main.ts
â â âââ app.module.ts
â â âââ auth/
â â â âââ guards/clerk-auth.guard.ts
â â â âââ guards/clerk-auth.guard.spec.ts # Auth guard tests
â â â âââ decorators/current-user.decorator.ts
â â âââ collections/
â â âââ {entity}/
â â âââ {entity}.controller.ts
â â âââ {entity}.controller.spec.ts # Controller tests
â â âââ {entity}.service.ts
â â âââ {entity}.service.spec.ts # Service tests
â âââ apps/api/test/
â â âââ {entity}.e2e-spec.ts # E2E tests
â â âââ setup.ts # E2E test setup
â âââ vitest.config.ts
â âââ package.json
â âââ .env.example
â
âââ frontend/ # NextJS apps
â âââ apps/dashboard/
â â âââ app/
â â â âââ layout.tsx
â â â âââ page.tsx
â â â âââ sign-in/[[...sign-in]]/page.tsx
â â â âââ sign-up/[[...sign-up]]/page.tsx
â â â âââ {entity}/ # Generated per entity
â â âââ src/test/
â â â âââ setup.ts # Test setup with Clerk mocks
â â âââ middleware.ts # Clerk route protection
â â âââ providers/
â â âââ clerk-provider.tsx
â âââ packages/
â â âââ components/
â â â âââ {entity}-list.tsx
â â â âââ {entity}-list.spec.tsx # Component tests
â â â âââ {entity}-form.tsx
â â â âââ {entity}-form.spec.tsx # Component tests
â â âââ hooks/
â â â âââ use-{entities}.ts
â â â âââ use-{entities}.spec.ts # Hook tests
â â âââ services/ # API clients
â â âââ interfaces/
â âââ vitest.config.ts # Frontend test config (jsdom)
â âââ package.json
â
âââ mobile/ # React Native + Expo (optional)
â âââ ...
â
âââ packages/ # Shared packages
âââ packages/
âââ common/
â âââ interfaces/
â âââ enums/
âââ helpers/
Key Patterns
Backend Controller Pattern
@ApiTags('tasks')
@ApiBearerAuth()
@UseGuards(ClerkAuthGuard)
@Controller('tasks')
export class TasksController {
constructor(private readonly tasksService: TasksService) {}
@Post()
@ApiOperation({ summary: 'Create a new task' })
create(
@Body() createTaskDto: CreateTaskDto,
@CurrentUser() user: { userId: string },
) {
return this.tasksService.create(createTaskDto, user.userId);
}
// ... full CRUD
}
Backend Service Pattern
@Injectable()
export class TasksService {
constructor(
@InjectModel(Task.name) private taskModel: Model<TaskDocument>,
) {}
async create(createTaskDto: CreateTaskDto, userId: string): Promise<Task> {
const task = new this.taskModel({ ...createTaskDto, userId });
return task.save();
}
// ... full CRUD with userId filtering
}
Frontend Component Pattern
'use client';
import { useEffect, useState } from 'react';
import { TaskService } from '@services/task.service';
import { Task } from '@interfaces/task.interface';
export function TaskList() {
const [tasks, setTasks] = useState<Task[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
const controller = new AbortController();
TaskService.getAll({ signal: controller.signal })
.then(setTasks)
.finally(() => setLoading(false));
return () => controller.abort();
}, []);
// ... render
}
Additional Scripts
# Add a new entity to existing project
python3 ~/.claude/skills/fullstack-workspace-init/scripts/add-entity.py \
--root ~/www/myproject \
--name "comment" \
--fields "content:string,taskId:string"
# Add a new frontend app
python3 ~/.claude/skills/fullstack-workspace-init/scripts/add-frontend-app.py \
--root ~/www/myproject/frontend \
--name admin
Development Commands
After scaffolding:
cd myproject
# Install all dependencies
bun install
# Start all services (backend + frontend)
bun dev
# Or start individually
bun run dev:api # Backend on :3001
bun run dev:frontend # Frontend on :3000
bun run dev:mobile # Mobile via Expo
# Quality commands
bun run lint # Check code style
bun run test # Run tests
bun run test:coverage # Run with coverage
bun run typecheck # Type checking
Environment Variables
Create .env files based on .env.example:
API (.env):
PORT=3001
MONGODB_URI=mongodb://localhost:27017/myproject
CLERK_SECRET_KEY=sk_test_...
Frontend (.env.local):
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
NEXT_PUBLIC_API_URL=http://localhost:3001
References
references/templates/– Code generation templatesservice.spec.template.ts– NestJS service unit test templatecontroller.spec.template.ts– NestJS controller unit test templatee2e.spec.template.ts– E2E test template with supertest + MongoDB Memory Servercomponent.spec.template.tsx– React component test templatehook.spec.template.ts– React hook test templatetest-setup.template.ts– Frontend test setup with Clerk mocks
references/vitest.config.ts– Backend Vitest configuration (80% coverage)references/vitest.config.frontend.ts– Frontend Vitest configuration (jsdom)references/github-actions/ci.yml– CI/CD workflowreferences/architecture-guide.md– Architectural decisionsreferences/coding-standards.md– Coding rules