appfunctions

Generates Kotlin AppFunctions code exposing Android app workflows to on-device AI agents.

3|Updated Aug 4, 2024
One-click install
npx skills add https://github.com/kabindra-shrestha/Clean-Architecture-Kotlin-Compose-Multiplatform --skill appfunctions-kabindra-shrestha
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: appfunctions
Source: https://github.com/kabindra-shrestha/Clean-Architecture-Kotlin-Compose-Multiplatform/tree/main/.agents/skills/device-ai/appfunctions
Command: npx skills add https://github.com/kabindra-shrestha/Clean-Architecture-Kotlin-Compose-Multiplatform --skill appfunctions-kabindra-shrestha

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Android developers need to expose app features to system AI agents, voice commands, and shortcuts without requiring users to open the app UI, but implementing AppFunctions correctly involves KSP setup, metadata XML, KDoc conventions, and ADB testing that are easy to get wrong. ## Core Features & Use Cases - Feature Discovery: Analyzes Android codebases (manifests, activities, services) to identify high-value workflows worth exposing as AppFunctions. - Implementation & Configuration: Generates Kotlin code with @AppFunction annotations, KSP/Gradle setup, app_metadata.xml, and optional Hilt dependency injection. - KDoc Refinement: Optimizes function and serializable documentation so LLM agents and MCP clients correctly understand and invoke the functions. - ADB Testing: Provides commands to list, invoke, enable, and disable AppFunctions on a connected device for verification. - Use Case: A notes app developer asks the assistant to expose note creation to Gemini; the skill discovers the workflow, generates createNote/listNotes AppFunctions with proper KDoc, and verifies registration via adb shell cmd app_function. ## Quick Start Analyze my Android app and implement AppFunctions for its core user workflows, then help me test them with ADB.

Frequently Asked Questions about appfunctions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement AppFunctions in an Android app?

Add the androidx.appfunctions, appfunctions-service, and KSP compiler dependencies, then annotate suspend functions with @AppFunction(isDescribedByKDoc = true). The first parameter must be AppFunctionContext, and you must define app_metadata.xml referenced from AndroidManifest.xml.

How do I test AppFunctions with ADB?

Use adb shell cmd app_function list-app-functions to see registered functions, then execute one with adb shell cmd app_function execute-app-function --package <pkg> --function <id> --parameters '<json>'. Wrap the JSON in single quotes to avoid shell escaping issues.

What Android version is required for AppFunctions?

AppFunctions are part of the Android platform API from Android 16 onwards, so the app must target SDK 36 or newer and compile against SDK 37 or newer. The Jetpack library handles backwards compatibility.

Why is my AppFunction metadata missing after building?

Metadata extraction fails when @AppFunctionSerializable classes use class-level @param tags instead of inline KDoc on each property. Also verify the KSP compiler dependency is applied and the ksp argument appfunctions:aggregateAppFunctions is set to true.

What data types can AppFunction parameters use?

Supported types include primitives, primitive arrays, String, PendingIntent, Uri, LocalDate, LocalDateTime, Instant, classes annotated with @AppFunctionSerializable, and Lists of supported non-primitive types. Prefer LocalDateTime or Instant for date and time values.