Scaffold the file structure for a new feature following the TDD workflow. Use when starting any new feature.
Scaffold the standard file structure for feature: $ARGUMENTS
Use the feature name as the directory name in kebab-case.
src/lib/<feature>/
<feature>.ts # Core logic — pure functions, no side effects
<feature>.test.ts # Vitest unit tests
types.ts # TypeScript interfaces for this feature
tests/
<feature>.test.ts # Playwright E2E tests
Only create a .svelte component file if the feature has a UI. If so, also create <feature>.svelte.test.ts.
src/lib/<feature>/<feature>.ts// TODO: implement
src/lib/<feature>/<feature>.test.tsimport { describe, it, expect } from 'vitest'
describe('<feature>', () => {
it('TODO: write first failing test', () => {
expect(true).toBe(false)
})
})
src/lib/<feature>/types.ts// Define TypeScript interfaces for this feature
export interface TODO {
// fill in
}
tests/<feature>.test.tsimport { test, expect } from '@playwright/test'
test.describe('<feature>', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/')
})
test('TODO: write first E2E test', async ({ page }) => {
// fill in
})
})
Remind the user:
Or use /tdd to be guided through each step.