feat: add /setup-new-repo command for bootstrapping new repositories - #399
Conversation
Add a Claude command that sets up new repositories with: - DevContainer configuration - CI/CD workflows (GitHub Actions) - Development tools (ESLint, Prettier, Jest, Husky) - Git configuration (commitlint, .gitignore) - Documentation templates (README, CLAUDE.md, SECURITY.md) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughA new documentation file is added that comprehensively describes a command for bootstrapping new repositories. The guide details steps for argument parsing, directory validation, initializing Git, copying DevContainer and VSCode configurations, setting up CI/CD workflows, configuring development tools, generating documentation files, and installing dependencies. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In @.claude/commands/setup-new-repo.md:
- Around line 230-233: Update the "9.3 SECURITY.md" step to include a concrete
SECURITY.md creation action: either paste a basic SECURITY.md template (e.g.,
reporting process, contact, PGP key, disclosure timeline) directly under the
"### 9.3 SECURITY.md" section or add a copy command that pulls the file from the
config repo (e.g., cp CONFIG_REPO/SECURITY.md TARGET_DIR/) and mention which
repo/path to use; ensure the section clearly shows the template content or the
exact copy command and destination so the step is actionable.
- Around line 52-58: The "Step 4: Initialize Git Repository" sequence uses "cd
TARGET_DIR" without ensuring the directory exists; update this step to create
the directory first by running "mkdir -p TARGET_DIR" (or equivalent) before "cd
TARGET_DIR" so the subsequent "git init" won't fail if the target directory is
missing; modify the block containing "cd TARGET_DIR" and "git init" to include
the directory creation command immediately above the cd command.
- Around line 287-294: The documentation references a non-existent shell script
path `/path/to/config/script/setup-new-repo.sh` which will confuse users; either
remove the "Alternative: Use Shell Script" section or update it to clearly mark
the script as a placeholder/planned feature (e.g., "script not yet available")
and remove the absolute placeholder path, ensuring references to
"setup-new-repo.sh" or the section header "Alternative: Use Shell Script" are
updated accordingly so readers aren’t misled.
- Around line 244-276: The fenced code block containing the "Repository Setup
Complete" banner is missing a language identifier; update that block to use a
plaintext language tag (e.g., add ```text) so the linter is satisfied and the
output is rendered clearly—locate the fenced block that wraps the banner text
and change its opening triple-backticks to include "text" (or "plaintext").
🧹 Nitpick comments (1)
.claude/commands/setup-new-repo.md (1)
180-223: Clarify placeholder substitution mechanism.The README template includes placeholders like
{project-name}(line 181) and{LICENSE}(line 221), but the documentation doesn't explain how these should be substituted with actual values. Consider adding a note about the substitution mechanism or providing example sed/awk commands to replace these placeholders.
| ## Step 4: Initialize Git Repository | ||
|
|
||
| ```bash | ||
| cd TARGET_DIR | ||
| git init | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Add directory creation before cd TARGET_DIR.
The command sequence attempts to cd TARGET_DIR without ensuring the directory exists first. Step 2 mentions "Directory will be created" but Step 4 doesn't actually create it. If the target directory doesn't exist, the cd command will fail.
📁 Proposed fix to create directory first
+```bash
+mkdir -p TARGET_DIR
+```
+
```bash
cd TARGET_DIR
git init📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ## Step 4: Initialize Git Repository | |
| ```bash | |
| cd TARGET_DIR | |
| git init | |
| ``` | |
| ## Step 4: Initialize Git Repository | |
🤖 Prompt for AI Agents
In @.claude/commands/setup-new-repo.md around lines 52 - 58, The "Step 4:
Initialize Git Repository" sequence uses "cd TARGET_DIR" without ensuring the
directory exists; update this step to create the directory first by running
"mkdir -p TARGET_DIR" (or equivalent) before "cd TARGET_DIR" so the subsequent
"git init" won't fail if the target directory is missing; modify the block
containing "cd TARGET_DIR" and "git init" to include the directory creation
command immediately above the cd command.
| ### 9.3 SECURITY.md | ||
|
|
||
| セキュリティポリシーを作成。 | ||
|
|
There was a problem hiding this comment.
Complete SECURITY.md creation step.
Step 9.3 mentions creating a security policy ("セキュリティポリシーを作成") but doesn't provide the content, template, or command to create it. This step is incomplete compared to the detailed instructions provided for README.md and other files.
📄 Suggestion to complete this step
Either provide the SECURITY.md template content inline (similar to the README.md template) or specify copying from the config repository:
cp CONFIG_REPO/SECURITY.md TARGET_DIR/Or provide a basic template if one doesn't exist in the config repo.
🤖 Prompt for AI Agents
In @.claude/commands/setup-new-repo.md around lines 230 - 233, Update the "9.3
SECURITY.md" step to include a concrete SECURITY.md creation action: either
paste a basic SECURITY.md template (e.g., reporting process, contact, PGP key,
disclosure timeline) directly under the "### 9.3 SECURITY.md" section or add a
copy command that pulls the file from the config repo (e.g., cp
CONFIG_REPO/SECURITY.md TARGET_DIR/) and mention which repo/path to use; ensure
the section clearly shows the template content or the exact copy command and
destination so the step is actionable.
| ``` | ||
| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
| ✅ Repository Setup Complete | ||
| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
|
||
| 📁 Target: {TARGET_DIR} | ||
|
|
||
| Files Created: | ||
| ✅ .devcontainer/ | ||
| ✅ .vscode/ | ||
| ✅ .github/workflows/ci.yml | ||
| ✅ .github/ISSUE_TEMPLATE/ | ||
| ✅ .github/PULL_REQUEST_TEMPLATE.md | ||
| ✅ package.json | ||
| ✅ eslint.config.mjs | ||
| ✅ .prettierrc | ||
| ✅ jest.config.js | ||
| ✅ commitlint.config.js | ||
| ✅ .gitignore | ||
| ✅ README.md | ||
| ✅ CLAUDE.md | ||
| ✅ SECURITY.md | ||
|
|
||
| Next Steps: | ||
| 1. cd {TARGET_DIR} | ||
| 2. Update README.md with project details | ||
| 3. Update package.json (name, description) | ||
| 4. git add . && git commit -m "chore: initial setup" | ||
| 5. gh repo create (optional) | ||
| 6. git push -u origin main | ||
|
|
||
| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
| ``` |
There was a problem hiding this comment.
Specify language for fenced code block.
The fenced code block lacks a language specification. While this is output text rather than executable code, specifying text or plaintext would satisfy the linter and improve clarity.
📝 Proposed fix
-```
+```text
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Repository Setup Complete🧰 Tools
🪛 markdownlint-cli2 (0.20.0)
[warning] 244-244: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
In @.claude/commands/setup-new-repo.md around lines 244 - 276, The fenced code
block containing the "Repository Setup Complete" banner is missing a language
identifier; update that block to use a plaintext language tag (e.g., add
```text) so the linter is satisfied and the output is rendered clearly—locate
the fenced block that wraps the banner text and change its opening
triple-backticks to include "text" (or "plaintext").
| ## Alternative: Use Shell Script | ||
|
|
||
| シェルスクリプトを直接実行することも可能: | ||
|
|
||
| ```bash | ||
| /path/to/config/script/setup-new-repo.sh TARGET_DIR [OPTIONS] | ||
| ``` | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for setup-new-repo.sh in the repository
echo "=== Searching for setup-new-repo.sh ==="
fd -t f 'setup-new-repo\.sh' || echo "No matches found"
echo ""
echo "=== Searching for any script directory ==="
fd -t d 'script' || echo "No script directories found"
echo ""
echo "=== Checking the documentation file ==="
head -n 300 .claude/commands/setup-new-repo.md | tail -n 30Repository: keito4/config
Length of output: 1132
Remove or clarify the non-existent shell script reference.
The shell script setup-new-repo.sh does not exist in the repository. The path /path/to/config/script/setup-new-repo.sh is a placeholder that will confuse users. Either remove this section or add a note that it describes a planned feature and is not yet available.
🤖 Prompt for AI Agents
In @.claude/commands/setup-new-repo.md around lines 287 - 294, The documentation
references a non-existent shell script path
`/path/to/config/script/setup-new-repo.sh` which will confuse users; either
remove the "Alternative: Use Shell Script" section or update it to clearly mark
the script as a placeholder/planned feature (e.g., "script not yet available")
and remove the absolute placeholder path, ensuring references to
"setup-new-repo.sh" or the section header "Alternative: Use Shell Script" are
updated accordingly so readers aren’t misled.
PR Review:
|
| カテゴリ | 件数 |
|---|---|
| Critical | 2 |
| Major | 4 |
| Performance | 2 |
| Documentation | 3 |
| Testing | 1 |
| Enhancement | 2 |
Next Steps
- 必須: Critical と Major の問題を修正
- 推奨: テストプランの2つ目の項目を完了
- 任意: Enhancement の提案を検討
全体的に有用なコマンドですが、上記の問題を解決することで、より堅牢で使いやすいツールになります。
.claude/commands/setup-new-repo.md:71
.claude/commands/setup-new-repo.md:156-162
.claude/commands/setup-new-repo.md:221
.claude/commands/setup-new-repo.md:271
|
🎉 This PR is included in version 1.61.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
/setup-new-repoコマンドを追加Features
このコマンドで以下をセットアップ:
.devcontainer/,.vscode/.gitignoreUsage
Options
--minimal--no-devcontainer--license TYPE--no-installTest plan
/setup-new-repo /tmp/test-repoで新規リポジトリをセットアップできることを確認🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.