Communitygithub.com

cdcoonce/Portfolio_Website

部署作品集聊天智能体 Lambda 函数到 AWS。当用户要求部署、重新部署、推送到 Lambda、更新聊天智能体,或更新了上下文文件或 lambda_function.py 后使用。会重建知识库、打包依赖并部署到 AWS Lambda。

Portfolio_Website 是什么?

该技能用于自动将作品集聊天智能体(虚似助手)部署到 AWS Lambda。它提供端到端的部署流程:首先从 `WebContent/context/` 目录下的上下文文件重建知识库(`lambda/knowledge_base.json`),然后清理旧的构建产物,安装适用于 Linux/x86_64 架构的 Python 依赖,将处理函数和知识库打包成 ZIP 文件,最后通过 AWS CLI 的 `update-function-code` 命令更新 Lambda 函数。部署后会自动验证状态,确保 Lambda 函数更新成功。该技能主要用于 RAG(检索增强生成)场景下的智能体持续迭代,非常适合需要频繁更新聊天智能体知识或逻辑的开发者。它支持在任何可以运行 Python 和 AWS CLI 的环境中使用,但建议在 macOS 上开发,部署到 Amazon Linux 的 Lambda 环境。技能内置了常见问题的故障排除指南,包括依赖问题、路径错误、函数创建和 ZIP 包过大等场景。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cdcoonce/Portfolio_Website/tree/HEAD/.claude/skills/deploy

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

部署技能

重建并部署作品集聊天智能体 Lambda 函数到 AWS。

使用时机

  • 更新 WebContent/context/ 目录下的任何文件后
  • 修改 lambda/lambda_function.py 后
  • 用户说出“部署”、“重新部署”、“推送到 Lambda”或“更新聊天智能体”时

工作流程

  1. 重建知识库 — 从上下文文件重新生成 lambda/knowledge_base.json
  2. 清理之前的构建 — 删除旧的 package/ 目录和 deployment.zip
  3. 安装依赖 — 安装适用于 Linux/x86_64 目标平台的 Python 包
  4. 打包 — 将处理函数和知识库复制到 package 目录,并创建 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 标志确保编译扩展是为 Amazon Linux 构建的,而不是 macOS。

步骤 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 标志 —— 依赖是为 macOS 而非 Linux 构建的
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 创建和函数 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.

相关技能