Iikit 06 analyze

From intent-integrity-chain/kit · View interactive version

Iikit 06 analyze is an AI agent skill from the GitHub repository intent-integrity-chain/kit. Validate cross-artifact consistency — checks that every spec requirement traces to tasks, plan tech stack matches task file paths, and constitution principles are satisfied across all artifacts. Use when running a consistency check, verifying requirements traceability, detecting conflicts between de

How to use this skill

Skill file

Intent Integrity Kit Analyze

Process steps in order. Do not skip ahead.

Non-destructive cross-artifact consistency analysis across spec.md, plan.md, and tasks.md.

Operating Constraints

User Input

$ARGUMENTS

You MUST consider the user input before proceeding (if not empty).

Constitution Loading

Load constitution per constitution-loading.md (basic mode — ERROR if missing). Extract principle names and normative statements.

Prerequisites Check

  1. Run:
  1. Derive paths: SPEC, PLAN, TASKS from FEATURE_DIR. ERROR if any missing.
  2. If JSON contains needs_selection: true: present the features array as a numbered table (name and stage columns). Follow the options presentation pattern in conversation-guide.md. After user selects, run:

Then re-run the prerequisites check (item 1 of this section).

  1. Checklist gate per checklist-gate.md.

Step 1 — Load Artifacts (Progressive)

From spec.md: overview, requirements, user stories, edge cases.

From plan.md: architecture, data model refs, phases, constraints.

From tasks.md: task IDs, descriptions, phases, [P] markers, file paths.

Proceed immediately to Step 2.

Step 2 — Build Semantic Models

Proceed immediately to Step 3.

Step 3 — Detection Passes (limit 50 findings)

| Pass | Category | What to detect |

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

| A | Duplication | Near-duplicate requirements → consolidate |

| B | Ambiguity | Vague terms (fast, scalable, secure) without measurable criteria; unresolved placeholders |

| C | Underspecification | Requirements missing objects/outcomes; stories without acceptance criteria; tasks referencing undefined components |

| D | Constitution Alignment | Conflicts with MUST principles; missing mandated sections. Per-principle status: ALIGNED or VIOLATION (auto-CRITICAL) |

| E | Phase Separation | Per phase-separation-rules.md — tech in constitution, implementation in spec, governance in plan |

| F | Coverage Gaps | Requirements with zero tasks; tasks with no mapped requirement; non-functional requirements absent from tasks; requirements unreferenced in plan.md. Scan plan.md for each FR-xxx/SC-xxx ID; collect contextual refs (KDD-x, section headers) where found |

| G | Inconsistency | Terminology drift; entities in plan but not spec; conflicting requirements |

| G2 | Prose Ranges | Patterns like "TS-XXX through TS-XXX" in tasks.md → flag MEDIUM: "Prose range detected — intermediate IDs not traceable. Use explicit comma-separated list." |

| H | Feature Traceability | When FEATURE_DIR/tests/features/ exists — see H1–H3 below |

H1. Untested requirements (HIGH): For each FR-XXX/SC-XXX in spec.md, verify at least one .feature file carries a matching @FR-XXX/@SC-XXX tag. Flag unmatched IDs.

H2. Orphaned tags (MEDIUM): For each @FR-XXX/@SC-XXX tag in .feature files, verify the ID exists in spec.md. Flag tags referencing non-existent IDs.

H3. Step definition coverage (optional): If tests/step_definitions/ exists, run:

BLOCKED → report undefined steps (HIGH). DEGRADED → note in report only.

Proceed immediately to Step 4.

Step 4 — Severity

Proceed immediately to Step 5.

Step 5 — Analysis Report

Output to console AND write to FEATURE_DIR/analysis.md:

## Specification Analysis Report

| ID | Category | Severity | Location(s) | Summary | Recommendation |
|----|----------|----------|-------------|---------|----------------|

**Constitution Alignment**: principle name -> status (ALIGNED | VIOLATION) -> notes
**Coverage Summary**: requirement key -> has task? -> task IDs -> has plan? -> plan refs
**Phase Separation Violations**: artifact, line, violation, severity
**Metrics**: total requirements, total tasks, coverage %, ambiguity count, critical issues

**Health Score**: <score>/100 (<trend>)

## Score History

| Run | Score | Coverage | Critical | High | Medium | Low | Total |
|-----|-------|----------|----------|------|--------|-----|-------|
| <timestamp> | <score> | <coverage>% | <critical> | <high> | <medium> | <low> | <total_findings> |

Proceed immediately to Step 6.

Step 6 — Persist Health Score

After computing Metrics in Step 5, persist the health score:

  1. Compute: score = max(0, round(100 - (critical×20 + high×5 + medium×2 + low×0.5))).
  2. Read .specify/score-history.json (initialize {} if missing).
  3. Append entry keyed by feature directory name (e.g. 001-user-auth):

{ "timestamp": "<ISO-8601 UTC>", "score": <n>, "coverage_pct": <n>, "critical": <n>, "high": <n>, "medium": <n>, "low": <n>, "total_findings": <n> }

  1. Write updated object back to .specify/score-history.json.
  2. Trend: compare new score to previous entry — ↑ improving / ↓ declining / → stable (or stable if no prior entry).
  3. Display: Health Score: <score>/100 (<trend>) in console and analysis.md.
  4. Include full score_history array for the current feature under the Score History table in analysis.md.

Proceed immediately to Step 7.

Step 7 — Next Actions

Proceed immediately to Step 8.

Step 8 — Offer Remediation

Ask: "Suggest concrete remediation edits for the top N issues?" Do NOT apply automatically.

Finish here.

Operating Principles

Commit, Dashboard & Next Steps

Run post-phase to commit, refresh dashboard, and compute next step in a single call:

Parse next_step from JSON. Present per model-recommendations.md:

Analysis complete!
Next: [/clear → ] <next_step> (model: <tier>)
[- <alt_step> — <reason> (model: <tier>)]
- Dashboard: file://$(pwd)/.specify/dashboard.html
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.