Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
7
⚠️ Pre-push hook will REJECT incorrect imports
Sign in to like and favorite skills
⚠️ Pre-push hook will REJECT incorrect imports
// Components - one per line import Button from '@mui/material/Button'; import Box from '@mui/material/Box'; // Icons - one per line import SearchIcon from '@mui/icons-material/Search'; import EditIcon from '@mui/icons-material/Edit'; // Hooks from /styles import { useTheme, styled } from '@mui/material/styles'; // Types use 'import type' import type { PaletteMode } from '@mui/material'; import type { SvgIconProps } from '@mui/material/SvgIcon';
import { Button, Box } from '@mui/material'; // NO! import { Search, Edit } from '@mui/icons-material'; // NO! import { PaletteMode } from '@mui/material'; // NO! Use 'import type'
Common Components Quick Reference:
// Layout: Box, Container, Grid, Stack // Inputs: Button, TextField, Select, MenuItem, Checkbox, Switch // Feedback: Alert, Dialog, Snackbar, CircularProgress // Data: Table, TableBody, TableCell, TableHead, TableRow, Chip, Tooltip // Navigation: Tabs, Tab, Drawer // Utils: IconButton, Divider, Paper, Typography
Validation: Run
./scripts/check-mui-imports.sh or yarn build:analyze
Every component MUST follow the
index.tsx pattern:
ComponentName/ ├── index.tsx # Main component (REQUIRED) ├── SubComponent.tsx # Sub-components in same dir ├── helpers.ts # Component-specific utilities ├── types.ts # Component-specific types └── styles.css # Component-specific styles
Rules:
index.tsx (main entry point)PascalCase.tsxhelpers.ts, types.ts, constants.ts, utils.tsshared/ or common/ directoryMyComponent/MyComponent.tsx → use MyComponent/index.tsxExamples:
theme-toggle/ └── index.tsx admin-console/ ├── index.tsx ├── layout/index.tsx ├── maps-page/index.tsx └── accounts-page/index.tsx action-widget/pane/ ├── topic-style-editor/ │ ├── index.tsx │ ├── IconCollection.tsx │ └── ColorPicker.tsx └── shared/ ├── StyledTabs.tsx └── StyledEditorContainer.tsx
Clean Imports Result:
import ThemeToggle from '../common/theme-toggle'; // ✅ Clean import MapsPage from '../admin-console/maps-page'; // ✅ Clean // vs import ThemeToggle from '../common/theme-toggle/ThemeToggle'; // ❌ Redundant
PascalCase (MyComponent.tsx)camelCase (myUtility.ts)UPPER_SNAKE_CASE (MAX_VALUE)mainfeature/name, fix/nameyarn build:analyze to verify bundle sizes*.test.ts or *.test.tsxMANDATORY: All TypeScript code must be properly typed. NO exceptions.
any type - Always use specific types@ts-ignore or @ts-expect-error without discussionany from function parameters or variables// ✅ CORRECT - Import types from mindplot import { Topic, Designer } from '@wisemapping/mindplot'; // ❌ WRONG - Using 'any' const topic: any = ...;
// ✅ CORRECT - Properly handle Topic | null const getTopicDepth = (topic: Topic): number => { let current: Topic | null = topic; while (current && current.getParent() !== null) { current = current.getParent(); // Returns Topic | null } }; // ❌ WRONG - Type mismatch const getTopicDepth = (topic: Topic): number => { let current = topic; // TypeScript infers Topic current = current.getParent(); // ERROR: Topic | null not assignable to Topic };
// ✅ If you truly don't know the type const data: unknown = JSON.parse(str); if (typeof data === 'object' && data !== null) { // Type guard before use } // ❌ WRONG const data: any = JSON.parse(str);
MANDATORY: AI MUST check linter errors after EVERY file creation or modification.
For EACH file created/modified: 1. Write/modify the code 2. IMMEDIATELY run read_lints([specific_file_path]) 3. Fix ALL errors found 4. Re-run read_lints to verify 5. Only then move to next file At task completion: 1. Run read_lints on ALL modified files together 2. Fix any remaining issues 3. Final verification 4. Task complete
// ✅ CORRECT - Check specific files you modified read_lints([ "packages/editor/src/components/new-component/index.tsx", "packages/editor/src/components/new-component/styled.ts" ]) // ❌ WRONG - Checking entire codebase (too noisy) read_lints() // or read_lints([])
@typescript-eslint/no-explicit-any - NO any types@typescript-eslint/no-unused-vars - Remove unused imports/variables@typescript-eslint/explicit-function-return-type - Type function returns when needed1. Create/modify TypeScript file 2. Add proper type imports (Topic, Designer, etc.) 3. Use correct types for all variables and parameters 4. Handle nullable types with | null or | undefined 5. RUN read_lints([file_path]) - DO NOT SKIP THIS 6. Fix all errors found 7. Verify with read_lints again 8. Move to next file/task