appfunctions
它能做什么
这个技能审查 Android 应用,找出常见的用户任务,例如创建笔记或播放媒体,并把它们转换为 AppFunctions。一旦暴露,AI 智能体和语音命令无需打开应用即可运行它们。适合希望应用与系统智能体协同工作的 Android 开发者。
适用场景
- ✓当你希望 AI 智能体或语音命令能在你的 Android 应用中创建笔记或播放媒体的时候。
- ✓当你想找出应用中哪些操作值得暴露给系统智能体时。
- ✓当你需要 Kotlin 代码和清晰的描述,使智能体能正确选择和调用你的函数的时候。
技能链接
https://github.com/android/skills/blob/main/device-ai/appfunctions/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请找出我的 Android 应用中主要的任务,并告诉我哪些应该作为 AppFunctions 暴露给 AI 智能体。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能会分析应用以找出用户工作流,然后使用 androidx.appfunctions 库编写 Kotlin 代码。它还会改进描述,使智能体理解何时使用每个函数。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Analyzes Android apps to identify key user workflows to expose as AppFunctions, such as creating a note, playing media, or sending a message, for AI agents, voice commands, and system shortcuts to run without opening the app UI.
Generates Kotlin code to expose these workflows to the Android system, allowing agents to discover and execute them on-device.
Also refines KDoc documentation and the app description so AI agents correctly understand and use the provided functionality.
Prerequisites
The app must targetSdk 36 or newer and use compileSdk 37 or newer as
AppFunctions, part of the Android platform API, are available from Android 16
onwards.
Always use the Jetpack library because it handles backward compatibility.
Use androidx.appfunctions:appfunctions and the KSP compiler
androidx.appfunctions:appfunctions-compiler, version 1.0.0-beta01 or later.
Workflows
This skill enables the caller to discover features that will be provided to system agents, implement these with AppFunctions, improve function description for agents, and use ADB commands for local evaluation and testing.
The full AppFunction development flow consists of these four steps:
- Step 1: Discovery: Analyze Android codebases to identify and recommend potential AppFunctions. Use this step when a user asks to "discover AppFunctions," "find features for AI," or "analyze my app for agentic tools."
- Step 2: Implementation and configuration: Generate Kotlin implementations of AppFunctions, manage system-wide configuration, and configure build dependencies. Use this step when a user asks to "implement AppFunctions," "set up the AppFunctions framework," or "configure Hilt for AppFunctions."
- Step 3: KDoc refinement: Optimize AppFunction KDoc and the app description for AI agents and Model Context Protocol. If a user asks to "write KDoc", "optimize for MCP", or "refactor tool descriptions for LLMs", use this step.
- Step 4: Testing and debugging: Provide commands to interact with AppFunctions using ADB for testing and debugging. If a user wants to "list app functions", "invoke an app function", or "verify app function registration" on a device, use this step.
When the user asks for a subset of the steps, run those steps and any step that the critical constraints require. Then list the skipped steps and ask whether to run them.
If they apply, you must load the following references:
- Context and terminology: Defines the ubiquitous language, architecture definitions, and design patterns across the AppFunctions skill suite. Load when you need to understand core architecture terminology or check the distinctions between modern and legacy AppFunctions APIs.
- Migration to service entry point : Migrates apps on AppFunctions 1.0.0-alpha09 or lower to the
AppFunctionServiceEntryPointarchitecture from 1.0.0-alpha10, and upgrades apps to 1.0.0-beta01. Load it when a user asks to migrate or upgrade existing AppFunctions code. When you find legacyAppFunctionConfiguration.Providerimplementations,@AppFunctionannotations, orappfn:descriptionattributes, load it and ask the user before you migrate.
Critical constraints
- Modular consistency: You must refine KDocs immediately after you generate AppFunction implementations.
- Security: Expose only safe, non-destructive tasks that the app's UI already offers on that form factor. Never give agents wide-ranging access to user data or system resources. Never require or return passwords, financial details, private keys, or other highly sensitive personal information.
- Descriptions: Describe what each function does, never how an agent must behave. Put call order across functions in the app description, not in function KDoc.
Troubleshooting
- If you encounter build-time errors such as Kotlin Symbol Processing (KSP) issues, see Implementation and configuration.
- If you encounter runtime errors such as missing services or execution failures, see Testing and debugging.
- If you need architecture definitions and vocabulary, see Context and terminology.
- If you encounter issues when upgrading AppFunct
常见问题
我的应用需要哪个 Android 版本?
应用必须以 SDK 36 或更高版本为目标,并使用 SDK 37 或更高版本编译,因为 AppFunctions 是 Android 16 及更高版本的一部分。
我可以在没有应用界面的情况下测试函数吗?
可以。该技能包含用于本地测试和评估的 ADB 命令。
它会改变应用界面的外观吗?
不会。它的目标是把工作流暴露给智能体,使其无需打开应用界面即可运行。
详情
作者的原始描述
Analyzes Android apps to find user workflows to expose as AppFunctions, such as creating a note, playing media, or sending a message. AI agents, voice commands, and system shortcuts then run them without opening the app UI. Generates Kotlin code with the androidx.appfunctions library, and refines KDoc and the app description so that agents choose and call functions correctly. Use this skill when discovering, implementing, documenting, testing, or upgrading AppFunctions in an Android app, including @AppFunctionDeclaration, @AppFunctionSerializable, @AppFunctionServiceEntryPoint, AppFunctionServ
repo: android/skills
热度
- GitHub 星标
- 10k
- 排名
- #11910
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/29
评论
- …
同一仓库的更多技能
agp-9-upgrade
10k帮你的智能体把 Android 应用升级到 Android Gradle Plugin 9,并处理其中的破坏性变更。不适用于多平台项目。
camerax
10k帮你的智能体使用 CameraX 构建 Android 相机功能,包括视频录制、硬件控制以及 ML Kit 和 Media3 效果。
android-for-cars-parked-apps
10k帮你的智能体把 Android 视频、游戏或浏览器应用调整为可在 Android Auto 和 Android Automotive 上以停放应用形式运行。
litert-lm
10k帮你的智能体构建一个在设备上运行开放文本 AI 模型的 Android 应用,使用 LiteRT-LM Kotlin API。