Skip to content
Back to skills

Documents

ASecurity

APIで受け付けたファイルを非同期に解析し、解析結果をDBへ保存する。APIはファイル本体をキューへ送らず、オブジェクトストレージ上の保存先だけをキューへ登録する。

  • 50 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
developmentapi

Works with

  • api

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned November 7, 2026

npx -y skills add iwasa-kosui/tanteki --skill documents --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Documents?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Documents
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/iwasa-kosui-documents-e0d80cea/badge)](https://www.skillsdirectory.com/skills/iwasa-kosui-documents-e0d80cea)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# ファイル取込の設計

## 1. 目的

APIで受け付けたファイルを非同期に解析し、解析結果をDBへ保存する。APIはファイル本体をキューへ送らず、オブジェクトストレージ上の保存先だけをキューへ登録する。

## 2. 範囲

対象は次の処理である。

- APIによるファイルの受け付け
- オブジェクトストレージへの保存
- 保存先のキューへの登録
- ワーカーによるファイル取得と解析
- 解析結果のDB保存

キューへの登録に失敗した場合の回復方法は未決定であり、本設計では扱わない。

## 3. 設計

### 3.1 構成

```mermaid
sequenceDiagram
    participant C as 利用者
    participant A as API
    participant S as オブジェクトストレージ
    participant Q as キュー
    participant W as ワーカー
    participant D as DB

    C->>A: ファイル送信
    A->>S: ファイル保存
    alt 保存失敗
        S-->>A: 保存エラー
        A-->>C: 503 Service Unavailable
    else 保存成功
        S-->>A: 保存先
        A->>Q: 保存先を登録
        Q-->>A: 登録結果
        A-->>C: 受付結果
        Q->>W: 保存先を通知
        W->>S: ファイル取得
        S-->>W: ファイル本体
        W->>W: 解析
        W->>D: 解析結果を保存
    end
```

### 3.2 APIの処理

1. APIは受信したファイルをオブジェクトストレージへ保存する。
2. 保存に失敗した場合、APIは `503 Service Unavailable` を返す。この場合、キューには登録しない。
3. 保存に成功した場合、APIはオブジェクトストレージ上の保存先をキューへ登録する。
4. キューへの登録結果に応じた処理は、回復方法の決定後に確定する。

ファイル本体はキューへ登録しない。10MBのファイルがキューの1MB制限を超えるためである。

### 3.3 ワーカーの処理

1. ワーカーはキューから保存先を受け取る。
2. 保存先からオブジェクトストレージ上のファイルを読み込む。
3. ファイルを解析する。
4. 解析結果をDBへ保存する。

## 4. 失敗時の扱い

| 失敗箇所 | 確定した扱い |
|---|---|
| オブジェクトストレージへの保存 | APIは503を返す |
| 保存失敗後のキュー登録 | 登録しない |
| キューへの登録 | 回復方法は未決定 |

オブジェクトストレージへの保存成功後にキューへの登録が失敗した場合、保存済みファイルをどう扱うかは未決定である。再登録、保存済みファイルの削除、状態の記録などの具体的な方式は、この設計の確定対象外とする。

## 5. 採用しない方式

ファイル本体をキューへ載せる方式は採用しない。対象ファイルのサイズは10MBであり、キューの上限である1MBを超えるためである。保存先をキューへ載せる方式なら、ワーカーが必要なファイル本体をオブジェクトストレージから取得できる。

## 6. 利用者への影響

解析を非同期で実行するため、利用者が解析結果を確認できるまでの時間は、同期処理より遅くなる。結果の通知方法と、結果を確認できる状態の定義は本資料では未定義である。

## 7. 未決定事項

- オブジェクトストレージへの保存成功後、キューへの登録に失敗した場合の回復方法
- 非同期処理の受付結果と解析結果を利用者へ提示する方法
- 解析結果を確認できる状態の定義

これらは決定後に本設計へ反映する。

## 8. 実装上の確認点

- 保存失敗時に503を返すこと
- 保存失敗時にキューへ登録しないこと
- キューにはファイル本体ではなく保存先を登録すること
- ワーカーが保存先からファイルを取得すること
- 解析結果をDBへ保存すること

Files in this skill

  • adr-boundary.1.with_skill.md1.4 KB
  • adr-boundary.1.without_skill.md2.1 KB
  • adr-boundary.2.with_skill.md1.2 KB
  • adr-boundary.2.without_skill.md3 KB
  • canonical-reference.1.with_skill.md290 B
  • canonical-reference.1.without_skill.md321 B
  • canonical-reference.2.with_skill.md306 B
  • canonical-reference.2.without_skill.md289 B
  • comparison-rfc.1.with_skill.md1.3 KB
  • comparison-rfc.1.without_skill.md1.4 KB
  • comparison-rfc.2.with_skill.md1.3 KB
  • comparison-rfc.2.without_skill.md1.6 KB
  • design-tradeoff.1.with_skill.md3.9 KB
  • design-tradeoff.1.without_skill.md9.9 KB
  • design-tradeoff.2.with_skill.md3.9 KB
  • design-tradeoff.2.without_skill.md6.3 KB
  • incident-record.1.with_skill.md517 B
  • incident-record.1.without_skill.md535 B
  • incident-record.2.with_skill.md557 B
  • incident-record.2.without_skill.md500 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.