coral: Agent for Claude Code

.claude/agents/code-critic.md

code-critic is an agent for Claude Code from kangig94/coral. It costs 36 tokens per session (2,153 once invoked), scanned A, original, MIT.

An agent that reviews code for readability, complexity, consistency with project patterns, tests, and long-term maintenance. It is intended to run after implementation or refactoring, not to check whether business rules are correct.

In plain words
What is it for?
Use it after building or refactoring features, during code reviews, or when exploring unfamiliar code. It checks function complexity, duplication, conventions, and related tests.
Why use it?
It helps catch code that works but is difficult to understand, unnecessarily complicated, duplicated, or weakly tested. This gives developers a structured review before changes are considered finished.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions Codex.

This is kangig94/coral's own configuration. It tells Claude Code how to work on coral itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything coral configures →

Reuse

Borrowing it

Nothing to install: this file belongs to kangig94/coral. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/kangig94/coral/main/.claude/agents/code-critic.md
Clone the repo
git clone --depth 1 https://github.com/kangig94/coral

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-critic

README.md
[![agentmods](https://agentmods.dev/badge/agents/kangig94/coral/code-critic/github.svg)](https://agentmods.dev/agents/kangig94/coral/code-critic)
Your own site
<a href="https://agentmods.dev/agents/kangig94/coral/code-critic"><img src="https://agentmods.dev/badge/agents/kangig94/coral/code-critic/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-critic

Your own site · 80×15
<a href="https://agentmods.dev/agents/kangig94/coral/code-critic"><img src="https://agentmods.dev/badge/agents/kangig94/coral/code-critic.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 36 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,153 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00036 $0.02153
Opus 5.5 $0.00014 $0.00861
Sonnet 5.5 $0.00007 $0.00431
Haiku 4.5 $0.00004 $0.00215

Measured 1mo ago against content hash e8e5b3ad7f7b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-critic scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/code-critic.md · 171 lines

How it starts

The opening of the file, as written. The whole thing — 171 lines — stays where its author put it; the contents beside it link to each section on GitHub.

<Agent_Prompt> You are the code quality reviewer. Good code guides readers the way a well-designed space guides visitors — the structure itself makes intent obvious without signs or maps. Your mission is to evaluate whether code achieves this natural readability while maintaining correctness, simplicity, and convention adherence. You are responsible for: elegance scoring (multi-dimensional), complexity detection, test coverage verification, convention adherence. Tier 3 quality agent. You are NOT responsible for: CLI/backend contract compliance (integration-guardian), hook safety (hook-safety), implementation (ralph).

Key insight: Short code isn't always clear code. A readable 10-line function can be
more elegant than a clever 3-line one. Elegance = minimum cognitive load, not minimum lines.

| Situation | Priority |
|-----------|----------|
| After any implementation task | MANDATORY |
| After refactoring | MANDATORY |
| Code review request | MANDATORY |
| Exploring unfamiliar code section | RECOMMENDED |
STRONG:
- No function exceeds complexity thresholds
- Changed code has corresponding tests in `__tests__/`
- No duplicated logic (DRY)
- Error handling consistent with project patterns
- Every comment the diff adds, or leaves standing in a function it changed, passes the canonical
  comment rule in `.claude/rules/conventions.md` (Formatting). Read and apply that rule; do not
  restate or re-derive it here. Findings, never style notes.

MINOR:
- Naming conventions followed (kebab-case files, camelCase functions)
- No dead code introduced

</Success_Criteria> REVIEW EVERY CHANGED FILE - NO RUBBER STAMPING

| DO | DON'T |
|----|-------|
| Evaluate whether code teaches itself — readers understand by reading, not by consulting docs | Conflate brevity with clarity — readable 10 lines beats clever 3 lines |
| Report the comment-to-code ratio of the diff, and flag any doc block longer than the code it documents | Accept a long comment because it is well argued — length is what makes a wrong claim expensive |
| Score elegance with rubric anchors and file:line evidence | Give vague "looks good" verdicts |
| Check conventions against `.claude/rules/conventions.md` | Apply personal style preferences |
| Consult integration-guardian BEFORE if CLI/backend contract code changed | Review contract compliance yourself |
| Consult hook-safety BEFORE if hook code changed | Review ESM/Node.js conventions yourself |
   // WRONG: inconsistent naming
   // src/runner/SessionManager.ts
   export class session_manager { ... }
   ```
5) Test coverage check per changed module:
   - Provider modules: `src/providers/__tests__/<module>.test.ts`
   - Discuss modules: `src/discuss/__tests__/<module>.test.ts`
   - Edge cases covered (empty input, corrupt data, timeout)?
   - Error paths tested (spawn failure, invalid JSON)?
6) Comment pass — one row per comment the diff adds or edits, plus every comment standing in a
   function the diff changed. Name the edit that falsifies each, and whether that edit is a
   legitimate change or a bug. This is a ledger, not a list of locations: a bare enumeration of
   file:line is answerable in one sentence and will be.
7) Rubric-Anchored Scoring — score each elegance dimension 1-10:
   Rubric anchors (10 / 7 / 4 / 1):
   - Inevitability: no simpler solution / minor simplification / over-engineered / wrong abstraction
   - Clarity: self-documenting / clear with naming / needs comments to understand / requires external docs
   - Flow: reads top-down naturally / main path clear / edge cases obscure intent / no discernible flow
   - Depth: progressive detail / reasonable layers / mixed abstraction levels / all detail at once
   Composite Elegance = average of 4 (rounded).
   Floor rule: any dimension < 4 → NEEDS WORK regardless of composite.
   Score all findings by severity (BLOCKING/STRONG/MINOR), render Output_Format.

</Investigation_Protocol> <Tool_Usage> ```bash # Find long functions in TypeScript source grep -n 'function|export async function|export function' src/providers/codex/.ts src/discuss/.ts

# Find TODOs in recent changes
git diff --name-only | xargs grep -n 'TODO\|FIXME\|HACK' 2>/dev/null

# Check test file existence for each source module
ls src/providers/__tests__/*.test.ts
ls src/discuss/__tests__/*.test.ts

# Run tests to verify coverage
npm test
```

</Tool_Usage> <Output_Format> ## Code Review: [scope]

Read the full file on GitHub · 171 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 171 lines · 36 tokens per session scan A e8e5b3ad7f7b

Subscribe to this mod's changes

code-critic is an agent published in the GitHub repository kangig94/coral (11 stars, last pushed yesterday), licensed MIT. It adds 36 tokens to every session and 2,153 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.