跳到正文
Skillpedia
API 与服务器(后端)48k · #5280

native-data-fetching

它能做什么

这个工具可以帮你的应用连接互联网,获取或发送信息。它涵盖的内容很广,从发起网络请求的基础知识,到处理网络问题,再到存储数据以便离线使用。

适用场景

  • ✓当你需要从某个网站或服务获取数据时。
  • ✓当你的应用即使在没有网络连接的情况下也需要正常工作时。
  • ✓当数据加载不正常,你需要排查问题时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/native-data-fetching/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/native-data-fetching/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我该如何在应用中从 API 获取数据?”

每周 5 个新技能,1 分钟读完。

工作原理

它会指导你选择最佳的网络请求方式,说明如何使用常用的数据获取库,并帮你配置应用,让它在各种网络环境下都能良好运行。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Expo Networking

You MUST use this skill for ANY networking work including API requests, data fetching, caching, or network debugging.

Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use

Use this skill when:

  • Implementing API requests
  • Setting up data fetching (React Query, SWR)
  • Using Expo Router data loaders (useLoaderData, web SDK 55+)
  • Debugging network failures
  • Implementing caching strategies
  • Handling offline scenarios
  • Authentication/token management
  • Configuring API URLs and environment variables

Example Invocations

User: "How do I make API calls in React Native?" -> Use fetch, wrap with error handling

User: "Should I use React Query or SWR?" -> React Query for complex apps, SWR for simpler needs

User: "My app needs to work offline" -> Use NetInfo for status, React Query persistence for caching

User: "How do I handle authentication tokens?" -> Store in expo-secure-store, implement refresh flow

User: "API calls are slow" -> Check caching strategy, use React Query staleTime User: "How do I configure different API URLs for dev and prod?" -> Use EXPOPUBLIC env vars with .env.development and .env.production files User: "Where should I put my API key?" -> Client-safe keys: EXPOPUBLIC in .env. Secret keys: non-prefixed env vars in API routes only

User: "How do I load data for a page in Expo Router?" -> See references/expo-router-loaders.md for route-level loaders (web, SDK 55+). For native, use React Query or fetch.

Limitations

  • Use this skill only when the task clearly matches its upstream product or API scope.
  • Verify commands, API behavior, pricing, quotas, credentials, and deployment effects against current official documentation before making changes.
  • Do not treat generated examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
常见问题

什么是“API 请求”?

它就像你的应用向互联网上的其他服务发出的请求,用来获取或发送信息。

为什么要处理网络错误?

这样即使连接失败,你的应用也不会崩溃,或显示令人困惑的信息,从而带来更好的使用体验。

什么是“缓存”?

缓存是指临时保存已经获取过的信息,这样应用下次就能更快地访问它,而不需要再次从互联网上获取。

详情

作者的原始描述

Use when implementing or debugging ANY network request, API call, or data fetching. Covers fetch API, React Query, SWR, error handling, caching, offline support, and Expo Router data loaders (`useLoaderData`).

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5280
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能