← Back to list

patternscallback-context
by mgreenly
An AI Coding Agent
⭐ 1🍴 0📅 Jan 24, 2026
SKILL.md
name: patterns/callback-context description: Callback + Context Pattern (C-Specific) pattern for C development
Callback + Context Pattern (C-Specific)
Pair function pointer with void * user data. Callback receives user data, enabling state access without globals. Universal C pattern for async/event handling.
ikigai Application
Streaming responses:
typedef void (*chunk_cb_t)(void *user_ctx, const char *data, size_t len);
res_t ik_llm_stream(ik_llm_client_t *client,
ik_message_t **msgs,
chunk_cb_t on_chunk,
void *user_ctx); // Passed to callback
Usage: REPL passes itself as context, callback updates scrollback.
Convention: Callback function pointer immediately followed by void * context parameter. Callback signature includes context as first param.
Benefit: Stateful callbacks without globals. Each caller provides own context.
Score
Total Score
60/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon