|
| 1 | +# Implementation Plan: Skills Marketplace |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This implementation plan breaks down the Skills Marketplace feature into discrete, incremental coding tasks. The approach follows a backend-first strategy, establishing the API endpoint and data models before building the frontend interface. Each task builds upon previous work, ensuring no orphaned code and continuous integration. |
| 6 | + |
| 7 | +## Tasks |
| 8 | + |
| 9 | +- [-] 1. Create backend data models and contracts |
| 10 | + - Create `src/MyYuCode/Contracts/Skills/` directory |
| 11 | + - Define `SkillsIndexDto`, `SkillDto`, `SkillServicesDto`, and `SkillCompatibilityDto` record types |
| 12 | + - Ensure all models match the JSON structure from the GitHub registry |
| 13 | + - _Requirements: 2.1, 2.2, 2.3_ |
| 14 | + |
| 15 | +- [-] 1.1 Write property test for data model validation |
| 16 | + - **Property 1: API Returns Valid Skills Data Structure** |
| 17 | + - **Validates: Requirements 1.2, 2.3** |
| 18 | + - Generate random valid skills data and verify all required fields are present and correctly typed |
| 19 | + - Minimum 100 iterations |
| 20 | + |
| 21 | +- [ ] 2. Implement Skills API endpoint |
| 22 | + - [ ] 2.1 Add Skills API endpoint to `ApiEndpoints.cs` |
| 23 | + - Create `MapSkills` method following existing patterns (e.g., `MapGit`, `MapTools`) |
| 24 | + - Implement `GET /api/skills` endpoint |
| 25 | + - Use `HttpClient` to fetch from `https://raw.githubusercontent.com/AIDotNet/MoYuCode/refs/heads/main/skills/index.json` |
| 26 | + - Parse JSON response into `SkillsIndexDto` |
| 27 | + - Return parsed data with 200 status on success |
| 28 | + - _Requirements: 1.1, 1.2_ |
| 29 | + |
| 30 | + - [ ] 2.2 Implement error handling for network failures |
| 31 | + - Catch `HttpRequestException` and return 503 status with error message |
| 32 | + - Catch timeout exceptions and return 503 status |
| 33 | + - Set HTTP client timeout to 10 seconds |
| 34 | + - _Requirements: 1.3, 7.1_ |
| 35 | + |
| 36 | + - [ ] 2.3 Implement error handling for invalid JSON |
| 37 | + - Catch `JsonException` and return 502 status with error message |
| 38 | + - Validate required fields are present before returning |
| 39 | + - Return 502 status if validation fails |
| 40 | + - _Requirements: 1.4, 7.1_ |
| 41 | + |
| 42 | + - [ ] 2.4 Register Skills API in `MapMyYuCodeApis` |
| 43 | + - Call `MapSkills(api)` in the `MapMyYuCodeApis` method |
| 44 | + - Ensure endpoint is included in the API response filter |
| 45 | + - _Requirements: 1.1_ |
| 46 | + |
| 47 | +- [ ] 2.5 Write property test for network error handling |
| 48 | + - **Property 2: Network Error Handling** |
| 49 | + - **Validates: Requirements 1.3, 7.1** |
| 50 | + - Simulate various network failure scenarios and verify all return 503 status code |
| 51 | + - Minimum 100 iterations |
| 52 | + |
| 53 | +- [ ] 2.6 Write property test for invalid JSON handling |
| 54 | + - **Property 3: Invalid JSON Handling** |
| 55 | + - **Validates: Requirements 1.4, 7.1** |
| 56 | + - Generate various malformed JSON strings and verify all return 502 status code |
| 57 | + - Minimum 100 iterations |
| 58 | + |
| 59 | +- [ ] 2.7 Write unit tests for Skills API endpoint |
| 60 | + - Test successful data fetch with mocked GitHub response |
| 61 | + - Test empty skills array handling |
| 62 | + - Test missing required fields scenario |
| 63 | + - Test HTTP client timeout scenario |
| 64 | + - _Requirements: 1.1, 1.2, 1.3, 1.4_ |
| 65 | + |
| 66 | +- [ ] 3. Checkpoint - Backend API complete |
| 67 | + - Ensure all tests pass, ask the user if questions arise. |
| 68 | + |
| 69 | +- [ ] 4. Extend frontend API client |
| 70 | + - [ ] 4.1 Add Skills types to `web/src/api/types.ts` |
| 71 | + - Define `SkillsIndexDto` type |
| 72 | + - Define `SkillDto` type |
| 73 | + - Define `SkillServicesDto` type |
| 74 | + - Define `SkillCompatibilityDto` type |
| 75 | + - Export all types |
| 76 | + - _Requirements: 2.1, 2.2, 2.3_ |
| 77 | + |
| 78 | + - [ ] 4.2 Add Skills API method to `web/src/api/client.ts` |
| 79 | + - Add `skills` object to `api` export |
| 80 | + - Implement `list()` method that calls `GET /api/skills` |
| 81 | + - Return typed `SkillsIndexDto` response |
| 82 | + - _Requirements: 1.1, 4.1_ |
| 83 | + |
| 84 | +- [ ] 5. Create Skill Card component |
| 85 | + - [ ] 5.1 Create `web/src/components/SkillCard.tsx` |
| 86 | + - Accept `skill: SkillDto` as prop |
| 87 | + - Display skill name, summary, and description |
| 88 | + - Display tags as badge chips |
| 89 | + - Display version and status |
| 90 | + - Use existing UI components from `web/src/components/ui/` |
| 91 | + - _Requirements: 4.3, 4.4_ |
| 92 | + |
| 93 | + - [ ] 5.2 Add status indicator styling |
| 94 | + - Create visual indicators for "active" status (green) |
| 95 | + - Create visual indicators for "deprecated" status (orange/amber) |
| 96 | + - Create visual indicators for "experimental" status (blue) |
| 97 | + - Use distinct colors or icons for each status |
| 98 | + - _Requirements: 6.1, 6.2, 6.3, 6.4_ |
| 99 | + |
| 100 | + - [ ] 5.3 Add compatibility badges |
| 101 | + - Display Codex compatibility badge based on `services.codex.compatible` |
| 102 | + - Display Claude Code compatibility badge based on `services.claudecode.compatible` |
| 103 | + - Use existing badge/chip components |
| 104 | + - _Requirements: 4.4_ |
| 105 | + |
| 106 | +- [ ] 5.4 Write property test for status indicator consistency |
| 107 | + - **Property 6: Status Indicator Consistency** |
| 108 | + - **Validates: Requirements 6.1, 6.2, 6.3, 6.4** |
| 109 | + - Generate skills with various status values and verify each has distinct visual indicator |
| 110 | + - Minimum 100 iterations |
| 111 | + |
| 112 | +- [ ] 5.5 Write property test for compatibility badge display |
| 113 | + - **Property 10: Compatibility Badge Display** |
| 114 | + - **Validates: Requirements 4.4** |
| 115 | + - Generate skills with various compatibility combinations and verify badges match boolean values |
| 116 | + - Minimum 100 iterations |
| 117 | + |
| 118 | +- [ ] 5.6 Write unit tests for Skill Card component |
| 119 | + - Test rendering with sample skill data |
| 120 | + - Test status indicator for each status type |
| 121 | + - Test compatibility badges for different combinations |
| 122 | + - Test tag rendering |
| 123 | + - _Requirements: 4.3, 4.4, 6.1, 6.2, 6.3, 6.4_ |
| 124 | + |
| 125 | +- [ ] 6. Create Skills Page component |
| 126 | + - [ ] 6.1 Create `web/src/pages/SkillsPage.tsx` |
| 127 | + - Implement component with state for skills, loading, error, and searchQuery |
| 128 | + - Fetch skills data from API on component mount using `api.skills.list()` |
| 129 | + - Display loading indicator while fetching (use existing Spinner component) |
| 130 | + - Display error message if API call fails |
| 131 | + - Render skills in a grid layout using SkillCard components |
| 132 | + - _Requirements: 4.1, 4.2, 4.3, 4.5, 4.6_ |
| 133 | + |
| 134 | + - [ ] 6.2 Implement search/filter functionality |
| 135 | + - Add search input field at top of page |
| 136 | + - Filter skills based on search query (name, summary, description, tags) |
| 137 | + - Implement case-insensitive search |
| 138 | + - Update displayed skills in real-time as user types |
| 139 | + - Display all skills when search is empty |
| 140 | + - _Requirements: 5.1, 5.2, 5.3_ |
| 141 | + |
| 142 | + - [ ] 6.3 Implement error handling and retry |
| 143 | + - Display user-friendly error message when API fails |
| 144 | + - Provide "Retry" button to reload skills |
| 145 | + - Handle network offline state using existing OfflineIndicator |
| 146 | + - Display empty state message when no skills are available |
| 147 | + - _Requirements: 4.6, 7.1, 7.2, 7.3, 7.4_ |
| 148 | + |
| 149 | +- [ ] 6.4 Write property test for search filtering correctness |
| 150 | + - **Property 4: Search Filtering Correctness** |
| 151 | + - **Validates: Requirements 5.2** |
| 152 | + - Generate random skills data and search queries, verify filtered results only include matching skills |
| 153 | + - Minimum 100 iterations |
| 154 | + |
| 155 | +- [ ] 6.5 Write property test for real-time filter updates |
| 156 | + - **Property 5: Real-time Filter Updates** |
| 157 | + - **Validates: Requirements 5.3, 8.2** |
| 158 | + - Generate random search inputs and verify UI updates within 200ms |
| 159 | + - Minimum 100 iterations |
| 160 | + |
| 161 | +- [ ] 6.6 Write property test for loading state display |
| 162 | + - **Property 8: Loading State Display** |
| 163 | + - **Validates: Requirements 4.5, 8.1** |
| 164 | + - Verify loading indicator appears within 100ms of request starting |
| 165 | + - Minimum 100 iterations |
| 166 | + |
| 167 | +- [ ]* 6.7 Write property test for error message display |
| 168 | + - **Property 9: Error Message Display** |
| 169 | + - **Validates: Requirements 4.6, 7.3, 7.4** |
| 170 | + - Generate various API error responses and verify user-friendly error message and retry action appear |
| 171 | + - Minimum 100 iterations |
| 172 | + |
| 173 | +- [ ]* 6.8 Write unit tests for Skills Page component |
| 174 | + - Test skills rendering with mocked API response |
| 175 | + - Test loading state display |
| 176 | + - Test error state display and retry button |
| 177 | + - Test empty state display |
| 178 | + - Test search filtering with various queries |
| 179 | + - Test search clearing behavior |
| 180 | + - _Requirements: 4.1, 4.2, 4.5, 4.6, 5.1, 5.2, 5.3_ |
| 181 | + |
| 182 | +- [ ] 7. Integrate Skills navigation |
| 183 | + - [ ] 7.1 Add Skills route to `web/src/App.tsx` |
| 184 | + - Import SkillsPage component |
| 185 | + - Add `<Route path="/skills" element={<SkillsPage />} />` to Routes |
| 186 | + - _Requirements: 3.2_ |
| 187 | + |
| 188 | + - [ ] 7.2 Add Skills navigation item to sidebar |
| 189 | + - Add NavIconLink for Skills in the navigation section |
| 190 | + - Use appropriate icon (e.g., Book, Library, or Package icon from lucide-react) |
| 191 | + - Place between existing navigation items |
| 192 | + - Ensure visual consistency with other nav items |
| 193 | + - _Requirements: 3.1, 3.3_ |
| 194 | + |
| 195 | +- [ ]* 7.3 Write unit test for navigation integration |
| 196 | + - Test that Skills menu item exists in navigation |
| 197 | + - Test that clicking Skills navigates to `/skills` route |
| 198 | + - Test that Skills page renders when route is accessed |
| 199 | + - _Requirements: 3.1, 3.2, 3.3_ |
| 200 | + |
| 201 | +- [ ] 8. Final checkpoint - Ensure all tests pass |
| 202 | + - Ensure all tests pass, ask the user if questions arise. |
| 203 | + |
| 204 | +## Notes |
| 205 | + |
| 206 | +- Tasks marked with `*` are optional and can be skipped for faster MVP |
| 207 | +- Each task references specific requirements for traceability |
| 208 | +- Checkpoints ensure incremental validation |
| 209 | +- Property tests validate universal correctness properties with minimum 100 iterations |
| 210 | +- Unit tests validate specific examples and edge cases |
| 211 | +- The implementation follows existing patterns in the codebase for consistency |
| 212 | +- Backend is completed first to ensure API is available for frontend development |
| 213 | +- Frontend components are built incrementally: API client → Card component → Page component → Navigation |
0 commit comments