本文へスキップ
Skillpedia
APIとサーバー(バックエンド)48k · #4599

fastapi-router-py

できること

このコードは、情報を扱うWebサイトやWebアプリケーションの部分を作るのに役立ちます。情報が整理され、安全に扱われるようにします。データの受け取り方と送り方、そして誰がそのデータにアクセスできるかを定義します。

使う場面

  • ✓Webサイトの新しいセクションを作るとき。
  • ✓ログインや権限の機能を追加するとき。
  • ✓ユーザーに表示する情報の構成を整理するとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fastapi-router-py/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fastapi-router-py/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“アプリに、安全なログインとユーザー一覧の表示ができる、ユーザー管理用の新しいセクションを作ってください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

データの構造と、認証されたユーザーだけが特定の情報にアクセスできるようにするルールを、テンプレートを使って定義します。また、処理が成功したかどうかを示すステータスコードも設定します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Bundled upstream support

Supporting files are included at skill-relative paths. See UPSTREAM-NOTICE.md for their pinned sources, licenses, hashes, and import changes.

FastAPI Router

Create FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes.

Quick Start

Copy the template from assets/template.py and replace placeholders:

  • {{ResourceName}} → PascalCase name (e.g., Project)
  • {{resource_name}} → snake_case name (e.g., project)
  • {{resource_plural}} → plural form (e.g., projects)

Authentication Patterns

# Optional auth - returns None if not authenticated
current_user: Optional[User] = Depends(get_current_user)

# Required auth - raises 401 if not authenticated
current_user: User = Depends(get_current_user_required)

Response Models

@router.get("/items/{item_id}", response_model=Item)
async def get_item(item_id: str) -> Item:
    ...

@router.get("/items", response_model=list[Item])
async def list_items() -> list[Item]:
    ...

HTTP Status Codes

@router.post("/items", status_code=status.HTTP_201_CREATED)
@router.delete("/items/{id}", status_code=status.HTTP_204_NO_CONTENT)

Integration Steps

  1. Create router in src/backend/app/routers/
  2. Mount in src/backend/app/main.py
  3. Create corresponding Pydantic models
  4. Create service layer if needed
  5. Add frontend API functions

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
よくある質問

「ルーター」とは何ですか?

建物の部署のようなものだと考えてください。各階や各部屋に決まった役割があるように、コードの中ではWebアプリケーションのさまざまな部分を整理する役割を持ちます。

「認証」とは何ですか?

ユーザーが本人であるかどうかを確認する仕組みのことです。ユーザー名とパスワードでログインするのが代表的な例です。

「レスポンスモデル」とは何ですか?

ユーザーに返されるデータの形式や内容を定めた、いわば書式のようなものです。返される情報の一貫性を保つ役割があります。

詳細

作者による元の説明

Create FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#4599
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル