Communitygithub.com

Android 백그라운드 태스크 전문가

WorkManager, Foreground Service, Doze 모드 및 배터리 최적화를 위한 Android 백그라운드 태스크 특화 스킬입니다. "WorkManager", "background task Android", "Foreground Service", "Doze mode", "battery optimization", "periodic work", "background sync Android", "JobScheduler" 등에서 활성화됩니다. iOS 백그라운드 태스크, React Native 백그라운드, UI 아키텍처에는 사용하지 마세요.

Android 백그라운드 태스크 전문가란 무엇인가요?

이 스킬은 Android 애플리케이션에서 백그라운드 작업을 설계하고 구현할 때 필요한 전문 지식을 제공합니다. WorkManager를 이용한 지연 가능한 작업, Foreground Service를 통한 사용자 인지 작업, Doze 모드 및 배터리 최적화 처리를 위한 모범 사례와 코드 패턴을 제시합니다. 주요 기능으로는 CoroutineWorker와 HiltWorker를 활용한 비동기 작업 정의, 네트워크/배터리/저장소 제약 조건 설정, 작업 체이닝, 재시도 정책, 고유 작업 정책 등이 포함됩니다. Android 12 이상에서 백그라운드 서비스 제한이 강화됨에 따라 AlarmManager 대신 WorkManager 사용, Foreground Service 타입 명시, 배터리 세이버 존중 등의 안티 패턴을 방지할 수 있습니다. 또한 adb를 통한 Doze 모드 테스트, TestWorkerBuilder를 통한 단위 테스트 방법까지 상세히 안내하여 실제 개발 환경에서 바로 적용 가능합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/curiositech/windags-skills/tree/HEAD/skills/android-background-task-specialist

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Android Background Task Specialist

Android 백그라운드 실행 전문가: WorkManager, Foreground Service, Doze 모드 처리, 배터리 효율적인 프로세싱에 대한 전문 지식을 제공합니다.

활성화 트리거

다음에서 활성화: "WorkManager", "background task Android", "Foreground Service", "Doze mode", "battery optimization", "periodic work", "background sync", "JobScheduler", "background processing Android"

다음에서는 사용하지 마세요: iOS 백그라운드 태스크 → swiftui-data-flow-expert | React Native 백그라운드 → mobile-offline-sync-architect | UI 아키텍처 → jetpack-compose-navigation-expert

빠른 시작

  1. 올바른 API 선택 — 지연 가능한 작업에는 WorkManager, 사용자에게 보이는 지속적 작업에는 Foreground Service, 짧은 비동기 작업에는 코루틴 사용
  2. 워커 정의 — CoroutineWorker를 확장하고 suspend 함수를 사용하여 깔끔한 비동기 코드 작성
  3. 제약 조건 구성 — 네트워크 유형, 배터리 수준, 저장 공간 요구사항 설정
  4. Doze 및 App Standby 처리 — Doze 호환 스케줄링을 위해 AlarmManager 대신 WorkManager 사용
  5. adb로 테스트 — Doze 모드를 강제하고 제약 조건 충족 시 작업이 실행되는지 확인

핵심 기능

도메인기술
지연 가능한 작업WorkManager 2.10, OneTimeWorkRequest, PeriodicWorkRequest
포그라운드Foreground Service 유형 (dataSync, location, mediaPlayback, shortService)
제약 조건NetworkType, BatteryNotLow, StorageNotLow, DeviceIdle
체이닝WorkContinuation, 병렬 체인, 고유 작업 정책
테스팅TestWorkerBuilder, TestListenableWorkerBuilder, WorkManagerTestInitHelper

아키텍처 패턴

WorkManager 결정 트리

작업이 사용자에 의해 시작되었고 완료되어야 하는가?
  ├─ 예 → 10분 미만인가?
  │   ├─ 예 → Foreground Service (shortService 유형)
  │   └─ 아니오 → Foreground Service (dataSync, location 등)
  │
  └─ 아니오 → 지연 가능한가?
      ├─ 예 → WorkManager
      │   ├─ 일회성? → OneTimeWorkRequest
      │   └─ 주기적? → PeriodicWorkRequest (최소 15분 간격)
      │
      └─ 아니오 → 앱이 화면에 보이는 동안인가?
          ├─ 예 → CoroutineScope (viewModelScope 또는 lifecycleScope)
          └─ 아니오 → 아마도 WorkManager를 사용해야 함

재시도 및 진행률을 포함한 CoroutineWorker

