code-review
Freeプロジェクトガイドラインへの準拠をチェックし、バグ、スタイル違反、コード品質問題を検出する。PRレビュー時に使用。
The English summary is being prepared. Showing the original description.
Creates and reviews agent skills safely by enforcing deletion-prevention harness rules: no fixed absolute temp paths, no cwd-dependent cleanup, no wildcard deletes, no workspace-external file operations, no silent cleanup failures, and mandatory temp-root validation before any destructive command. Use when creating a new skill, updating an existing SKILL.md, or reviewing prompts/runbooks that include temp files, extraction, cleanup, PowerShell, bash, rm, del, Remove-Item, or archive expansion.
The English summary is being prepared. Showing the original description.
See how to installReview the instructions the agent will receive before you install.
SKILL.md や関連 runbook を作成・更新するときに、削除事故や workspace 外操作を招く危険な記述を防ぐためのスキル。
このスキルの目的は、「スキルを作るスキル」を安全側に倒し、テンポラリ作成・展開・cleanup を含む記述でも削除防止ハーネスを最初から組み込むことです。
Get-Location を workspace root の代わりに使わないSilentlyContinue で握りつぶさない新しいスキルや runbook を作るときは、以下を満たしているか確認する。
rm, del, Remove-Item, find -delete に wildcard が含まれていない以下のパターンを含むスキル文面は生成しない。
# ❌ 固定絶対パス
$tempDir = "d:\Git\project\_temp_extract"
# ❌ cwd 依存
$workspaceRoot = (Get-Location).Path
# ❌ wildcard cleanup
Remove-Item -Force "d:\Git\project\_temp_*_output.md"
# ❌ temp root 丸ごと削除
Remove-Item -Recurse -Force $tempRoot
# ❌ cleanup 失敗の握りつぶし
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
# ❌ 相対削除
rm -rf ./*
# ❌ workspace 外の固定パス
rm -rf /tmp/project-extract
# ❌ find -delete
find . -name '*temp*' -delete
function New-ScopedTempDirectory($sourceFilePath, $toolName) {
$resolvedSourcePath = [System.IO.Path]::GetFullPath($sourceFilePath)
$sourceDirectory = Split-Path -Parent $resolvedSourcePath
$tempRoot = Join-Path $sourceDirectory (".tmp_" + $toolName)
$runId = [guid]::NewGuid().ToString("N")
$tempDir = Join-Path $tempRoot $runId
if (-not (Test-Path -LiteralPath $tempRoot)) {
New-Item -ItemType Directory -Path $tempRoot | Out-Null
}
New-Item -ItemType Directory -Path $tempDir | Out-Null
return @{ TempRoot = $tempRoot; TempDir = $tempDir }
}
function Remove-TempPathSafely($path, $tempRoot) {
$resolvedPath = [System.IO.Path]::GetFullPath($path)
$resolvedRoot = [System.IO.Path]::GetFullPath($tempRoot)
$pathRoot = [System.IO.Path]::GetPathRoot($resolvedPath)
$normalizedRoot = $resolvedRoot.TrimEnd('\\', '/')
$rootWithSeparator = $normalizedRoot + [System.IO.Path]::DirectorySeparatorChar
if ($resolvedPath -eq $pathRoot) {
throw "Refusing to delete a drive root: $resolvedPath"
}
if ($resolvedPath -eq $normalizedRoot) {
throw "Refusing to delete the temp root itself: $resolvedPath"
}
if (-not $resolvedPath.StartsWith($rootWithSeparator, [System.StringComparison]::OrdinalIgnoreCase)) {
throw "Refusing to delete a path outside temp root: $resolvedPath"
}
if (Test-Path -LiteralPath $resolvedPath) {
Remove-Item -LiteralPath $resolvedPath -Recurse -Force
}
}
source_file="<target-file>"
source_dir="$(cd "$(dirname "$source_file")" && pwd)"
temp_root="$source_dir/.tmp_toolname"
run_id="$(uuidgen | tr '[:upper:]' '[:lower:]')"
temp_dir="$temp_root/$run_id"
mkdir -p "$temp_dir"
case "$temp_dir" in
"$temp_root"/*) rm -rf -- "$temp_dir" ;;
*) echo "Refusing to delete outside temp root: $temp_dir" >&2; exit 1 ;;
esac
Remove-Item -LiteralPath を優先するスキルを生成するときは、以下の順序で書く。
temp や cleanup を扱うスキルでは、必ず「安全上の必須ルール」を本文前半に置くこと。
既存スキルをレビューするときは、以下を重点的に確認する。
ErrorAction SilentlyContinue や 2>/dev/null で事故兆候を隠していないかdocs/05-operations/deployment/agent-deletion-prevention-harness.md — 初期セット外。必要になった時点でテンプレート配布元からコピーするNo reviews yet. Tell others what you thought.
No login needed. Share how it worked for you, ask a question, or note where it did not run.
No comments yet. Be the first to write one.
プロジェクトガイドラインへの準拠をチェックし、バグ、スタイル違反、コード品質問題を検出する。PRレビュー時に使用。
The English summary is being prepared. Showing the original description.
Enforces project coding standards during code review: naming conventions (PascalCase for classes, camelCase for methods/variables, UPPER_SNAKE_CASE for constants, kebab-case for files), standard file structure, anti-magic-number policy, file size limits (500/800 lines), security patterns, and design patterns. Use when reviewing code, writing new code, or checking adherence to project conventions.
The English summary is being prepared. Showing the original description.
機能を保持したまま不要な複雑性を排除し、コードの簡潔性と可読性を向上させる。30行超の関数や3段以上のネスト検出時に使用。
The English summary is being prepared. Showing the original description.
コードコメントの正確性、完全性、長期的な保守性を分析する。JSDoc、コメント、README等のドキュメントが変更された場合に使用。
The English summary is being prepared. Showing the original description.
サイレント失敗を検出し、堅牢なエラーハンドリングを確保する。PRレビューでのエラーハンドリング検査時に使用。
The English summary is being prepared. Showing the original description.
Enforces error handling standards: silent error prohibition, custom error class hierarchy (AppError base with category never-fallback / transient / permanent, cause preservation, ValidationError / UnauthorizedError / UpstreamError etc. — canonical definitions in ERRORS.md), external-boundary normalization (normalizeExternalError), Result pattern (Result.ok/Result.fail), proper try-catch with error type checking, structured error logging with a single Logger contract, fallback prohibition categories (isNeverFallback), and HTTP status code mapping. Use when implementing error handling, reviewing catch blocks, or designing error responses.
The English summary is being prepared. Showing the original description.