Help us improve
Share bugs, ideas, or general feedback.
From claude-auto-context
Review and apply structural suggestions from Auto Context. USE WHEN user types /cac-apply or mentions applying suggestions.
npx claudepluginhub getklaim/claude-auto-context --plugin claude-auto-contextHow this skill is triggered — by the user, by Claude, or both
Slash command
/claude-auto-context:cac-applyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Orchestrates the cac-executor and cac-qa agents to reliably apply pending suggestions.
Provides structured workflow packs for 7 common Claude Code tasks: codebase exploration, bug fixing, safe refactoring, TDD, repo review before merge, CLAUDE.md generation, and migration planning.
Guides multi-step implementation work with a verification-driven loop: orient, plan, implement, verify, commit. Useful for coding features, fixing bugs, or refactoring.
Runs multi-agent verification loop post-implementation, dispatching specialized agents for review with autonomous subagent fixes and retries until unanimous approval.
Share bugs, ideas, or general feedback.
Orchestrates the cac-executor and cac-qa agents to reliably apply pending suggestions. Reads suggestions, spawns executor for changes, spawns QA for independent verification, iterates on failure (max 3 cycles), rolls back on persistent failure.
{timestamp}: apply specific item by timestamp ID (e.g., /cac-apply 20260323-143052)all: ask user "몇 개를 적용하시겠습니까?" then apply that many sequentiallyBefore doing ANYTHING, verify the environment is safe for refactoring.
DIRTY=$(git status --porcelain 2>/dev/null | head -1)
If output is non-empty:
A) git stash 후 진행 / B) 현재 상태에서 진행 (위험) / C) 취소# Detect test runner from any supported manifest
HAS_TESTS="NO_TESTS"
[ -f package.json ] && grep -q '"test"' package.json && HAS_TESTS="HAS_TESTS"
[ -f Makefile ] && grep -q '^test:' Makefile && HAS_TESTS="HAS_TESTS"
[ -f Cargo.toml ] && HAS_TESTS="HAS_TESTS"
[ -f go.mod ] && HAS_TESTS="HAS_TESTS"
[ -f pyproject.toml ] && HAS_TESTS="HAS_TESTS"
[ -f setup.py ] && HAS_TESTS="HAS_TESTS"
[ -f Gemfile ] && HAS_TESTS="HAS_TESTS"
echo "$HAS_TESTS"
Record HAS_TESTS or NO_TESTS. If tests exist, verify they pass BEFORE any changes:
# Run pre-change tests using detected manifest
if [ -f package.json ] && grep -q '"test"' package.json; then npm test 2>&1
elif [ -f Cargo.toml ]; then cargo test 2>&1
elif [ -f go.mod ]; then go test ./... 2>&1
elif [ -f pyproject.toml ]; then pytest 2>&1
elif [ -f Makefile ] && grep -q '^test:' Makefile; then make test 2>&1
elif [ -f Gemfile ]; then bundle exec rake test 2>&1
fi
If tests already fail: report "기존 테스트가 이미 실패합니다." Ask user whether to proceed. Record failing test names as PRE_EXISTING_FAILURES.
CHECKPOINT_SHA=$(git rev-parse HEAD)
CHECKPOINT_BRANCH=$(git branch --show-current)
Report: "체크포인트: {CHECKPOINT_SHA}. 문제 발생 시 여기로 롤백합니다."
.md files in BOTH directories:
.claude-auto-context/suggestions/.claude-auto-context/hygiene/^applied$, ^rejected$, or ^failed$ (bare word on its own line)For each pending item, check if it has the structured format:
Has ### Files to modify? | Has ### Changes? | Has ### Acceptance criteria? | Action |
|---|---|---|---|
| YES | YES | YES | Structured — proceed normally |
| Any missing | — | — | Legacy — skip with message: "structured 포맷이 아닙니다. 스킵합니다." |
필수 3개: ### Files to modify, ### Changes, ### Acceptance criteria
선택 (있으면 활용): ### Read first, ### Impact — 있으면 executor에게 전달, 없으면 executor가 자체 판단
# | Timestamp | Title | Category | Complexity
1 | 20260404-053034 | Replace resolveElementType | ai-unfriendly-fragile | MEDIUM (2 files)
2 | 20260404-050020 | Embedded override scattered files | ai-unfriendly-struct | LOW (docs only)
all argument — count selectionFor each selected item:
Read the full .md file. Extract:
### Read first — files to read before changes### Files to modify — target file list### Changes — ordered change list with function/section names### Impact — files that might break### Acceptance criteria — verification conditionsRead EVERY file listed in ### Read first. Report a one-line summary per file:
파일 확인 완료:
- {file} ({lines}줄, {brief description})
If any file doesn't exist: warn "파일 없음: {path}" but continue.
Report:
A) 별도 브랜치 생성 / B) 현재 브랜치에서 진행If A: git checkout -b refactor/{suggestion-timestamp}
Spawn the cac-executor agent. Two methods (try in order):
Method A — Plugin agent auto-discovery:
subagent_type: claude-auto-context:cac-executorMethod B — Prompt-based fallback (if Method A fails or agent type not found):
Read agents/cac-executor.md--- frontmatter closing delimiterprompt parameterAgent spawn prompt (appended to agent prompt for both methods):
Apply the suggestion at {SUGGESTION_PATH}.
SUGGESTION_PATH: {absolute path to suggestion .md file}
CHECKPOINT_SHA: {checkpoint SHA from Phase 0}
TEST_RUNNER: {HAS_TESTS or NO_TESTS}
PRE_EXISTING_FAILURES: {comma-separated list or "none"}
Agent configuration:
description: "Execute suggestion: {suggestion title}"Parse executor output: Look for the ## Result block at the end of the executor's response. Extract:
STATUS: SUCCESS / PARTIAL / FAILEDCOMMITS: list of commit SHAsFILES_CHANGED: list of changed filesISSUES: list of issues encounteredIf executor STATUS is FAILED: Skip to Phase 4.5 (iteration) or Phase 5 (finalize as failed).
CRITICAL: You MUST spawn the cac-qa agent as a separate agent. Do NOT verify acceptance criteria yourself. Do NOT skip this phase. Do NOT perform QA inline. The entire point of this architecture is independent verification by a separate agent that did not see the executor's reasoning. If you verify inline, the executor/QA separation is defeated and this skill provides no value over the old single-agent approach.
Spawn the cac-qa agent. Two methods (try in order):
Method A — Plugin agent auto-discovery:
subagent_type: claude-auto-context:cac-qaMethod B — Prompt-based fallback (if Method A fails or agent type not found):
Read agents/cac-qa.md--- frontmatter closing delimiterprompt parameterAgent spawn prompt (appended to agent prompt for both methods):
Verify the refactoring applied by cac-executor for suggestion at {SUGGESTION_PATH}.
SUGGESTION_PATH: {absolute path to suggestion .md file}
EXECUTOR_COMMITS: {comma-separated commit SHAs from executor}
EXECUTOR_FILES: {comma-separated file list from executor}
PRE_EXISTING_FAILURES: {comma-separated list or "none"}
ITERATION: {cycle number, starting at 1}
Agent configuration:
subagent_type: claude-auto-context:cac-qadescription: "QA verify: {suggestion title}"Parse QA output: Look for the ## QA Verdict block. Extract:
STATUS: PASS / FAILCONFIDENCE: HIGH / MEDIUM / LOWIf QA STATUS is PASS: Proceed to Phase 5 (finalize as applied).
If QA STATUS is FAIL: Proceed to Phase 4.5 (iteration loop).
Maximum 3 full cycles (executor + QA). Total agent spawns capped at 6.
Track: ITERATION_COUNT = 1 (incremented each cycle)
## Issues sectionQA found {N} issues in iteration {ITERATION_COUNT}. Fix these:
{QA issues with fix suggestions}
Then re-apply remaining changes. Same contract — end with ## Result block.
git reset --hard {CHECKPOINT_SHA}
Report: "3회 시도 후에도 QA 통과 실패. 체크포인트로 롤백했습니다."
Mark suggestion as failed.
If Agent tool spawn fails (model quota, crash, timeout, no output):
Find the existing ## Status line. Replace the ENTIRE status block:
## Status, applied, rejected, failed, pending, ## Applied At, ## Changes Made## Status
{applied or failed}
## Applied At
{ISO 8601 timestamp}
## Changes Made
- {file}: {description of change}
## Commits
- {sha short}: {commit message}
## Verification
- Executor: {STATUS from executor}
- QA: {STATUS from QA} (iteration {N})
- Tests: {PASS/SKIP/FAIL}
- Confidence: {HIGH/MEDIUM/LOW}
=== Suggestion {Applied/Failed}: {title} ===
변경 전:
- {file}: {original state}
변경 후:
- {file}: {new state}
커밋: {N}개
QA iterations: {N}/3
최종 QA: {PASS/FAIL} (confidence: {level})
If applying multiple items:
=== cac-apply 완료 ===
적용: {N}개
스킵: {M}개 (legacy format)
실패: {K}개
커밋 목록:
- {sha}: {message}
롤백 방법: git reset --hard {CHECKPOINT_SHA}
| 상황 | 행동 |
|---|---|
| suggestion에 structured format 없음 | 스킵 (legacy format 거부) |
| Read first 파일 없음 | 경고 출력, 계속 진행 |
| Executor STATUS: FAILED | QA 스킵, iteration 또는 failed 처리 |
| QA STATUS: FAIL | Iteration loop (max 3 cycles) |
| 3회 iteration 후 QA FAIL | Rollback to checkpoint, failed 처리 |
| Agent spawn 실패 1회 | 재시도 |
| Agent spawn 실패 2회 | Inline fallback (단일 에이전트 모드) |
| Tests fail (new failure) | QA가 FAIL verdict, iteration loop |
| Tests fail (pre-existing) | 무시 — 리팩토링 원인 아님 |
| HIGH risk + dirty tree | 강력히 경고, 브랜치 생성 권장 |
If the orchestrator itself encounters an unrecoverable error:
STATUS: BLOCKED
REASON: {1-2 sentences}
ATTEMPTED: {what was tried}
SUGGESTION: {what the user should do}
ROLLBACK: git reset --hard {CHECKPOINT_SHA}
Stop. Do not retry further.