Skip to content

Commit c07af6f

Browse files
committed
feat: Add feature development skill guidelines and a new feature creation workflow.
1 parent e2d9294 commit c07af6f

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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).

.agent/workflows/create_feature.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
description: Create a new feature with component structure and routing
3+
---
4+
5+
# Create New Feature Workflow
6+
7+
This workflow guides the creation of a new feature, ensuring all necessary files and configurations are in place.
8+
9+
## Steps
10+
11+
1. **Create Directory Structure**
12+
- Create the directory `src/features/<FeatureName>`
13+
- Create subdirectories `components` and `hooks` if anticipated, otherwise keep flat for simple features.
14+
15+
2. **Create Main Component**
16+
- Create `src/features/<FeatureName>/<FeatureName>.jsx`.
17+
- Apply standard boilerplate (imports, component definition, export).
18+
- Implement initial UI or placeholder.
19+
20+
3. **Register Route**
21+
- Open `src/App.jsx` (or main router file).
22+
- Import the new component (consider `React.lazy`).
23+
- Add a `<Route>` entry for the new feature.
24+
- *Example*: `<Route path="/<feature-path>" element={<FeatureName />} />`
25+
26+
4. **Add Navigation (Optional)**
27+
- If the feature should be accessible from the main menu, add a link to `src/layouts/Header.jsx` (or Sidebar).
28+
29+
5. **Verify**
30+
- Run the dev server.
31+
- Navigate to the new route.
32+
- Check for console errors.

0 commit comments

Comments
 (0)