|
| 1 | +--- |
| 2 | +name: Feature Development |
| 3 | +description: Guidelines and best practices for creating new features in the application. |
| 4 | +--- |
| 5 | + |
| 6 | +# Feature Development Skill |
| 7 | + |
| 8 | +This skill outlines the standards and practices for adding new features to the application. |
| 9 | + |
| 10 | +## Core Principles (Senior Engineer Standards) |
| 11 | +1. **Clean Code**: |
| 12 | + - **DRY (Don't Repeat Yourself)**: Extract usage patterns into reusable hooks or components. |
| 13 | + - **SOLID**: Components should have a single responsibility. |
| 14 | + - **Meaningful Naming**: Variables and functions should clearly describe their intent (e.g., `isModalOpen` vs `open`). |
| 15 | +2. **Component Structure**: |
| 16 | + - **Small & Focused**: Break down large views into smaller sub-components. |
| 17 | + - **Colocation**: Keep related styles, tests, and types close to the component. |
| 18 | +3. **Modern React**: |
| 19 | + - Use Functional Components and Hooks. |
| 20 | + - Avoid `useEffect` for derived state; use `useMemo` or simple derivation during render. |
| 21 | + |
| 22 | +## Feature Structure |
| 23 | +When creating a new feature, follow this directory structure: |
| 24 | + |
| 25 | +``` |
| 26 | +src/features/<FeatureName>/ |
| 27 | +├── index.js # Public API export |
| 28 | +├── <FeatureName>.jsx # Main Feature Component |
| 29 | +├── components/ # Sub-components specific to this feature |
| 30 | +└── hooks/ # Custom hooks specific to this feature |
| 31 | +``` |
| 32 | + |
| 33 | +## Routing |
| 34 | +- All new page-level features must be registered in the main router (typically `src/App.jsx` or a dedicated `routes` file). |
| 35 | +- Use lazy loading for page components to optimize bundle size: |
| 36 | + ```javascript |
| 37 | + const NewFeature = lazy(() => import('./features/NewFeature')); |
| 38 | + ``` |
| 39 | + |
| 40 | +## Implementation Checklist |
| 41 | +- [ ] Create feature directory. |
| 42 | +- [ ] Implement main component. |
| 43 | +- [ ] Add sub-components as needed. |
| 44 | +- [ ] Register route. |
| 45 | +- [ ] Verify responsiveness and styling (Tailwind CSS). |
0 commit comments