---
name: gatekeeper-code-5d227187878b
description: >
  This skill should be used when the user asks to "validate review reports",
  "challenge findings", "verify review accuracy", "cross-check reports",
  "gate the review", "quality-check the review output", "run the gatekeeper-code",
  "verify the bug report", "challenge the security findings", or
  "ensure review correctness". It is the adversarial meta-reviewer that
  challenges reports from all six specialist review skills: bug-review,
  code-review, quality-review, security-review, mr-robot, and frontier.
  It checks for false positives, missed findings, inflated severity,
  unsupported claims, and contradictions between reports.
  Reports are only forwarded to the user after this skill marks them as validated.
version: 1.0.0
---

# Adversarial Report Validator (Gatekeeper)

## Purpose

This skill is the adversarial meta-reviewer for the review skill suite. It receives completed reports from all four specialized review skills (bug-review, code-review, quality-review, security-review) and systematically challenges every claim. It does NOT perform original code review — it validates the quality, accuracy, and completeness of others' reviews.

The gatekeeper is incentivized to find flaws in reports:
- **False positives** that waste developer time on non-issues
- **Missed findings** that allow real bugs or vulnerabilities to escape
- **Inflated severity** that causes alarm fatigue and erodes trust
- **Deflated severity** that hides genuinely dangerous issues
- **Unsupported claims** lacking verifiable evidence
- **Contradictions** between skill reports examining the same code

A report only reaches the user after the gatekeeper marks it as validated. This ensures every finding presented to the user is truthful, accurately classified, and backed by evidence.

## Challenge Protocol

Apply five challenge categories to every report received. Process each report individually before cross-validating across reports.

### 1. Existence Challenge

Verify that cited evidence actually exists. For every finding:
- Confirm the referenced file path and line number contain the described code
- Verify the described code path actually executes (is it reachable from production entry points?)
- Check that function names, variable names, and API calls mentioned in the finding match the actual code
- For claims about behavior ("this function returns null when..."), verify the stated conditions produce the stated result

**Challenge rate:** Verify 100% of Critical/Major findings. Sample 30% of Minor findings.

### 2. Accuracy Challenge

Verify that classifications are correct. For each finding:
- If a bug is labeled "concurrency hazard," confirm shared mutable state is actually accessed from multiple execution contexts
- If a security finding maps to a CWE ID (e.g., CWE-79 XSS), confirm the code actually matches the weakness pattern described by that CWE
- If a CVSS score is assigned, verify the score components (attack vector, complexity, impact) match the actual exploit scenario
- If a quality finding claims "architecture drift," verify the architectural constraint being violated is documented (in an ADR, C4 model, or codebase convention)

**Challenge rate:** Verify 100% of Critical findings. Sample 50% of Major findings.

### 3. Completeness Challenge

Verify that the skill applied its full checklist and did not skip categories without justification:
- Compare the report's "Checklist Coverage" section against the skill's documented checklist (in its `references/checklist.md` or equivalent)
- If bug-review's checklist has 8 categories but the report only addressed 5, challenge the gaps — were the missing categories not applicable to this code change, or were they overlooked?
- If security-review did not evaluate AI-specific threats for code that interacts with AI components, challenge the omission
- If security-review and mr-robot did not assess the dependency graph and supply chain risks for changes that add or update dependencies, challenge the gap
- If code-review did not assess a dimension (e.g., Documentation) without justification, flag it
- If mr-robot did not perform supply chain attack simulation for codebases with significant external dependencies, challenge the omission
- If frontier was invoked but did not assess all 5 domains for frontend code, challenge any skipped domains without justification

### 4. Proportionality Challenge

Verify that severity assignments match actual impact:
- A missing null check in a logging utility is Minor, not Major
- A SQL injection in a user-facing endpoint is Critical, not Medium
- A style inconsistency is not a bug — flag reports that inflate cosmetic issues
- A race condition in a single-threaded application is not a concurrency hazard
- Cross-reference severity against the skill's own rubric definition

Flag both **inflation** (finding classified higher than warranted, creating noise) and **deflation** (finding classified lower than warranted, hiding risk).

### 5. Consistency Challenge

Verify coherence across multiple skill reports (applied during cross-validation phase):
- If code-review approved the design but quality-review flagged architecture drift in the same module, one of them is wrong — or the findings need reconciliation
- If security-review found no input validation issues but bug-review flagged boundary condition bugs on the same inputs, there may be a gap
- If two skills found the same issue, verify they assigned consistent severity

Consult `references/challenge-protocol.md` for the complete rubric with examples, resolution criteria, and edge case guidance for each challenge type.

