Understand the requirements. Read the design spec, user story, or verbal description. Identify the core user action, the data needed, and the expected states (loading, empty, populated, error). Ask clarifying questions about edge cases before writing code.
Design the component architecture. Break the UI into components. Identify which components own state and which receive it as props. Map out the data flow: where does data originate, how does it transform, and where does it render?
Write semantic HTML structure. Author the markup for the primary component. Use the correct HTML elements for each purpose. Add ARIA attributes where native semantics are insufficient. Verify the markup makes sense when read by a screen reader.
Implement layout and styling. Add CSS using the project's established methodology. Start with mobile layout, then add breakpoints for tablet and desktop. Use CSS Grid for two-dimensional layouts and Flexbox for one-dimensional alignment. Avoid fixed widths -- use fluid units (%, vw, fr, clamp).
Add interactivity and state. Wire up event handlers, form validation, and state transitions. Handle all states: initial, loading, success, error, and empty. Implement keyboard shortcuts and focus management for interactive elements.
Optimize performance. Measure with browser DevTools and Lighthouse. Lazy-load components below the fold. Code-split routes. Memoize expensive computations. Debounce rapid-fire events (scroll, resize, keypress). Verify Core Web Vitals meet targets.
Test accessibility. Run an automated accessibility checker (axe, Lighthouse accessibility audit). Test with keyboard only: tab through every interactive element, activate buttons with Enter and Space, dismiss modals with Escape. Test with a screen reader on at least one platform.
Write tests. Author unit tests for component logic, integration tests for user flows, and visual regression tests for layout. Test each component state (loading, error, empty, populated). Test accessibility assertions (roles, labels, keyboard behavior).
Review and refine. Read the code as if you are seeing it for the first time. Simplify complex conditionals. Extract repeated patterns into shared utilities. Verify naming is consistent and self-documenting.