Communitygithub.com

デプロイスキル(ポートフォリオチャットエージェント)

ポートフォリオチャットエージェントのLambda関数をAWSにデプロイします。ユーザーがデプロイ、再デプロイ、Lambdaへのプッシュ、チャットエージェントの更新、またはコンテキストファイルやlambda_function.pyの更新を依頼した際に使用します。ナレッジベースを再構築し、依存関係をパッケージ化し、AWS Lambdaにデプロイします。

デプロイスキル(ポートフォリオチャットエージェント) とは?

このスキルは、ポートフォリオチャットエージェントのAWS Lambda関数を自動的にビルドおよびデプロイするためのものです。ユーザーがチャットエージェントの更新やデプロイを依頼した際、または`WebContent/context/`内のファイルや`lambda/lambda_function.py`を変更した後に、ナレッジベースの再生成、依存関係のクリーンインストール、ZIPパッケージ化、そしてAWS CLIを使用したLambda関数コードの更新を順に実行します。Amazon Linux x86_64環境向けに依存関係を正しくビルドするためのプラットフォームフラグなど、環境固有の設定を自動的に処理します。デプロイ後は、Lambda関数のステータスや`CodeSha256`値を確認して成功を検証します。また、Anthropic APIキーを誤ってログや出力に含めないようにするセキュリティルールも含まれています。トラブルシューティングセクションでは、モジュールの欠落、パスエラー、リソース未発見、ストレージ超過などの一般的な問題とその解決策がまとめられています。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cdcoonce/Portfolio_Website/tree/HEAD/.claude/skills/deploy

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

デプロイスキル

ポートフォリオチャットエージェントLambda関数を再構築し、AWSにデプロイします。

使用タイミング

  • WebContent/context/ 内のファイルを更新した後
  • lambda/lambda_function.py を変更した後
  • ユーザーが「デプロイ」「再デプロイ」「Lambdaにプッシュ」「チャットエージェントを更新」と言ったとき

ワークフロー

  1. ナレッジベースを再構築 — コンテキストファイルから lambda/knowledge_base.json を再生成します
  2. 以前のビルドをクリーンアップ — 古い package/ ディレクトリと deployment.zip を削除します
  3. 依存関係をインストール — Linux/x86_64ターゲット用のPythonパッケージをインストールします
  4. パッケージ化 — ハンドラとナレッジベースをパッケージにコピーし、zipを作成します
  5. デプロイ — AWS CLIを介してLambda関数コードを更新します
  6. 確認 — デプロイの成功を確認します

コマンド

ステップ 1: ナレッジベースの再構築

python scripts/build_knowledge_base.py

出力に期待されるプロジェクト数が表示され、エラーがないことを確認します。

ステップ 2: クリーンアップと依存関係のインストール

cd lambda
rm -rf package/ deployment.zip
pip install -r requirements.txt -t package/ \
  --platform manylinux2014_x86_64 \
  --only-binary=:all: \
  --implementation cp \
  --python-version 3.12

--platform フラグと --only-binary フラグにより、コンパイル済み拡張がmacOSではなくAmazon Linux用にビルドされるようにします。

ステップ 3: デプロイメントZIPのパッケージ化

cp lambda_function.py knowledge_base.json package/
cd package && zip -r ../deployment.zip . && cd ..

ステップ 4: Lambdaへのデプロイ

aws lambda update-function-code \
  --function-name portfolio-chat-agent \
  --zip-file fileb://lambda/deployment.zip

リポジトリルートから実行して、fileb:// パスが正しく解決されるようにします。

ステップ 5: 確認

レスポンスに以下が含まれていることを確認します。

  • "LastUpdateStatus": "InProgress" または "Successful"
  • "FunctionName": "portfolio-chat-agent"
  • 更新された CodeSha256 の値

設定

設定項目値
関数名portfolio-chat-agent
ランタイムpython3.12
リージョンus-west-1
メモリ256 MB
タイムアウト30 秒
アーキテクチャx86_64

ルール

  • Anthropic APIキーを絶対に出力またはログに記録しないでください。 AWS CLIのレスポンスに環境変数が含まれている場合、ユーザーにそれらをエコーバックしないでください。
  • 常に最初にナレッジベースを再構築してください。 lambda_function.py のみが変更された場合でも、再構築によりナレッジベースが最新であることが保証されます。
  • リポジトリルートから実行してください。 デプロイコマンドの fileb:// パスはワーキングディレクトリからの相対パスです。
  • ユーザーが明示的にAPIキーの更新を要求した場合を除き、Lambdaの環境変数を変更しないでください。

トラブルシューティング

問題解決策
No module named 'pydantic_core._pydantic_core'pip install 時に --platform フラグが不足している — 依存関係がLinuxではなくmacOS用にビルドされています
Unable to load paramfile fileb://ワーキングディレクトリが間違っている — リポジトリルートからデプロイコマンドを実行してください
ResourceNotFoundExceptionLambda関数がまだ存在しない — aws lambda create-function を使用してください(docs/plans/chat-agent/aws-setup.md ステップ7参照)
CodeStorageExceededExceptionデプロイメントZIPが大きすぎる — requirements.txt 内の不要な依存関係を確認してください

