dockerfile-optimizer — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited dockerfile-optimizer (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Dockerfile을 분석하고 빌드 속도·이미지 크기·보안·배포 안정성 관점에서 개선안을 제안한다. 사용자가 명시 승인하기 전까지 어떤 파일도 만지지 않는다.
다음 발화에서 발동:
explicit (의도=optimize 기본):
resource (의도=optimize):
security (의도=security):
review-only 의도 키워드:
CWD 또는 사용자가 지정한 경로에 Dockerfile*이 존재해야 한다. 없으면 "Dockerfile을 찾을 수 없습니다"로 종료. 자동 생성 금지.
**/Dockerfile*, **/docker-compose*.y*ml, **/.dockerignorereview / optimize / securityDockerfile이 2개 이상이면 AskUserQuestion으로 선택받는다 (전체 / 특정 1개 / 특정 다중).
Bash(scripts/detect-stack.sh <dockerfile-dir>) 호출. 출력 JSON 파싱:
{
"language": "node|python|go",
"package_manager": "npm|pnpm|yarn|pip|poetry|uv|go",
"has_native_deps": true|false,
"framework_hint": "nestjs|nextjs|express|fastify|fastapi|django|flask|unknown"
}has_native_deps=true면 ImageSize 룰 DFO-SIZE-002 (alpine 추천)을 비활성화한다.
Dockerfile을 라인별로 읽고, 4개 룰 카테고리 references를 적용:
references/rules-security.md — DFO-SEC-001 ~ 008 (8개)references/rules-performance.md — DFO-PERF-001 ~ 005 (5개)references/rules-image-size.md — DFO-SIZE-001 ~ 005 (5개)references/rules-reliability.md — DFO-REL-001 ~ 006 (6개)각 룰의 Detection 섹션에 따라 매칭. 매칭 시 findings[]에 {rule_id, severity, line, evidence, message} 추가.
Bash(command -v hadolint) 호출. exit 0이면 Bash(hadolint --format json <Dockerfile>) 실행. 결과는 리포트의 "External Linter Findings" 섹션에 별도 부착, 점수 미반영.
미설치 시 리포트 하단에 1회 안내: 💡 hadolint가 설치돼 있으면 추가 룰까지 점검됩니다. (brew install hadolint). 같은 세션에서 반복 안내 금지.
hadolint 실행 실패 시 에러 무시, 룰 기반 결과만 출력.
심각도별 감점:
카테고리별: 점수 = max(0, 배점 - sum(감점))
총점 = 합. 등급: 90+ A / 80+ B / 70+ C / 60+ D / <60 F.
references/report-template.md 구조에 따라 마크다운 출력. 채팅 인라인. 파일 저장 X.
개선 Dockerfile은 references/presets-{language}.md에서 사용자 패키지 매니저에 맞는 템플릿을 가져와 사용자 프로젝트의 빌드 명령에 맞게 수정한다 (단순 복사 금지).
.dockerignore 부족 시 references/dockerignore-base.md에서 언어별 권장 내용 가져와 리포트에 코드블록으로 표시. 파일 자동 생성 금지.
리포트 출력 직후 반드시 `AskUserQuestion` 도구를 호출해서 사용자가 텍스트를 입력하지 않고 선택만으로 진행할 수 있게 한다. 의도별로 질문 구성이 다르다.
#### intent = optimize (기본)
question: "위 개선안을 어떻게 적용할까요?"
header: "적용 방식"
multiSelect: false
options:
1. label: "전체 적용 (Dockerfile + .dockerignore)"
description: "제안된 모든 변경을 적용합니다. 가장 빠르고 일관된 결과."
(Recommended — label 끝에 "(Recommended)" 표시)
→ .dockerignore가 이미 충분하거나 .dockerignore 권장 섹션이 없으면 옵션 라벨은 "전체 적용 (Dockerfile)" 으로 자동 변경
2. label: "Dockerfile만 적용"
description: ".dockerignore는 그대로 두고 Dockerfile만 갱신."
(.dockerignore 권장 섹션이 있을 때만 표시)
3. label: ".dockerignore만 만들기"
description: "Dockerfile은 유지, .dockerignore만 새로 생성/갱신."
(.dockerignore 권장 섹션이 있을 때만 표시)
4. label: "선택 적용 — 번호로 지정"
description: '예: "1, 3번만 적용". 채팅으로 finding 번호를 알려주세요.'
5. label: "적용 안 함 (리뷰만)"
description: "어떤 파일도 수정하지 않고 종료."옵션 4를 선택하면 사용자가 후속 메시지로 finding 번호를 보낼 때까지 대기. 옵션 5를 선택하면 [10] 단계로 가지 않고 종료.
#### intent = security
question: "보안 항목을 어떻게 적용할까요?"
header: "적용 방식"
multiSelect: false
options:
1. label: "보안 항목만 적용 (Recommended)"
description: "Security 카테고리 finding에 해당하는 변경만 적용 — USER 추가, 시크릿 제거 등."
2. label: "전체 최적화 적용"
description: "보안 외 Performance/ImageSize/Reliability 개선도 모두 적용."
3. label: "선택 적용 — 번호로 지정"
description: '예: "1, 3번만 적용".'
4. label: "적용 안 함 (리뷰만)"
description: "어떤 파일도 수정하지 않고 종료."#### intent = review
AskUserQuestion 호출 금지. 리뷰 전용 모드이므로 적용 안내 자체를 생략하고 종료. 사용자가 후속으로 "최적화해줘" 발화하면 그때 새 분석 사이클로 들어간다.
#### 다중 Dockerfile
분석한 Dockerfile이 2개 이상이면 위 질문 위에 한 단계 더 추가:
question: "어떤 파일에 적용할까요?"
header: "적용 대상"
multiSelect: true
options: 각 Dockerfile 경로 (점수 낮은 순) + "전체 (Recommended)"선택된 Dockerfile들에 대해서만 위의 적용 방식 질문을 한 번 더 묻는다.
#### 안전 규칙
AskUserQuestion을 호출하지 않고 임의로 Edit/Write 호출 금지[9]에서 사용자가 "적용 안 함"을 선택했으면 이 단계는 스킵하고 한 줄 마무리 ("적용 없이 종료. 다시 검토하려면 다시 불러주세요.")만 출력.
적용을 선택한 경우:
"선택 적용 — 번호로 지정"을 골랐던 경우에는 사용자가 후속 메시지로 번호를 보내올 때까지 대기하고, 받은 후 위 단계를 실행한다.
--mount=type=cache 등 BuildKit 기능 추천 활성화| ID | Category | Severity | Title | |
|---|---|---|---|---|
| DFO-SEC-001 | Security | critical | Container runs as root | |
| DFO-SEC-002 | Security | critical | Container explicitly runs as root | |
| DFO-SEC-003 | Security | critical | Secret files copied into image | |
| DFO-SEC-004 | Security | major | Secret-like ARG or ENV declarations | |
| DFO-SEC-005 | Security | major | ADD <URL> without checksum | |
| DFO-SEC-006 | Security | major | Base image tag is latest or missing | |
| DFO-SEC-007 | Security | minor | apt-get without --no-install-recommends | |
| DFO-SEC-008 | Security | major | curl ... \ | sh pattern |
| DFO-PERF-001 | Performance | major | Source COPY before dependency install | |
| DFO-PERF-002 | Performance | major | Install command does not respect lockfile | |
| DFO-PERF-003 | Performance | minor | Consecutive RUN commands not combined | |
| DFO-PERF-004 | Performance | minor | apt-get update without cache cleanup | |
| DFO-PERF-005 | Performance | minor | BuildKit cache mount not used for large deps | |
| DFO-SIZE-001 | ImageSize | major | Multi-stage build not used | |
| DFO-SIZE-002 | ImageSize | minor | Full base image used (slim/alpine candidate) | |
| DFO-SIZE-003 | ImageSize | major | devDependencies present in runtime stage | |
| DFO-SIZE-004 | ImageSize | major | .dockerignore missing or incomplete | |
| DFO-SIZE-005 | ImageSize | minor | No cleanup after package installs | |
| DFO-REL-001 | Reliability | major | CMD uses shell form | |
| DFO-REL-002 | Reliability | minor | ENTRYPOINT uses shell form | |
| DFO-REL-003 | Reliability | minor | WORKDIR not set | |
| DFO-REL-004 | Reliability | minor | Server-like CMD without EXPOSE | |
| DFO-REL-005 | Reliability | info | HEALTHCHECK missing | |
| DFO-REL-006 | Reliability | minor | Missing standard runtime env vars |
새 룰을 추가할 때:
references/rules-<category>.md에 룰 추가 (ID, severity, deduction, detection, why, bad/good 예)SKILL.md의 Rule Index 표에 한 줄 추가tests/fixtures/<rule-id>-bad/Dockerfile 위반 예 추가tests/fixtures/<rule-id>-good/Dockerfile 정상 예 추가tests/expected/<rule-id>-*.md에 기대 결과 명시references/rules-security.mdreferences/rules-performance.mdreferences/rules-image-size.mdreferences/rules-reliability.mdreferences/presets-nodejs.mdreferences/presets-python.mdreferences/presets-go.mdreferences/dockerignore-base.mdreferences/report-template.md~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.