协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
tidy-project-structure【开发与工程】Organize project files into conventional directories, update stale READMEs, clean configuration drift, and archive deprecated items without changing code logic. Use when files are scattered without clear organization, READMEs are outdated or contain broken examples, configuration files have multiplied across dev/staging/prod, deprecated files remain …
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
當項目組已偏於規時用此技:
勿用 為碼重構或依重構。此技焦於文組與文檔之衛。
| Parameter | Type | Required | Description |
|---|---|---|---|
project_path | string | Yes | 項目根之絕路 |
conventions | string | No | 風格書之路(如 docs/conventions.md) |
archive_mode | enum | No | move(默)或 delete 為棄文 |
readme_update | boolean | No | 更陳之 README(默:是) |
比當前構與項目規或語最佳實。
諸語常之規:
JavaScript/TypeScript:
src/ # Source code
tests/ # Test files
dist/ # Build output (gitignored)
docs/ # Documentation
.github/ # CI/CD workflows
Python:
package_name/ # Package code
tests/ # Test suite
docs/ # Sphinx docs
scripts/ # Utility scripts
R:
R/ # R source
tests/testthat/ # Test suite
man/ # Documentation (generated)
vignettes/ # Long-form guides
inst/ # Installed files
data/ # Package data
Rust:
src/ # Source code
tests/ # Integration tests
benches/ # Benchmarks
examples/ # Usage examples
得:違規之文/目列存於 structure_audit.txt
敗則:若無書之規,用語標默
移文於其規之目。
常移:
tests/ 外之試文 → 移於 tests/docs/ 外之文檔 → 移於 docs/src/ 中之建造 → 除(當 gitignored)config/ 或 .config/各移:
# Check if file is referenced anywhere
grep -r "filename" .
# If no references or only relative path references:
mkdir -p target_directory/
git mv source/file target_directory/file
# Update any imports/requires
# (language-specific — see repair-broken-references skill)
得:諸文於規之位;git 史以 git mv 存
敗則:若移斷引,更引路或升
識諸 README 之陳資。
陳之徵:
# Find all READMEs
find . -name "README.md" -o -name "readme.md"
# For each README:
# - Check last modified date
git log -1 --format="%ci" README.md
# - Check for broken links
markdown-link-check README.md
# - Verify example code still runs (sample first example)
得:陳 README 列於 readme_freshness.txt,附具患
敗則:若 markdown-link-check 不可得,手審外鏈
修斷鏈、更例、加缺節。
標修:
README 模板構:
# Project Name
Brief description (1-2 sentences).
## Installation
```bash
# Language-specific install command
# Basic example
Link to full docs.
Link to CONTRIBUTING.md or inline guidelines.
LICENSE badge and link.
得:諸 README 已更;例已驗可行
敗則:若例碼不可驗,標警
### 第五步:審配文
識配偏而合重設。
**常配之患**:
1. 多 `.env` 文(`.env`、`.env.local`、`.env.dev`、`.env.prod`)
2. 諸配文重設
3. 硬編密(當用環變)
4. 陳 API 端或能旗
```bash
# Find all config files
find . -name "*.config.*" -o -name ".env*" -o -name "*.yml" -o -name "*.yaml"
# For each config:
# - Check for duplicate keys
# - Grep for hardcoded secrets (API keys, tokens, passwords)
grep -E "(api[_-]?key|token|password|secret)" config_file
# - Compare dev vs prod settings
diff .env.dev .env.prod
得:配偏書於 config_review.txt;密標為升
敗則:若 diff 示大歧,升於 devops-engineer
移或除不再須之文。
棄之候:
nginx.conf.old)file.bak、file~)存之程:
# Create archive directory (if archive_mode=move)
mkdir -p archive/YYYY-MM-DD/
# For each deprecated file:
# 1. Verify not referenced anywhere
grep -r "filename" .
# 2. Check git history for last modification
git log -1 --format="%ci" filename
# 3. If not modified in >1 year and no references:
if [ "$archive_mode" = "move" ]; then
git mv filename archive/YYYY-MM-DD/
else
git rm filename
fi
# 4. Document in ARCHIVE_LOG.md
echo "- filename (reason, last modified: DATE)" >> ARCHIVE_LOG.md
得:棄文已存;ARCHIVE_LOG.md 已更
敗則:若不確文是否棄,留位而書於報
察諸項目中文命之不一。
常規:
my-file.js(JS/網項目常用)my_file.py(Python 標)MyComponent.tsx(React 件)myUtility.js(JavaScript 函)# Find files violating conventions
# Example: Python project expecting snake_case
find . -name "*.py" | grep -v "__pycache__" | grep -E "[A-Z-]"
# For each violation, either:
# 1. Rename to match conventions
# 2. Document exception (e.g., Django settings.py convention)
得:諸文遵命之規或例外已書
敗則:若改名斷引,更引或升
書諸構之變。
# Project Structure Tidying Report
**Date**: YYYY-MM-DD
**Project**: <project_name>
## Directory Changes
- Moved X files to conventional directories
- Created Y new directories
- Archived Z deprecated files
## README Updates
- Updated W stale READMEs
- Fixed X broken links
- Verified Y code examples
## Config Cleanup
- Consolidated X duplicate settings
- Flagged Y hardcoded secrets for removal
- Documented Z config drift issues
## Files Archived
See ARCHIVE_LOG.md for full list (Z files).
## Naming Convention Fixes
- Renamed X files to match conventions
- Documented Y exceptions
## Escalations
- [Config drift requiring devops review]
- [Hardcoded secrets requiring security audit]
得:報存於 TIDYING_REPORT.md
敗則:(不適——皆生報)
整後:
git mv,非 mv)斷相對引:移文斷相對引路。更諸引或用絕對引。
失 git 史:用 mv 而非 git mv 失文史。移恆用 git 之命。
過組:立過深之嵌目使導行更難。簡至繁須構為止。
除而非存:直除失復之能。確之前恆先存。
忽語規:以己好凌語標。遵立之規。
不更文檔:移文不更 README 之路致文斷。