参考ドキュメント

  • aws-setup.md — AWSアカウントの完全なセットアップ、IAMロール、初期Lambda作成、およびFunction URLの設定

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cdcoonce/Portfolio_Website

Git commit workflow with enforced conventional commit style. Use when Claude needs to stage and commit changes, craft commit messages, or the user asks to commit, make a commit, or save their work. Ensures consistent commit message format, proper scoping, and atomic commits across the project.

cdcoonce/Portfolio_Website

AI-powered code quality analysis for Python, Markdown, and Mermaid diagrams. Use this skill when: (1) reviewing code for quality issues, (2) checking Python files for PEP8 violations, unused code, missing type hints, docstring problems, complexity issues, or potential runtime errors, (3) validating Markdown documentation for broken links, heading structure, or formatting issues, (4) validating Mermaid diagram syntax, (5) the user asks for a "code review" or "quality check", (6) analyzing code snippets pasted in conversation, or (7) suggesting and applying fixes for code quality issues.

cdcoonce/Portfolio_Website

Generate multiple radically different interface designs for a module using parallel sub-agents. Use when user wants to design an API, explore interface options, compare module shapes, or mentions "design it twice".

cdcoonce/Portfolio_Website

Orchestrate the full GitHub-issues-driven development lifecycle. 7-phase pipeline from brainstorm through PR with state tracking and cross-conversation resume. Use when user says "dev cycle", "development workflow", "full development pipeline", or invokes /dev-cycle.

cdcoonce/Portfolio_Website

Production Python coding standards with automatic version detection (3.10-3.13). Use when writing, reviewing, or refactoring Python to ensure adherence to modern type syntax, LBYL exception handling, pathlib operations, ABC-based interfaces, and production-tested patterns. Not Dagster-specific - applies to any Python project.

cdcoonce/Portfolio_Website

Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.

cdcoonce/Portfolio_Website

GitHub CLI (gh) integration for managing issues, pull requests, branches,

cdcoonce/Portfolio_Website

Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".

cdcoonce/Portfolio_Website

Explore a codebase to find opportunities for architectural improvement, focusing on making the codebase more testable by deepening shallow modules. Use when user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more AI-navigable.

cdcoonce/Portfolio_Website

CEO/founder-mode plan review. Rethink the problem, find the 10-star product, challenge premises, expand scope when it creates a better product. Three modes: SCOPE EXPANSION (dream big), HOLD SCOPE (maximum rigor), SCOPE REDUCTION (strip to essentials). Use when the user asks for a plan review, CEO review, mega review, or wants a plan challenged/stress-tested before implementation.

cdcoonce/Portfolio_Website

Break a PRD into independently-grabbable GitHub issues using tracer-bullet vertical slices. Use when user wants to convert a PRD to issues, create implementation tickets, or break down a PRD into work items.

cdcoonce/Portfolio_Website

Turn a PRD into a multi-phase implementation plan using tracer-bullet vertical slices, saved as a local Markdown file in docs/plans/. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions "tracer bullets".

cdcoonce/Portfolio_Website

Generate or update the `.claude/docs/project.md` file that gives Claude project-specific context. Use this skill when the user asks to create, update, regenerate, or refresh project context, or says things like "update project.md", "generate project context", "this repo needs a project.md", or "Claude doesn't know about this project". Also trigger when onboarding Claude to a new repository for the first time.

cdcoonce/Portfolio_Website

Generate comprehensive, high-quality README.md files for code repositories. Use this skill whenever the user asks to create, write, generate, update, or improve a README for any project or repository. Also trigger when the user says things like "document this project", "write docs for this repo", "this repo needs a README", "help me onboard developers to this codebase", or asks for project documentation in markdown. Even if the user just says "README" or "readme" in the context of a codebase, use this skill.

cdcoonce/Portfolio_Website

Create a detailed refactor plan with tiny commits via user interview, then file it as a GitHub issue. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.

cdcoonce/Portfolio_Website

Set up pre-commit hooks for the current repo. Use when user wants to add pre-commit hooks, configure commit-time linting, formatting, type checking, or testing. Triggers on "pre-commit", "git hooks", "linting hooks", or /setup-pre-commit.

cdcoonce/Portfolio_Website

Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.

cdcoonce/Portfolio_Website

Triage a bug or issue by exploring the codebase to find root cause, then create a GitHub issue with a TDD-based fix plan. Use when user reports a bug, wants to file an issue, mentions "triage", or wants to investigate and plan a fix for a problem.

cdcoonce/Portfolio_Website

Rewrites the prose sections of wiki pages in-place. Reads source files to understand current context, then updates only the content inside <!-- claude:prose --> ... <!-- claude:prose:end --> markers. Never touches <!-- generated:start --> ... <!-- generated:end --> blocks. Supports targeting a single page with /update-wiki {PageName}.

cdcoonce/Portfolio_Website

Create a PRD through user interview, codebase exploration, and module design, then submit as a GitHub issue. Use when user wants to write a PRD, create a product requirements document, or plan a new feature.

関連スキル