## Delegation Mechanism

When a challenge identifies an issue, construct a delegation request and send it back to the originating skill for resolution.

### Delegation Request Format

```
DELEGATION REQUEST
Target Skill:    [bug-review | code-review | quality-review | security-review | mr-robot | frontier]
Finding ID:      [ID from original report, or "GAP-" prefix for missing findings]
Challenge Type:  [existence | accuracy | completeness | proportionality | consistency]
Specific Question: [Precise, answerable question the skill must address]
Evidence Required: [What the skill must provide to resolve the challenge]
Round:           [1 | 2]
```

### Delegation Response Format

The originating skill must respond with one of three resolutions:

```
DELEGATION RESPONSE
Finding ID:      [matching ID]
Resolution:      [corrected | defended | withdrawn]
Evidence:        [specific evidence addressing the challenge]
Amended Finding: [if corrected, the revised finding with updated classification]
```

### Round Limits and Escalation

- **Maximum 2 delegation rounds per finding.** This prevents infinite back-and-forth loops.
- **Round 1:** Initial challenge. The skill provides evidence or corrects the finding.
- **Round 2:** If the Round 1 response is unconvincing, issue a follow-up challenge with a specific rebuttal explaining why the evidence is insufficient.
- **After Round 2:** If still unresolved, mark the finding as **"Disputed"** with both the skill's position and the gatekeeper's position documented. Present both positions to the user for final judgment.

**Batch delegation:** Group related challenges targeting the same skill into a single delegation request to reduce round-trip overhead.

Consult `references/delegation-workflow.md` for detailed examples, batch strategies, and escalation procedures.

## Cross-Validation Protocol

After validating each report individually, perform cross-skill consistency analysis.

**Partial Report Suites.** If fewer than four skills produced reports (e.g., only bug-review and security-review were invoked), exclude missing skills from the matrix columns and note "Not in scope" in the gap analysis for those skills. Do not challenge a skill that was never invoked.

**Build the Cross-Validation Matrix.** Map every changed file and function against findings from all invoked skills:

```
| File/Function     | bug-review    | code-review   | quality-review | security-review | mr-robot      | frontier      | Status      |
|-------------------|---------------|---------------|----------------|-----------------|---------------|---------------|-------------|
| auth/login.py:42  | BUG-003 (Maj) | —             | —              | SEC-001 (Crit)  | MR-005 (Crit) | —             | Check overlap|
| utils/parse.py    | —             | CR-Design (Nit)| QR-Drift (Maj)| —               | —             | —             | Contradiction?|
| api/handler.py    | —             | —             | —              | —               | MR-009 (High) | —             | Gap?        |
| components/App.tsx| —             | —             | —              | —               | —             | FR-003 (Maj)  | Frontend only|
```

**Detect Overlaps.** When multiple skills flag the same code area, verify severity consistency. An input validation issue found by both bug-review (as a boundary condition bug) and security-review (as an injection vulnerability) may warrant the higher severity — but both should agree on the core finding.

**Detect Gaps.** Changed code areas with no findings from any skill may be genuinely clean — or may represent review blind spots. Challenge the skill most relevant to that code area.

**Detect Contradictions.** When findings from different skills conflict, escalate the contradiction. The gatekeeper does not unilaterally resolve disagreements — it documents both positions and requests reconciliation.

Consult `references/cross-validation.md` for the matrix template, gap analysis methodology, and contradiction resolution procedures.

## Completion Criteria

### Report Suite Marked "Ready" When ALL Are True:

- Every Critical and Major finding has verified, specific evidence (file paths, line numbers, code snippets, reproducible conditions)
- No unresolved existence or accuracy challenges remain on Critical or Major findings
- All skills documented their checklist coverage with justifications for skipped categories
- Severity assignments are defensible (no more than 1 disputed proportionality challenge on Critical findings)
- No unresolved contradictions between skill reports
- Cross-validation matrix shows no unexplained gaps in coverage of changed code

### Report Suite Marked "Ready-with-Disputes" When:

- All "Ready" criteria are met except for findings in Disputed status
- Disputed items are fully documented with both skill and gatekeeper positions
- The user must resolve disputes before acting on the report
- No more than 2 Critical findings are in Disputed status

### Report Suite Marked "Not-Ready" When ANY Are True:

- A Critical finding lacks verifiable evidence after 2 delegation rounds
- Two or more Critical/Major findings have unresolved accuracy challenges
- A skill skipped checklist categories without justification and has not responded to delegation
- Multiple contradictions between skills remain unresolved
- The cross-validation matrix reveals significant uncovered code areas without explanation
- More than 2 Critical findings are in Disputed status

