Validate artefacts

From Fr-e-d/GAAI-framework · View interactive version

Validate artefacts is an AI agent skill from the GitHub repository Fr-e-d/GAAI-framework. Validate that all Discovery artefacts (Epics, Stories) are clear, governed, complete, and safe to pass into Delivery. Activate after generating Epics or Stories and before any Delivery planning. This is the mandatory Discovery → Delivery gate.

How to use this skill

Skill file

Validate Artefacts

Purpose / When to Activate

Activate:

This is the mandatory gate between Discovery and Delivery. No Story proceeds to Delivery without passing this check.


Process

Epic Validation

Story Validation

required_skills: [name-a, name-b]). A bare string, map, or other non-list type

returns BLOCKED: required_skills must be a YAML list (got: <type>).

the project skills index (.gaai/project/skills/skills-index.yaml) or directly as

.gaai/project/skills/<track>/<name>/SKILL.md. A non-resolving entry returns

BLOCKED: required_skills entry '<name>' not found in project skills.

names the observable output of that skill. An entry with no co-declared output AC

returns BLOCKED: `required_skills entry '<name>' has no bound output AC — add an AC

naming the observable output the skill must produce`.

any other validation. Non-regression for stories that do not use custom skills.

Story Scope Pre-Flight (Plan contract symmetry)

The Plan phase agent enforces hard scope caps before producing an execution plan:

>10 distinct files modified OR created, >6 acceptance criteria, or >300 lines of implementation code projected all trigger a plan-block + decomposition demand and waste a full Delivery cycle (worktree spin, branch chore commit, then PLAN exit non-zero with plan-blocked.md). To prevent this Discovery → Refined → Plan-blocked round-trip, this skill enforces the same caps at the Discovery gate. The Refined contract MUST guarantee Plan-feasibility upstream.

LOC counting basis (coordinated decision — mirrored verbatim in the Plan agent prompt; change both together or neither): the ≤300 LOC cap counts implementation LOC only; test-file LOC is excluded. Test files still count toward the ≤10-file cap and must appear in the File Inventory marked (test). Basis rationale: the cap is calibrated on single-pass implementation coherence; test code mirrors the implementation it covers, so a tests-included basis would make any properly-tested new service unshippable (~250-line service + ~280-line test always exceeds 300 combined) while empirical deliveries (e.g. a 246-impl/298-test billing story) pass reliably. Grossly disproportionate test scope (>~3× impl LOC) is flagged for review, not blocked. A test file is one containing only automated test code and test-only fixtures/helpers, following the project's test naming convention (e.g. *.test.*, *.spec.*, tests/ or __tests__/ directories). Any file imported or executed by production code counts as implementation regardless of name or marker.

Cap enforcement is hard, not advisory.

| Cap | Threshold | Source of truth in story |

|---|---|---|

| Files | ≤ 10 distinct files modified or created | ## File Inventory section (mandatory for any multi-file story) |

| Acceptance criteria | ≤ 6 | counted from ## Acceptance Criteria bullets |

| LOC projection | ≤ 300 implementation LOC only — rows marked (test) are excluded from the sum | optional loc_estimate line in File Inventory, summed over non-test rows |

Multi-file detection (when File Inventory is mandatory):

A story requires a ## File Inventory section if BOTH of the following are true (concrete signals — vibe-only triggers produce false-positives on legitimate single-file refactor stories):

When BOTH signals match, the story body MUST contain a ## File Inventory section listing each file to be modified or created, with a 1-line scope note per file, an optional loc_estimate per row, and the literal marker (test) on any test-file row (test rows are excluded from the LOC cap but count toward the file cap). Stories matching the detection criteria without this section are BLOCKED — the validator cannot compute the file cap without an explicit list.

A ## File Inventory listing more than 10 files is BLOCKED. Discovery must decompose before re-running this skill. This is the PLAN contract symmetry — any story that would plan-block at Delivery MUST be caught here instead. There is no escape hatch in V1: the cap mirrors the Plan agent's hard cap exactly, and the Plan agent does not honor exemption flags. Truly atomic cross-file refactors are vanishingly rare ; if encountered, raise the cap in BOTH this skill AND the Plan agent prompt as a single coordinated decision.

Single-file stories (one of the two detection signals does not match) may omit the File Inventory section. AC and LOC caps still apply.

Rationale (why this lives in the Discovery gate, not in Plan only):

The Plan phase agent is the executor — its scope caps protect single-pass implementation reliability. But by the time PLAN runs, the wrapper has already spun a worktree, made a chore commit, and consumed a retry slot. Mirroring the caps here closes the gap: Discovery never produces a Refined story that PLAN would block. Defense-in-depth at the wrapper exit trap (reconcile to status=blocked when plan-blocked.md is detected) catches any edge case this skill misses.


`impl_model` Field Validation (optional field — E94)

The impl_model field is optional. Stories without it validate exactly as before (non-regression guarantee).

Valid values: ['primary', 'secondary'] — checked as a list lookup, not an if/else chain, so V2 extension (e.g., tertiary) is a one-line change.

| Condition | Verdict |

|---|---|

| impl_model absent (story frontmatter or backlog entry) | PASS — default behavior |

| impl_model: primary | PASS |

| impl_model: secondary (any tier) | PASS — Tier × impl_model hard-gate retired ; daemon hard-gate previously removed ahead of formal decision. Fallback to primary on secondary failure is preserved via the universal-cascade fallback policy. |

| Any other value (e.g. tertiary, claude-opus-4-6, "") | FAIL — impl_model must be 'primary' or 'secondary' (got: '<value>') |

| impl_model in frontmatter AND backlog entry with different values | FAIL — impl_model mismatch: frontmatter=<X>, backlog=<Y> |

Field location rules (AC6 — canonical resolution):

Tier × impl_model compatibility (skill-side gate retired)

Current routing doctrine :

This skill now :

Setting impl_model: secondary explicitly: always passes. Useful for cost-optimal stories where the author has verified the secondary model's context budget is comfortably sufficient OR is comfortable relying on the universal-cascade fallback.

Setting impl_model: primary explicitly: always passes. Useful for Tier 2+ stories needing stronger reasoning, security/compliance-critical work, or other sensitivity overrides.

Leaving impl_model ABSENT: routes to default (secondary when env-configured else primary). Recommended for Tier 1 stories.

Test fixtures: .gaai/core/skills/discovery/validate-artefacts/tests/impl_model.test.yaml

Cross-checks

Skill Attestation (Base Rule #2 Enforcement)


Outputs

Validation Report — Discovery

Epics:
- E01: PASS | FAIL — reason
- E02: PASS | FAIL — reason

Stories:
- S01: PASS | FAIL — reason
- S02: PASS | FAIL — reason

Skill Attestation (Base Rule #2):
- E01: skills_invoked: [generate-epics] ✓ | MISSING ✗
- S01: skills_invoked: [generate-stories] ✓ | MISSING ✗
- S01: related_decs: [<DEC-id>] ✓ | MISSING ✗

Governance:
- rules respected: yes | no
- missing artefacts: none | list
- risks detected: none | list

Overall Status:
PASS | BLOCKED

Blocking Conditions

The skill MUST block progression if:

(unbound contract — per the contract-carried delivery invariant)

.gaai/project/skills/ (referential integrity failure)

No partial approval. No silent warnings.


Non-Goals

This skill must NOT:

It validates — it does not fix. If Delivery can misunderstand it, Discovery is not done.

On BLOCKED verdict: the Discovery Agent must invoke refine-scope to resolve the identified gaps, then re-run this skill. Do not proceed to Delivery until the verdict is PASS.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.