Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/2154355737/jieshenshequ/02-react-typescriptgit clone --depth 1 https://github.com/2154355737/JieShenSheQuWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/2154355737/jieshenshequ/02-react-typescript)<a href="https://agentmods.dev/rules/2154355737/jieshenshequ/02-react-typescript"><img src="https://agentmods.dev/badge/rules/2154355737/jieshenshequ/02-react-typescript.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02158 |
| Opus 5 | $0.00000 | $0.01079 |
| Sonnet 5 | $0.00000 | $0.00432 |
| Haiku 4.5 | $0.00000 | $0.00216 |
Grade A, and why
02-react-typescript scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 355 lines — stays where its author put it; the contents beside it link to each section on GitHub.
React + TypeScript 开发规范
📋 组件开发规范
1. 组件定义
// ✅ 推荐: 使用函数组件 + TypeScript
interface UserProfileProps {
userId: string;
onUpdate?: (user: User) => void;
}
export const UserProfile: React.FC<UserProfileProps> = ({ userId, onUpdate }) => {
const [loading, setLoading] = useState(false);
return <div>...</div>;
};
2. Props类型定义
- 总是为Props定义接口
- 使用可选属性标记
? - 提供默认值
interface ButtonProps {
label: string;
variant?: 'primary' | 'secondary' | 'outline';
disabled?: boolean;
onClick?: () => void;
}
export const Button: React.FC<ButtonProps> = ({
label,
variant = 'primary',
disabled = false,
onClick
}) => {
return <button className={`btn-${variant}`} disabled={disabled} onClick={onClick}>
{label}
</button>;
};
3. Hooks使用规范
// ✅ 推荐: 自定义Hook
export const useAuth = () => {
const context = useContext(AuthContext);
if (!context) {
throw new Error('useAuth must be used within AuthProvider');
}
return context;
};
// 在组件中使用
const MyComponent: React.FC = () => {
const { user, login, logout } = useAuth();
// ...
};
4. 状态管理
// ✅ 推荐: 使用Context API
interface AuthContextType {
user: User | null;
isAuthenticated: boolean;
login: (token: string) => Promise<void>;
logout: () => void;
}
export const AuthContext = createContext<AuthContextType | undefined>(undefined);
export const AuthProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
const [user, setUser] = useState<User | null>(null);
const login = async (token: string) => {
// 实现登录逻辑
};
return (
<AuthContext.Provider value={{ user, isAuthenticated: !!user, login, logout }}>
{children}
</AuthContext.Provider>
);
};
5. 错误处理
// ✅ 推荐: 使用错误边界
export const ErrorBoundary: React.FC<{ children: ReactNode }> = ({ children }) => {
const [hasError, setHasError] = useState(false);
useEffect(() => {
const handleError = (error: Error) => {
console.error('Error caught:', error);
setHasError(true);
};
window.addEventListener('error', handleError);
return () => window.removeEventListener('error', handleError);
}, []);
if (hasError) {
return <div>Something went wrong</div>;
}
return <>{children}</>;
};
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 355 lines · 2,158 tokens per session scan A 812ccc899d59
02-react-typescript is a cursor rule published in the GitHub repository 2154355737/JieShenSheQu (2 stars, last pushed 10mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,158 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
react-native-best-practices
React Native performance — route to react-native-best-practices SKILL.md and profiling first.
library-conventions
React Native library conventions for this starter. Apply when creating or editing components, hooks, types, or tests in src/.
react-native-polyfills
Required polyfills and configuration for MetaMask Connect SDK in React Native — import order, Buffer, window, Event/CustomEvent, metro config, and persistence.
navigation
React Navigation V7 導覽規範與 iOS 26 原生適配.
expo
Expo/React Native: native modules, navigation, platform-specific code.
react-native
该规则解释了 TypeScript、React Native、Expo 和移动 UI 开发的使用方法和最佳实践。.