plugins/lisa-expo-cursor/skills/cross-platform-compatibility/SKILL.md
This skill enforces cross-platform compatibility best practices for Expo apps targeting iOS, Android, and web. It should be used when creating new features, components, or screens to ensure they work correctly on all platforms. Use this skill when writing platform-specific code, using Platform.OS checks, creating platform-specific files (.web.tsx, .native.tsx, .ios.tsx, .android.tsx), or reviewing code for cross-platform issues.
npx skillsauth add codyswanngt/lisa cross-platform-compatibilityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides guidance for writing code that works correctly on iOS, Android, and web platforms in Expo applications.
Every feature must work on all three platforms (iOS, Android, web) unless explicitly documented otherwise. Test on all platforms before considering a feature complete.
There are two primary ways to handle platform differences:
Use Platform.OS for small, inline differences within a single component.
import { Platform } from "react-native";
// Simple conditional
if (Platform.OS === "web") {
// Web-specific code
}
// Platform.select for multiple platforms
const styles = StyleSheet.create({
container: {
...Platform.select({
ios: { shadowColor: "#000" },
android: { elevation: 4 },
web: { boxShadow: "0 2px 4px rgba(0,0,0,0.1)" },
}),
},
});
Use file extensions when entire components or modules differ significantly between platforms.
| Extension | Platforms | Use Case |
| -------------- | ------------- | ------------------------------- |
| .web.tsx | Web only | Web-specific implementation |
| .native.tsx | iOS + Android | Shared native implementation |
| .ios.tsx | iOS only | iOS-specific implementation |
| .android.tsx | Android only | Android-specific implementation |
Resolution Priority: Metro bundler resolves in this order:
.ios.tsx / .android.tsx (most specific).native.tsx (native platforms).web.tsx (web platform).tsx (universal fallback)Need platform-specific behavior?
├── Small differences (styles, one-liner logic)?
│ └── Use Platform.OS or Platform.select()
├── Moderate differences (conditional rendering blocks)?
│ └── Use Platform.OS with clear separation
└── Significant differences (entire component logic)?
└── Use platform-specific file extensions
dom-to-image for web vs react-native-view-shot for native)app/ Directory (Expo Router)Platform-specific extensions in the app/ directory require a base version for route universality:
app/
├── _layout.tsx # Required base version
├── _layout.web.tsx # Optional web override
├── index.tsx # Required base version
├── about.tsx # Required base version
└── about.web.tsx # Optional web override
app/ DirectoryPlatform-specific files outside app/ do not require a base version:
components/
├── DatePicker/
│ ├── DatePickerContainer.tsx # Container (shared logic)
│ ├── DatePickerView.tsx # Default view
│ ├── DatePickerView.web.tsx # Web-specific view
│ └── index.tsx # Exports container
To use platform-specific components in routes:
// components/about/index.tsx (or about.native.tsx + about.web.tsx)
// Platform-specific implementations
// app/about.tsx
export { default } from "../components/about";
These APIs require Platform.OS checks or alternatives on web:
| API | Issue on Web | Solution |
| --------------------------------- | ----------------- | -------------------------------- |
| MediaLibrary.saveToLibraryAsync | Not supported | Use download link on web |
| Share.share() | Limited support | Use Web Share API or clipboard |
| Haptics.* | Not supported | Skip or use CSS animations |
| captureRef() | Not supported | Use dom-to-image on web |
| Linking.openURL() | Works but differs | Consider window.open() for web |
// Platform-specific shadows
const shadowStyles = Platform.select({
ios: {
shadowColor: "#000",
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.25,
shadowRadius: 3.84,
},
android: {
elevation: 5,
},
web: {
boxShadow: "0 2px 4px rgba(0,0,0,0.25)",
},
});
// Web may need different gesture handlers
const gestureConfig = Platform.select({
web: { enabled: false }, // Disable on web if using mouse
default: { enabled: true },
});
// hooks/useSaveImage.ts
import { Platform } from "react-native";
/**
* Hook for saving images with platform-specific implementations.
*/
export const useSaveImage = () => {
const saveImage = useCallback(async (imageRef: React.RefObject<View>) => {
if (Platform.OS === "web") {
// Web implementation using dom-to-image
const dataUrl = await domtoimage.toJpeg(imageRef.current);
const link = document.createElement("a");
link.download = "image.jpeg";
link.href = dataUrl;
link.click();
} else {
// Native implementation using view-shot
const uri = await captureRef(imageRef);
await MediaLibrary.saveToLibraryAsync(uri);
}
}, []);
return { saveImage };
};
// components/Modal/ModalView.native.tsx
import { Modal as RNModal } from "react-native";
const ModalView = ({ visible, children }: ModalViewProps) => (
<RNModal visible={visible} animationType="slide">
{children}
</RNModal>
);
// components/Modal/ModalView.web.tsx
const ModalView = ({ visible, children }: ModalViewProps) =>
visible ? (
<div className="modal-overlay">
<div className="modal-content">{children}</div>
</div>
) : null;
// Only import heavy libraries on platforms that need them
const loadPlatformModule = async () => {
if (Platform.OS === "web") {
return await import("dom-to-image");
}
return await import("react-native-view-shot");
};
Before submitting code, verify:
app/ have base versionsdefault)To validate cross-platform compliance:
python3 .claude/skills/cross-platform-compatibility/scripts/validate_cross_platform.py [path]
For detailed patterns and examples:
references/platform-api.md - Platform module API referencereferences/file-extensions.md - File extension patterns and resolutionreferences/common-issues.md - Platform-specific issues and solutionsdocumentation
Onboard a user to the project via its LLM Wiki. Interviews the user about themselves in relation to the project, captures that to project-scoped memory only, then gives a guided tour of what the project is and sample questions they can ask. Use when someone is new to the project or asks to be onboarded. Read-mostly — it does not open PRs or write PII into the wiki.
documentation
Migrate an existing, hand-rolled wiki implementation onto the lisa-wiki kernel — phased and compatibility-first, with a strict no-loss guarantee. Use when adopting lisa-wiki in a repo that already has its own wiki/, ingest skills, docs, or roles. Renaming things into the canonical shape is fine; losing functionality or data is not. Ends by running /doctor.
development
Health-check the LLM Wiki. Reports orphan pages, contradictions, stale claims, broken internal links, missing index/log coverage, structure-manifest violations, and secret/tenant leaks. Use periodically or before hardening a wiki. Read-only — it reports findings, it does not fix them.
testing
Ingest source material into the LLM Wiki. With an argument (URL, file path, or prompt) it ingests that one source; with no argument it runs a full ingest across every enabled non-external-write source. Routes to the right connector, then runs the ordered pipeline (source note → synthesis → index → log → verify → state → commit/PR). Use whenever new knowledge should enter the wiki.