@HiltWorker
class SyncWorker @AssistedInject constructor(
    @Assisted context: Context,
    @Assisted params: WorkerParameters,
    private val syncRepository: SyncRepository,
    private val notificationHelper: NotificationHelper,
) : CoroutineWorker(context, params) {

    override suspend fun doWork(): Result {
        // UI 관찰을 위한 진행률 보고
        setProgress(workDataOf("progress" to 0))

        return try {
            val pendingItems = syncRepository.getPendingChanges()

            pendingItems.forEachIndexed { index, item ->
                syncRepository.syncItem(item)
                setProgress(workDataOf(
                    "progress" to ((index + 1) * 100 / pendingItems.size)
                ))
            }

            Result.success(workDataOf("synced" to pendingItems.size))
        } catch (e: IOException) {
            if (runAttemptCount < 3) {
                Result.retry()  // 기본적으로 지수 백오프 적용
            } else {
                Result.failure(workDataOf("error" to e.message))
            }
        }
    }

    override suspend fun getForegroundInfo(): ForegroundInfo {
        return ForegroundInfo(
            NOTIFICATION_ID,
            notificationHelper.createSyncNotification()
        )
    }
}

제약 조건 및 체이닝을 포함한 스케줄링

// 1시간마다 주기적 동기화 스케줄링 (최소 15분)
val syncRequest = PeriodicWorkRequestBuilder<SyncWorker>(1, TimeUnit.HOURS)
    .setConstraints(
        Constraints.Builder()
            .setRequiredNetworkType(NetworkType.CONNECTED)
            .setRequiresBatteryNotLow(true)
            .build()
    )
    .setBackoffCriteria(
        BackoffPolicy.EXPONENTIAL,
        WorkRequest.MIN_BACKOFF_MILLIS,
        TimeUnit.MILLISECONDS
    )
    .addTag("sync")
    .build()

WorkManager.getInstance(context).enqueueUniquePeriodicWork(
    "periodic-sync",
    ExistingPeriodicWorkPolicy.KEEP,  // 이미 스케줄링되어 있으면 다시 시작하지 않음
    syncRequest
)

// 체인: 다운로드 → 처리 → 업로드 (순차적)
WorkManager.getInstance(context)
    .beginWith(downloadWork)
    .then(processWork)
    .then(uploadWork)
    .enqueue()

안티 패턴

  1. 지연 가능한 작업에 AlarmManager 사용 — AlarmManager 알람은 Doze 호환되지 않으며 배터리를 소모합니다. Doze, App Standby, 배터리 세이버를 존중하는 WorkManager를 사용하세요.
  2. 포그라운드 알림 없이 백그라운드 서비스 실행 — Android 12+는 백그라운드 서비스를 종료합니다. 적절한 유형 선언과 함께 Foreground Service를 사용하거나 WorkManager를 사용하세요.
  3. 15분 미만의 PeriodicWork — WorkManager는 최소 15분 간격을 강제합니다. 더 자주 실행해야 하는 작업은 Foreground Service 또는 생명주기를 인식하는 코루틴을 사용하세요.
  4. Foreground Service 유형 선언 누락 — Android 14+는 manifest에 foregroundServiceType을 명시적으로 선언해야 합니다. 생략하면 SecurityException이 발생합니다.
  5. 작업 관찰 무시 — 작업을 시작만 하고 사용자에게 진행률을 보여주지 않는 경우. getWorkInfoByIdLiveData() 또는 getWorkInfoByIdFlow()를 통해 WorkInfo를 관찰하여 UI를 업데이트하세요.

품질 체크리스트

[ ] 지연 가능한 백그라운드 작업에 WorkManager 사용 (AlarmManager 아님)
[ ] Foreground Service가 AndroidManifest에 올바른 유형으로 선언됨
[ ] 제약 조건 구성 (네트워크, 배터리, 저장소)
[ ] 일시적 실패에 대한 백오프 재시도 정책 설정
[ ] 주기적/일회성 작업에 대한 고유 작업 정책 설정
[ ] 작업 진행률이 UI에서 관찰 가능함
[ ] Doze 모드 adb 테스트: `adb shell dumpsys deviceidle force-idle`
[ ] 배터리 최적화 테스트: `adb shell am set-inactive <package> true`
[ ] TestWorkerBuilder로 워커 테스트 완료
[ ] Foreground Service 알림용 알림 채널 생성됨
[ ] 작업 체인이 부분적 실패를 우아하게 처리함
[ ] 백그라운드 작업이 사용자의 배터리 세이버 선호도를 존중함

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

