Skip to main content
ClaudeWave
Skill132 repo starsupdated 2d ago

skill-align

skill-align audits and fixes documentation drift in Lattice by comparing the live skill inventory against README, docs/, GitHub issue templates, and CLAUDE.md. Run this skill after creating, renaming, or removing any skill, or when documentation references appear outdated or misaligned with the actual codebase structure.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/techygarg/lattice /tmp/skill-align && cp -r /tmp/skill-align/dev-skills/skill-align ~/.claude/skills/skill-align
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# Lattice Sync

**Core responsibility:** Keep every public-facing document in sync with the actual skill inventory. The skills directory is the source of truth — all documents derive from it.

**Input:** None required. Reads the live state of `skills/` and all documentation on every run. Optionally: a specific skill name or tier to focus the audit.

**Output:**
- A findings report listing every gap as `[GAP]`, `[STALE]`, or `[WRONG]` with file and description
- All found gaps fixed in-place across: `README.md`, `docs/how-it-works.md`, `docs/configuration.md`, `docs/practical-guide.md`, `CLAUDE.md`, `.github/ISSUE_TEMPLATE/bug_report.yml`
- A final clean confirmation: "No gaps found" or a list of what was changed

**How to verify this skill did its job:**
```bash
grep -rn "requirements atom\|framework:requirements\b" \
  docs/ README.md CLAUDE.md .github/ skills/ \
  --include="*.md" --include="*.yml"
```
Any result from this grep means the sync is incomplete. A clean run returns no output.

Also verify: every skill in `skills/` appears in the bug_report.yml dropdown and the how-it-works.md inventory tables.

## When to run

- After creating any new atom, molecule, or refiner
- After renaming or removing a skill
- After changing a skill's config key, consumed-by relationships, or output path
- When a user suspects docs are out of date

## Phase 1 — Build the live inventory

Read the skills directory tree. Do NOT assume you already know the inventory — always read from files.

```bash
find skills/ -name "SKILL.md" | sort
```

For each SKILL.md found, extract:
- `name:` field (frontmatter)
- `tier:` inferred from path (`atoms/`, `molecules/`, `refiners/`)
- Config key: grep for `paths\.\w+` in the file
- Consumes: grep for `framework:` references (molecules only)
- Produces: grep for `.lattice/standards/` path (refiners only)
- Output subfolder: grep for `.lattice/\w+/` paths (molecules only)

Build a structured inventory:
```
atoms:    [name, config_key, has_refiner, has_defaults_md]
molecules: [name, composes[], output_subfolder]
refiners:  [name, config_key, produces_path, consumed_by_atom]
```

Read `references/audit-checklist.md` for the complete per-document audit rules before starting Phase 2.

---

## Phase 2 — Audit each document

Work through every document in this order. For each, apply the checks in `references/audit-checklist.md`. Log every finding as:

```
[GAP]    file:line — description of what is missing or wrong
[STALE]  file:line — description of what refers to something that no longer exists
[WRONG]  file:line — description of a relationship (consumed-by, produces) that is incorrect
```

Documents to audit:
1. `docs/how-it-works.md`
2. `docs/configuration.md`
3. `docs/practical-guide.md`
4. `README.md`
5. `CLAUDE.md`
6. `.github/ISSUE_TEMPLATE/bug_report.yml`
7. `.github/ISSUE_TEMPLATE/skill_request.yml` *(generic — only check if skill-specific examples are present)*
8. `.github/ISSUE_TEMPLATE/documentation.yml` *(generic — only check if skill names appear)*
9. `knowledge-base/requirement-forge-requirements.md` *(if exists — check it matches current skill names)*

Present a consolidated findings report before making any changes:

```
## Lattice Sync — Findings

### docs/how-it-works.md
[GAP] Atoms table missing: requirement-quality
[STALE] Refiners in Depth: requirement-forge-refiner consumed-by says "molecule" but should say "requirement-quality atom"

### .github/ISSUE_TEMPLATE/bug_report.yml
[GAP] Skill dropdown missing: requirement-quality (atom)

Total: N gaps, M stale references, P wrong relationships
```

Ask: *"Ready to apply all fixes? Or are there any findings you want to skip?"*

---

## Phase 3 — Fix

Apply every agreed fix. For each document, make all changes in a single edit pass — do not make multiple passes over the same file.

After all fixes are applied, run one final verification grep to confirm no old references remain:

```bash
# Check for stale atom names or wrong consumed-by text
grep -rn "<old-name>\|consumed.*molecule\|consumed.*wrong" \
  docs/ README.md CLAUDE.md .github/ --include="*.md" --include="*.yml"
```

If the grep returns results, fix them before declaring done.

---

## Phase 4 — Deploy (optional)

If the user wants to push the updated skills to their AI tool's skills directory:

```bash
./tools/install.sh /path/to/your/skills/folder
```

Ask the user for the target path if not provided. Default for Claude Code: `~/.claude/skills/`.

---

## Key relationships to always verify

The most error-prone relationship in Lattice documentation is the refiner → atom → molecule chain. Documents frequently drift to say a refiner is "consumed by the molecule" when it's actually consumed by an atom that the molecule composes.

