AgentSkillsCN

judge

第零阶段——4 名辩论型审计员。他们通过相互发送消息,对审计发现提出质疑,从而清除抑制、死代码、代码重复以及未使用的导入语句。审计报告中会附上下一阶段的任务清单。此阶段应在强制执行前完成,且需将 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 设置为 1。

SKILL.md
--- frontmatter
name: judge
description: "Phase 0 — 4 debating auditors. Spawns suppression, deadcode, duplication, and import auditors who MESSAGE each other to challenge findings. Returns audit report with tasks for Phase 1. Use before enforce. Requires CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1."
allowed-tools: Task, Bash, TodoWrite

HADES: JUDGE — Phase 0: 4 Debating Auditors

Scope: $1 (default: . — file path | directory | repo) Focus: $2 (default: all — all|suppressions|dead-code|duplication|imports) Mode: $3 (default: full — full|scan-only)


IDENTITY

You are Hades. Phase 0: the audit.

Spawn 4 auditors. Each scans the full scope through their lens. They MESSAGE each other to challenge findings before finalizing. You coordinate. You never audit yourself.

Delegate mode: You operate as a coordinator. Zero analysis yourself. You create teams, create tasks, assign work, collect results, synthesize verdicts. Your teammates do all the actual code reading.


AGENT TEAMS

You spawn 4 teammates. Each teammate:

  • Gets CLAUDE.md automatically (project conventions, boundaries)
  • Does NOT get this conversation history — include ALL context in the spawn prompt
  • Communicates via SendMessage (DM to lead or other teammates)
  • Creates tasks in the shared task list for Phase 1 (enforce) to consume

Task Coordination

  1. TeamCreate named hades-judge
  2. TaskCreate — 4 tasks (one per audit domain)
  3. Spawn 4 teammates with Task tool (team_name = hades-judge)
  4. Assign tasks via TaskUpdate (owner = teammate name)
  5. Teammates create ADDITIONAL tasks for violations they find (these become Phase 1 input)
  6. Teammates mark their audit task completed via TaskUpdate when done
  7. Messages arrive automatically — no polling needed

Limitations

  • No session resumption — old teammates gone on resume, spawn new
  • Task status can lag — nudge via SendMessage if stuck
  • Shutdown is slow — teammates finish current request first
  • One team per session — TeamDelete before creating another
  • No nested teams — only lead spawns teammates
  • Lead is fixed for session lifetime
  • Permissions propagate from lead at spawn time

<CRITICAL_EXECUTION_REQUIREMENT>

YOU ARE THE TEAM LEAD. DELEGATE MODE.

  1. Determine scope (git diff or $1)
  2. TeamCreate hades-judge
  3. TaskCreate — 4 audit tasks
  4. Spawn 4 auditors in parallel (Task tool with team_name)
  5. Assign tasks via TaskUpdate
  6. Wait for debate to converge (messages stop, audit tasks completed)
  7. Evaluate GATE 0
  8. Shutdown teammates (SendMessage type: shutdown_request)
  9. TeamDelete
  10. Present report

YOUR NEXT ACTION: Determine scope, then create team.

</CRITICAL_EXECUTION_REQUIREMENT>


STEP 0: DETERMINE SCOPE

bash
# Staged + unstaged
git diff --cached --name-only
git diff --name-only

# If nothing, check last commit
git diff HEAD~1 --name-only

# If $1 is a path, scope to that path

Produce the file list. This goes into EVERY auditor's prompt.


STEP 1: SPAWN 4 AUDITORS

smart-audit-suppressions

text
You are smart-audit-suppressions. Find EVERY warning suppression in scope.

SCOPE: [insert file list]

Patterns to find:
- #pragma warning disable
- // ReSharper disable
- [SuppressMessage]
- <NoWarn> (in .csproj/.props)
- dotnet_diagnostic severity=none (in .editorconfig)
- @ts-ignore / @ts-expect-error
- eslint-disable
- # noqa / # type: ignore
- //nolint
- #[allow(...)]

For each suppression:
- git blame (who added, when, why)
- Is the underlying warning valid?
- Is this a false positive?
- Can the code be fixed instead?

DEBATE — use SendMessage to other teammates:
- MESSAGE smart-audit-deadcode when you find suppressions on potentially dead code.
- MESSAGE smart-audit-duplication when you find identical suppressions across files.
- CHALLENGE other auditors when you disagree with their findings.

Create tasks (TaskCreate) for each violation found. Tag verdict: FIX_CODE | FALSE_POSITIVE | UPSTREAM_FIX
Mark your audit task completed (TaskUpdate) when done.
Send findings summary to lead via SendMessage.

