audit-check
Phase 2: Run mechanical checks and Gemini formatted audit
What this skill does
# Phase 2: Check (Mechanical + AI Audit)
Two-stage checking: Python mechanical checks catch definite errors; Gemini batch audit catches judgment-call issues.
## Stage 2a: Mechanical Checks (Python)
```bash
uv run python3 "${CLAUDE_SKILL_DIR}/../../../../skills/bluebook-audit/scripts/scan_formatting.py" --docx path/to/file.docx
```
Checks performed on ALL footnotes:
1. **Journal name small caps** - Comprehensive pattern list (law reviews, finance journals, newspapers, periodicals, forums)
2. **Book title small caps** - Detect italic book titles that should be small caps
3. **Id. chain validation** - Rule 4.1 mechanical check (single-source predecessor)
4. **Signal italic consistency** - All signals (see, cf., e.g.) must be italic
5. **Terminal period** - Every footnote must end with a period
6. **Hereinafter consistency** - Defined at first citation, used consistently after
7. **Author name supra format** - Text before `*supra*` should be roman, not italic (unless it's a case name short form). Catches `*Manne, supra*` → should be `Manne, *supra*`
8. **Italic spillover** - Trailing/leading spaces inside italic or small caps runs (e.g., `*supra *` should be `*supra* `). These don't affect Word display but cause Gemini misparses
### NBSP Handling
DOCX uses non-breaking spaces (`\xa0`) in abbreviations. ALL search functions must handle both `\x20` and `\xa0`:
- `No.\xa02106`, `Feb.\xa07`, `Oct.\xa021`
- `Wall St.\xa0J.`, `Corp.\xa0Governance`
## Stage 2b: Gemini Batch Formatted Audit
**Default: Use Gemini Batch API** (50% cheaper, handles all footnotes in one job). Fallback to sync calls if batch is unavailable.
### Step 1: Extract formatted footnotes
```bash
uv run python3 "${CLAUDE_SKILL_DIR}/../../../../skills/bluebook-audit/scripts/gemini_audit.py" --docx path/to/file.docx --extract-only
```
This outputs a JSON file mapping footnote numbers to formatted text with inline markup:
- `*text*` = italic
- `[SC]text[/SC]` = small caps
- Plain text = roman
### Step 2: Submit Gemini Batch Job
Build a JSONL file with one request per footnote, then submit via Batch API:
```python
# Build JSONL (one line per footnote)
for fn_num, formatted_text in footnotes.items():
request = {
"custom_id": f"fn-{fn_num}",
"body": {
"contents": [{"parts": [{"text": PROMPT.format(fn_num=fn_num, formatted_text=formatted_text)}]}],
"generationConfig": {"responseMimeType": "application/json", "temperature": 0.1}
}
}
# Submit batch job (see /gemini-batch skill for full pattern)
# Use examples/batch_processor.py pattern — DO NOT guess API parameters
```
**IMPORTANT:** Follow the `/gemini-batch` skill's Iron Law — read `examples/batch_processor.py` before writing batch code.
**Fallback (sync):** If batch is unavailable, use:
```bash
uv run python3 "${CLAUDE_SKILL_DIR}/../../../../skills/bluebook-audit/scripts/gemini_audit.py" --docx path/to/file.docx
```
### Gemini Prompt Focuses On:
- Source type classification (case, statute, article, book, newspaper, working paper, hearing, letter, regulation)
- Typeface correctness per Rule 2 (italic vs small caps vs roman)
- Abbreviation correctness per T6/T13
- Short form validity (cases must not use supra)
<EXTREMELY-IMPORTANT>
## Iron Law: Audit ALL Footnotes
The Gemini audit MUST cover every footnote, not a subset. Auditing only "major" or "flagged" footnotes guarantees missed errors.
Previous failure: Auditing 45 of 239 footnotes missed 41 journal names needing small caps.
</EXTREMELY-IMPORTANT>
## Stage 2c: Claude Cross-Footnote Review
**Never trust a single agent.** After Gemini's per-footnote audit, Claude reviews the full set for cross-footnote patterns that per-footnote analysis misses.
Claude receives:
1. ALL formatted footnotes (fits in 1M context at ~20-40K tokens)
2. Gemini's per-footnote findings
3. Mechanical check results
**Claude reviews for:**
- **Supra chain validity** — does `supra note 42` actually point to the right source?
- **Hereinafter consistency** — defined at first citation? Used consistently after?
- **Repeated source type errors** — if Gemini misclassified one SEC release, it likely missed them all
- **Id. chain context** — predecessor footnote analysis that per-footnote Gemini can't see
- **Gemini false positive filtering** — flag Gemini suggestions that are likely wrong (SEC releases, exec orders, working papers)
**Output:** Annotated version of Gemini findings with cross-footnote issues added and false positives flagged.
## Red Flags - STOP If You Catch Yourself:
| Action | Why Wrong | Do Instead |
|---|---|---|
| Sending plain text to Gemini | 10-20x false positives without formatting info | Always include inline markup |
| Auditing a subset of footnotes | Missed errors guaranteed | Audit ALL footnotes |
| Skipping NBSP variants in mechanical checks | Silent search failures | Always try both space types |
| Trusting Gemini results without Claude cross-check | Per-footnote misses cross-footnote patterns | Always run Stage 2c |
| Trusting Claude review without mechanical checks | Claude misses deterministic patterns | Mechanical checks are authoritative for their categories |
| Skipping any stage | Each stage catches different error classes | Run all three: mechanical → Gemini → Claude |
## Merging Three-Layer Findings
**Priority order: Mechanical > Claude cross-review > Gemini per-footnote**
Mechanical checks are authoritative for deterministic rules:
- Signal italic formatting → trust mechanical checker (regex on run-level XML)
- Terminal periods → trust mechanical checker
- Id. chain validation → trust mechanical checker
- Journal/book small caps patterns → trust mechanical checker
Claude cross-review is authoritative for:
- Cross-footnote consistency (supra chains, hereinafter definitions)
- Gemini false positive filtering (source type misclassifications)
- Patterns across footnotes that per-footnote analysis misses
Gemini per-footnote is authoritative for:
- Individual source type classification (when not overridden by Claude)
- Abbreviation correctness (T6/T13 tables)
- Short form validity
**Never drop a mechanical finding because Gemini or Claude didn't flag it.** The mechanical checker catches 100% of signal issues by design.
## Gate: Exit Check
Before proceeding to Report phase:
- [ ] `scratch/audit_findings.json` exists
- [ ] Mechanical check results cover ALL footnotes
- [ ] Gemini audit results cover ALL footnotes (verify count matches extract)
- [ ] Claude cross-footnote review complete
- [ ] Findings merged (mechanical > Claude > Gemini priority)
## Next Phase
Read `${CLAUDE_SKILL_DIR}/../../../../skills/bluebook-audit/skills/audit-report/SKILL.md` and follow its instructions.
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.