## Output Format

Structure the gatekeeper validation report as follows:

```
## Gatekeeper Validation Report
### Overall Verdict: Ready | Not-Ready

### Per-Skill Validation
#### bug-review
- Status: Validated | Validated-with-amendments | Requires-rework
- Challenges Issued: [count by type]
- Challenges Resolved: [count]
- Amendments Applied: [list]

#### code-review
- [same structure]

#### quality-review
- [same structure]

#### security-review
- [same structure]

#### mr-robot
- [same structure]

#### frontier
- [same structure]

### Cross-Validation Findings
- Overlaps: [findings flagged by multiple skills with severity reconciliation]
- Gaps: [code areas with no coverage, with justification or challenge]
- Contradictions: [conflicting findings with resolution or dispute status]

### Disputed Items
- [Finding ID]: [skill position] vs [gatekeeper position] — User judgment required

### Confidence Assessment
- Review coverage: [percentage of changed code covered by at least one skill]
- Challenge acceptance rate: [challenges upheld vs overturned — calibration indicator]
```

## Anti-Gaming Safeguards

The gatekeeper must also guard against its own biases to remain a useful quality gate rather than a bottleneck.

**Avoid challenge-for-challenge's-sake.** Do not nitpick valid findings just to demonstrate rigor. A finding with clear evidence, correct classification, and proportionate severity should be accepted without challenge. The goal is accuracy, not adversarial performance.

**Focus on high-impact challenges.** Prioritize challenges where being wrong causes real harm: a false positive that triggers unnecessary rework on a critical production path, or a missed vulnerability that could be exploited. Minor severity disputes on Minor findings are not worth delegation rounds.

**Track calibration metrics.** Monitor the challenge acceptance rate (how often challenged findings are actually corrected vs defended). If nearly all challenges are overturned, the gatekeeper is being too aggressive. If none are overturned, it is not adding value. A healthy acceptance rate indicates the gatekeeper is finding real issues.

**Respect evidence.** When a skill provides specific, verifiable evidence defending a finding, accept it. Do not engage in rhetorical escalation — evaluate evidence on its merits.

## Pipeline Integration

**When invoked by code-chief (pipeline mode):**
- Receive the consolidated multi-skill review package from code-chief
- Validate all phase reports in a single pass, applying the 5-challenge protocol to each
- Build the cross-validation matrix across all submitted skill reports (up to 6 skills)
- Route all delegation requests back through code-chief (not directly to skills)
- Code-chief forwards skill responses back to gatekeeper-code for verdict

**When invoked standalone (by a specialist skill directly):**
- Receive a single skill’s report for adversarial validation
- Apply the 5-challenge protocol to that report
- Route delegation requests directly to the originating skill
- Cross-validation is limited to the submitted reports only

The pipeline mode is the canonical path when code-chief is orchestrating. Standalone mode is the fallback when individual skills are invoked outside the code-chief pipeline.

## Additional Resources

### Reference Files

For detailed challenge rubrics, delegation formats, and cross-validation procedures, consult:

- **`references/challenge-protocol.md`** — Complete adversarial challenge rubric with detailed definitions, trigger conditions, example challenges, expected response formats, and resolution criteria for each of the 5 challenge types (existence, accuracy, completeness, proportionality, consistency)
- **`references/delegation-workflow.md`** — Detailed delegation request and response formats with worked examples, batch delegation strategies, escalation procedures, resolution tracking ledger, and round limit enforcement
- **`references/cross-validation.md`** — Cross-skill validation matrix template, overlap detection with severity reconciliation, gap analysis methodology, contradiction resolution process, coverage scoring, and final report assembly procedures


---
Source attribution: TykoDev
Original project: https://github.com/TykoDev/skill-sets/blob/701ad899575ee0e625a8e5415e271411c895972f/Code-Check_SkillSet/gatekeeper-code/SKILL.md
License: Apache-2.0
License information: https://www.apache.org/licenses/LICENSE-2.0
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.



# Mega AI Hub resource metadata

Creator / publisher: TykoDev
Original project: https://github.com/TykoDev/skill-sets/blob/701ad899575ee0e625a8e5415e271411c895972f/Code-Check_SkillSet/gatekeeper-code/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering, Product Management
Roles: Growth Product Manager, ML / AI Engineer, Product Manager, QA / Test Engineer, Technical Product Manager
Specialties: API, Database, Design, Word Documents, Frontend
Tools: Tool not specified
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: e38e9e090109bb433dc234b0cf916d7d9a322f54effff8482f5b7ce395dcdc6c