curiositech/windags-skills

Expert in 2000s-era music visualization (Milkdrop, AVS, Geiss) and modern WebGL implementations. Specializes in Butterchurn integration, Web Audio API AnalyserNode FFT data, GLSL shaders for audio-reactive visuals, and psychedelic generative art. Activate on "Milkdrop", "music visualization", "WebGL visualizer", "Butterchurn", "audio reactive", "FFT visualization", "spectrum analyzer". NOT for simple bar charts/waveforms (use basic canvas), video editing, or non-audio visuals.

curiositech/windags-skills

Expert legal research agent for finding and scraping expungement data state by state. Knows authoritative sources, URL patterns, Firecrawl configuration, and 2026 legal landscape.

curiositech/windags-skills

Expert in 3D computer vision labeling tools, workflows, and AI-assisted annotation for LiDAR, point clouds, and sensor fusion. Covers SAM4D/Point-SAM, human-in-the-loop architectures, and vertical-specific training strategies. Activate on '3D labeling', 'point cloud annotation', 'LiDAR labeling', 'SAM 3D', 'SAM4D', 'sensor fusion annotation', '3D bounding box', 'semantic segmentation point cloud'. NOT for 2D image labeling (use clip-aware-embeddings), general ML training (use ml-engineer), video annotation without 3D (use computer-vision-pipeline), or VLM prompt engineering (use prompt-engineer).

curiositech/windags-skills

Implement WCAG 2.2 AA/AAA compliance with automated testing, keyboard navigation, screen reader support, and focus management. Activate on: accessibility audit, WCAG compliance, keyboard navigation, screen reader, aria attributes, axe-core, focus trap. NOT for: design-level accessibility review (use design-accessibility-auditor), color contrast only (use css-in-js-architect).

curiositech/windags-skills

Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time estimation, dopamine-aware task design, and building systems that actually work for neurodivergent minds.

curiositech/windags-skills

Designs digital experiences for ADHD brains using neuroscience research and UX principles. Expert in reducing cognitive load, time blindness solutions, dopamine-driven engagement, and compassionate design patterns. Activate on 'ADHD design', 'cognitive load', 'accessibility', 'neurodivergent UX', 'time blindness', 'dopamine-driven', 'executive function'. NOT for general accessibility (WCAG only), neurotypical UX design, or simple UI styling without ADHD context.

curiositech/windags-skills

>- Apply crisis decision-making research to agent routing, uncertainty triage, and coordination failure analysis in time-pressured systems. Use when diagnosing handoff failures, analytical paralysis, or expert judgment under incomplete information. NOT for routine coding, simple CRUD design, or static single-agent tasks with complete information.

curiositech/windags-skills

Extend and modify the admin dashboard, developer portal, and operations console. Use when adding new admin tabs, metrics, monitoring features, or internal tools. Activates for dashboard development, analytics, user management, and internal tooling.

curiositech/windags-skills

Conversation patterns and interaction protocols for multi-agent systems. Covers request/response, pub/sub, blackboard, delegation chains, debate, critique, consensus, fan-out/fan-in, supervisor-worker, and peer negotiation. Deep analysis of AutoGen conversation patterns, CrewAI delegation, LangGraph state passing, and FIPA-ACL performatives. Teaches how to design what agents say to each other and in what order. Activate on: "agent conversation", "agent protocol", "multi-agent debate", "agent delegation", "supervisor worker pattern", "agent voting", "consensus protocol", "fan-out fan-in", "agent negotiation", "blackboard pattern", "agent dialogue", "conversation topology", "agent handoff". NOT for: wire format or serialization (use agent-interchange-formats), orchestration infrastructure (use agentic-infrastructure-2026), single agent behavior (use agentic-patterns).

curiositech/windags-skills

Meta-agent for creating new custom agents, skills, and MCP integrations. Expert in agent design, MCP development, skill architecture, and rapid prototyping. Activate on 'create agent', 'new skill', 'MCP server', 'custom tool', 'agent design'. NOT for using existing agents (invoke them directly), general coding (use language-specific skills), or infrastructure setup (use deployment-engineer).

curiositech/windags-skills

