Gitignore Sync
Generate high-confidence .gitignore rules from real repo signals and gitignore.io, then update safely via a managed block so manual rules stay untouched.
Execution Rule
Use scripts/update_gitignore.py as the only execution path.
Do not fetch from the API directly in ad-hoc commands.
Do not manually compose or rewrite .gitignore when this skill is selected.
Workflow
- 1. Infer requested templates from the user prompt.
- Detect likely templates from repository files and folders.
- Run
scripts/update_gitignore.py with --prompt-text and/or --services. - Let the script fetch combined template rules from
https://www.toptal.com/developers/gitignore/api/<templates>. - Let the script write or update a managed block in
.gitignore. - Preserve non-managed user sections in
.gitignore.
Run
From the target repository root, run:
CODEBLOCK0
Use explicit templates when the user names exact services:
CODEBLOCK1
Notes
- - Prefer passing both
--prompt-text and --services when available. - Keep manual custom rules outside the managed block markers.
- Re-run safely; the script replaces only the managed block.
- Use
--rules-file for offline/local testing when network access is blocked.
Gitignore 同步
从真实仓库信号和 gitignore.io 生成高置信度的 .gitignore 规则,并通过受管区块安全更新,使手动规则保持不变。
执行规则
使用 scripts/update_gitignore.py 作为唯一执行路径。
不要在临时命令中直接通过 API 获取。
当选择此技能时,不要手动编写或重写 .gitignore。
工作流程
- 1. 从用户提示中推断请求的模板。
- 从仓库文件和文件夹中检测可能的模板。
- 使用 --prompt-text 和/或 --services 运行 scripts/update_gitignore.py。
- 让脚本从 https://www.toptal.com/developers/gitignore/api/ 获取组合模板规则。
- 让脚本在 .gitignore 中写入或更新受管区块。
- 保留 .gitignore 中非受管的用户部分。
运行
从目标仓库根目录运行:
bash
python3 /scripts/update_gitignore.py \
--prompt-text create .gitignore for flutter firebase vscode \
--repo .
当用户指定确切服务时使用显式模板:
bash
python3 /scripts/update_gitignore.py \
--services flutter,firebase,visualstudiocode \
--repo .
注意事项
- - 尽可能同时传递 --prompt-text 和 --services。
- 将手动自定义规则保留在受管区块标记之外。
- 可安全重新运行;脚本仅替换受管区块。
- 当网络访问受限时,使用 --rules-file 进行离线/本地测试。