搜索

PythonReactSEOPDF
OpenClaw

phoenix-api-gen

Generate a full Phoenix JSON API from an OpenAPI spec or natural language description. Creates contexts, Ecto schemas, migrations, controllers, JSON views/renderers, router entries, ExUnit tests with factories, auth plugs, and tenant scoping. Use when building a new Phoenix REST API, adding CRUD endpoints, scaffolding resources, or converting an OpenAPI YAML into a Phoenix project.

gchapim0 来源安装数☆ 0 仓库 Stars

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

SkillHub CLI

skillhub install gchapim/phoenix-api-gen

打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。

将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。

查看来源 ↗使用指南

技能说明

Phoenix API Generator

Workflow

From OpenAPI YAML
  1. Parse the OpenAPI spec — extract paths, schemas, request/response bodies.
  2. Map each schema to an Ecto schema + migration.
  3. Map each path to a controller action; group by resource context.
  4. Generate auth plugs from securitySchemes.
  5. Generate ExUnit tests covering happy path + validation errors.
From Natural Language
  1. Extract resources, fields, types, and relationships from the description.
  2. Infer context boundaries (group related resources).
  3. Generate schemas, migrations, controllers, views, router, and tests.
  4. Ask the user to confirm before writing files.

File Generation Order

  1. Migrations (timestamps prefix: YYYYMMDDHHMMSS)
  2. Ecto schemas + changesets
  3. Context modules (CRUD functions)
  4. Controllers + FallbackController
  5. JSON renderers (Phoenix 1.7+ *JSON modules, or *View for older)
  6. Router scope + pipelines
  7. Auth plugs
  8. Tests + factories

Phoenix Conventions

See references/phoenix-conventions.md for project structure, naming, context patterns.

Key rules:

  • One context per bounded domain (e.g., Accounts, Billing, Notifications).
  • Context is the public API — controllers never call Repo directly.
  • Schemas live under contexts: MyApp.Accounts.User.
  • Controllers delegate to contexts; return {:ok, resource} or {:error, changeset}.
  • Use FallbackController with action_fallback/1 to handle error tuples.

Ecto Patterns

See references/ecto-patterns.md for schema, changeset, migration details.

Key rules:

  • Always use timestamps(type: :utc_datetime_usec).
  • Binary IDs: @primary_key {:id, :binary_id, autogenerate: true} + @foreign_key_type :binary_id.
  • Separate create_changeset/2 and update_changeset/2 when create/update fields differ.
  • Validate required fields, formats, and constraints in changesets — not in controllers.

Multi-Tenancy

Add `tenant_id :bina...

来源信息

Source
github
Repository
openclaw/skills
Path
skills/gchapim/phoenix-api-gen
Version
—
Commit
1f3f223ac3e350bb9561304010f8a06cce4351be
分类来源
rules
状态
active
可见性
public

这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。

来源内容

SKILL.md
# Phoenix API Generator

## Workflow

### From OpenAPI YAML

1. Parse the OpenAPI spec — extract paths, schemas, request/response bodies.
2. Map each schema to an Ecto schema + migration.
3. Map each path to a controller action; group by resource context.
4. Generate auth plugs from `securitySchemes`.
5. Generate ExUnit tests covering happy path + validation errors.

### From Natural Language

1. Extract resources, fields, types, and relationships from the description.
2. Infer context boundaries (group related resources).
3. Generate schemas, migrations, controllers, views, router, and tests.
4. Ask the user to confirm before writing files.

## File Generation Order

1. Migrations (timestamps prefix: `YYYYMMDDHHMMSS`)
2. Ecto schemas + changesets
3. Context modules (CRUD functions)
4. Controllers + FallbackController
5. JSON renderers (Phoenix 1.7+ `*JSON` modules, or `*View` for older)
6. Router scope + pipelines
7. Auth plugs
8. Tests + factories

## Phoenix Conventions

See [references/phoenix-conventions.md](references/phoenix-conventions.md) for project structure, naming, context patterns.

Key rules:
- One context per bounded domain (e.g., `Accounts`, `Billing`, `Notifications`).
- Context is the public API — controllers never call Repo directly.
- Schemas live under contexts: `MyApp.Accounts.User`.
- Controllers delegate to contexts; return `{:ok, resource}` or `{:error, changeset}`.
- Use `FallbackController` with `action_fallback/1` to handle error tuples.

## Ecto Patterns

See [references/ecto-patterns.md](references/ecto-patterns.md) for schema, changeset, migration details.

Key rules:
- Always use `timestamps(type: :utc_datetime_usec)`.
- Binary IDs: `@primary_key {:id, :binary_id, autogenerate: true}` + `@foreign_key_type :binary_id`.
- Separate `create_changeset/2` and `update_changeset/2` when create/update fields differ.
- Validate required fields, formats, and constraints in changesets — not in controllers.

## Multi-Tenancy

Add `tenant_id :bina...

相关技能

OpenClaw

humanpages

human-pages-ai

Search and hire real humans for tasks — photography, delivery, research, and more

OpenClaw

geo-optimization

capt-marbles

Generative Engine Optimization (GEO) for AI search visibility. Optimize content to appear in ChatGPT, Perplexity, Claude, and Google AI Overviews. Use when optimizing websites, pages, or content for LLM discove...

OpenClaw

openclaw-skills

zseven-w

Reusable skill templates for OpenClaw AI agents. Templates for API integration, data processing, web scraping, CLI tools, and file processing.