Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add miles-knowbl/orchestrator --skill "scaffold"
Install specific skill from multi-skill repository
# Description
Generate project and feature scaffolding with proper structure, configuration, and boilerplate. Creates new projects from scratch or adds features to existing codebases. Applies stack-specific conventions, tooling setup, and best practices. Produces ready-to-develop foundations that follow team standards.
# SKILL.md
name: scaffold
description: "Generate project and feature scaffolding with proper structure, configuration, and boilerplate. Creates new projects from scratch or adds features to existing codebases. Applies stack-specific conventions, tooling setup, and best practices. Produces ready-to-develop foundations that follow team standards."
phase: SCAFFOLD
category: core
version: "1.0.0"
depends_on: ["spec"]
tags: [setup, structure, boilerplate]
Scaffold
Generate project and feature scaffolding with proper structure.
When to Use
- New project β Starting from scratch, need full setup
- New feature β Adding feature to existing codebase
- New service β Adding service to existing system
- Migration β Moving to new structure or stack
- When you say: "scaffold this", "set up a new project", "create the structure for"
Reference Requirements
MUST read before applying this skill:
| Reference | Why Required |
|---|---|
directory-structures.md |
Standard project layouts |
configuration-templates.md |
Config file templates |
Read if applicable:
| Reference | When Needed |
|---|---|
project-templates.md |
When creating new projects |
service-templates.md |
When adding services |
documentation-templates.md |
When setting up docs structure |
Verification: Ensure scaffold builds and runs before proceeding.
Required Deliverables
| Deliverable | Location | Condition |
|---|---|---|
| Project directory structure | Project root | Always |
package.json or equivalent |
Project root | Always |
tsconfig.json / config files |
Project root | As applicable |
README.md |
Project root | Always (initial) |
Core Concept
Scaffold answers: "What's the starting structure for this?"
Good scaffolding is:
- Consistent β Follows established patterns and conventions
- Complete β Includes all necessary configuration
- Minimal β No unnecessary boilerplate
- Ready β Can start development immediately
Scaffolding is NOT:
- Implementation (that's implement)
- Architecture design (that's architect)
- Code generation for business logic
Scaffolding Types
| Type | Scope | Output |
|---|---|---|
| Project | Entire new project | Full directory structure, config, tooling |
| Feature | New feature in existing project | Feature directory, components, tests |
| Service | New service in system | Service boilerplate, API, deployment |
| Module | New module/package | Module structure, exports, tests |
| Component | UI component | Component file(s), styles, tests |
The Scaffolding Process
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SCAFFOLDING PROCESS β
β β
β 1. UNDERSTAND CONTEXT β
β βββ What type? What stack? What conventions? β
β β
β 2. IDENTIFY REQUIREMENTS β
β βββ What's needed? What integrations? What tools? β
β β
β 3. SELECT TEMPLATE β
β βββ Use existing template or create custom? β
β β
β 4. CUSTOMIZE CONFIGURATION β
β βββ Adapt template to specific needs β
β β
β 5. GENERATE STRUCTURE β
β βββ Create directories, files, boilerplate β
β β
β 6. VERIFY SETUP β
β βββ Does it build? Does it run? Are tools working? β
β β
β 7. DOCUMENT β
β βββ README, setup instructions, conventions β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Step 1: Understand Context
Before scaffolding, gather:
| Aspect | Questions |
|---|---|
| Type | Project, feature, service, module, component? |
| Stack | Languages, frameworks, tools? |
| Conventions | Existing patterns? Team standards? |
| Environment | Dev, staging, prod? Cloud provider? |
| Team | Experience level? Preferred tools? |
Context Checklist
- [ ] Scaffolding type identified
- [ ] Technology stack confirmed
- [ ] Existing conventions documented
- [ ] Target environment understood
- [ ] Team preferences known
Step 2: Identify Requirements
Project Requirements
## Project Scaffolding Requirements
**Core:**
- [ ] Language/runtime version
- [ ] Framework and version
- [ ] Package manager
- [ ] Build tooling
**Development:**
- [ ] Linting configuration
- [ ] Formatting configuration
- [ ] Testing framework
- [ ] Development server
**Infrastructure:**
- [ ] Docker/containerization
- [ ] CI/CD pipeline
- [ ] Deployment configuration
- [ ] Environment management
**Integrations:**
- [ ] Database
- [ ] Authentication
- [ ] External APIs
- [ ] Monitoring/logging
Feature Requirements
## Feature Scaffolding Requirements
- [ ] Feature name and location
- [ ] Components needed (UI, API, data)
- [ ] Test files needed
- [ ] Shared dependencies
- [ ] Routing/navigation integration
Step 3: Select Template
Template Decision
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β Existing project with conventions? β
β β β
β βββ YES β Follow existing patterns β
β β β
β βββ NO β Standard template exists? β
β β β
β βββ YES β Use standard template β
β β β
β βββ NO β Create minimal custom β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Standard Templates
| Stack | Template Source | Notes |
|---|---|---|
| React | Create React App, Vite, Next.js | Vite preferred for new projects |
| Vue | create-vue, Nuxt | |
| Node.js | Express generator, Fastify CLI | |
| Python | Poetry new, Cookiecutter | |
| Django | django-admin startproject | |
| Go | Standard layout, go mod init | |
| Rust | cargo new |
β See references/project-templates.md
Brownfield Project Handling
CRITICAL: Before scaffolding, detect existing project setup.
Detection Checklist
Run these checks before generating any files:
| Check | Files to Look For | If Found |
|---|---|---|
| Package manager | pnpm-lock.yaml, yarn.lock, package-lock.json, bun.lockb |
Use detected package manager |
| Framework | next.config.*, nuxt.config.*, svelte.config.*, vite.config.*, elm.json, angular.json |
Follow framework conventions |
| Backend | manage.py, go.mod, Cargo.toml, requirements.txt, pyproject.toml |
Follow backend patterns |
| Directory structure | src/, lib/, app/, packages/ |
Follow existing structure |
| Config files | tsconfig.json, .eslintrc.*, .prettierrc |
Extend, don't replace |
| Test framework | jest.config.*, vitest.config.*, pytest.ini |
Use existing test setup |
| Build tooling | vite.config.*, webpack.config.*, turbo.json |
Use existing bundler |
| Database | prisma/, drizzle.config.*, migrations/, alembic/ |
See infra-database skill |
| Docker | docker-compose.yml, Dockerfile |
See infra-docker skill |
If Existing Project Found
| Scenario | Action |
|---|---|
| Adding feature to existing project | Follow existing patterns exactly |
| Has different tech than requested | Clarify with user: extend existing or migrate? |
| Has partial setup | Complete setup without replacing existing config |
| Converting structure | Gradual migration, preserve functionality first |
| Has Makefile or scripts/dev.sh | Preserve/wrap existing interfaces |
Universal Package Manager Detection
detect_package_manager() {
[ -f "pnpm-lock.yaml" ] && echo "pnpm" && return
[ -f "yarn.lock" ] && echo "yarn" && return
[ -f "bun.lockb" ] && echo "bun" && return
[ -f "package-lock.json" ] && echo "npm" && return
[ -f "package.json" ] && echo "npm" && return
[ -f "poetry.lock" ] && echo "poetry" && return
[ -f "Pipfile.lock" ] && echo "pipenv" && return
[ -f "go.mod" ] && echo "go" && return
[ -f "Cargo.toml" ] && echo "cargo" && return
[ -f "Gemfile.lock" ] && echo "bundler" && return
echo "unknown"
}
Brownfield Decision Tree
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β Does project have existing package.json / pyproject.toml / go.mod? β
β β β
β βββ YES β Does it have existing directory structure? β
β β β β
β β βββ YES β BROWNFIELD: Follow existing patterns β
β β β β
β β βββ NO β PARTIAL: Complete setup carefully β
β β β
β βββ NO β GREENFIELD: Use standard templates β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Step 4: Customize Configuration
Configuration Layers
βββββββββββββββββββββββββββββββββββββββββββ
β Application Config β β app.config.ts, settings.py
βββββββββββββββββββββββββββββββββββββββββββ€
β Build/Bundle Config β β vite.config.ts, webpack.config.js
βββββββββββββββββββββββββββββββββββββββββββ€
β Tooling Config β β eslint, prettier, jest
βββββββββββββββββββββββββββββββββββββββββββ€
β Environment Config β β .env, docker-compose
βββββββββββββββββββββββββββββββββββββββββββ€
β Infrastructure Config β β Dockerfile, k8s, terraform
βββββββββββββββββββββββββββββββββββββββββββ
Essential Configuration Files
| Category | Files | Purpose |
|---|---|---|
| Package | package.json, pyproject.toml, go.mod | Dependencies |
| TypeScript | tsconfig.json | Compiler options |
| Linting | .eslintrc, .pylintrc, .golangci.yml | Code quality |
| Formatting | .prettierrc, .editorconfig | Code style |
| Testing | jest.config.js, pytest.ini | Test runner |
| Git | .gitignore, .gitattributes | Version control |
| Environment | .env.example, .env.local | Env variables |
| Docker | Dockerfile, docker-compose.yml | Containerization |
| CI/CD | .github/workflows/, .gitlab-ci.yml | Automation |
β See references/configuration-templates.md
Step 5: Generate Structure
Project Structure Principles
| Principle | Description |
|---|---|
| Flat over nested | Avoid deep nesting (max 3-4 levels) |
| Feature-based | Group by feature, not by type |
| Predictable | Consistent naming, obvious locations |
| Scalable | Structure that works at 10x size |
Common Structures
Frontend (React/Vue)
project/
βββ src/
β βββ components/ # Shared components
β β βββ Button/
β β βββ Button.tsx
β β βββ Button.test.tsx
β β βββ index.ts
β βββ features/ # Feature modules
β β βββ auth/
β β βββ components/
β β βββ hooks/
β β βββ api.ts
β β βββ index.ts
β βββ hooks/ # Shared hooks
β βββ lib/ # Utilities
β βββ types/ # TypeScript types
β βββ App.tsx
β βββ main.tsx
βββ public/
βββ tests/
β βββ e2e/
β βββ integration/
βββ .env.example
βββ package.json
βββ tsconfig.json
βββ vite.config.ts
βββ README.md
Backend (Node.js/Express)
project/
βββ src/
β βββ modules/ # Feature modules
β β βββ users/
β β βββ users.controller.ts
β β βββ users.service.ts
β β βββ users.repository.ts
β β βββ users.routes.ts
β β βββ users.types.ts
β β βββ users.test.ts
β βββ common/ # Shared code
β β βββ middleware/
β β βββ errors/
β β βββ utils/
β βββ config/ # Configuration
β βββ database/ # DB setup, migrations
β βββ app.ts # Express app setup
β βββ server.ts # Entry point
βββ tests/
β βββ integration/
β βββ fixtures/
βββ scripts/
βββ .env.example
βββ package.json
βββ tsconfig.json
βββ Dockerfile
βββ README.md
Backend (Python/Django)
project/
βββ src/
β βββ project_name/
β βββ apps/
β β βββ users/
β β βββ models.py
β β βββ views.py
β β βββ serializers.py
β β βββ urls.py
β β βββ tests/
β βββ core/ # Shared code
β βββ settings/
β β βββ base.py
β β βββ development.py
β β βββ production.py
β βββ urls.py
β βββ wsgi.py
βββ tests/
βββ scripts/
βββ pyproject.toml
βββ Dockerfile
βββ README.md
β See references/directory-structures.md
Step 6: Verify Setup
Verification Checklist
## Scaffolding Verification
### Build
- [ ] Dependencies install without errors
- [ ] Project builds/compiles successfully
- [ ] No TypeScript/type errors
- [ ] Linting passes
### Run
- [ ] Development server starts
- [ ] Application renders/responds
- [ ] Hot reload works
- [ ] Environment variables load
### Test
- [ ] Test runner executes
- [ ] Sample tests pass
- [ ] Coverage reporting works
### Tools
- [ ] Linting works (IDE and CLI)
- [ ] Formatting works
- [ ] Git hooks run (if configured)
- [ ] CI pipeline runs (if configured)
Smoke Test Commands
# Install dependencies
npm install # or yarn, pnpm, pip install, go mod download
# Build
npm run build # or equivalent
# Lint
npm run lint
# Test
npm run test
# Start dev server
npm run dev
Step 7: Document
README Template
# Project Name
Brief description of what this project does.
## Prerequisites
- Node.js 18+
- pnpm 8+
- PostgreSQL 14+
## Getting Started
1. Clone the repository
2. Copy environment file: `cp .env.example .env`
3. Install dependencies: `pnpm install`
4. Start database: `docker-compose up -d db`
5. Run migrations: `pnpm db:migrate`
6. Start dev server: `pnpm dev`
## Scripts
| Script | Description |
|--------|-------------|
| `dev` | Start development server |
| `build` | Build for production |
| `test` | Run tests |
| `lint` | Run linter |
| `format` | Format code |
## Project Structure
[Brief explanation of directory structure]
## Environment Variables
| Variable | Description | Required |
|----------|-------------|----------|
| `DATABASE_URL` | PostgreSQL connection string | Yes |
| `API_KEY` | External API key | Yes |
## Deployment
[Deployment instructions]
## Contributing
[Contribution guidelines]
β See references/documentation-templates.md
Feature Scaffolding
Feature Structure
When adding a feature to existing project:
src/features/[feature-name]/
βββ components/ # Feature-specific components
β βββ FeatureComponent.tsx
βββ hooks/ # Feature-specific hooks
β βββ useFeature.ts
βββ api/ # API calls
β βββ featureApi.ts
βββ types/ # Type definitions
β βββ feature.types.ts
βββ utils/ # Utilities
β βββ featureUtils.ts
βββ __tests__/ # Tests
β βββ Feature.test.tsx
βββ index.ts # Public exports
Feature Checklist
## Feature Scaffolding Checklist
### Structure
- [ ] Feature directory created
- [ ] Components directory (if UI)
- [ ] Hooks directory (if needed)
- [ ] API module (if backend calls)
- [ ] Types file
- [ ] Test files
- [ ] Index file with exports
### Integration
- [ ] Route added (if needed)
- [ ] Navigation updated (if needed)
- [ ] State management connected (if needed)
- [ ] API endpoints defined
### Boilerplate
- [ ] Component skeleton
- [ ] Hook skeleton
- [ ] Test skeleton
- [ ] Type definitions
Service Scaffolding
Microservice Structure
service-name/
βββ src/
β βββ handlers/ # Request handlers
β βββ services/ # Business logic
β βββ repositories/ # Data access
β βββ models/ # Data models
β βββ middleware/ # Middleware
β βββ config/ # Configuration
β βββ index.ts # Entry point
βββ tests/
βββ scripts/
βββ Dockerfile
βββ docker-compose.yml
βββ .env.example
βββ package.json
βββ README.md
Service Checklist
## Service Scaffolding Checklist
### Core
- [ ] Entry point configured
- [ ] HTTP server setup
- [ ] Health check endpoint
- [ ] Graceful shutdown
### Configuration
- [ ] Environment variables
- [ ] Config validation
- [ ] Secrets management
### Infrastructure
- [ ] Dockerfile
- [ ] Docker Compose (dev)
- [ ] Kubernetes manifests (if needed)
### Observability
- [ ] Logging setup
- [ ] Metrics endpoint
- [ ] Tracing setup (if needed)
### CI/CD
- [ ] Build workflow
- [ ] Test workflow
- [ ] Deploy workflow
β See references/service-templates.md
Stack-Specific Guidance
TypeScript/Node.js
// tsconfig.json essentials
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
Python
# pyproject.toml essentials
[project]
name = "project-name"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = []
[project.optional-dependencies]
dev = [
"pytest>=7.0",
"ruff>=0.1",
"mypy>=1.0",
]
[tool.ruff]
line-length = 88
select = ["E", "F", "I"]
[tool.mypy]
strict = true
Go
// Standard project layout
project/
βββ cmd/
β βββ server/
β βββ main.go
βββ internal/
β βββ handlers/
β βββ services/
β βββ models/
βββ pkg/ # Public packages
βββ go.mod
βββ go.sum
βββ Makefile
β See references/stack-configurations.md
Common Pitfalls
| Pitfall | Problem | Solution |
|---|---|---|
| Over-scaffolding | Too many empty directories | Only create what you need now |
| Wrong abstraction level | Premature service extraction | Start simple, extract when needed |
| Inconsistent naming | Mixed conventions | Establish and follow naming rules |
| Missing configuration | Works locally, fails in CI | Include all config files |
| No verification | Scaffold doesn't build | Always verify setup works |
Output Checklist
Before considering scaffolding complete:
## Scaffolding Completion Checklist
### Structure
- [ ] All necessary directories created
- [ ] Entry points configured
- [ ] Exports properly defined
### Configuration
- [ ] Package manager configured
- [ ] Build tooling configured
- [ ] Linting configured
- [ ] Formatting configured
- [ ] Testing configured
- [ ] Environment management set up
### Verification
- [ ] Dependencies install
- [ ] Project builds
- [ ] Tests run
- [ ] Dev server starts
- [ ] Linting passes
### Documentation
- [ ] README with setup instructions
- [ ] Environment variables documented
- [ ] Scripts documented
- [ ] Structure explained
Relationship to Other Skills
| Skill | Relationship |
|---|---|
architect |
Architecture informs scaffold structure |
frontend-design |
(Frontend systems) DESIGN.md informs component directory structure |
spec |
Spec may define required components to scaffold |
implement |
Scaffold provides foundation for implementation |
code-verification |
Scaffold should pass verification from start |
Key Principles
Start minimal. Add structure as needed, not preemptively.
Follow conventions. Use established patterns for the stack.
Verify immediately. A scaffold that doesn't build is useless.
Document setup. Others need to know how to get started.
Consistency over novelty. Match existing project patterns when adding features.
References
references/project-templates.md: Full project templates by stackreferences/directory-structures.md: Directory layout patternsreferences/configuration-templates.md: Config file templatesreferences/service-templates.md: Microservice scaffoldingreferences/documentation-templates.md: README and doc templatesreferences/stack-configurations.md: Stack-specific setup guides
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.