Generated banner for Appfunctions
Generated logo for Appfunctions

Appfunctions

Android (Google)OfficialCreated by Google LLCDistributed by Android (Google)

  • Skill
  • Tool integration
  • Software development
  • Apache-2.0
  • No issues found

From the author

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, AppFunctionService, app_metadata.xml, appfn:instructions, adb shell cmd app_function, and legacy @AppFunction or AppFunctionConfiguration.Provider code. Don't use for building agents that call AppFunctions or for remote MCP servers.
— the description by Google LLC

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The appfunctions skill provides a structured approach to exposing Android app workflows as AppFunctions. It covers the full development lifecycle, including feature discovery, Kotlin implementation using the androidx.appfunctions library, KDoc optimization for AI agents, and local testing via ADB. It ensures developers can build modular, secure, and discoverable tools that allow AI agents, voice commands, and system shortcuts to interact with app functionality without requiring the user to open the app UI.

What it does

  • Analyzes Android codebases to identify workflows suitable for AppFunctions.
  • Generates Kotlin code using the androidx.appfunctions library and KSP.
  • Refines KDoc and app metadata to improve AI agent understanding and tool selection.
  • Provides ADB commands for listing, executing, and managing AppFunction states.
  • Supports migration from legacy AppFunction APIs to the modern Service Entry Point architecture.
  • Enforces security constraints to ensure only safe, non-destructive tasks are exposed.

When to use it

  • When you need to expose app features to AI agents or system-level voice commands.
  • When implementing or upgrading to the latest androidx.appfunctions library.
  • When you need to optimize existing function descriptions for better LLM or MCP compatibility.
  • When testing or debugging AppFunction registration and execution on a local device or emulator.
  • When migrating legacy AppFunction implementations to the current service entry point pattern.

Advantages

  • Enables seamless, UI-less interaction between AI agents and Android applications.
  • Standardizes the implementation process through clear, step-by-step development workflows.
  • Improves discoverability and reliability of app tools for AI models.
  • Provides robust testing capabilities via direct ADB command integration.
  • Ensures backward compatibility through the use of Jetpack libraries.

Usage examples

“Analyze my app to find features that should be exposed as AppFunctions.”
The agent will perform a feature discovery analysis, identifying key user workflows and recommending which should be implemented as AppFunctions.
“How do I implement a 'send message' AppFunction in my Kotlin project?”
The agent will guide you through generating the necessary Kotlin code, configuring the service entry point, and adding the required annotations.
“Optimize my AppFunction KDocs so an AI agent knows how to use them.”
The agent will review your existing KDoc and app metadata, providing refinements to ensure clear, intent-based descriptions for AI models.
“List all registered AppFunctions on my device for package com.example.app.”
The agent will provide the specific ADB command to query and display the registered functions for your application.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/android/appfunctions/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip appfunctions.zip -d .agents/skills

Documentation by Google LLC

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 AppFunctionServiceEntryPoint architecture 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 legacy AppFunctionConfiguration.Provider implementations, @AppFunction annotations, or appfn:description attributes, 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

Files

references/kdoc-refinement-optimization.md

Optimizes AppFunction KDoc and the app description for AI agents and Model Context Protocol.

Instructions

Workflow: Agent-centric documentation
  1. Identify the core outcome : Start the description with a third-person verb and the resource it acts on. Examples: "Searches contacts", "Creates a task", and "Updates a channel". Put key information first, because some agents don't read the whole description. Focus on the user benefit, not the code implementation.

  2. Behavior : State conditional behavior, for example, "If query is null, returns the 3 most recent contacts." Never describe call order across functions, such as "Search for the contact first." Write call order in the app description instead.

  3. Parameter documentation :

    • For functions : Use specific @param tags. Isolate validation rules and default values here. Describe the result with @return. Only the summary, @param, and @return reach agents; other tags, such as @throws, don't.

    • For serializables : Use inline KDoc directly for each property declaration. KSP won't extract documentation from class-level tags.

  4. Error surface mapping : The agent receives the type and message of the exception that a function throws. Throw the matching AppFunctionException subclass with a plain-language message, for example, "No contact matches query."

Workflow: App description

When writing the app description in the appfn:instructions attribute of app_metadata.xml, follow these instructions. Before 1.0.0-beta01, this attribute was appfn:description.

  1. Lead with the domain: Start with the app's primary domain, then give a concise list of the tasks that its AppFunctions perform.

  2. Capture cross-function relationships : Explain dependencies or sequences between functions, for example, "Call 'searchContacts' to get the endpointValue for 'send'." Agents decide whether to follow the app description, so never rely on it to enforce critical behavior.

  3. Document operational patterns: Guide the LLM on token-conserving usage, for example, "Use 'batch_update' over multiple 'update' calls."

  4. Specify constraints : State constraints that apply across functions, for example, "File operations limited to workspace" or "Rate limit: 10 requests per minute." Put limits on a single parameter in that function's @param tag.

  5. Anti-patterns :

    • Don't repeat individual function descriptions.

    • Don't include marketing claims or subjective praise.

    • Don't attempt to prompt model personality or conversation style.

Critical constraints

Descriptive, not commanding

Describe what the function does , not what the LLM must do. Avoid phrases like "You must call this..." or "You must ask the user for...". Start with the outcome instead, such as "Creates a task with a title and due date."

No "fluff"

Remove conversational padding like "This method is used to..." or "Helpful for...". Be concise, specific, and neutral.

No emphasis markup

Never use excessive capitalization or special characters to draw attention, such as **CRITICAL** or VERY IMPORTANT.

Accurate and self-contained

The description matches what the code does, including its parameters and output. A function described as read-only never writes or deletes data. Never describe more than the function does, because agents then call it for unrelated requests. Never reference or try to influence other AppFunctions, including other apps' AppFunctions.

Instruction annotations override KDoc

If an element has @AppFunctionInstruction, its text replaces that element's KDoc in the generated metadata. Refine the annotation text instead of the KDoc.

Inline KDoc for serializables

Mandatory : For @AppFunctionSerializable classes, documentation must be inline for each property. KSP ignores class-level @param or @property tags for these classes.

Examples

Example: MCP refactoring

Original:

/** This function helps you find people. */

Refined:

 /**
   * Searches for message recipients by name or email.
   * @param query Search string for name/email. If null, returns 3 most recent contacts.
   * @return List of "Recipient" objects matching the query.
   */
Example: App description

Refined:

This app manages tasks for teams: creating and assigning tasks, updating task
status, and searching users.

Operational Patterns:
- Always use 'searchUsers' to resolve user handles to internal IDs before calling 'assignTask'.
- Prefer 'batchUpdateStatus' when modifying more than three tasks simultaneously to reduce latency.

Constraints:
- Task titles are limited to 100 characters.
- Attachment uploads are limited to 5 MB.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Google LLC
Publisher
Android (Google) (Official)
Distributed by
Android (Google)
Source
android/skills · device-ai/appfunctions · commit bf68e2d
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE.txt)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google LLC or Android (Google).

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download appfunctions.zip