Skill Development

Scaffold

Scaffold a new feature with files, tests, and types

install path ~/.claude/skills/scaffold/SKILL.md
command /scaffold
scaffoldboilerplatefeaturegeneratenew
SKILL.md

Scaffold Skill

You are an expert at project scaffolding. When this skill is invoked, generate all the files needed for a new feature.

What This Skill Does

Creates a complete set of files for a new feature including implementation, types, tests, and any necessary configuration, following the project’s existing patterns and conventions.

Step-by-Step Instructions

  1. Understand the feature. Clarify with the user:

    • What the feature does
    • Where it fits in the existing architecture
    • Any specific requirements or constraints
  2. Study the project’s patterns. Before generating code, examine:

    • How existing similar features are structured
    • Naming conventions for files, functions, types, and variables
    • Directory structure and where new files should go
    • Import patterns and module organization
    • Testing patterns and conventions
    • Any code generators or templates already in the project
  3. Plan the files to create. Depending on the feature type, plan:

    For a UI component:

    • Component file (.tsx, .vue, .svelte, etc.)
    • Styles file if using CSS modules or separate stylesheets
    • Types file if complex types are needed
    • Test file
    • Story file if using Storybook

    For a service/module:

    • Main implementation file
    • Types/interfaces file
    • Test file
    • Index/barrel file for exports

    For an API feature:

    • Route handler
    • Validation schema
    • Service/business logic layer
    • Types for request/response
    • Test file
    • Database migration if needed
  4. Generate each file. For every file:

    • Follow the project’s existing patterns exactly
    • Include proper imports
    • Add TypeScript types if the project uses TypeScript
    • Add JSDoc/docstrings for public interfaces
    • Use the project’s error handling patterns
    • Include TODO comments for parts that need user customization
  5. Generate tests. Create a test file with:

    • Basic structure and imports
    • Happy path test (may have placeholder implementation)
    • Edge case tests (listed as TODOs)
    • Error handling tests (listed as TODOs)
  6. Update any registration files. If the new feature needs to be registered:

    • Add routes to the router
    • Add exports to barrel files
    • Update configuration files
    • Add navigation entries if applicable
  7. Report what was created:

## Scaffolded: [Feature Name]

### Files Created
- path/to/file.ts - Description
- path/to/file.test.ts - Description

### Files Modified
- path/to/router.ts - Added new route

### Next Steps
1. Implement the business logic in [file]
2. Complete the TODO items in the test file
3. Add any needed environment variables

Guidelines

  • Match existing code style exactly. Consistency matters more than “best practice”.
  • Do not over-engineer. Generate the minimum needed to get started.
  • Keep files under 600 lines of code.
  • Use the project’s existing state management, not a new one.
  • If the project has a code generator (plop, hygen, etc.), use it instead of manual scaffolding.
  • Leave clear TODO comments for parts that need user input.
  • Do not add dependencies without asking the user first.
  • Make the scaffolded code compile and pass linting from the start.

Copy this into ~/.claude/skills/scaffold/SKILL.md to use it as a slash command in Claude Code.

get crystl