composable-functions-skill

📁 darna-digital/skills 📅 4 days ago
1
总安装量
1
周安装量
#43288
全站排名
安装命令
npx skills add https://github.com/darna-digital/skills --skill composable-functions-skill

Agent 安装分布

amp 1
opencode 1
kimi-cli 1
codex 1
github-copilot 1
gemini-cli 1

Skill 文档

Pattern

The composable functions pattern uses:

  • Interfaces defining dependencies (data + side effects) and function contracts
  • Pure functions that receive injected dependencies
  • Mock factories for testing
  • Adapters (RSC/Hooks) that wire up real dependencies

Workflow

  1. Read the example structure in example/ to understand the patterns
  2. Ask the user for the feature name
  3. Generate minimal boilerplate in src/features/<feature-name>/ with:
    • entity/<feature>.interfaces.ts – dependency and function interfaces
    • functions/<feature>.functions.ts – pure functions with DI
    • functions/<feature>.functions.mock.ts – mock factory
    • functions/<feature>.functions.test.ts – test file
  4. Ask the user what adapter type to create:
    • RSC (React Server Components) – default
    • React Hooks – default
    • Other (API, proxy-handler, etc.) – search codebase for examples, otherwise improvise
  5. Generate the adapter in adapters/<feature>.<type>.adapter.ts

Do not implement business logic – generate bare minimum boilerplate only.