feed-patterns

Implements reactive feed filters and ViewModels for Amethyst's Nostr client lists.

1.6k|222|Updated Jan 11, 2023
One-click install
npx skills add https://github.com/vitorpamplona/amethyst --skill feed-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: feed-patterns
Source: https://github.com/vitorpamplona/amethyst/tree/main/.claude/skills/feed-patterns
Command: npx skills add https://github.com/vitorpamplona/amethyst --skill feed-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Adding or modifying a scrollable list of notes in Amethyst (home, profile, hashtag, bookmarks, notifications, DMs) requires coordinating filters, ViewModels, cache invalidation, and Compose rendering across shared KMP and Android-only code, which is easy to get wrong.

Core Features & Use Cases

  • Feed Filter Composition: Guides extending FeedFilter, AdditiveFeedFilter, or AdditiveComplexFeedFilter with correct feedKey(), feed(), applyFilter(), and limit() implementations.
  • ViewModel Selection: Explains when to use FeedViewModel, ListChangeFeedViewModel, ChatroomFeedViewModel, or MarmotGroupFeedViewModel and how to wire invalidation from Account flows and LocalCacheFlow.
  • Platform Boundary Guidance: Clarifies which classes live in shared commons/ versus Android-only ui/dal/ versus Desktop desktopApp/ code.
  • Use Case: When adding a new hashtag feed, follow the step-by-step recipe to write the filter, pick the ViewModel, subscribe to relays, and render with a keyed LazyColumn.

Quick Start

Ask the assistant to add a new feed screen for a hashtag using the feed-patterns skill and have it generate the filter, ViewModel wiring, and Compose rendering code.

Frequently Asked Questions about feed-patterns

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

FAQPage Schema
How do I add a new feed screen in Amethyst?

Extend AdditiveFeedFilter<Note> with feedKey, feed, applyFilter, sort, and limit implementations, then instantiate a FeedViewModel with that filter. Wire invalidation from Account flows, subscribe to relays for history, and render the collected FeedState in a keyed LazyColumn.

When should I use AdditiveFeedFilter vs FeedFilter?

Use AdditiveFeedFilter when new notes arrive incrementally and should slot into the existing list without a full recompute. Use plain FeedFilter when membership is stable and you recompute the whole list on each invalidation.

Why is my Amethyst feed not updating after a mute or follow change?

The ViewModel is likely missing a collector on the relevant Account flow such as muteList or kind3FollowList. Add a viewModelScope collector that calls invalidateAll() when that flow emits, and route exclusions through FilterByListParams.

Can feed filters be shared between Android and Desktop in Amethyst?

The base classes FeedFilter, AdditiveFeedFilter, ChangesFlowFilter, and FeedContentState are shared in commons, but concrete filters are platform-local in amethyst ui/dal and desktopApp feeds. Share a concrete filter only when both platforms need identical inclusion rules.

Why does my feed lose state or show wrong notes after invalidation?

A non-stable feedKey causes the ViewModel cache to cross-contaminate between feeds, and an applyFilter that disagrees with feed() causes additive drift. Make feedKey deterministic per filter instance and keep both paths logically consistent.