Help us improve
Share bugs, ideas, or general feedback.
From pharaoh
Analyzes sphinx-needs projects for gaps, redundancies, inconsistencies in requirements traceability, orphans, status contradictions, and ID/schema validation.
npx claudepluginhub useblocks/pharaoh --plugin pharaohHow this skill is triggered — by the user, by Claude, or both
Slash command
/pharaoh:pharaoh-meceThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill's visible output is the full **MECE Analysis Report** as defined in Step 9. The report is mandatory -- every invocation MUST emit the complete report with all sections (omit only sections with no findings, but always emit the Summary section). The session-state update in Step 8 is internal bookkeeping and MUST NOT replace the report in the output.
Detects one gap category (orphan, unverified, duplicate, contradictory, lifecycle, etc.) in a sphinx-needs corpus and returns ordered list of affected needs with evidence.
Verifies V-Model artifact graph integrity: checks dead links, orphan artifacts, backlog completeness, valid references across BA sections, Epics, Features, Success Criteria, ADRs, arc42 sections, PLANs, Backlog, Wayfinder rows, and code. Syntactic default; semantic via agent.
Authors, updates, and validates atomic functional and non-functional requirements with traceability matrices, validation packs, and explicit human-in-the-loop approvals. Use for creating or reviewing requirements as source of truth.
Share bugs, ideas, or general feedback.
This skill's visible output is the full MECE Analysis Report as defined in Step 9. The report is mandatory -- every invocation MUST emit the complete report with all sections (omit only sections with no findings, but always emit the Summary section). The session-state update in Step 8 is internal bookkeeping and MUST NOT replace the report in the output.
Failure modes:
Non-interactive callers (claude -p, CI, batch) cannot reach the report past a follow-up prompt. The skill MUST be self-terminating.
Analyze a sphinx-needs project for structural completeness and consistency. MECE stands for Mutually Exclusive, Collectively Exhaustive. This skill finds gaps in traceability coverage (not exhaustive), redundant or overlapping requirements (not mutually exclusive), and status or ID inconsistencies across the needs set.
Review skills (e.g. pharaoh:req-review) check the content of individual needs -- whether the
requirement text is clear, whether test cases adequately cover what they claim,
whether implementations match their specifications.
pharaoh:mece checks the structure of the requirements set as a whole --
whether every need is connected to the traceability chain, whether the chain has
gaps, and whether the set is internally consistent.
Both skills are complementary. Running them together gives full coverage of content quality and structural integrity.
In safety-critical domains (ISO 26262, IEC 62304, DO-178C, A-SPICE), regulatory audits require evidence of complete bidirectional traceability from top-level requirements through specifications, implementations, and tests. A single orphan requirement or broken link chain can result in audit findings. This skill automates the structural checks that catch these problems before an auditor does.
Follow these steps in order. Do not skip steps. If a step fails or produces no data, note that in the final report and continue to the next step.
Follow the instructions in skills/shared/data-access.md completely. At the
end of data access you must have:
req, spec, impl, test).links plus all extra_link names (e.g.,
implements, tests).Read pharaoh.toml and extract the [pharaoh.traceability] section. Record
the required_links array. These rules drive gap analysis in Step 2.
If pharaoh.toml does not exist or required_links is missing/empty, use the
following defaults based on the detected need types:
req and spec types exist: "req -> spec"spec and impl types exist: "spec -> impl"impl and test types exist: "impl -> test"Only apply default rules for type pairs that actually exist in the project configuration. Do not assume types that are not configured.
Present the data access summary before proceeding:
Project: <name> (<config source>)
Types: <list of directive names>
Links: <list of link type names>
Data source: <tier and version>
Needs found: <count>
Strictness: <advisory or enforcing>
Required chains: <list of required_links rules>
For each rule in the required_links list (or the defaults from Step 1):
"<source_type> -> <target_type>"
(e.g., "req -> spec").type matches <source_type>.links, implements, tests, or any extra_link)
to a need whose type matches <target_type>.When checking links, resolve them transitively only one level deep. That is,
check direct links only. Do not follow chains (e.g., if req -> spec -> impl
are two separate rules, check each rule independently).
When checking link targets, match on the type of the target need, not on
the ID prefix. Look up each linked ID in the needs index and check its type
field.
Record each gap as:
"req -> spec")If ubc CLI is available, also run ubc check and incorporate any traceability
warnings it reports. Merge ubc results with the file-based analysis to avoid
duplicates.
Scan the needs index and link graph to classify each need:
Completely disconnected (orphans): A need that has NO incoming links AND no outgoing links of any kind. It is entirely isolated from the traceability graph.
Dead ends: A need that has incoming links but no outgoing links. This is expected for leaf types -- types that sit at the end of the traceability chain (typically test cases, or top-level requirements that have no parent). It is unexpected for intermediate types (e.g., a specification with no implementation link).
Determine leaf types from the required_links rules:
<source_type> in any rule is a leaf type.
Example: if the rules are req -> spec, spec -> impl, impl -> test,
then test is a leaf type because it never appears on the left side.<target_type> in any rule is a root type.
Example: req is a root type because it never appears on the right side.Classification:
| Condition | Root type | Intermediate type | Leaf type |
|---|---|---|---|
| No incoming, no outgoing | Orphan (warning) | Orphan (error) | Orphan (error) |
| Has incoming, no outgoing | N/A (root has no incoming by definition) | Dead end (error) | Expected (ok) |
| No incoming, has outgoing | Expected (ok) | Missing parent (warning) | Unexpected parent (info) |
| Has incoming, has outgoing | Unexpected (info) | Expected (ok) | Unexpected (info) |
Record each finding with:
Check for potential duplicates within each need type. Compare needs of the same type only -- needs of different types are expected to have related content (e.g., a spec that mirrors a req is correct, not redundant).
Title similarity: For each pair of needs of the same type, compare their titles. Flag pairs where:
Content similarity: For each pair of needs of the same type, compare their content bodies. Flag pairs where:
Structural similarity: For each pair of needs of the same type, compare their link sets. Flag pairs where:
Do not attempt full semantic analysis. Use string-level comparison only. The goal is to surface obvious duplicates that a human reviewer should evaluate.
For each potential redundancy, record:
Always flag redundancies as informational. Redundancy may be intentional. Never suggest automatic resolution.
Check for contradictions between the statuses of linked needs. These checks apply regardless of the link type used.
Parent closed, child open:
If a parent need has status matching any of closed, done, verified,
approved (case-insensitive), but a child need linked from it has status
matching any of open, draft, in_progress, todo (case-insensitive),
flag the inconsistency. The parent appears complete, but work remains on its
child.
Child closed, parent open: If all children of a need have a closed-family status, but the parent itself has an open-family status, flag it. The parent may be ready to close.
Status vs. link existence:
implemented (or similar) that has no outgoing link to
any impl-type need is suspicious.verified or tested that has no outgoing link to any
test-type need is suspicious.For each inconsistency, record:
Check that all need IDs conform to the project's expected patterns.
From pharaoh.toml:
If pharaoh.toml defines [pharaoh.id_scheme] with a pattern, use that
pattern as the expected format. The pattern is a template string like
"{TYPE}-{MODULE}-{NUMBER}". Convert it to a validation check:
{TYPE} should match the need's type prefix.{MODULE} should be an uppercase alphanumeric string.{NUMBER} should be a zero-padded integer of at least id_length digits.From ubproject.toml:
If no pharaoh.toml pattern exists, use the type prefixes from ubproject.toml.
Each need's ID should start with its type's prefix value (e.g., REQ_ for
req type needs).
Duplicate ID check: Scan all need IDs across all files. Report any ID that appears more than once. Include the file paths and line numbers of each occurrence.
ID format consistency:
Even without an explicit pattern, check that all IDs of the same type follow a
consistent format. If most req IDs are REQ_NNN but one is req-42, flag
the outlier.
For each violation, record:
If the data access tier is ubc CLI (Tier 1):
ubc schema validate from the project root. Parse the output for
validation errors and warnings.ubc check from the project root. Parse the output for lint findings.If ubc CLI is not available, skip this step and note in the report:
Schema validation: Skipped (ubc CLI not available)
This step is internal bookkeeping. Perform it silently before emitting the report in Step 9 -- do not narrate it in the visible output.
Update the session state file (.pharaoh/session.json) as described in
skills/shared/strictness.md:
.pharaoh/session.json (or create the default structure
if it does not exist).global.mece_checked to true.global.mece_timestamp to the current ISO 8601 timestamp.updated to the current ISO 8601 timestamp.The interaction with require_mece_on_release is described in Section 3
(Strictness Behavior).
This is the skill's visible output. Compile all findings into a single structured report. Use the format below exactly. Omit sections that have no findings (but mention "None found" in the summary counts). Always emit the Summary section. After emitting the report, end the turn -- do not ask the user follow-up questions.
## MECE Analysis Report
### Project
- Name: <project name>
- Data source: <tier>
- Needs analyzed: <total count>
- Types: <list>
- Required chains: <list of rules>
### Gaps (Missing Coverage)
| Source | Type | Missing | Required By |
|--------|------|---------|-------------|
| <id> | <type> | No <target_type> | <rule> |
| ... | ... | ... | ... |
### Orphans
| Need ID | Type | Title | Issue | Severity |
|---------|------|-------|-------|----------|
| <id> | <type> | <title> | <description> | error/warning/info |
| ... | ... | ... | ... | ... |
### Potential Redundancies
| Need A | Need B | Similarity | Reason |
|--------|--------|------------|--------|
| <id> | <id> | Title/Content/Structural | <brief reason> |
| ... | ... | ... | ... |
### Status Inconsistencies
| Need ID | Status | Issue | Severity |
|---------|--------|-------|----------|
| <id> | <status> | <description> | warning |
| ... | ... | ... | ... |
### ID Violations
| Need ID | Expected Pattern | Issue | Severity |
|---------|-----------------|-------|----------|
| <id> | <pattern> | <description> | error/warning |
| ... | ... | ... | ... |
### Schema Validation
<ubc results or "Skipped (ubc CLI not available)">
### Summary
- Gaps found: <N> (errors)
- Orphans: <N> (<X> errors, <Y> warnings, <Z> info)
- Redundancies: <N> (info)
- Status issues: <N> (warnings)
- ID violations: <N> (<X> errors, <Y> warnings)
- Schema issues: <N or "skipped">
- Overall health: <good / needs-attention / critical>
Overall health classification:
Emit the report and end the turn.
Follow the instructions in skills/shared/strictness.md for all strictness
decisions.
This skill has no gates. It executes freely in both advisory and enforcing mode. There is no prerequisite skill that must run before MECE analysis.
When pharaoh.toml contains:
[pharaoh.workflow]
require_mece_on_release = true
then pharaoh:release requires a passing MECE check before it can proceed
(in enforcing mode). The session state field global.mece_checked must be
true.
In advisory mode, if require_mece_on_release = true and MECE has not been
run, pharaoh:release shows:
Tip: Consider running pharaoh:mece to check for gaps before release.
If the user modifies needs after a MECE check, the session state is NOT
automatically invalidated. The recorded mece_checked = true persists until
the session is reset. This is by design -- the user decides when to re-run.
If you observe that needs were modified since the last MECE timestamp (by
comparing file modification times to global.mece_timestamp), mention this
in your output:
Note: Needs files were modified after the last MECE check
(<timestamp>). Consider re-running pharaoh:mece for an up-to-date analysis.
The user may request a scoped analysis instead of a full project scan. Support the following scope modifiers. If no scope is specified, default to full project analysis.
Analyze all needs across all files in all detected project roots. This is the
default when the user invokes pharaoh:mece with no arguments.
When the user specifies a file path or directory:
auth/requirements.rst may link to a
need in shared/types.rst -- that link must still be validated.Scope: auth/requirements.rst (12 of 47 needs)
When the user specifies a type (e.g., "check only specs" or "mece for requirements"):
Scope: type=spec (15 of 47 needs)
When the user specifies a level of the chain (e.g., "check the spec -> impl link" or "mece for the implementation level"):
Scope: chain spec -> impl (15 specs, 22 impls)
Scopes can be combined. For example, "check specs in auth/" applies both the type filter and the directory filter. Apply all filters as a logical AND -- a need must match all specified criteria to be in scope.