

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
12345## Define Generic Context Interfaces for Dependency Injection67Define a **generic interface** for your component context with three parts:8`state`, `actions`, and `meta`. This interface is a contract that any provider9can implement—enabling the same UI components to work with completely different10state implementations.1112**Core principle:** Lift state, compose internals, make state13dependency-injectable.1415**Incorrect (UI coupled to specific state implementation):**1617```tsx18function ComposerInput() {19 // Tightly coupled to a specific hook20 const { input, setInput } = useChannelComposerState()21 return <TextInput value={input} onChangeText={setInput} />22}23```2425**Correct (generic interface enables dependency injection):**2627```tsx28// Define a GENERIC interface that any provider can implement29interface ComposerState {30 input: string31 attachments: Attachment[]32 isSubmitting: boolean33}3435interface ComposerActions {36 update: (updater: (state: ComposerState) => ComposerState) => void37 submit: () => void38}3940interface ComposerMeta {41 inputRef: React.RefObject<TextInput>42}4344interface ComposerContextValue {45 state: ComposerState46 actions: ComposerActions47 meta: ComposerMeta48}4950const ComposerContext = createContext<ComposerContextValue | null>(null)51```5253**UI components consume the interface, not the implementation:**5455```tsx56function ComposerInput() {57 const {58 state,59 actions: { update },60 meta,61 } = use(ComposerContext)6263 // This component works with ANY provider that implements the interface64 return (65 <TextInput66 ref={meta.inputRef}67 value={state.input}68 onChangeText={(text) => update((s) => ({ ...s, input: text }))}69 />70 )71}72```7374**Different providers implement the same interface:**7576```tsx77// Provider A: Local state for ephemeral forms78function ForwardMessageProvider({ children }: { children: React.ReactNode }) {79 const [state, setState] = useState(initialState)80 const inputRef = useRef(null)81 const submit = useForwardMessage()8283 return (84 <ComposerContext85 value={{86 state,87 actions: { update: setState, submit },88 meta: { inputRef },89 }}90 >91 {children}92 </ComposerContext>93 )94}9596// Provider B: Global synced state for channels97function ChannelProvider({ channelId, children }: Props) {98 const { state, update, submit } = useGlobalChannel(channelId)99 const inputRef = useRef(null)100101 return (102 <ComposerContext103 value={{104 state,105 actions: { update, submit },106 meta: { inputRef },107 }}108 >109 {children}110 </ComposerContext>111 )112}113```114115**The same composed UI works with both:**116117```tsx118// Works with ForwardMessageProvider (local state)119<ForwardMessageProvider>120 <Composer.Frame>121 <Composer.Input />122 <Composer.Submit />123 </Composer.Frame>124</ForwardMessageProvider>125126// Works with ChannelProvider (global synced state)127<ChannelProvider channelId="abc">128 <Composer.Frame>129 <Composer.Input />130 <Composer.Submit />131 </Composer.Frame>132</ChannelProvider>133```134135**Custom UI outside the component can access state and actions:**136137The provider boundary is what matters—not the visual nesting. Components that138need shared state don't have to be inside the `Composer.Frame`. They just need139to be within the provider.140141```tsx142function ForwardMessageDialog() {143 return (144 <ForwardMessageProvider>145 <Dialog>146 {/* The composer UI */}147 <Composer.Frame>148 <Composer.Input placeholder="Add a message, if you'd like." />149 <Composer.Footer>150 <Composer.Formatting />151 <Composer.Emojis />152 </Composer.Footer>153 </Composer.Frame>154155 {/* Custom UI OUTSIDE the composer, but INSIDE the provider */}156 <MessagePreview />157158 {/* Actions at the bottom of the dialog */}159 <DialogActions>160 <CancelButton />161 <ForwardButton />162 </DialogActions>163 </Dialog>164 </ForwardMessageProvider>165 )166}167168// This button lives OUTSIDE Composer.Frame but can still submit based on its context!169function ForwardButton() {170 const {171 actions: { submit },172 } = use(ComposerContext)173 return <Button onPress={submit}>Forward</Button>174}175176// This preview lives OUTSIDE Composer.Frame but can read composer's state!177function MessagePreview() {178 const { state } = use(ComposerContext)179 return <Preview message={state.input} attachments={state.attachments} />180}181```182183The `ForwardButton` and `MessagePreview` are not visually inside the composer184box, but they can still access its state and actions. This is the power of185lifting state into providers.186187The UI is reusable bits you compose together. The state is dependency-injected188by the provider. Swap the provider, keep the UI.189
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| nota-america/forgecat-agent-profilesprofiles/addyosmani/agent-skills/for-cursor/.cursor/rules/cmd-build.mdc · 51 | Cursor rules | no sections | 16/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/addyosmani/agent-skills/for-cursor/.cursor/rules/cmd-code-simplify.mdc · 51 | Cursor rules | testing-strategy | 30/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/addyosmani/agent-skills/for-cursor/.cursor/rules/cmd-plan.mdc · 51 | Cursor rules | no sections | 16/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/addyosmani/agent-skills/for-cursor/.cursor/rules/cmd-review.mdc · 51 | Cursor rules | no sections | 16/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/addyosmani/agent-skills/for-cursor/.cursor/rules/cmd-ship.mdc · 51 | Cursor rules | testing-strategygitdeploymentdo-not | 61/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/addyosmani/agent-skills/for-cursor/.cursor/rules/cmd-spec.mdc · 51 | Cursor rules | no sections | 16/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/addyosmani/agent-skills/for-cursor/.cursor/rules/cmd-test.mdc · 51 | Cursor rules | no sections | 16/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/addyosmani/agent-skills/for-forgecat/AGENTS.md · 51 | AGENTS.md | lint-formatstylearchdo-not | 73/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/addyosmani/agent-skills/for-forgecat/CLAUDE.md · 51 | CLAUDE.md | teststylearchagent-behaviour | 70/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-code/anthropics_claude-code_ralph-wiggum/for-cursor/.cursor/rules/cmd-cancel-ralph.mdc · 51 | Cursor rules | no sections | 16/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-code/anthropics_claude-code_ralph-wiggum/for-cursor/.cursor/rules/cmd-help.mdc · 51 | Cursor rules | no sections | 54/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-code/anthropics_claude-code_ralph-wiggum/for-cursor/.cursor/rules/cmd-ralph-loop.mdc · 51 | Cursor rules | no sections | 22/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-plugins-official/anthropics_claude-plugins-official_agent-sdk-dev/for-cursor/.cursor/rules/cmd-new-sdk-app.mdc · 51 | Cursor rules | setupstylearchdocs | 76/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-plugins-official/anthropics_claude-plugins-official_claude-md-management/for-cursor/.cursor/rules/cmd-revise-claude-md.mdc · 51 | Cursor rules | agent-behaviour | 50/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-plugins-official/anthropics_claude-plugins-official_code-review/for-cursor/.cursor/rules/cmd-code-review.mdc · 51 | Cursor rules | testing-strategygit | 35/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-plugins-official/anthropics_claude-plugins-official_commit-commands/for-cursor/.cursor/rules/cmd-clean_gone.mdc · 51 | Cursor rules | no sections | 60/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-plugins-official/anthropics_claude-plugins-official_commit-commands/for-cursor/.cursor/rules/cmd-commit-push-pr.mdc · 51 | Cursor rules | stylegit | 44/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-plugins-official/anthropics_claude-plugins-official_commit-commands/for-cursor/.cursor/rules/cmd-commit.mdc · 51 | Cursor rules | style | 44/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-plugins-official/anthropics_claude-plugins-official_example-plugin/for-cursor/.cursor/rules/cmd-example-command.mdc · 51 | Cursor rules | lint-formatstyleagent-behaviour | 58/100 | today | |
| nota-america/forgecat-agent-profilesprofiles/anthropics/claude-plugins-official/anthropics_claude-plugins-official_feature-dev/for-cursor/.cursor/rules/cmd-feature-dev.mdc · 51 | Cursor rules | stylearchgit | 56/100 | today |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| bybren-llc/safe-agentic-workflow.cursor/rules/10-backend-python.mdc · 399 | Cursor rules | testlint-formatstylegit+4 | 97/100 | today |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/nota-america-forgecat-agent-profiles-profiles-vercel-labs-agent-skills-vercel-labs-agent-skills-composition-patterns-for-cursor-cursor-rules-rule-state-context-interface)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.