tn-review
Skill2 starsChanged 8 months agoMITView on GitHub
Code Review & Security Analysis Skill
In this repository36 other files it gives its agents.
- agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- create-agentSkill
- doc-writerSkill
- feynman-auditorSkill
- gh-issueSkill
- human-writingSkill
- mermaidSkill
- nemesis-ogSkill
- nemesis-scanSkill
- outline-codeSkill
- report-to-pr-commentsSkill
- skill-creatorSkill
- solidity-security-scanSkill
- state-inconsistency-auditorSkill
- telx-reviewSkill
- tn-add-benchmarkSkill
- tn-bug-scanSkill
- tn-debug-e2eSkill
- tn-domain-consensusSkill
- tn-domain-contractsSkill
- tn-domain-epochSkill
- tn-domain-executionSkill
- tn-domain-networkingSkill
- tn-domain-storageSkill
- tn-domain-workerSkill
- tn-hardenSkill
- tn-nemesis-scanSkill
- tn-review-contractsSkill
- tn-rust-engineerSkill
- tn-rust-skillsSkill
- tn-security-evalSkill
- tn-threat-modelSkill
- tn-write-crate-docSkill
- tn-write-e2eSkill
- tn-write-proptestSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
PR diff: Run git diff for the relevant range.
- Very specific: line 21
Module/crate: Read all .rs files in the crate.
- Distinctive: line 22
Specific files: Read them plus their direct dependents if the change touches public APIs.
- Very specific: line 48
Write findings to report-{relevent_branch_name_reference}.md in the project root (or as specified by the user).
- Very specific: line 85
After documenting all findings in Phase 2, invoke the findings-verifier agent via the Agent tool to verify each finding independently, …
- Very specific: line 101
Do not present findings to the user before findings-verifier completes.
- Distinctive: line 105
Every finding goes through subagent evaluation before being presented as confirmed.
- Distinctive: line 106
Read code before commenting on it.
- Distinctive: line 112
Check both the Rust code layer and any contract/protocol-level validation before concluding a finding is valid.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code Review & Security Analysis Skill
Use this skill when asked to review code, audit files, analyze PRs, or perform security analysis. Trigger on: "review", "audit", "analyze", "code review", "PR review", "security check", "look at this code", "check this module", "what do you think of this". Use this skill whenever the user asks you to examine code for quality, safety, or correctness — even if they don't explicitly say "review" or "audit".
Project Context
Telcoin-network is a Rust blockchain node combining Narwhal/Bullshark DAG-based BFT consensus with EVM execution via Reth. In this system, correctness equals safety: consensus bugs can halt the network, EVM state transition mismatches can lose funds, and concurrency bugs in async networking can corrupt shared state. The review categories and severity calibrations throughout this skill are tuned for this threat profile — a "Medium" finding in a typical web service may be "Critical" here if it can cause validator disagreement.
Process
Phase 1: Scope & Read
Determine the review scope from the user's request:
- PR diff: Run
git difffor the relevant range. Read every changed file in full (not just the diff hunks — surrounding context catches issues the diff alone hides). Also read files that import or are imported by changed files when the change touches a public interface. - Module/crate: Read all
.rsfiles in the crate. Start withlib.rsormain.rsto understand the module's public surface, then read internal modules. For large crates (20+ files), readlib.rsfirst to understand structure, then prioritize files touching consensus, state, crypto, or networking. - Specific files: Read them plus their direct dependents if the change touches public APIs.
While reading, note the file path, line numbers, and any concerns across these categories:
Rust & Systems
- Memory & Safety —
unsafeblocks without safety comments, raw pointer manipulation, transmute, missing bounds checks, buffer handling, use-after-free patterns - Concurrency — data races, deadlock potential (lock ordering),
Send/Syncbound issues, missing or incorrect use ofArc/Mutex/RwLock, unbounded channel/queue growth, task cancellation safety (what happens when a tokio task is dropped mid-await?) - Error Handling —
unwrap()/expect()on fallible operations in non-test code (these panic and crash the node),_catch-all in match arms that silently swallow new variants, error chains that lose context via.map_err(|_| ...)
Consensus & Blockchain
- Determinism — any operation whose output could vary across validators breaks consensus. Watch for: HashMap iteration order, floating point, system time, thread-dependent ordering, randomness without deterministic seeding
- Consensus Safety — incorrect quorum calculations, missing signature verification on messages, accepting messages from wrong rounds/epochs, equivocation handling, certificate validation gaps
- State & Funds — EVM state transitions that don't match Ethereum semantics, incorrect gas accounting, missing balance checks, storage writes without corresponding reads for validation, batch execution ordering assumptions
- Fork Safety — code that behaves differently at different block heights without explicit fork-gating, upgrade paths that could split the network
General
- Security — access control bypasses, unvalidated external input (network messages, RPC params, CLI args), cryptographic misuse (nonce reuse, weak randomness, missing constant-time comparison), resource exhaustion vectors (unbounded allocations from untrusted input)
- Bugs — logic errors, off-by-one, incorrect error propagation, silent failures, type confusion between similar newtypes
- Architecture — layering violations (consensus code reaching into execution internals or vice versa), missing abstraction boundaries, god objects, inconsistent patterns across similar code
- Optimization — unnecessary allocations in hot paths, redundant computation, runtime work that could be compile-time (
const fn, type-level computation), inefficient data structures for the access pattern
Phase 2: Document Findings
Write findings to report-{relevent_branch_name_reference}.md in the project root (or as specified by the user).
The report name should be based on the specific branch that's checked out.
Report structure:
# Code Review: [scope description]
Date: [date]
Scope: [what was reviewed — PR number, crate name, or file list]
## Summary
[1-2 sentences on overall assessment]
| # | Title | Severity | Category | Status |
|---|-------|----------|----------|--------|
## Findings
### [N]. [Title]
- **Severity (initial)**: Critical / High / Medium / Low / Informational
- **Category**: [from list above]
- **Location**: `file_path:line_number`
- **Claim**: [standalone factual assertion — what is wrong, NO reasoning chain]
- **Key Question**: [the specific thing a verifier must answer — e.g., "Can this unwrap panic if a validator sends a malformed certificate?"]
- **Relevant Files**: [files that must be read to verify this finding]
- **Source**: tn-reviewSeverity guide — calibrated for a blockchain node:
- Critical — funds at risk, consensus break/halt, remote code execution, state corruption that persists across restarts
- High — denial of service against the node, privilege escalation, incorrect state transitions that are recoverable, panics in production paths that crash the node
- Medium — silent failures affecting correctness that don't immediately break consensus, missing validation at system boundaries (RPC, network messages), economic impact under specific conditions
- Low — suboptimal patterns, minor inefficiencies, weak diagnostics,
unwrap()in paths that are practically safe but not provably so - Informational — style, naming, dead code, compile-time improvements, idiomatic Rust suggestions
Phase 3: Verify and Present
After documenting all findings in Phase 2, invoke the findings-verifier agent via the Agent tool to verify each finding independently, produce the final report, and present confirmed results.
Pass to the agent:
- The full contents of
report-{relevent_branch_name_reference}.md(all documented findings in canonical schema) - The review scope context (what was reviewed — PR number, crate name, or file list)
- The list of all changed files
The findings-verifier agent handles:
- Independent subagent verification of each finding (anti-confirmation bias — verifiers never see your original reasoning)
- Tiered verification (CRITICAL/HIGH individually, MEDIUM batched 2-3, LOW batched 3-5, INFO skipped)
- Proposed fixes for confirmed findings using the remediation decision tree
- Updating
report-{relevent_branch_name_reference}.mdwith verification results - Presenting confirmed findings in the conversation with verification stats
Do not present findings to the user before findings-verifier completes. Unverified findings waste time.
Rules
- Every finding goes through subagent evaluation before being presented as confirmed. Unverified findings waste time.
- Read code before commenting on it. Speculation produces false positives.
- Include
file_path:line_numberreferences for every finding. - Propose fixes, not just problems. A finding without a solution is half-finished work.
- Group subagent work to keep each focused (2-3 concerns max per agent).
- Calibrate severity honestly. A style issue is Informational, not Medium. An
unwrap()on aSomethat's guaranteed by the previous line is not High. - For state transitions and fund flows, verify complete accounting (inputs = outputs + fees).
- Check both the Rust code layer and any contract/protocol-level validation before concluding a finding is valid.
debug_assert!is not a production guard — it compiles to nothing in release builds. If correctness depends on adebug_assert!, that's a real finding.- For consensus code: if two honest validators could produce different results from the same input, that's at minimum High severity.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

