test-story-coupling

Validate component, test, and story file naming and presence.

1|Updated Feb 7, 2016
One-click install
npx skills add https://github.com/ynotradio/site --skill test-story-coupling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-story-coupling
Source: https://github.com/ynotradio/site/tree/main/.claude/skills/test-story-coupling
Command: npx skills add https://github.com/ynotradio/site --skill test-story-coupling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enforces strict naming conventions and file presence requirements to ensure that every user-facing component has corresponding test and story files, preventing technical debt and improving maintainability.

Core Features & Use Cases

  • Enforces Naming Conventions: Ensures component, test, and story files use exact, case-sensitive naming.
  • Verifies File Completeness: Checks for the presence of test files for utilities and migration scripts, and both test and story files for user-facing components.
  • Use Case: When developing a new UserProfileCard component, this skill ensures you create UserProfileCard.tsx, UserProfileCard.test.tsx, and UserProfileCard.stories.tsx with matching names, or that UserProfileCard.stories.tsx includes interaction tests.

Quick Start

Run the pre-commit hook to validate test and story file coupling for staged component files.

Frequently Asked Questions about test-story-coupling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce component, test, and story file consistency in a frontend codebase?

To enforce component, test, and story file consistency, you can validate strict naming conventions and file presence using a pre-commit hook and CI validation. This ensures user-facing components have matching `.test.tsx` and `.stories.tsx` files, preventing technical debt.

How do I ensure Storybook stories have corresponding test files for TypeScript components?

To ensure Storybook stories have corresponding test files, enforce file completeness via pre-commit validation. This verifies that every user-facing component has matching `.stories.tsx` and `.test.tsx` files with exact, case-sensitive naming.

What is the best way to automate naming convention checks for React components and Storybook stories?

The best way to automate naming convention checks is by running a pre-commit hook that validates staged component files. This enforces exact, case-sensitive naming for component, test, and story files before changes are committed to the codebase.

Does file validation differ between utility scripts and user-facing TypeScript components?

File validation differs significantly: user-facing components require both `.test.tsx` and `.stories.tsx` files, while utilities and migration scripts only require `.test.ts` files to pass CI validation and maintain code quality.

Can I pass validation if my Storybook story includes interaction tests instead of a separate test file?

Yes, you can pass validation if your Storybook story includes interaction tests. The file completeness check allows a component's `.stories.tsx` file to satisfy testing requirements when it contains interaction tests, rather than requiring a separate `.test.tsx` file.