developing-typescript
Developing TypeScript
Expert guidance for building robust, type-safe TypeScript and React applications.
Quick Start
For immediate help, identify your task type and consult the relevant reference:
| Working On | Reference File | Key Topics |
|---|---|---|
| Generics, conditional types, inference | typescript-core | Type system, utility types, declarations |
| Components, hooks, state management | react-architecture | Composition, Context, reducers |
| React 19, Server Components, Actions | react-19-patterns | ref as prop, useActionState, use(), Server Actions |
| Apollo Client, codegen, type safety | graphql-integration | Queries, mutations, cache |
| React Testing Library, integration tests | testing-react | User behavior testing, async |
| Bundle size, memoization, Core Web Vitals | performance-optimization | Code splitting, profiling |
TDD Phase Awareness
All guidance in this skill is phase-aware. Identify your current phase:
RED Phase (Writing Failing Tests)
- Write the smallest test that captures intent
- Use concrete values directly in tests
- Focus on user behavior, not implementation
- Skip edge cases and complex mocking initially
GREEN Phase (Making Tests Pass)
- RESIST over-engineering at all costs
- Start with simple implementations
- Use
anytemporarily if types block progress - Focus only on making the current test pass
REFACTOR Phase (Improving Design)
- NOW apply proper type constraints
- Extract custom hooks from components
- Add comprehensive type definitions
- Improve component composition patterns
Cross-Cutting Principles
These principles apply across all TypeScript/React development:
Type Safety First
- Prefer compile-time errors over runtime errors
- Use strict mode and appropriate compiler options
- Leverage type inference where it improves readability
- Create discriminated unions for state management
Component Architecture
- Prefer composition over prop drilling
- Keep components focused on single responsibilities
- Use custom hooks to extract reusable logic
- Push side effects to dedicated hooks or boundaries
Testing Philosophy
- Test user behavior, not implementation details
- Write tests that can fail for real defects
- Avoid over-mocking; prefer integration tests
- Use React Testing Library queries by accessibility
Performance Mindset
- Measure before optimizing
- Understand React's rendering model
- Use memoization strategically, not reflexively
- Consider bundle size for every dependency
Examples
Creating a type-safe form component:
User: "I need a reusable form that handles different data types"
→ Consult typescript-core.md for generics, react-architecture.md for patterns
Optimizing re-renders:
User: "My component re-renders too often"
→ Consult performance-optimization.md for profiling and memoization strategies
Setting up GraphQL with type safety:
User: "Integrate Apollo Client with TypeScript codegen"
→ Consult graphql-integration.md for setup and patterns
Writing component tests:
User: "Test this form submission flow"
→ Consult testing-react.md for user behavior testing patterns
Anti-Patterns to Avoid
Premature Abstraction
- Creating generic components before you have 3 similar cases
- Building complex type utilities for one-off uses
- Over-engineering state management with Context
- Adding dependency injection patterns unnecessarily
Type System Misuse
- Using
anyto silence errors instead of fixing types - Over-constraining types that limit legitimate use cases
- Creating deep type hierarchies that confuse inference
- Ignoring TypeScript's structural typing strengths
Testing Anti-Patterns
- Testing implementation details
- Over-mocking to the point tests don't catch real bugs
- Testing React internals instead of user outcomes
- Creating elaborate test utilities prematurely
Performance Anti-Patterns
- Premature memoization without measurement
- useCallback/useMemo on every function/value
- Splitting code before you have bundle size problems
- Optimizing renders that aren't causing issues
Reference File IDs
For programmatic access (e.g., parallel reviews), use these identifiers:
typescript-core · react-architecture · react-19-patterns · graphql-integration · testing-react · performance-optimization
More from bnadlerjr/dotfiles
slicing-elephant-carpaccio
Breaks features into ultra-thin vertical slices using Elephant Carpaccio methodology. Use when planning new features, breaking down epics, slicing work across layers, or when a task spans multiple components. Produces an ordered backlog of thin slices, each independently working, testable, and demoable. Handles single-repo, monorepo, and multi-repo architectures.
14receiving-code-review
Guides technical evaluation of code review feedback before implementation. Use when receiving PR comments, review suggestions, GitHub feedback, or when asked to address reviewer feedback. Emphasizes verification and reasoned pushback over blind agreement.
13breaking-down-stories
Breaks down user stories into small, actionable tasks. Use when decomposing user stories, planning sprint work, creating task lists from tickets, or when the user mentions story breakdown, task decomposition, or sprint planning.
12mui
Material-UI component library patterns including sx prop styling, theme integration, responsive design, and MUI-specific hooks. Use when working with MUI components (@mui/material), styling with sx prop, theme customization, or MUI utilities. Supports v5, v6, and v7.
1applying-swiss-design
Applies Swiss/International Typographic Style principles to create clear, functional output. Use when designing interfaces, data visualizations, documentation, CLI output, or any output where clarity matters. Recognizes requests like "make it cleaner", "reduce clutter", "too busy", "improve readability", "visual hierarchy", "simplify the layout".
1coding-workflow
Use when user asks to build a feature, implement something new, or make significant code changes. Recognizes requests like "build", "implement", "create a new feature", "add functionality", "develop", "I need to build X", "let's implement", "new feature request", "make these changes". Orchestrates a four-stage workflow (Research → Brainstorm → Plan → Implement) using the appropriate thought pattern skill at each stage.
1