For every refiner in the live inventory, derive the correct relationship dynamically:
1. Read the refiner's SKILL.md — find which atom it says consumes it (look for "consumed by" or "reads this document")
2. Read that atom's Config Resolution — confirm it reads the same `paths.{key}`
3. Read the molecule that composes that atom — confirm the chain is complete
4. If any document says the refiner is consumed by the molecule directly (not the atom), flag `[WRONG]`

Exception: `review-refiner` is consumed by the `review` molecule directly — it configures the molecule's workflow, not an atom. This is the only correct molecule-direct consumption in the current framework.

---

## Known `.lattice/` subfolders

Every molecule that writes living documents must use a named subfolder. If a new molecule is found that writes to `.lattice/` and its subfolder is not in this list, flag it for addition to `CLAUDE.md`:

- `standards/` — refiner outputs
- `context/` — feature anchor docs (context-anchoring atom)
- `learnings/` — review insights
- `reviews/` — review log
- `transform/` — plan-transformation output
- `requirements/` — requirement-forge output

---

## What good looks like

The sync is complete when:
- Every skill in `skills/` ap
skill-forgeSkill

Create a new Lattice skill — atom, molecule, or refiner — following all framework conventions. Writing skill files manually almost always produces convention violations: wrong section order, missing confirmation gates, defaults.md without the right structure. This skill knows all of that and guides you through it. Use whenever adding any new atom, molecule, or refiner to Lattice, or when the user says 'create a new skill', 'add an atom', 'add a molecule', 'add a refiner', 'build X for Lattice', 'new lattice skill', or 'skill forge'. Does not validate, align docs, or deploy — those are separate skills you run after.

skill-reviewSkill

Deep behavioral audit of a Lattice skill — proposes 3 review personas relevant to the skill, runs independent scenario analysis from each persona's perspective, then merges only the high-confidence, practical findings into a severity-ordered gap report with proposed fixes. Structural validation (conventions, cross-references) is skill-validate's job — this skill finds gaps that would realistically surface when someone actually uses the skill: missing scenario handling, ambiguous instructions, silent failure cases, and behavioral inconsistencies. Filters out theoretical edge cases, low-likelihood speculation, and findings owned by other skills. Use after writing or significantly changing any skill, or when the user says 'review this skill', 'deep review', 'does this skill work', 'find gaps in this skill', 'stress test this skill', 'review from different angles', or 'skill review'. Standalone — does not call other skills.

skill-validateSkill

Validate any Lattice SKILL.md against all tier conventions — atoms, molecules, and refiners. Catches structural errors, broken cross-references, and convention violations before they reach the repo. If you just wrote or modified a Lattice skill file and haven't run this yet, run it now — manual review consistently misses the same categories of errors this skill is specifically designed to catch. Use when the user says 'validate this skill', 'check this skill', 'does this follow conventions', 'review this skill file', 'check my SKILL.md', or 'skill validate'. Reports PASS/FAIL with specific file-and-section findings and actionable fixes. Standalone — does not call other skills.

architecture-compassSkill

Architectural thinking partner for an existing repository — scans the codebase, conducts a structured interview, agrees on current architectural state and recommended direction, and produces a shareable insights document. Scoped to one repository, module, or folder. Does not execute transformation — it orients. Use when the user says 'assess my codebase architecture', 'what direction should my codebase go', 'architecture compass', 'understand my architecture', 'audit architecture drift', 'architectural assessment', or 'help me understand what is wrong with my codebase'.

architecture-refinerSkill

Facilitate a structured conversation to define architecture principles for a repository. Supports multiple architecture styles: clean architecture (default), hexagonal / ports & adapters, modular monolith, or custom. Produces a formal architecture document that the corresponding atom will use. Use when setting up a new project, defining architecture standards, or when the user says 'setup architecture', 'define layers', 'architecture principles', 'help me define my architecture', 'hexagonal architecture', 'modular monolith', 'ports and adapters', or 'define my architecture style'.

architectureSkill

Enforce architectural rules when generating or modifying code. Defaults to clean architecture; supports any architecture style via the architecture-refiner. Validates layer responsibilities, dependency direction, and structural constraints using the loaded architecture rules. Use when generating code, reviewing architecture, creating new files, or when the user mentions 'architecture', 'layers', 'structure', 'dependency rules', 'hexagonal architecture', 'ports and adapters', 'modular monolith', or 'onion architecture'. Also use when reviewing generated code for structural compliance.

bug-fixSkill

Investigate, reproduce, and safely fix a bug with regression protection. Composes context, diagnosis, architecture, code quality, and testing guardrails into a reproduce-first repair workflow. Use when the user says 'fix this bug', 'debug this', 'investigate this failure', 'patch this regression', 'repair this issue', or 'why is this broken'.

clean-code-refinerSkill

Facilitate a structured conversation to define clean code principles for a repository. Produces a formal clean-code.md document that the clean-code atom will use as its override. Use when setting up coding standards, defining code quality rules, or when the user says 'setup clean code', 'define coding standards', 'code quality principles', 'coding guidelines', or 'help me define my code standards'.