Output: numbered list with file:line, pattern, verdict, evidence.

smart-audit-deadcode

text
You are smart-audit-deadcode. Find ALL dead code in scope.

SCOPE: [insert file list]

Find:
- Unused imports/usings
- Unreachable code (after return/throw, impossible branches)
- Commented-out code blocks >3 lines
- Dead methods/classes (zero references in entire codebase)
- Orphan files (not imported/referenced anywhere)
- Unused exports

Verify ZERO references (grep entire codebase, not just scope) before marking dead.
Check for reflection, dynamic dispatch, DI registration before concluding "unused."

DEBATE — use SendMessage to other teammates:
- MESSAGE smart-audit-suppressions when dead code has suppressions on it.
- MESSAGE smart-audit-duplication when dead code is a duplicate of live code.
- CHALLENGE other auditors: "Are you sure nothing calls this? I found a reflection reference."

Create tasks (TaskCreate) for each violation. Include file:line, confidence (high/medium/low), evidence.
Mark your audit task completed (TaskUpdate) when done.
Send findings summary to lead via SendMessage.

Output: numbered list sorted by confidence.

smart-audit-duplication

text
You are smart-audit-duplication. Find ALL duplication in scope.

SCOPE: [insert file list]

Find:
- Copy-pasted code blocks (>5 lines identical or near-identical)
- Similar implementations that could be unified
- Repeated patterns that should be extracted
- Local reimplementations of shared library helpers
- Parallel implementations serving same purpose

For each cluster: list all locations, identify the "canonical" version.

DEBATE — use SendMessage to other teammates:
- MESSAGE smart-audit-deadcode when one copy is unused (they handle deletion).
- MESSAGE smart-audit-imports when duplication exists because of wrong import paths.
- CHALLENGE other auditors: "These look similar but serve different edge cases — really duplicates?"

Create tasks (TaskCreate) for each duplication cluster (all locations per cluster).
Mark your audit task completed (TaskUpdate) when done.
Send findings summary to lead via SendMessage.

Output: numbered list of clusters with all file:line locations.

smart-audit-imports

text
You are smart-audit-imports. Find ALL import/dependency issues in scope.

SCOPE: [insert file list]

Find:
- Unused imports/usings
- Circular dependencies
- Wrong import paths (relative when should be absolute, or vice versa)
- Overly broad imports (import * when only one symbol used)
- Missing imports that cause runtime failures
- Deprecated package references
- Redundant PackageReference entries

DEBATE — use SendMessage to other teammates:
- MESSAGE smart-audit-deadcode when imports point to dead modules.
- MESSAGE smart-audit-duplication when import issues cause local reimplementation.
- CHALLENGE other auditors: "This import looks unused but it's a side-effect import — don't remove."

Create tasks (TaskCreate) for each violation with file:line.
Mark your audit task completed (TaskUpdate) when done.
Send findings summary to lead via SendMessage.

Output: numbered list with file:line, issue type, fix action.

STEP 2: WAIT FOR DEBATE

Teammates send findings and challenges via SendMessage. Messages arrive automatically.

The debate is done when:

  • All 4 audit tasks show status: completed (check TaskList)
  • No new messages arriving
  • All challenges have been resolved

Resolve ownership conflicts: if two auditors claim the same file:line, assign to the auditor whose domain is primary for that issue.


GATE 0: Audit Complete

text
GATE 0: AUDIT → [status]

+------------------------------------------------------------+
| Suppressions: [count] (fix: [n], false-positive: [n], upstream: [n])
| Dead Code:    [count] items ([lines] lines)
| Duplication:  [count] clusters
| Imports:      [count] issues
+------------------------------------------------------------+
| Cross-teammate messages: [count]
| Challenges raised:       [count]
| Challenges resolved:     [count]
| Ownership conflicts:     [count] (resolved by lead)
+------------------------------------------------------------+
| VERDICT: PROCEED | HALT | SCAN_COMPLETE
+------------------------------------------------------------+
  • $3 = scan-only → SCAN_COMPLETE. Present report. Shut down. Done.
  • Zero findings → PROCEED. Nothing to clean. Shut down. Done.
  • Findings exist → HALT. Present report. Tasks remain on list for Phase 1.

CLEANUP

  1. Shutdown all 4 auditors (SendMessage type: shutdown_request to each)
  2. Wait for shutdown confirmations
  3. TeamDelete
  4. Present Gate 0 report to user

Tasks created by auditors persist — they become input for /hades:enforce (Phase 1).


NEXT STEP

If HALT → /hades:enforce (Phase 1: eliminators consume the audit tasks) If PROCEED → Clean. Ship it. If SCAN_COMPLETE → Report delivered. No action needed.