Slice · AI prompt
Data-source-driven repeater: register pluggable sources, render one component per item, round-robin across variants, none/infinite pagination — no backend required.
# Install `content-loops` — Content Loops
> Data-source-driven repeater: register pluggable sources, render one component per item, round-robin across variants, none/infinite pagination — no backend required.
📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail : https://resource.rahmanef.com/slices/content-loops
🧠 JSON catalog : https://resource.rahmanef.com/api/knowledge?slice=content-loops
🔗 Source : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/content-loops
## 1. Install
```bash
npx rahman-resources add content-loops
# alias: npx rr add content-loops
```
The CLI copies `frontend/slices/content-loops/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.
## 2. What it ships
- shadcn primitives: `button`
## 3. Wire it up
Run `npx rr add content-loops`. Env-free demo: createMockLoopSource() then <ContentLoop source={s} pagination='infinite' pageSize={6} variants={[CardA, CardB]} /> — variants round-robin (item i -> variants[i % n]). Real source: implement LoopEntitySource { id: 'blog.posts' (namespaced 'ns.name'), fields, async fetch({ filters, orderBy, direction, limit, offset }) returns { items, totalItems } }, call loopSourceRegistry.registerOrReplace(source), then <ContentLoop sourceId='blog.posts' variants={[...]} />. item.fields holds RESOLVED values — resolve media/author inside fetch.
## Rules of engagement
- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice
The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.