|
| 1 | +--- |
| 2 | +name: project-conventions |
| 3 | +description: Project conventions for Pipeline Studio App including file structure, imports, code quality, and general rules. Use when writing new code, creating files, or organizing imports. |
| 4 | +--- |
| 5 | + |
| 6 | +# Project Conventions |
| 7 | + |
| 8 | +## Project Overview |
| 9 | + |
| 10 | +React + TypeScript application for building and running ML pipelines using drag and drop. Uses Vite, TailwindCSS v4, ShadCN, Radix UI, React Flow, and Monaco Editor. |
| 11 | + |
| 12 | +## File Structure & Imports |
| 13 | + |
| 14 | +- Use absolute imports with `@/` prefix for src directory |
| 15 | +- Follow existing folder structure: |
| 16 | + - `src/components/` for all React components |
| 17 | + - `src/hooks/` for custom hooks |
| 18 | + - `src/types/` for TypeScript definitions |
| 19 | + - `src/utils/` for utility functions |
| 20 | + - `src/services/` for API and business logic |
| 21 | +- **Import order**: external packages -> internal modules -> relative imports |
| 22 | +- Use simple-import-sort rules (already configured in ESLint) |
| 23 | +- Do not use barrel exports |
| 24 | + |
| 25 | +## Code Quality |
| 26 | + |
| 27 | +- Follow ESLint rules (configured in eslint.config.js) |
| 28 | +- Use Prettier for formatting |
| 29 | +- Write tests using Vitest for unit tests, Playwright for E2E |
| 30 | +- Use descriptive variable and function names |
| 31 | +- Add JSDoc comments for complex functions |
| 32 | +- Prefer early returns to reduce nesting |
| 33 | + |
| 34 | +## Comments & Documentation |
| 35 | + |
| 36 | +- Use JSDoc for public APIs |
| 37 | +- Add comments for complex business logic |
| 38 | +- **Explain "why" not "what" in comments** |
| 39 | +- Keep comments up to date with code changes |
| 40 | +- Avoid writing redundant comments for functions and variables that are self-explanatory |
| 41 | + |
| 42 | +## Error Handling |
| 43 | + |
| 44 | +- Use proper error boundaries |
| 45 | +- Handle async errors with try/catch |
| 46 | +- Use toast notifications for user-facing errors |
| 47 | +- Log errors appropriately |
| 48 | + |
| 49 | +## React Flow Specific |
| 50 | + |
| 51 | +- Use `@xyflow/react` for flow diagrams |
| 52 | +- Follow existing node types and edge patterns |
| 53 | +- Keep flow state management consistent with existing patterns |
| 54 | +- Use proper node and edge typing |
| 55 | + |
| 56 | +## Specific Project Patterns |
| 57 | + |
| 58 | +- Use Monaco Editor for code editing features |
| 59 | +- Use localforage for client-side storage |
| 60 | +- Follow existing authentication patterns |
| 61 | +- Use proper task node and pipeline handling patterns |
| 62 | +- Follow the existing component library structure |
| 63 | +- **Do not modify componentSpec structure** without express permission |
| 64 | + |
| 65 | +## Don't Do |
| 66 | + |
| 67 | +- Don't use CSS-in-JS or styled-components |
| 68 | +- Don't use inline styling (`style={styles}`) except where strictly necessary |
| 69 | +- Don't use relative imports for `@/components/ui` |
| 70 | +- Don't create new global state without good reason |
| 71 | +- Don't bypass existing abstractions without discussion |
| 72 | + |
| 73 | +## Planning & Documentation |
| 74 | + |
| 75 | +When asked to create planning documents, architecture decisions, or investigation notes: |
| 76 | +- **Always save to `.local/`** - This directory is gitignored for local-only files |
| 77 | +- Use descriptive filenames: `.local/feature-name-planning.md`, `.local/bug-investigation.md` |
| 78 | + |
| 79 | +## Optional "While We're Here" Cleanup |
| 80 | + |
| 81 | +After completing a code generation task, scan the surrounding area for small, low-risk improvements. **Only offer** if ALL conditions are met: |
| 82 | + |
| 83 | +1. **Small scope**: Affects < 30 lines of code |
| 84 | +2. **Low risk**: Purely cosmetic or minor refactoring (not logic changes) |
| 85 | +3. **Same file**: In a file you already modified |
| 86 | +4. **Clear benefit**: Improves readability, removes dead code, or fixes obvious issues |
| 87 | + |
| 88 | +Don't be naggy — only offer once per task, and only if genuinely worthwhile. |
0 commit comments