Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
21
> **For AI Assistants**: This file contains essential rules for working with this codebase. For comprehensive documentation, see `CLAUDE.md`.
Sign in to like and favorite skills
For AI Assistants: This file contains essential rules for working with this codebase. For comprehensive documentation, see
.CLAUDE.md
Only use the exact peer dependencies listed in package.json:
@fluentui/[email protected] @pnp/spfx-controls-react@^3.22.0 @pnp/logging@^4.16.0 @pnp/sp@^3.20.1 @pnp/queryable@^3.20.1 react@^17.0.1 react-dom@^17.0.1 devextreme@^22.2.3 devextreme-react@^22.2.3 react-hook-form@^7.45.4 zustand@^4.3.9
NEVER add: lodash, moment, date-fns, axios, styled-components, or ANY other package.
In source code (this library) - Use RELATIVE imports:
// ✅ CORRECT import { IComponentProps } from './ComponentName.types'; import { SPContext } from '../../utilities/context'; // ❌ WRONG - No path aliases import { IComponentProps } from '@/components/ComponentName.types';
Fluent UI - Use tree-shakable imports:
// ✅ CORRECT - Saves 200-500KB+ import { Button } from '@fluentui/react/lib/Button'; import { TextField } from '@fluentui/react/lib/TextField'; import { Stack } from '@fluentui/react/lib/Stack'; // ❌ WRONG - Imports entire library import { Button, TextField, Stack } from '@fluentui/react';
// In consuming web part's onInit(): await SPContext.smart(this.context, 'MyWebPart'); // Then use anywhere: SPContext.sp.web.lists.getByTitle('MyList').items(); SPContext.logger.info('Message');
ComponentName/ ├── ComponentName.tsx # Main component ├── ComponentName.types.ts # TypeScript interfaces ├── ComponentName.css # Scoped styles ├── index.ts # Exports └── README.md # Documentation
Always use
isMountedRef or requestIdRef for async operations:
// Pattern 1: isMountedRef const isMountedRef = useRef(true); useEffect(() => { return () => { isMountedRef.current = false; }; }, []); // In async callback: if (isMountedRef.current) { setState(result); } // Pattern 2: Request versioning (for rapid prop changes) const requestIdRef = useRef(0); useEffect(() => { const currentRequestId = ++requestIdRef.current; fetchData().then(result => { if (currentRequestId === requestIdRef.current) { setState(result); } }); }, [dependency]);
Use
SPContext.logger instead of console.log/warn/error:
SPContext.logger.info('Message', { data }); SPContext.logger.warn('Warning', { context }); SPContext.logger.error('Error', error, { context });
npm run build # Build TypeScript + copy assets npm run validate # Validate build output npm run watch # Development mode npm run clean # Clean build output
| Component | Purpose | Import Path |
|---|---|---|
| Card | Expandable containers | |
| UserPersona | User profile display | |
| WorkflowStepper | Process flow UI | |
| ManageAccess | Permission management | |
| VersionHistory | Document versions | |
| ConflictDetector | Concurrent editing | |
| GroupViewer | SharePoint groups | |
| ErrorBoundary | Error handling | |
| Utility | Purpose |
|---|---|
| SPFx context management, PnP instances, logging |
| Batch SharePoint operations |
| Permission validation |
| Field extraction/updates |
/lib/ pathsSPContext.loggerisMountedRef or requestIdRefBefore committing:
npm run build passesnpm run validate passesSPContext.logger instead of consoleLast Updated: January 2026
For detailed documentation, see CLAUDE.md