discover-substrate

Inventory codebase specifications, invariants, gotchas, linters, and CI checks.

Updated May 7, 2026
One-click install
npx skills add https://github.com/marktoda/cohesive --skill discover-substrate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: discover-substrate
Source: https://github.com/marktoda/cohesive/tree/main/skills/discover-substrate
Command: npx skills add https://github.com/marktoda/cohesive --skill discover-substrate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When preparing to modify a codebase, teams often lack a clear inventory of existing specifications, named invariants, gotchas, semantic linters, and enforcement mechanisms, leading to broken behavior, duplicated work, and lost institutional knowledge. This skill eliminates that guesswork by systematically surfacing what substrate already exists and what is missing for the exact change surface you are about to touch.

Core Features & Use Cases

  • Structured Substrate Inventory: Runs a bounded scan to categorize all existing normative docs, behavior matrices, invariants, gotchas, tests, CI checks, and custom linters for your target change surface.
  • Concrete Gap Identification: Surfaces missing memory with file:line evidence, so you can address critical gaps before writing code rather than fixing regressions after.
  • Cross-Skill Integration: Serves as the mandatory first step for internal Cohesive workflows including brainstorm-design, audit-substrate, review-codebase, and review-diff, or can be invoked directly for a standalone substrate inventory.
  • Use Case Example: Before rewriting the payment processing spec, run this skill to confirm all existing invariants around transaction idempotency and audit logging are captured, and flag any missing test coverage for edge cases.

Quick Start

Use the discover-substrate skill to inventory all existing specs, invariants, and gotchas for the payment processing subsystem before planning a refactor.

Frequently Asked Questions about discover-substrate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I inventory codebase invariants and gotchas before a refactor?

To inventory codebase invariants before a refactor, run a bounded scan to categorize existing specifications, behavior matrices, named invariants, gotchas, tests, and CI checks for your target change surface. This structured discovery separates existing substrate from missing memory with concrete file:line evidence.

What is codebase substrate discovery and when do I need it?

Codebase substrate discovery is the systematic surfacing of existing specifications, invariants, gotchas, semantic linters, and enforcement mechanisms for a targeted change surface. You need it before modifying code to eliminate guesswork, prevent duplicated work, and avoid losing institutional knowledge.

How do I find missing test coverage and specification gaps before changing code?

Find missing test coverage and specification gaps by running a substrate audit that surfaces missing memory with concrete file:line evidence. This flags critical gaps in existing invariants and tests before you write code, preventing regressions rather than fixing them afterward.

Can I audit a specific subsystem's specifications without scanning the entire repository?

Yes, you can audit a specific subsystem by running a bounded scan targeting your exact change surface. This categorizes all existing normative docs, behavior matrices, invariants, gotchas, tests, and custom linters only for the targeted code area rather than the entire repository.

Does this codebase audit approach work for planning spec rewrites?

Yes, this codebase audit approach works for planning spec rewrites by confirming all existing invariants around behaviors like transaction idempotency and audit logging are captured. It serves as the mandatory first step for refactor planning and spec rewriting workflows.

What should I do after completing a codebase substrate inventory?

After completing a codebase substrate inventory, follow the single recommended next Cohesive skill identified in the structured discovery report. Downstream workflows include brainstorm-design, audit-substrate, review-codebase, and review-diff for processing the surfaced gaps and existing substrate.