(任意)既存の API パターンを確認する
Devin に使用する OpenAPI 仕様書を指定する
まず、仕様がどこにあり、どのリソースを実装すべきかをDevinに伝えます。DevinはYAML内のすべてのパス、スキーマ、エラー定義を読み取り、既存のExpressルートと突き合わせて、自動的に既存の規約に沿うようにします。Devinが扱う仕様の一例を以下に示します。これは、bookingsリソース向けの標準的なOpenAPI 3.0仕様です。If your spec isn’t checked into the repo yet, paste it directly into the session or attach the YAML/JSON file when starting.
Devin が既存の Express パターンに合わせる
The single most impactful thing you can do is reference a well-implemented resource in your codebase. Devin studies that code and replicates the folder structure, naming conventions, middleware chain, and error handling — so the new endpoints look like they were written by the same developer.For example, Devin reads Devin also derives Zod schemas directly from the OpenAPI component definitions, so request validation stays in sync with the spec:環境設定にテスト用データベースの設定と必要な環境変数を含めておき、Devin がローカルでテストスイート全体を実行できるようにしてください。API に認証情報 (database URL、JWT secret など) が必要な場合は、セッションを開始する前にそれらをSecretsとして登録するか、セッション中にチャットで渡してください。
src/api/v2/users/router.ts and produces a matching bookings router:Devin delivers a tested PR
Devin reads the spec, studies your existing code, and implements each endpoint to match both the OpenAPI contract and your Express codebase conventions. Here’s what a typical PR looks like:Devin runs the Supertest suite before opening the PR:
仕様でカバーされていない部分を反復的に改善する
OpenAPI 仕様はコントラクトを定義しますが、ビジネスルール、認可ロジック、またはパフォーマンス要件を捉えることはほとんどありません。フォローアッププロンプトを使用してギャップを埋めましょう:
Devin Review を使って PR をレビューする
Devin が PR を作成したら、実装内容をレビューするために Devin Review を使用します。Devin Review は、エラー処理の抜けやレスポンス形式の不整合、仕様と一致していないエンドポイントなどの問題を検出できます。Devin Review が問題を検出した場合は、Autofix を使って Devin に自動的に修正させることができます。Autofix はフォローアップセッションを開き、修正を適用し、各変更点を手動で説明することなく更新されたコミットをプッシュします。
