src/autoskillit/skills_extended/audit-cohesion/SKILL.md
Audit codebase for internal cohesion - how well components fit together and maintain consistent patterns. Distinct from audit-arch (which checks rule violations); this checks integration fitness and convergence. Use when user says "audit cohesion", "check cohesion", "cohesion audit", or "alignment check".
npx skillsauth add talont-org/autoskillit audit-cohesionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Audit the codebase for internal cohesion: how well components integrate and maintain consistent patterns across boundaries.
Key Distinction: audit-arch checks whether architectural rules are followed (violations). audit-cohesion checks whether components fit together (alignment, consistency, completeness). A codebase can pass all architectural rules yet still have poor cohesion — parallel structures that diverge, registries with missing entries, or scattered features.
NEVER:
run_in_background: true is prohibited)ALWAYS:
{{AUTOSKILLIT_TEMP}}/audit-cohesion/ (create if needed){{AUTOSKILLIT_TEMP}}/audit-cohesion/cohesion_audit_{YYYY-MM-DD_HHMMSS}.mdThe report must be plan-ready. Every finding must contain enough detail that a /autoskillit:make-plan invocation can act on it without re-investigating the codebase.
ENUMERATE, do not summarize. The following are NOT acceptable findings:
| Bad (anemic) | Good (actionable) | |---|---| | "16 fields missing from registry" | Table listing each missing field name, its source file:line, and suggested lifecycle category | | "Several source modules without tests" | Table listing each untested module path and what it does | | "Export depth inconsistent" | Table listing each symbol that requires deep imports, its deep path, and where consumers import it from | | "48 files use broad exception handlers" | Table listing each file:line, the exception type caught, and what it catches |
Minimum per dimension: Each dimension section MUST contain:
If a dimension has no findings (scores STRONG), still provide the evidence: what was checked, how many items passed, and key file paths examined.
Each subagent MUST structure its response as:
## Dimension: C{N} — {Name}
### Score: {STRONG|ADEQUATE|WEAK|FRACTURED}
### Methodology
{What was searched, how many items checked, key directories examined}
### Findings Table
| {columns appropriate to dimension} |
|---|
| {row per finding} |
### Evidence
{For each finding, the specific file:line, what was expected, what was found}
### Compliant Patterns
{Specific examples of things that ARE working well, with file:line}
Subagents must NOT return prose summaries. They must return structured data (tables, lists with file:line). If a subagent returns "X items are inconsistent" without listing each item, the finding is incomplete and must be expanded before inclusion in the report.
Question: Do parallel structures maintain consistent patterns, or have they diverged?
Audit Strategy:
| Directory/File | Planner Has? | Executor Has? | Symmetric? | Notes |
|---------------|-------------|--------------|------------|-------|
| nodes/ | Yes | Yes | Yes | — |
| checkpointer.py | Yes (single file) | Yes (directory/) | NO | Naming: PlannerCheckpointer vs HybridCheckpointer |
List ALL directories and key files, not just divergent ones.
| Repository | Extends Base? | Has Interface? | Has Factory Method? | Method Pattern | |-----------|--------------|---------------|--------------------|--------------|
| Pattern | Planner Implementation | Executor Implementation | Consistent? | |---------|----------------------|------------------------|-------------| | Worker dispatch | Send API via prep node | Send API via prep node | Yes | | State wrapper | StatePropagatingWrapper | ... | ... |
| Template Type | Planner Path | Executor Path | Shared Partials | Divergence | |--------------|-------------|--------------|----------------|-----------|
Question: Are adapter, factory, and contract chains complete with no missing links?
Audit Strategy:
| State Field | In PersistenceAdapter? | Database Column | Bidirectional? | |------------|----------------------|----------------|---------------|
| Table Model | Has Repository? | Has Factory Method? | Factory Method Name | |------------|----------------|--------------------|--------------------|
| Interface | Contract Test File | Tests Count | Full Surface Covered? | |-----------|-------------------|-------------|---------------------|
| Location (file:line) | SQLModel Type | Destination | Violation? | |---------------------|--------------|------------|-----------|
Question: Is related functionality co-located, or scattered across unrelated packages?
Audit Strategy:
| Feature | File Path | Role in Feature | Package |
|---------|----------|----------------|---------|
| Checkpointing | agents/graph/planner/checkpointer.py | Planner checkpointing | agents |
| Checkpointing | agents/graph/executor/checkpointer/checkpointer.py | Executor checkpointing | agents |
| Checkpointing | packages/sdk/graph/checkpointer.py | Base abstraction | sdk |
Audit at minimum: checkpointing, work package execution, plan compilation, canvas sync, test framework detection.
| SDK Module | Total Importers | Planner-Only | Executor-Only | Shared | Verdict |
|-----------|----------------|-------------|--------------|--------|---------|
| sdk/execution/executor_scope.py | 8 | 0 | 8 | 0 | Misplaced — executor-only |
| Module | Importer Count | Is Shared Infrastructure? | |--------|---------------|-------------------------|
Question: Are naming patterns consistent across the codebase?
Audit Strategy:
| Suffix | Count | Examples | Exceptions |
|--------|-------|---------|-----------|
| *Repository | 27 | PlanRepository, PhaseRepository | — |
| *Checkpointer | 2 | PlannerCheckpointer, HybridCheckpointer | Mixed naming strategy |
| Verb | Count | Files | Synonym Conflicts |
|------|-------|-------|------------------|
| get_ | 218 | 32 files | None |
| fetch_ | ? | ? | Conflicts with get_? |
| File | Pattern Expected | Pattern Found | Location | |------|-----------------|---------------|----------|
| Enum Class | Value Style | Location | Consistent? | |-----------|------------|----------|-------------|
Question: Does the test structure mirror the source structure, with no orphans or gaps?
Audit Strategy:
| Source Module | Test File | Exists? | Test Count |
|--------------|-----------|---------|-----------|
| agents/graph/executor/nodes/execute/worker.py | tests/agents/graph/executor/nodes/test_worker.py | Yes | 12 |
| packages/sdk/code_intelligence/lens.py | — | NO | 0 |
List ALL gaps — every source file without a corresponding test file.
| Test File | Expected Source | Source Exists? | |-----------|----------------|---------------|
| Test File | Current Dir | Expected Dir | Reason | |-----------|-------------|-------------|--------|
| Fixture File | Referenced By | Still Valid? | |-------------|-------------|-------------|
Question: Are all registries internally consistent and complete?
Audit Strategy:
| Field Name | In State Schema? | In Field Registry? | Lifecycle Category | Source File:Line |
|-----------|-----------------|-------------------|-------------------|-----------------|
| session_started_at | Yes (unified_state.py:42) | NO | — | Missing |
List EVERY missing field.
| Phase | In Registry? | Hardcoded Elsewhere? | Location of Hardcode | |-------|-------------|---------------------|---------------------|
| Role | In Registry? | Has Prompt Template? | Template Path | Gap |
|------|-------------|---------------------|--------------|-----|
| Provider | Yes | NO | — | Missing provider_guidance.j2 |
| Tool | In Registry? | In pyproject.toml? | In pre-commit? | Gap | |------|-------------|-------------------|---------------|-----|
Question: Do prompt templates match the agents and nodes that consume them?
Audit Strategy:
| Template File | Consumer (renderer method or node) | Variables Expected | Variables Provided | Gap | |--------------|----------------------------------|-------------------|-------------------|-----|
| Template File | Any Consumer Found? | Last Modified | |--------------|-------------------|--------------|
| Partial File | Used by Planner? | Used by Executor? | Truly Shared? | |-------------|-----------------|------------------|--------------|
| Node File:Line | Prompt Construction | Should Use Template? | |---------------|--------------------|--------------------|
Question: Are __init__.py exports consistent, complete, and intentional?
Audit Strategy:
| Symbol | Shallow Import (from packages.X import Y) | Deep Import Required? | Consumer Count |
|--------|---------------------------------------------|---------------------|---------------|
| Plan | Yes | No | 45 |
| ExecutorGraphState | No | from packages.schema.state.executor_state import ... | 23 |
List EVERY symbol that requires deep imports but has 5+ consumers.
__all__ consistency:| Package | Has __all__? | __all__ Count | Actual Public Symbols | Delta |
|---------|---------------|----------------|---------------------|-------|
| Symbol | Import Variants Found | Count Each | Dominant Pattern | |--------|---------------------|-----------|-----------------|
| Re-export | Source Location | Target Location | Target Exists? | |-----------|----------------|----------------|---------------|
Question: Are error patterns (exceptions, logging, error states) consistent across the codebase?
Audit Strategy:
| Exception Class | Base Class | Defined In | Used In (files) | Agent-Specific? | |----------------|-----------|-----------|----------------|----------------|
Flag duplicates (same name in different agents).
| Error Field | In Planner State? | In Executor State? | Same Semantics? | |------------|-------------------|-------------------|----------------|
except Exception or except BaseException:| File:Line | Exception Caught | Handler Action | Justified? | |-----------|-----------------|----------------|-----------|
| File | Logger Pattern | Consistent? | |------|--------------|-------------|
Spawn subagents for each cohesion dimension. Each subagent MUST be instructed:
"You are conducting a thorough cohesion audit. Your output must be EXHAUSTIVE — enumerate every item, do not summarize. Return structured tables, not prose. Every finding needs a file:line reference. If you find 16 missing fields, list all 16 with their source locations. If you find 48 files with broad exception handlers, list all 48. Completeness is more important than brevity. This is a research task — DO NOT modify any code."
Grouping (spawn 5 subagents, one dimension each or grouped by relatedness):
| Subagent | Dimensions | Focus | |----------|-----------|-------| | 1 | C1, C4 | Structural symmetry + naming consistency (side-by-side comparison tables) | | 2 | C2, C8 | Interface completeness + export surface (adapter/factory chain verification) | | 3 | C3, C9 | Feature locality + error handling (file mapping + exception census) | | 4 | C5 | Test-source alignment (enumerate EVERY source module and its test status) | | 5 | C6, C7 | Registration completeness + prompt-agent alignment (registry gap tables) |
After all subagents return:
Ensure {{AUTOSKILLIT_TEMP}}/audit-cohesion/ exists (mkdir -p).
Write to {{AUTOSKILLIT_TEMP}}/audit-cohesion/cohesion_audit_{YYYY-MM-DD_HHMMSS}.md. (relative to the current working directory)
The report WILL be long. This is expected and correct — thoroughness over brevity.
If report exceeds 500 lines, split into parts at natural dimension boundaries:
_scorecard.md — scorecard, cross-dimension patterns, recommended focus areas_c1_c4.md — dimensions C1 through C4 with full tables_c5_c9.md — dimensions C5 through C9 with full tablesEach part must reference the other parts by filename.
Display:
Each dimension section in the report MUST follow this structure:
## C{N}: {Dimension Name}
### Score: {STRONG|ADEQUATE|WEAK|FRACTURED}
### Methodology
- Directories examined: {list}
- Items checked: {count}
- Tools used: {grep patterns, glob patterns}
### Findings
#### {Finding Category 1}
| {Column Headers Appropriate to Finding} |
|---|
| {One row per item — EVERY item, not a sample} |
#### {Finding Category 2}
{... same pattern ...}
### Compliant Patterns
- {file:line} — {what's working well and why}
### Remediation Checklist
- [ ] {Specific action item with file path}
- [ ] {Next action item}
Do NOT flag:
{{AUTOSKILLIT_TEMP}}/config/STRONG: Components fit together cleanly. Patterns are consistent, interfaces are complete. No action needed.
ADEQUATE: Minor gaps or inconsistencies that don't impede development. Low-priority cleanup opportunities.
WEAK: Noticeable friction when working across components. Developers need tribal knowledge to navigate inconsistencies. Should be addressed in next refactor cycle.
FRACTURED: Components don't fit together. Patterns are inconsistent, interfaces have gaps. Active impediment to development. Requires dedicated remediation effort.
development
Generate YAML recipes for .autoskillit/recipes/. Use when user says "make script skill", "generate script", "script a workflow", "write a script", "create a script", "new recipe", "write a pipeline", or when loaded by other skills for script formatting.
data-ai
Create Uncertainty Representation visualization planning spec showing error bar definitions, distribution-aware alternatives, and multi-seed variance protocols. Statistical lens answering "How is uncertainty honestly represented?"
data-ai
Create Temporal Dynamics visualization planning spec showing axis scaling (linear vs log), smoothing disclosure, epoch/step alignment, run aggregation (mean + variance bands), early-stopping markers, and wall-clock vs step-count x-axis. Temporal lens answering "Are training dynamics shown clearly and honestly?"
data-ai
Create Narrative Story Arc visualization planning spec showing visual consistency across the report (same color = same model everywhere), logical figure progression, redundant figure detection, and narrative dependency between figures. Narrative lens answering "Do the figures tell a coherent story across the report?"