본문으로 건너뛰기
cccskills
무료GitHub에 공개

skill-authoring-safety

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md6.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

スキル作成安全ガード

SKILL.md や関連 runbook を作成・更新するときに、削除事故や workspace 外操作を招く危険な記述を防ぐためのスキル。

このスキルの目的は、「スキルを作るスキル」を安全側に倒し、テンポラリ作成・展開・cleanup を含む記述でも削除防止ハーネスを最初から組み込むことです。

1. 基本原則

  1. 固定絶対パスを temp として決め打ちしない
  2. Get-Location を workspace root の代わりに使わない
  3. cleanup は相対パス、ワイルドカード、ドライブ直下を禁止する
  4. 削除対象は workspace 配下の専用 temp root に限定する
  5. cleanup 失敗を SilentlyContinue で握りつぶさない
  6. 削除前に temp root 配下かどうかを必ず検証する

2. 生成時の必須チェックリスト

新しいスキルや runbook を作るときは、以下を満たしているか確認する。

  • temp パスが対象ファイルまたは workspace 配下から導出されている
  • 固定ドライブ名、固定プロジェクト名、ユーザー固有パスが入っていない
  • cleanup が実行ごとの一意な temp ディレクトリ単位になっている
  • rm, del, Remove-Item, find -delete に wildcard が含まれていない
  • cleanup 前のパス検証関数がある
  • 削除対象が temp root 自体ではなく、その配下の subdirectory になっている
  • Windows を主対象にする場合、sandbox 前提の説明になっていない

3. 禁止パターン

以下のパターンを含むスキル文面は生成しない。

# ❌ 固定絶対パス
$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

4. 推奨パターン

PowerShell

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

bash / zsh

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

5. Windows 主体の注意事項

  • Windows では terminal sandbox を前提にしない
  • 削除防止は approval、deny ルール、hook を主手段とする
  • PowerShell 記述では Remove-Item -LiteralPath を優先する
  • ドライブレター付きの固定パス例をテンプレートに入れない

6. スキル生成時の出力方針

スキルを生成するときは、以下の順序で書く。

  1. 目的
  2. 適用対象
  3. 安全上の必須ルール
  4. 危険パターンを避けた実行例
  5. cleanup の安全条件
  6. 既知の制限事項

temp や cleanup を扱うスキルでは、必ず「安全上の必須ルール」を本文前半に置くこと。

7. レビュー観点

既存スキルをレビューするときは、以下を重点的に確認する。

  • temp path が他プロジェクトへ持ち越せない固定値になっていないか
  • cleanup が一意な temp subdirectory ではなく root 全体を消していないか
  • wildcard cleanup がないか
  • ErrorAction SilentlyContinue や 2>/dev/null で事故兆候を隠していないか
  • instructions と cleanup サンプルが矛盾していないか

8. 関連ドキュメント

  • MASTER.md
  • docs/05-operations/deployment/agent-deletion-prevention-harness.md — 初期セット外。必要になった時点でテンプレート配布元からコピーする

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

プロジェクトガイドラインへの準拠をチェックし、バグ、スタイル違反、コード品質問題を検出する。PRレビュー時に使用。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

feel-flow/ai-spec-driven-development72026년 10월 18일 업데이트

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

feel-flow/ai-spec-driven-development72026년 10월 18일 업데이트

機能を保持したまま不要な複雑性を排除し、コードの簡潔性と可読性を向上させる。30行超の関数や3段以上のネスト検出時に使用。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

feel-flow/ai-spec-driven-development72026년 10월 18일 업데이트

コードコメントの正確性、完全性、長期的な保守性を分析する。JSDoc、コメント、README等のドキュメントが変更された場合に使用。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

feel-flow/ai-spec-driven-development72026년 10월 18일 업데이트

サイレント失敗を検出し、堅牢なエラーハンドリングを確保する。PRレビューでのエラーハンドリング検査時に使用。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

feel-flow/ai-spec-driven-development72026년 10월 18일 업데이트

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

feel-flow/ai-spec-driven-development72026년 10월 18일 업데이트

feel-flow의 스킬 모두 보기

이 스킬의 문제 신고