Token导航 LogoToken导航TokenDH.com
研究检索可写文件github未标认证来源可访问clear审计未展示

gemini-apiGemini API 文档

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

192

周安装

8

GitHub Stars

公开资料未说明

下载量

64
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gemini-api(Gemini API 文档)
来源仓库:https://github.com/jchaselubitz/drill-app
仓库路径:skills/gemini-api
安装命令:
npx skills add jchaselubitz/drill-app --skill "gemini-api"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add jchaselubitz/drill-app --skill "gemini-api"

简介

gemini-api 辅助 API 设计与接口文档整理。

  • 适合梳理 endpoint、生成 OpenAPI 草稿或检查字段命名。
  • 使用 npx skills add jchaselubitz/drill-app --skill "gemini-api" 安装。
  • 涉及真实业务语义时应从现有代码中提取事实。
  • gemini-api 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Gemini API Patterns

SDK Setup

Use the @google/genai package with Expo Constants for API key management:

import { GoogleGenAI } from '@google/genai';
import Constants from 'expo-constants';

const genAI = new GoogleGenAI({
  apiKey: Constants.expoConfig?.extra?.geminiApiKey as string
});

Available Models

ModelIDBest For
Gemini 3 Progemini-3-pro-previewAdvanced reasoning, complex tasks
Gemini 3 Flashgemini-3-flash-previewBalanced speed/intelligence
Gemini 2.5 Flashgemini-2.5-flashPrice-performance, scale
Gemini 2.5 Flash-Litegemini-2.5-flash-liteHigh-throughput, cost-efficient
Gemini 2.5 Progemini-2.5-proComplex reasoning, code, math

All models support 1M input tokens and 65K output tokens.

Basic Text Generation

const response = await genAI.models.generateContent({
  model: 'gemini-3-flash-preview',
  contents: 'Your prompt here',
});
const text = response.text ?? '';

Structured Content Format

For multi-turn or complex inputs, use the full contents structure:

const response = await genAI.models.generateContent({
  model: 'gemini-3-flash-preview',
  contents: [
    { role: 'user', parts: [{ text: 'First message' }] },
    { role: 'model', parts: [{ text: 'Assistant response' }] },
    { role: 'user', parts: [{ text: 'Follow-up question' }] },
  ],
});

System Instructions

Guide model behavior with system instructions in the config:

const response = await genAI.models.generateContent({
  model: 'gemini-3-flash-preview',
  contents: [{ role: 'user', parts: [{ text: userMessage }] }],
  config: {
    systemInstruction: 'You are a helpful language tutor. Respond in a friendly, encouraging tone.',
  },
});

JSON Mode (Structured Output)

Request JSON responses for type-safe parsing:

async function generateJSON<T>(prompt: string, model: string): Promise<T> {
  const result = await genAI.models.generateContent({
    model,
    contents: [{ role: 'user', parts: [{ text: prompt }] }],
    config: {
      responseMimeType: 'application/json',
    },
  });
  return JSON.parse(result.text ?? '') as T;
}

With JSON Schema (Zod)

For strict schema validation:

import { z } from 'zod';

const CorrectionSchema = z.object({
  correction: z.string(),
  feedback: z.string(),
});

const result = await genAI.models.generateContent({
  model: 'gemini-3-flash-preview',
  contents: prompt,
  config: {
    responseMimeType: 'application/json',
    responseSchema: CorrectionSchema,
  },
});

Configuration Options

const response = await genAI.models.generateContent({
  model: 'gemini-3-flash-preview',
  contents: prompt,
  config: {
    temperature: 1.0,              // Randomness (keep at 1.0 for Gemini 3)
    topP: 0.95,                    // Nucleus sampling
    topK: 40,                      // Top-k sampling
    maxOutputTokens: 8192,         // Limit response length
    stopSequences: ['END'],        // Stop generation triggers
    systemInstruction: '...',      // System prompt
    responseMimeType: 'application/json',  // Force JSON output
  },
});

Temperature Warning

For Gemini 3 models, keep temperature at 1.0 (the default). Lowering it can cause:

  • Response looping
  • Degraded performance on complex tasks
  • Unexpected behavior in reasoning

Error Handling Pattern

async function generateText(prompt: string, model: string): Promise<string> {
  try {
    const response = await genAI.models.generateContent({
      model,
      contents: prompt,
    });
    if (!response) {
      throw new Error('No response from Gemini');
    }
    return response.text ?? '';
  } catch (error) {
    console.error('Error generating text:', error);
    return '';
  }
}

Multi-Turn Chat

Maintain conversation history:

async function chat(
  systemPrompt: string,
  messages: Array<{ role: 'user' | 'model'; text: string }>,
  model: string
): Promise<string> {
  const contents = messages.map((msg) => ({
    role: msg.role,
    parts: [{ text: msg.text }],
  }));

  const result = await genAI.models.generateContent({
    model,
    contents,
    config: {
      systemInstruction: systemPrompt,
    },
  });
  return result.text ?? '';
}

Best Practices

  1. Always handle null/undefined: Use response.text?? '' for safe access
  2. Type your JSON responses: Use generics with JSON.parse() result
  3. Use system instructions: Define persona and behavior expectations
  4. Keep Gemini 3 temperature at 1.0: Avoid performance degradation
  5. Validate JSON output: Structured format doesn't guarantee semantic correctness
  6. Choose appropriate model: Use Flash for speed, Pro for complex reasoning

Common Mistakes to Avoid

  • Don't lower temperature below 1.0 for Gemini 3 models
  • Don't assume JSON responses are semantically valid - always validate
  • Don't forget to handle the case where response.text is undefined
  • Don't use raw string concatenation for multi-turn - use proper contents array

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

windsurf

27.95%
按下载量换算18

OpenCode

22.63%
按下载量换算14

Codex

19.4%
按下载量换算12

Claude Code

14.13%
按下载量换算9

Antigravity

8.76%
按下载量换算6

Gemini CLI

3.95%
按下载量换算3

安全审计

暂无安全审计结果可展示。

权限和风险

可写文件

该 Skill 可能写入或修改本地文件,使用前需要确认目标目录和修改范围。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills