android-notification-derive
Skill0 starsChanged 3 months agoMITView on GitHub
Decides which alerting channel a business event gets in an Android app and implements it on the device, per spec/android/notifications-alerting/. Classifies the event on six axes, runs the ordered gate chain so the cheaper channel wins, and records a justified row per event in project/notification-ledger.md incl. the rejected gate. Then applies the device-side code: channel creation with permanent importance, the notification build, category, visibility, grouping, update and cancel rule, foreground-service or Live-Update contract. Operations: derive, audit (read-only report), apply. Invoke when the user asks whether or how an app should notify about something, wants notifications audited, or reports them missed, ignored, or switched off. Also handles equivalent German-language requests. Don't use for the permission declaration (android-permissions-derive) or the FCM/WorkManager delivery path (android-feature-implement). Supports resume on re-invocation.
In this repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- android-barcode-scanner-scaffoldSkill
- android-compose-uiSkill
- android-debuggingSkill
- android-feature-implementSkill
- android-localization-applySkill
- android-perceived-performanceSkill
- android-permissions-deriveSkill
- android-project-scaffoldSkill
- android-test-suite-applySkill
- android-toolchain-upgradeSkill
- android-uvc-microscope-scaffoldSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 6 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 146
Read references/gate-chain.md in full — it is the decision-time rule set distilled from the spec, and every event is classified against it.
- Very specific: line 148
Read the existing project/notification-ledger.md when one exists.
- Distinctive: line 150
Check for uncommitted changes in the paths to be touched.
- Distinctive: line 155
Run the steps in order, once per event.
- Distinctive: line 191
Update. Gate: confirm before anything is written.
- Very specific: line 195
Write or update project/notification-ledger.md per references/ledger-and-verification.md: one row per event, every column filled.
- Very specific: line 202
Read references/channel-templates.md and write: the channel creation (guarded by API level, importance set at creation), the notification …
- Very specific: line 215
Run the verification of references/ledger-and-verification.md: the granted, denied, and channel-blocked states as tests.
- Distinctive: line 221
Never leave a red or skipped element unreported (REQ-7).
- Distinctive: line 225
Read-only throughout. Nothing is written — not the ledger, not the code, not the manifest.
- Very specific: line 227
Enumerate the surface: Every notify() call site, every channel and channel-group creation, every foreground-service startForeground(), and …
- Very specific: line 230
Reconcile against the ledger: Read project/notification-ledger.md where it exists.
- Very specific: line 249
Read references/gate-chain.md before step 2 for the six axes, the ordered gates, and the channel catalogue's trade-offs in decision form.
- Very specific: line 251
Read references/ledger-and-verification.md in step 5 for the ledger's column contract and in step 7 for the verification and test matrix.
- Very specific: line 253
Read references/channel-templates.md in step 6 for the channel-creation, notification, grouping, foreground-service, and Live-Update …
- Distinctive: line 270
Never: create a channel or write a notification before a complete ledger row exists for its event (REQ-21).
- Very specific: line 295
When a spec under spec/android/ disagrees with this skill, the spec wins — report the gap and propose a spec change (REQ-6).
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Android Notification Derive
Decides how an app tells a user that something happened — and, far more often than developers expect, decides that it does not tell them at all. The channel is derived from what the event is, not from what is easiest to reach for.
The governing idea is that the ability to notify is a shared, revocable, app-wide resource. From Android 13 a single denial silences every channel the app has, so every notification is spent against every future notification the app will want to post. The cheapest channel that serves the event therefore wins, and anything more intrusive has to beat it on evidence.
The authoritative rules live in spec/android/notifications-alerting/; this skill
operationalizes them and never restates or contradicts them. On any conflict the spec wins —
report the gap and propose a spec change rather than deciding silently (REQ-6).
Grounding specs, in the order they bind this skill: spec/android/notifications-alerting/
(the model, the classification, the gate chain, the channel catalogue, delivery,
construction, degradation, verification), spec/android/permissions/ §F (the notification
permission family, whose derivation belongs to its own skill),
spec/android/app-architecture/ §B/§D (where state lives, how a write reaches the backend),
spec/android/iconography/ §D (notification icon formats), spec/android/localization/ §A
(notification text is externalized like any other string), spec/android/ui-components/ §A
(the in-app surface the presence gate selects), and spec/android/test-automation/ (where
the notification tests live).
German trigger phrases
Respond to these (and equivalents) exactly as to their English counterparts; the frontmatter
description stays English-only per skill-management §Structure:
- "Soll die App darüber benachrichtigen?", "Welchen Benachrichtigungskanal bekommt dieses Ereignis?", "Leite die Notification für X ab"
- "Auditiere/prüfe die bestehenden Benachrichtigungen", "Begründe diese Notification"
- "Nutzer schalten unsere Benachrichtigungen ab", "Wichtige Benachrichtigungen werden übersehen", "Die Channel-Wichtigkeit ist falsch", "Live Update / Foreground-Service-Notification für eine laufende Aktivität"
Why this is a skill, not an agent
- Mid-flow approval is the contract. Admitting a channel more intrusive than the one below it, refusing a requested notification as out of policy, and every code write are operator decisions with consequences that outlive the run (REQ-8); an agent's fire-and-forget shape cannot carry those gates.
- The persistent artifact is the deliverable. The notification ledger and the channel code land in the working tree and are reviewed in context, not behind a report boundary.
- It composes with sibling capabilities. Permissions →
android-permissions-derive, in-app surface →android-compose-ui, non-appearing notification →android-debugging; perspec/claude/skill-vs-agent/§Primary decision rule the orchestrator is always a skill. - Counter-dimension considered: the read-only
auditwould suit a dedicated auditor agent (a candidate spec extension); it stays here because its findings are phrased as thederiverows the operator starts next, so one gate vocabulary serves both.
Boundary vs the sibling capabilities
android-permissions-deriveowns every permission decision (REQ-20).POST_NOTIFICATIONS, theFOREGROUND_SERVICE_*pair,USE_FULL_SCREEN_INTENT, andPOST_PROMOTED_NOTIFICATIONSare consequences of a channel derived here: hand the ledger row over and take the declaration back, never write one into the manifest here. Guard-code ownership: the SDK-version guards aroundcanUseFullScreenIntent()(API 34+) andcanPostPromotedNotifications()(API 36+), their degradation branch, and the settings-intent launch (ACTION_MANAGE_APP_USE_FULL_SCREEN_INTENT,ACTION_APP_NOTIFICATION_PROMOTION_SETTINGS+EXTRA_APP_PACKAGE) are written here, by theapplytemplates; the permission skill records the obligation in its ledger row and verifies the guard exists.android-compose-uiowns every in-app surface (REQ-13). When the silence or presence gate matches, this skill decides that the in-app path carries the event and hands the authoring there; it does not build screens.android-feature-implementowns the feature across layers (REQ-19) and calls this skill for the channel step; this skill ends at the device-side notification code. The delivery path ofspec/android/notifications-alerting/§E lives in that skill's flat-layer-checklist §10 and layer-templates §5.Deliverycolumn ownership:android-feature-implementowns the decision (step 3) and the implementation (step 5.3) of the delivery path;android-notification-deriveowns the ledger row and records the handed-over value (local/scheduled/pushed) — it never decides it.android-ux-reviewerreviews UI read-only (REQ-14); notification-channel conformance is outside its Compose surface and is audited by theauditoperation here.android-debuggingdiagnoses why a notification never appeared (REQ-16). A wrong channel is a decision defect and belongs here; a notification that should appear and does not is a runtime defect and belongs there.
User-language policy
Detect the operator's language and respond in it (German for this operator). Generated
artifacts stay canonical: Kotlin, channel IDs, and identifiers in English; the ledger is
written in English so it stays reviewable alongside the spec corpus; user-visible notification
text is externalized to strings.xml per spec/android/localization/ §A — never inlined in a
builder call.
Operations
Pick one at the start and say which is running. The split is deliberate: derive decides
and records, audit only reports, apply writes code. Nothing is written into the
app before a complete ledger row exists for it.
derive— an event exists or is planned and its channel is undecided. Runs steps 1–4 and the ledger write of step 5. Touches no code.audit— an app already posts notifications and the set needs justifying. Runs the audit procedure below and writes nothing at all (REQ-21): it produces a severity-classified findings report (Critical/Warning/Suggestion/Infoperspec/claude/review-plan/) naming the ledger rows the app owes; turning a finding into a row is aderiverun the operator starts afterwards.apply— a ledger row exists and its device-side code is to be written or corrected. Runs steps 5–7.
The numbered procedure below is the derive/apply path; audit runs the separate audit
procedure that follows it.
Preconditions
Before deciding anything:
- Confirm the working directory is a git repository holding an Android project scaffolded per
spec/android/project-structure/. If there is no Gradle Android module, stop and route toandroid-project-scaffold. - Read
references/gate-chain.mdin full — it is the decision-time rule set distilled from the spec, and every event is classified against it. - Read the existing
project/notification-ledger.mdwhen one exists; an event already recorded there is re-derived, not duplicated. - Check for uncommitted changes in the paths to be touched. If dirty, report and ask whether to stash, commit, or abort — never overwrite unconfirmed work (REQ-8).
Procedure
Run the steps in order, once per event. Confirm with the operator at each gate before writing.
1. State the event
Name the business event in one sentence, as something that happens to or for the user — not as a technical trigger ("the sync job finished" is a trigger; "the user's order was shipped" is an event). An event that cannot be stated this way is usually not an event the user needs. Gate: confirm the statement before classifying.
2. Classify on the six axes
Fill all six axes from references/gate-chain.md: origination, presence, time sensitivity,
actionability, consequence of missing it, and continuity. Presence is a runtime property, so
record the behaviour for each of its three cases rather than assuming one. An axis the
operator cannot answer is a question for them, never a guess.
3. Run the gate chain
Walk the gates in order and take the first that matches. The ordering is the mechanism by which the cheaper channel wins, so a later gate is only reached by failing every earlier one. Record the matched gate and the cheaper gate that was rejected, with the reason. Two outcomes end the run without a channel: the refusal gate (promotional, re-engagement-driven, celebratory, a greeting, or a rating request — reported as out of policy) and the gap gate (a case the spec does not cover — reported as a spec gap per REQ-6, never resolved by analogy). Gate: confirm the outcome.
4. Derive the channel's properties
For a channel-bearing outcome, decide and record: the channel ID and user-visible name, its
permanent importance — one channel per type of event the user would want to control
separately — the setCategory() value, lock-screen visibility (with a public version wherever
the content is sensitive, and the sensitivity classification it applied), the delivery path
(recorded as handed over by android-feature-implement, never decided here), the group key with the summary behaviour, the update key (recorded as its own ledger column),
the dismissal and cancellation rule,
and the degradation behaviour when notifications are off. Where the outcome is the ongoing
family, add its contract — foreground-service type, or the promotion requirements of a Live
Update. Gate: confirm before anything is written.
5. Write the ledger row
Write or update project/notification-ledger.md per references/ledger-and-verification.md:
one row per event, every column filled. An incomplete row is not admitted, and no code is
written for an event that lacks one. Hand every permission the chosen channel implies to
android-permissions-derive at this point.
6. Apply the device-side code
Read references/channel-templates.md and write: the channel creation (guarded by API level,
importance set at creation), the notification build through NotificationCompat, the group
and summary where the app can produce more than one of a kind — promoted Live Updates excepted,
which are never grouped — the cancel and update paths, the conversation or call shape where the
row's gate was 4 (MessagingStyle bound to a long-lived shortcut, or CallStyle), and the
ongoing contract where it applies — including the SDK-guarded canUseFullScreenIntent() /
canPostPromotedNotifications() checks, their fallbacks, and settings routes, which this skill
owns. The content intent targets its activity directly — never a trampoline. User-visible
text goes through strings.xml. Gate: confirm before each file that would overwrite existing
code (REQ-8).
7. Verify and report
Run the verification of references/ledger-and-verification.md: the granted, denied, and
channel-blocked states as tests; the Doze and app-standby behaviour for any scheduled or
pushed row; the user-stop and timeout paths for a foreground-service row. Then ./gradlew
build green (REQ-1). Report, in the operator's language: the events derived and their
matched and rejected gates, the ledger rows written, the permissions handed over, each
verification element that was green, red, or unrunnable and why, and any spec gap found.
Never leave a red or skipped element unreported (REQ-7).
Audit procedure (operation audit)
Read-only throughout. Nothing is written — not the ledger, not the code, not the manifest.
- Enumerate the surface. Every
notify()call site, every channel and channel-group creation, every foreground-servicestartForeground(), and the notification-related permissions in the merged manifest. - Reconcile against the ledger. Read
project/notification-ledger.mdwhere it exists. A posted notification with no row, and a row with no code, are both findings. - Re-derive each posting site. Classify its event per step 2 and walk the gates per step 3, then compare the outcome with what the code actually does. A channel more intrusive than the chain admits is the finding this operation exists for.
- Check the construction rules of
references/channel-templates.mdper site: channel importance against the row, category set, lock-screen visibility against the row'sVisibilitycolumn, grouping with an update key where more than one of a kind can be posted, cancellation of stale notifications, no trampoline, no custom layout, the SDK guards aroundcanUseFullScreenIntent()/canPostPromotedNotifications()— and, where the app bubbles a conversation, that the notification still works as an ordinary one when bubbles are disabled. - Report on the canonical severity scale:
Criticalfor a posting site with no row or a channel the chain forbids,Warningfor a construction rule broken,Suggestionfor a cheaper gate the event would now match,Infofor a surface scanned clean. Each finding carries the file and line, the spec section, and the operation that would fix it.
Reference files
- Read
references/gate-chain.mdbefore step 2 for the six axes, the ordered gates, and the channel catalogue's trade-offs in decision form. - Read
references/ledger-and-verification.mdin step 5 for the ledger's column contract and in step 7 for the verification and test matrix. - Read
references/channel-templates.mdin step 6 for the channel-creation, notification, grouping, foreground-service, and Live-Update templates.
Resumability
Per spec/claude/resumable-work/, this skill is resumable: true. State is persisted to
.resume/android-notification-derive/<run-id>.yml after every gate and at each named step
boundary. On re-invocation, scan .resume/android-notification-derive/*.yml for files with
status: in_progress whose inputs: snapshot (repository + event name) matches the current
request; when one matches, prompt
Resume run <run_id> from phase <phase> (last checkpoint <last_checkpoint_at>)? [resume / start-new / discard].
resume re-hydrates and re-asks no answered gate; start-new leaves the old file intact;
discard deletes it. Fail closed on unparseable or higher-schema_version files. The envelope
keys and lifecycle are load-bearing in the spec and are not duplicated here.
Hard rules
- Never create a channel or write a notification before a complete ledger row exists for its event (REQ-21).
- Never implement a promotional, re-engagement-driven, celebratory, greeting, or rating-request notification. The refusal gate reports it as out of policy — including when the operator asks for it directly, in which case the report names the policy rather than complying (REQ-21).
- Never change the importance of an existing channel in place; it is immutable after creation. A reclassification is a new channel, with the old one's retirement recorded in the ledger (REQ-21).
- Never declare a notification-related permission here.
POST_NOTIFICATIONS, theFOREGROUND_SERVICE_*pair,USE_FULL_SCREEN_INTENT, andPOST_PROMOTED_NOTIFICATIONSgo toandroid-permissions-derivewith the ledger row as their justification (REQ-21). - Never post a point event as a notification for a surface the user is currently looking at, and never demote an ongoing activity to the in-app path because it happened to start on that surface — the ongoing gate is evaluated before the presence gate for exactly that reason.
- Never route a notification tap through a service or broadcast receiver that then starts an activity; the content intent targets the activity directly.
- Never ship a custom notification layout, and never let an event exist only as a notification — the in-app path is part of every ledger row.
- Never resolve a gap-gate outcome by analogy to a neighbouring event; report it (REQ-6).
- Always record the matched gate and the rejected cheaper gate; a row without the rejection is not a derivation, only a preference.
- Always end with the verification the operation calls for and an explicit report of every
red or unrunnable element (REQ-7): step 7 in full for
apply, the ledger row and its recorded gates forderive(which touches no code and therefore has nothing to build), the severity-classified report foraudit. - When a spec under
spec/android/disagrees with this skill, the spec wins — report the gap and propose a spec change (REQ-6).
Gotchas
Concrete corrections to non-obvious facts the executing agent would otherwise get wrong:
- A channel's behaviour is frozen at creation, not at first use. Importance, sound, vibration, and group membership can never be changed by the app afterwards — only name and description can. A wrong importance is not a tuning mistake; it costs a channel.
- Deleted channels stay visible. System settings count deleted channels as a spam signal, so churning channel IDs is itself a cost the user sees; on a development device, reinstall or clear app data to reset test channels.
- A notification posted to a blocked channel succeeds silently.
notify()does not throw; onlyareNotificationsEnabled()plus the channel'sgetImportance()distinguish "delivered" from "accepted and discarded". - A foreground-service notification may not appear for ten seconds. Android 12+ defers it —
right for short work, wrong when the user is waiting;
FOREGROUND_SERVICE_IMMEDIATEopts out. - Rapid updates are dropped, not queued. Re-posting the same ID many times a second is
throttled; update on meaningful change, with
setOnlyAlertOnce(true).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