AI-powered calendar management and agent-based scheduling coordination. Covers calendar APIs (Google Calendar, CalDAV/iCal), AI scheduling assistants (Reclaim, Clockwise, Motion, Cal.com), building custom calendar agents with MCP, multi-calendar merging, timezone management, focus block protection, meeting fatigue detection, and agent-to-agent meeting negotiation protocols. Activate on: "calendar agent", "AI scheduling", "calendar coordination", "meeting scheduling", "calendar API", "focus time protection", "calendar optimization", "Google Calendar MCP", "Reclaim", "Clockwise", "Motion", "Cal.com", "smart scheduling", "calendar-aware agent", "timezone scheduling", "agent negotiation meetings". NOT for: manual calendar UI component design (use form-validation-architect), project management scheduling or Gantt charts (use project-management-guru-adhd), general time-tracking or pomodoro apps (use adhd-daily-planner for time-awareness), building the agent itself from scratch (use agent-creator).

curiositech/windags-skills

Build and adopt production AI agent infrastructure in 2026. Covers framework selection (LangGraph, CrewAI, AutoGen, MCP), orchestration patterns, evaluation, observability, memory systems, and tool use. Also covers the SOCIAL dimension: how to sell agent infrastructure internally, change management, measuring ROI, building trust in autonomous systems, and scaling adoption across teams. Activate on: "agent infrastructure", "agent framework comparison", "which agent framework", "sell AI tools internally", "agent adoption", "agent observability", "agent evaluation", "MCP architecture", "agentic mesh", "enterprise AI agents", "AI change management", "agent ROI". NOT for: building specific agents (use ai-engineer), designing agent behavior patterns (use agentic-patterns), prompt tuning (use prompt-engineer).

curiositech/windags-skills

Fundamental patterns for effective agentic behavior. Teaches decomposition, tool orchestration, error recovery, context management, quality self-assessment, and knowing when to stop. Model-agnostic principles that make any agent more effective regardless of domain. Activate on: "how should I structure this agent", "agentic workflow", "agent patterns", "multi-step task", "tool orchestration", "/agentic-patterns", "decompose this", "agent best practices", "chain of actions", "when should the agent stop", "agent loop design". NOT for: creating agent infrastructure (use agent-creator), building DAGs (use windags-architect), specific tool implementation.

curiositech/windags-skills

Automated discovery and matching of agent skills for dynamic task routing and capability assessment

curiositech/windags-skills

Cryptographic security for agentic systems — zero-trust agent networking, signed message envelopes (JWS/JWE), capability-based security (ocaps), Merkle tree audit trails, WASM sandboxing, and formal verification. Covers CLI dev tool security, mTLS between agents, permission boundaries (least privilege for AI agents), and supply chain security for skills/plugins. Activate on: "agent security", "zero trust agents", "secure agent communication", "capability-based security", "ocap", "signed messages between agents", "agent audit trail", "sandbox agent execution", "agent permissions", "mTLS agents", "cryptographic verification", "agent supply chain", "OWASP agentic", "prove agent did X", "tamper-proof agent logs". NOT for: application-level SAST scanning (use security-auditor), network firewall rules (use infrastructure), SOC2/HIPAA compliance (organizational), or prompt injection defense (use prompt-engineer).

curiositech/windags-skills

Data structures and serialization formats for agent-to-agent communication. Covers message envelopes, structured output schemas, capability declarations, task handoff payloads, error/retry signaling, and context windows as data structures. Deep comparison of A2A protocol, MCP, OpenAI function calling, and LangChain message types. Teaches when to use rigid schemas vs free-form with validation, typed vs untyped, streaming vs batch. Activate on: "agent message format", "agent communication schema", "agent-to-agent protocol", "A2A protocol", "MCP message format", "structured output for agents", "agent interop", "interchange format", "agent serialization", "task handoff format", "capability declaration". NOT for: what agents say to each other (use agent-conversation-protocols), orchestration topology (use multi-agent-coordination), building agent infrastructure (use agentic-infrastructure-2026).

curiositech/windags-skills

Logic-based agent programming language implementing BDI architecture for practical autonomous agent development

curiositech/windags-skills

>- Design AgentSpeak(L)-style BDI agents with context-guarded plans, selection functions, and intention stacks. Use for interruptible autonomy, agent policy, and multi-agent orchestration in dynamic environments. NOT for simple rule engines, static planners, or centralized workflows.

curiositech/windags-skills

Foundational concurrent computation model where actors communicate exclusively through asynchronous message passing

curiositech/windags-skills

license: Apache-2.0 NOT for unrelated tasks outside this domain.

관련 스킬