From scaffold-project
This skill should be used when the user asks to "scaffold a new project", "initialize a new repo", "set up a new TypeScript/Python/Swift project", "add linting configs", "retrofit an existing project with configs", "update project templates", "add vitest", "add playwright", "add browser testing", "add e2e tests", "set up testing", or mentions setting up oxlint, oxfmt, oxc, ruff, swiftlint, swiftformat, basedpyright, vitest, playwright, cursor rules, or CLAUDE.md. Provides guided project scaffolding with standard dev configs.
npx claudepluginhub shravansunder/ai-tools --plugin ai-scaffoldThis skill uses the workspace's default tool permissions.
Scaffold new projects or retrofit existing ones with standardized development configurations including linters, type checkers, testing setup, IDE hooks, and AI assistant configs.
Implements structured self-debugging workflow for AI agent failures: capture errors, diagnose patterns like loops or context overflow, apply contained recoveries, and generate introspection reports.
Monitors deployed URLs for regressions in HTTP status, console errors, performance metrics, content, network, and APIs after deploys, merges, or upgrades.
Provides React and Next.js patterns for component composition, compound components, state management, data fetching, performance optimization, forms, routing, and accessible UIs.
Scaffold new projects or retrofit existing ones with standardized development configurations including linters, type checkers, testing setup, IDE hooks, and AI assistant configs.
DO NOT run the scaffold script immediately. Follow this flow:
This saves time by avoiding manual corrections after the fact.
This skill guides through three modalities:
| Category | TypeScript | Python | Swift |
|---|---|---|---|
| Linter | Oxlint (strict) | Ruff | SwiftLint (strict) |
| Formatter | Oxfmt | Ruff | SwiftFormat |
| Type Checker | TypeScript strict | BasedPyright | Swift compiler |
| Testing | Vitest (+ browser mode, Playwright) | Pytest (+ marks) | Swift Testing |
| Package Manager | pnpm | uv | SPM |
| IDE Hooks | Cursor afterFileEdit | Cursor afterFileEdit | Cursor afterFileEdit |
| AI Hooks | Claude PostToolUse | Claude PostToolUse | Claude PostToolUse |
IMPORTANT: Ask ALL questions FIRST, collect ALL preferences, THEN execute ONCE.
Silently check if scaffolding a new project or retrofitting:
ls -la package.json pyproject.toml .git 2>/dev/null
Use AskUserQuestion to collect ALL preferences before executing anything. Ask in batches:
Batch 1: Project Basics
Question 1: "What type of project are you creating?"
Options:
- Single-package TypeScript
- Single-package Python
- Single-package Swift/SwiftUI
- Monorepo TypeScript (pnpm workspaces)
- Monorepo Python (uv workspaces)
- Monorepo TypeScript + Python
- Monorepo Swift + TypeScript (SwiftUI + React webviews)
Question 2: "What is the project name?" (kebab-case)
Batch 2: Directory Structure (for monorepos)
Question: "What top-level directories do you want?"
Options (multiSelect: true):
- apps/ (Recommended) - Deployable applications
- packages/ (Recommended) - Shared libraries
- services/ - Backend services
- tools/ - CLI tools and scripts
Batch 3: Testing Setup
Question (TypeScript): "Which testing features do you need?"
Options (multiSelect: true):
- Vitest unit tests (Recommended)
- Vitest browser mode - for React/DOM component tests
- Playwright E2E - for full browser automation tests
Question (Python): "Include pytest with integration markers?"
Options:
- Yes (Recommended) - includes integration_llm, integration_db, integration_api markers
- No - skip pytest setup
Batch 4: Additional Options
Question: "Any additional configurations?"
Options (multiSelect: true):
- Claude hooks - lint on file edit
- Cursor hooks - lint on file edit
- Worktrunk config - git worktree management
Batch 5: CLAUDE.md Content
Question: "What should go in CLAUDE.md?"
Options (multiSelect: true):
- Structure + rule references (Recommended) - include @.cursor/rules references and project structure
- Package dependency graph - for monorepos, document inter-package dependencies
- Placeholders for patterns/constraints - empty sections for you to fill in
- Skip CLAUDE.md - I'll write it myself
Batch 6: Conflict Handling (retrofit only)
Question: "How should we handle existing files?"
Options:
- Skip existing files (Recommended) - only add missing configs
- Overwrite all - replace existing with scaffold templates
Run the appropriate scaffold scripts:
# Main orchestrator
bash ${CLAUDE_PLUGIN_ROOT}/scripts/scaffold/scaffold-project.sh \
--name "project-name" \
--type "monorepo-both" \
--author "Name" \
--email "email@example.com"
The script handles:
When retrofitting, handle existing files:
Ask user preference before proceeding.
Show summary of what was created/skipped:
Created:
- .oxlintrc.json
- .oxfmtrc.json
- .cursor/rules/ts-rules.mdc
- .cursor/hooks/after-edit.sh
...
Skipped (already exists):
- package.json
Templates use these placeholders:
| Variable | Description | Example |
|---|---|---|
{{PROJECT_NAME}} | kebab-case name | my-awesome-app |
{{PROJECT_DESCRIPTION}} | Brief description | A CLI tool for... |
{{AUTHOR_NAME}} | Author name | Jane Doe |
{{AUTHOR_EMAIL}} | Author email | jane@example.com |
{{INCLUDE_TS}} | Include TypeScript | true |
{{INCLUDE_PY}} | Include Python | true |
{{INCLUDE_SWIFT}} | Include Swift | true |
{{MONOREPO}} | Is monorepo | true |
To update base templates with latest tool standards:
Ask which templates to update:
Use web search and deepwiki to research:
Show diff of proposed changes with explanations:
# .oxlintrc.json changes
- "typescript/no-explicit-any": "error"
+ "typescript/no-explicit-any": "warn" # Relaxed for gradual adoption
For each change:
After all changes applied, commit to ai-tools repo:
git add templates/
git commit -m "chore: update templates with latest standards"
All templates are in ${CLAUDE_PLUGIN_ROOT}/templates/:
templates/
├── common/ # CLAUDE.md, .gitignore, wt.toml
├── typescript/ # .oxlintrc.json, .oxfmtrc.json, tsconfig.json, package.json, vitest
│ ├── single/
│ └── monorepo/
├── python/ # ruff.toml, pyrightconfig.json, pyproject.toml
│ ├── single/
│ └── monorepo/
├── swift/ # Package.swift, .swiftlint.yml, .swiftformat
│ └── single/
├── testing/ # vitest-browser, playwright configs
├── monorepo/ # apps/, packages/, services/ structure
├── cursor/ # rules/*.md (+ .mdc symlinks), hooks/
└── claude/ # hooks/, settings template
For detailed template inventory and configurations:
references/template-inventory.md - Complete list of all templates and their contentsShell scripts for scaffolding operations:
${CLAUDE_PLUGIN_ROOT}/scripts/scaffold/scaffold-project.sh - Main orchestrator (handles all project types, TypeScript, Python, and common files)User: "Create a new TypeScript monorepo called my-platform"
Claude asks (AskUserQuestion batch):
Q1: "What type of project?" → Monorepo TypeScript
Q2: "Top-level directories?" → [apps, packages, services]
Q3: "Testing features?" → [Vitest unit, Playwright E2E]
Q4: "Additional configs?" → [Claude hooks, Cursor hooks]
AFTER all answers collected, execute ONCE:
bash scaffold-project.sh --name my-platform --type monorepo-ts --playwright
Result: Full monorepo created with all selected options.
User: "Add my standard configs to this existing Python project"
Claude detects: pyproject.toml exists (retrofit mode)
Claude asks (AskUserQuestion batch):
Q1: "Include pytest with markers?" → Yes
Q2: "Additional configs?" → [Claude hooks, Worktrunk]
Q3: "Handle existing files?" → Skip existing
AFTER all answers, execute ONCE:
bash scaffold-project.sh --name existing-project --type single-py
Result: Missing configs added, existing files preserved.
When user asks to add specific testing setup (vitest, playwright, browser tests), use the scaffold script with appropriate flags or copy individual templates:
User: "Add playwright e2e testing to this project"
1. Run scaffold script with --playwright flag, or:
2. Read template: ${CLAUDE_PLUGIN_ROOT}/templates/testing/playwright.config.ts.template
3. Substitute {{PROJECT_NAME}} with actual project name
4. Write to playwright.config.ts
5. Create tests/e2e/ directory
6. Add @playwright/test to devDependencies
7. Update .gitignore with tmp/, playwright-report/
User: "Add vitest browser mode for React component tests"
1. Run scaffold script with --vitest-browser flag, or:
2. Read template: ${CLAUDE_PLUGIN_ROOT}/templates/testing/vitest-multiproject.config.ts.template
3. Substitute {{PROJECT_NAME}}
4. Write appropriate vitest config (single or multiproject)
5. Create tests/integration/ directory
6. Add @vitest/browser-playwright to devDependencies
TypeScript test files use naming to determine environment:
*.test.ts - Node environment (default)*.node.test.ts - Node environment (explicit)*.browser.test.ts - Browser environment via Playwright*.spec.ts - Playwright E2E tests (in tests/e2e/)User: "Update the oxlint/oxfmt template to latest standards"
1. Research latest oxlint/oxfmt recommended configuration
2. Show proposed changes with explanations
3. Apply approved changes
4. Commit to ai-tools