Markdown Converter
Agent skill for markdown-converter
This document provides instructions and guidelines for AI agents (like Claude) working on this React Boilerplate project.
Sign in to like and favorite skills
This document provides instructions and guidelines for AI agents (like Claude) working on this React Boilerplate project.
Ensure you have the following installed:
# Install dependencies bun install # Start development server (http://localhost:5173/) bun start # Build for production bun run build # Preview production build bun run serve # Run tests (watch mode) bun run test # Run tests with coverage report bun run test:coverage # Run ESLint bun run lint # Extract i18n messages bun run i18n:extract # Initialize MSW (Mock Service Worker) bun run msw
| Command | Purpose |
|---|---|
| Install dependencies using bun.lock |
| Install with locked dependencies (CI/CD) |
| Run dev server with auto-reload |
| Build TypeScript and bundle with Vite |
| Run all tests in watch mode |
| Run tests with coverage report |
| Check code style with ESLint |
import/export)// Use type annotations const count: number = 0; // Use arrow functions const handleClick = () => { /* ... */ }; // Use const for immutability const config = { /* ... */ }; // Use proper typing interface User { id: string; name: string; } // Destructure props const MyComponent = ({ name, age }: Props) => { return <div>{name}</div>; };
// Avoid any type const data: any = null; // ❌ // Avoid var var count = 0; // ❌ // Avoid loose typing const config = { /* ... */ }; // ❌ without type annotation // Avoid function declarations in components function MyComponent() { } // ❌
// File: src/components/MyComponent.tsx import { FC } from 'react'; interface MyComponentProps { title: string; onClose?: () => void; } export const MyComponent: FC<MyComponentProps> = ({ title, onClose }) => { return ( <div> <h1>{title}</h1> {onClose && <button onClick={onClose}>Close</button>} </div> ); };
src/ ├── components/ # React components │ ├── NavMenu.tsx │ ├── Counter.tsx │ └── ... ├── api/ # API services and requests │ ├── TodoService.ts │ └── ... ├── hooks/ # Custom React hooks ├── i18n.ts # i18n configuration ├── setupTests.ts # Test setup ├── setupStoragePolyfill.ts # Storage polyfill ├── App.tsx # Root component ├── index.tsx # Entry point └── styles/ # Global styles (CSS)
ComponentName.test.tsximport { render, screen } from '@testing-library/react'; import { MyComponent } from './MyComponent'; describe('MyComponent', () => { it('should render title', () => { render(<MyComponent title="Test" />); expect(screen.getByText('Test')).toBeInTheDocument(); }); });
import { FC } from 'react'; import { useTranslation } from 'react-i18next'; import { TodoService } from '../api/TodoService'; import { Button } from './Button';
The project enforces ESLint rules defined in
.eslintrc.json. Run before committing:
bun run lint
The build process includes TypeScript compilation:
# Runs as part of: bun run build tsc --noEmit
Maintain high test coverage. All public components and utilities should have tests.
bun run test:coverage
Only create new files when absolutely necessary:
Add dark mode toggle to application settingsNODE_NO_WARNINGS=1 (jsdom/Bun compatibility)src/i18n/locales/useTranslation() hook in componentssrc/mocks/handlers.tspublic/mockServiceWorker.js (auto-generated)src/setupTests.ts# 1. Create the component file # File: src/components/MyNewComponent.tsx import { FC } from 'react'; interface MyNewComponentProps { // Define props } export const MyNewComponent: FC<MyNewComponentProps> = (props) => { return <div>Component content</div>; }; # 2. Create test file # File: src/components/MyNewComponent.test.tsx # 3. Test it bun run test # 4. Run linter bun run lint
// File: src/api/MyService.ts export class MyService { static async fetch() { const response = await fetch('/api/endpoint'); return response.json(); } }
Clear cache and reinstall:
rm -rf node_modules bun.lock bun install
Check TypeScript errors:
bun run build
Run tests with verbose output:
bun run test -- --reporter=verbose
Debug a specific test:
bun run test MyComponent.test.tsx
bun run lint
For questions about the project structure or development workflow, refer to the main README.md or examine existing code examples in the repository.