enterprise-review
Skill1 starsChanged 8 months agoMITView on GitHub
Two-stage code review: spec compliance THEN code quality. Separate concerns prevent spec bugs hiding behind quality observations. Medium+ tier requires a separate agent — builder never reviews own work. Use after enterprise-build.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- cyl-castillo/agent-consoletheir own version, first seen Nov 15, 2026
- anotherben/claude-harnesstheir own version, first seen Nov 8, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- cyl-castillo/agent-console★ 10same name
- anotherben/claude-harness★ 7same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- enterprise-brainstormSkill
- enterprise-buildSkill
- enterprise-compoundSkill
- enterprise-contractSkill
- enterprise-debugSkill
- enterprise-discoverSkill
- enterprise-forgeSkill
- enterprise-harnessSkill
- enterprise-planSkill
- enterpriseSkill
- enterprise-verifySkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Read .claude/enterprise-state/stack-profile.json at skill start.
- Distinctive: line 35
If no profile exists: BLOCKED — run /enterprise-discover first.
- Distinctive: line 71
Before reviewing any code, classify EVERY changed file:
- Distinctive: line 111
Test passes but doesn't actually verify the postcondition (assertion too weak)
- Distinctive: line 113
Test mocks the exact thing the postcondition is about
- Distinctive: line 174
Only runs after Stage 1 passes.
- Distinctive: line 191
Test files are exempt from line limits.
- Very specific: line 219
ALL queries must use parameterized placeholders ($1, $2, etc.)
- Distinctive: line 220
No string concatenation in SQL
- Distinctive: line 221
No template literals building SQL with user input
- Distinctive: line 413
When code comes back after fixes:
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
Enterprise Review
You are reviewing code that was built from a contract. Your job is adversarial verification — find what's wrong, not confirm what's right. Two stages, two separate concerns: spec compliance FIRST, code quality SECOND. They never mix.
THE SEPARATION PRINCIPLE
Spec bugs hide behind quality observations.
"Clean code" that violates the contract is WORSE than messy code that fulfills it.
Review spec compliance FIRST. Only then review code quality.Quality findings during Stage 1? Write them down, but DO NOT report them until Stage 2. Spec findings during Stage 2? STOP — you missed something. Go back to Stage 1.
STACK RESOLUTION
Read .claude/enterprise-state/stack-profile.json at skill start. Extract:
$TEST_CMD=commands.test_all$SOURCE_DIR=structure.source_dirs.backend$FRONTEND_DIR=structure.source_dirs.frontend$TENANT_FIELD=multi_tenancy.field$TENANT_ENABLED=multi_tenancy.enabled$AUTH_MIDDLEWARE=auth.middleware_name$FILE_EXTENSIONS=conventions.file_extensions
If no profile exists: BLOCKED — run /enterprise-discover first.
PREREQUISITES
Before starting review:
- Verify upstream artifacts exist:
If any check fails: STOP. Report what's missing.# Contract must exist ls docs/contracts/*contract* 2>/dev/null || echo "BLOCKED: No contract found" # Build must have produced changes git diff --stat HEAD 2>/dev/null | tail -1 || echo "BLOCKED: No changes to review" # Tests must be passing $TEST_CMD 2>&1 | tail -5 - Identify the contract — find the contract document in
docs/contracts/or.claude/designs/ - Identify the plan — find the plan in
docs/plans/ - Identify all changed files — run
git diff --name-only <base-branch>...HEAD - Identify the tier — Micro/Small/Medium/Large/XL from the contract
- Check builder identity — Medium+ tier: you MUST be a different agent than the builder
Medium+ Tier Gate:
- Ask: "Who built this?"
- If YOU built it → STOP. Tell the user a separate agent must review.
- Builder reviews own work = review is INVALID.SCOPE CLASSIFICATION
Before reviewing any code, classify EVERY changed file:
| Category | Definition | Review Action |
| REQUIRED | Directly implements a postcondition | Full Stage 1 + Stage 2 |
| ENABLING | Infrastructure needed by REQUIRED files (utils, types, migrations) | Stage 2 only |
| DRIFT | Not traceable to any postcondition | Flag for removal |
# List all changed files
git diff --name-only <base-branch>...HEAD
# For each file, answer: which postcondition does this serve?
# If no postcondition → DRIFTDRIFT files are a red flag. They indicate scope creep. Report them prominently. The builder must justify each one or revert it.
STAGE 1: SPEC COMPLIANCE
1A — Postcondition Verification
For EACH postcondition in the contract (PC-1, PC-2, etc.):
PC-X: [postcondition text]
├── Implemented? YES/NO
│ └── Where? [file:line]
├── Test exists? YES/NO
│ └── Where? [test file:line]
├── Test verifies the RIGHT thing? YES/NO
│ └── Does the assertion match the postcondition exactly?
│ └── Does the test exercise the actual code path (not a mock)?
│ └── Does the test fail if the postcondition is violated?
└── Verdict: PASS / FAIL [reason]Common spec failures:
- Test passes but doesn't actually verify the postcondition (assertion too weak)
- Implementation handles happy path but not the error case stated in the PC
- Test mocks the exact thing the postcondition is about
- Postcondition says "returns X" but implementation returns X wrapped in something else
1B — Consumer Map Verification
For each consumer listed in the contract's consumer map:
Consumer: [consumer name]
├── Still receives correct data shape? YES/NO
├── Breaking changes introduced? YES/NO
├── Integration tested? YES/NO
└── Verdict: PASS / FAIL [reason]# Find all consumers of the changed module
cd $PROJECT_ROOT
grep -rn "require.*<module>" $SOURCE_DIR/ --include="*.js" | grep -v node_modules | grep -v __tests__
grep -rn "import.*from.*<module>" $SOURCE_DIR/ --include="*.js" | grep -v node_modules | grep -v __tests__1C — Invariant Verification
For each invariant in the contract:
Invariant: [invariant text]
├── Maintained in all code paths? YES/NO
├── Test guards the invariant? YES/NO
└── Verdict: PASS / FAIL [reason]1D — Stage 1 Verdict
═══════════════════════════════════════════
STAGE 1 VERDICT: SPEC [PASS/FAIL]
═══════════════════════════════════════════
Postconditions: X/Y passed
Consumers: X/Y verified
Invariants: X/Y maintained
[If FAIL:]
FAILURES:
- PC-X: [specific failure]
- Consumer Y: [specific failure]
- Invariant Z: [specific failure]
ACTION: Fix failures and re-submit for review.
Stage 2 will NOT run until Stage 1 passes.
═══════════════════════════════════════════If Stage 1 FAILS: STOP. Do not proceed to Stage 2. Report failures and return to builder.
STAGE 2: CODE QUALITY
Only runs after Stage 1 passes. Stage 2 has 8 quality lenses.
2A — File Size
# Check all changed files for line count
cd $PROJECT_ROOT
for f in $(git diff --name-only <base-branch>...HEAD | grep -E "$FILE_EXTENSIONS"); do
lines=$(wc -l < "$f" 2>/dev/null || echo "MISSING")
if [ "$lines" != "MISSING" ] && [ "$lines" -gt 400 ]; then
echo "OVER 400: $f ($lines lines)"
fi
done- Soft limit: 400 lines. Flag files over 400.
- Hard limit: 800 lines. FAIL files over 800 (unless pre-existing legacy).
- Test files are exempt from line limits.
2B — Tenant Isolation
# Find all new SQL queries in changed files
cd $PROJECT_ROOT
for f in $(git diff --name-only <base-branch>...HEAD | grep -E "$FILE_EXTENSIONS"); do
# Show new lines with SQL keywords
git diff <base-branch>...HEAD -- "$f" | grep "^+" | grep -iE "(SELECT|INSERT|UPDATE|DELETE|FROM)" | head -20
doneFor EACH new query:
- Has
$TENANT_FIELDin WHERE clause? (Exception:customerstable has no$TENANT_FIELD) - Has
$TENANT_FIELDin INSERT values? - Uses parameterized query (no string interpolation)?
2C — Query Safety
# Find potential SQL injection vectors in changed files
cd $PROJECT_ROOT
for f in $(git diff --name-only <base-branch>...HEAD | grep -E "$FILE_EXTENSIONS"); do
git diff <base-branch>...HEAD -- "$f" | grep "^+" | grep -E '(\$\{|` ?\+|string concat)' | grep -iE "(SELECT|INSERT|UPDATE|DELETE)" | head -10
done- ALL queries must use parameterized placeholders (
$1,$2, etc.) - No string concatenation in SQL
- No template literals building SQL with user input
2D — Import Verification
# Verify every import in changed files resolves
cd $PROJECT_ROOT
for f in $(git diff --name-only <base-branch>...HEAD | grep -E "$FILE_EXTENSIONS"); do
echo "=== $f ==="
grep -n "require(" "$f" | while read -r line; do
# Extract the module path
mod=$(echo "$line" | grep -oP "require\(['\"]([^'\"]+)" | sed "s/require(['\"]//")
if [[ "$mod" == .* ]]; then
# Relative import — check file exists
dir=$(dirname "$f")
resolved="$dir/$mod"
if [ ! -f "$resolved" ] && [ ! -f "${resolved}.js" ] && [ ! -f "${resolved}/index.js" ]; then
echo " MISSING: $mod (from line: $line)"
fi
fi
done
done2E — Debug Code
# Find debug artifacts in changed files (excluding test files)
cd $PROJECT_ROOT
for f in $(git diff --name-only <base-branch>...HEAD | grep -E "$FILE_EXTENSIONS" | grep -v __tests__ | grep -v '\.test\.' | grep -v '\.spec\.'); do
git diff <base-branch>...HEAD -- "$f" | grep "^+" | grep -nE "(console\.(log|debug|warn)|debugger|TODO|FIXME|HACK|XXX)" | head -10
if [ $? -eq 0 ]; then
echo " ^^^ in $f"
fi
doneconsole.log/console.debugin production code = FAILconsole.warn/console.errorwith context = OK (they're intentional logging)debuggerstatements = FAILTODO/FIXME/HACK/XXX= FLAG (not auto-fail, but must be intentional)
2F — Security
For each new route or endpoint:
- Auth middleware applied? (
$AUTH_MIDDLEWAREor equivalent) - Permission checks present? (role-based access)
- Input validation present? (request body/params validated)
- Route order correct? (public routes before auth middleware)
# Find new route definitions
cd $PROJECT_ROOT
for f in $(git diff --name-only <base-branch>...HEAD | grep -E "$FILE_EXTENSIONS"); do
git diff <base-branch>...HEAD -- "$f" | grep "^+" | grep -E "router\.(get|post|put|patch|delete)" | head -10
if [ $? -eq 0 ]; then
echo " ^^^ in $f"
fi
done2G — Pattern Compliance
- Does the code follow existing patterns in the codebase?
- Are there unnecessary abstractions not seen elsewhere?
- Does error handling match existing conventions?
- Are existing utilities reused (not reinvented)?
# Check if similar patterns exist in codebase
cd $PROJECT_ROOT
# Example: if new code creates a service, check existing service patterns
ls $SOURCE_DIR/services/*.js | head -5
# Compare structure with existing services2H — Migration Safety (if applicable)
# Check migration files in the diff
cd $PROJECT_ROOT
git diff --name-only <base-branch>...HEAD | grep -E 'migrations/.*\.sql$'For each migration:
- Uses
IF NOT EXISTS/IF EXISTSguards? - Uses
TIMESTAMPTZ(notTIMESTAMP)? - Adds indexes for foreign keys?
- Reversible? (or documented as irreversible)
2I — Stage 2 Verdict
═══════════════════════════════════════════
STAGE 2 VERDICT: QUALITY [PASS/FAIL]
═══════════════════════════════════════════
File Size: PASS/FAIL [details]
Tenant Isolation: PASS/FAIL [details]
Query Safety: PASS/FAIL [details]
Import Resolution:PASS/FAIL [details]
Debug Code: PASS/FAIL [details]
Security: PASS/FAIL [details]
Pattern Compliance: PASS/FAIL [details]
Migration Safety: PASS/FAIL [details if applicable]
[If FAIL:]
FAILURES:
- 2X: [specific failure and fix required]
ACTION: Fix failures and re-submit for review.
═══════════════════════════════════════════FINAL REVIEW REPORT
Save to: docs/reviews/YYYY-MM-DD-<slug>-review.md
# Review: <Feature Slug>
**Date:** YYYY-MM-DD
**Contract:** <path to contract>
**Builder:** <who built it>
**Reviewer:** <who reviewed it>
**Tier:** <Micro/Small/Medium/Large/XL>
## Scope Classification
| File | Category | Postcondition |
|------|----------|---------------|
| ... | REQUIRED | PC-X |
| ... | ENABLING | supports PC-Y |
| ... | DRIFT | none — flagged |
## Stage 1: Spec Compliance — [PASS/FAIL]
### Postconditions
| PC | Status | Implementation | Test | Notes |
|----|--------|---------------|------|-------|
| PC-1 | PASS/FAIL | file:line | test:line | ... |
### Consumers
| Consumer | Status | Notes |
|----------|--------|-------|
| ... | PASS/FAIL | ... |
### Invariants
| Invariant | Status | Notes |
|-----------|--------|-------|
| ... | PASS/FAIL | ... |
## Stage 2: Code Quality — [PASS/FAIL]
| Check | Status | Notes |
|-------|--------|-------|
| File Size | PASS/FAIL | ... |
| Tenant Isolation | PASS/FAIL | ... |
| Query Safety | PASS/FAIL | ... |
| Import Resolution | PASS/FAIL | ... |
| Debug Code | PASS/FAIL | ... |
| Security | PASS/FAIL | ... |
| Pattern Compliance | PASS/FAIL | ... |
| Migration Safety | PASS/FAIL | ... |
## Overall Verdict: [PASS/FAIL]
[Summary of findings, required fixes, or approval statement]REVIEW WORKFLOW
1. Receive review request
2. Locate contract + plan + changed files
3. Check tier → enforce builder != reviewer for Medium+
4. Classify scope: REQUIRED / ENABLING / DRIFT
5. Stage 1: Spec Compliance
└── FAIL? → STOP. Return to builder with failures.
6. Stage 2: Code Quality
└── FAIL? → Return to builder with failures.
7. Both PASS → Write review report → ApproveRE-REVIEW PROTOCOL
When code comes back after fixes:
- Only re-check the failures — don't re-review passing checks
- Verify the fix didn't break a previously passing check — run all tests
- Update the review report with new verdicts
- If new issues found during re-review — full stage re-run for that stage
# Verify tests still pass after fixes
cd $PROJECT_ROOT && $TEST_CMD 2>&1 | tail -20Does 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.

