Communitygithub.com

项目上下文生成器

生成或更新 `.claude/docs/project.md` 文件,为Claude提供项目特定上下文。当用户要求创建、更新、重新生成或刷新项目上下文,或说出“更新 project.md”、“生成项目上下文”、“这个仓库需要 project.md”或“Claude 不了解这个项目”等话语时使用。首次将 Claude 引入新仓库时也触发。

项目上下文生成器 是什么?

该技能旨在为AI编程助手(如Claude)自动生成或更新 `.claude/docs/project.md` 文件——一份专注于技术事实的精简项目参考。与面向人类读者的README不同,`project.md` 直接为Claude设计:密集、实诚、无需营销文案。通过自动分析代码库(分三步:项目元数据、架构扫描、数据源与基础设施),技能可以提取技术栈、命令、依赖、测试标记、架构模式等关键信息,并基于置信度标签(`[confirmed]`、`[inferred-high]`、`[inferred-low]`、`[unknown]`)标记每个事实。若存在不确定性,技能会提出聚焦的澄清问题。最终生成的 `project.md` 按标准化结构输出(包括技术栈、项目布局、数据流、测试标记等),并自动检查 `CLAUDE.md` 是否需要引用该文件。该技能适用于任何包含代码库的Claude会话,主要支持文件系统操作,无需外部API。核心价值在于节省Claude在每次对话中重新发现项目上下文的时间,提升开发效率。

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

在你喜欢的 AI 中提问

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

文档

项目上下文生成器 是做什么的?

创建或更新 .claude/docs/project.md —— Claude 在每次对话中加载的精简项目参考。与面向人类读者的 README 不同,project.md 是为 Claude 编写的:密集、实诚,无营销废话。

为什么需要这个技能

.claude/docs/project.md 通过 CLAUDE.md 自动加载到每一次 Claude 对话中。当它缺失或过时时,Claude 会浪费多轮对话来重新发现技术栈、测试命令和架构。此技能自动完成这一发现过程,生成一份紧凑而准确的项目参考文件。

工作流程

第 1 步:分析代码库

执行结构化的三阶段分析来收集项目事实。为每个事实标记置信度级别:[confirmed](从源代码读取)、[inferred-high](强证据)、[inferred-low](部分证据)或 [unknown]。

参见 references/analysis-methodology.md 了解详细的工具操作、glob/grep 模式以及记录模板。

阶段 1 —— 项目元数据: 全局搜索包管理器文件、环境变量模板、CI 配置和工具链文件。提取:项目名称、语言、Python 版本、依赖项(附用途)、脚本/命令、环境变量、CI 阶段、测试标记。

阶段 2 —— 架构扫描: 全局搜索所有源代码文件。识别入口点,构建导入图,分类模块(核心/叶子层/编排器),并识别架构模式。读取源代码引用的配置文件。

阶段 3 —— 数据源与基础设施: 识别外部数据源(数据库、API、文件)、输出目标(文件、上传、API)、测试结构以及自定义异常层次结构。

第 2 步:提出澄清问题

分析完成后,向用户询问 [inferred-low] 和 [unknown] 的项目。保持聚焦——不要问你已知的事项。常见缺口:

  • 项目目的: 这解决什么问题?(如果代码中不明显)
  • 数据源: 什么系统将数据输入?什么接收输出?
  • 部署: 这如何/在哪里运行?(本地、计划任务、云端)

如果代码库足够直接,你可能只需要 1-2 个问题或甚至不需要。

第 3 步:生成 project.md

使用以下结构写入文件。如果 .claude/docs/project.md 已经存在,在覆盖前请先与用户确认。


输出结构

生成的 project.md 必须遵循以下结构。根据项目规模调整详细程度——小项目可跳过某些章节,复杂项目可添加子章节。

# {项目名称} — 项目上下文

{一句话描述:它是什么、它做什么、关键技术。}

## 技术栈

- **{语言/运行时}** — {已知版本约束}
- **{框架}** — {用途}
- **{关键库}** — {用途}
- ...项目符号列表,工具名称加粗,注明用途

## 项目布局

```text
{带注释的目录树——每个条目一句简短说明}
```

数据流

{ASCII 示意图,显示 数据源 → 转换 → 输出 流水线}

数据源

  • {数据源名称} — {它提供什么}
  • ...包括数据库、API、本地文件等。

测试标记

  • {测试命令} — {它运行什么}
  • {标记名称} — {它控制什么}

关键架构模式

  • {模式名称}({文件}):{一句话解释}
  • ...仅列出值得指出的非明显模式

写作指南

  • 密集优于冗长。 每一行都应该有其存在的价值。Claude 不需要动机或背景设定——只需要事实。
  • 具体优于泛泛。 "运行 uv run pytest -m 'not snowflake'" 胜过 "运行排除外部依赖的测试"。
  • 每个模式一句话。 架构模式应每行一个——名称、文件、解释。
  • 真实命令。 从 pyproject.toml 或 CI 配置中复制测试命令,而不是近似版本。
  • 注释依赖项。 不要仅列出 polars —— 应写明 polars —— 高性能 DataFrame。
  • 数据源至关重要。 Claude 需要了解存在哪些外部系统。列出每一个数据库、API 和文件源。
  • 控制在 100 行以内。 如果 project.md 内容超过约 100 行,则过于详细——应将细节移至专用文档并添加链接。

输出

将文件保存为 .claude/docs/project.md(如有需要则创建目录)。如果文件已存在,在覆盖前向用户显示差异摘要。

生成 project.md 后,检查 CLAUDE.md 是否引用了它。如果没有,建议添加如下行:

参见 [.claude/docs/project.md](.claude/docs/project.md) 了解项目特定详情(技术栈、架构、测试标记)。

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

Deploy the portfolio chat agent Lambda function to AWS. Use when the user asks to deploy, redeploy, push to Lambda, update the chat agent, or after updating context files or lambda_function.py. Rebuilds the knowledge base, packages dependencies, and deploys to AWS Lambda.

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 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.

相关技能