hygiene
Audit project structure for convention violations, missing files, template drift, and cross-platform sync gaps — optionally auto-fix
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- hygiene
- type
- analysis
- version
- v0.0
- description
- Audit project structure for convention violations, missing files, template drift, and cross-platform sync gaps — optionally auto-fix
- argument-hint
- [audit|fix] [skills|tasks|docs|codex|all]
02 资源文件 1
- 其他routing-eval.jsonl232 B
03 SKILL.md 正文
Hygiene — Project Structure Audit
Checks that project files follow established conventions, flags gaps and drift, and optionally fixes mechanical issues. Think of it as a linter for project structure rather than code.
Process
1. Determine Mode and Scope
Parse $ARGUMENTS:
- Mode:
audit(default, read-only) orfix(apply mechanical fixes) - Scope:
skills,tasks,docs,codex, orall(default)
Read CLAUDE.md for project conventions. Read docs/skills-reference.md for the canonical skill list. For docs scope, also read references/documentation-templates.md from this skill directory.
2. Audit Skills (skills scope)
For each skill directory in base/claude/*/SKILL.md, base/codex/*/SKILL.md, packs/*/claude/*/SKILL.md, and packs/*/codex/*/SKILL.md:
Frontmatter check:
- Has
namefield — matches directory name - Has
descriptionfield — non-empty, under 120 characters - Has
versionfield — valid semver (X.Y.Z) - Has
argument-hintfield (can be empty)
Section check:
- Has a top-level
# Headingthat matches the skill's purpose - Has
## Processsection with numbered steps - Has
## Output Formatsection (or explicit "no files written" note) - Has
## Constraintssection
Naming check:
- Directory name uses kebab-case
- Directory name matches frontmatter
name
Flag each violation with the file path and what's wrong.
3. Audit Tasks (tasks scope)
Check expected project files exist based on project phase:
Always expected:
tasks/roadmap.md— has content, not just a placeholdertasks/todo.md— has content with checkable items (- [ ]or- [x])tasks/manual-todo.md— if it exists, has content with checkable human-only external items (- [ ]or- [x]) and_(blocks: ...)_or_(after: ...)_annotationstasks/record-todo.md— if it exists, contains non-blocking condition-gated records with source, condition, non-blocking reason, evidence, and promotion rule fieldstasks/recurring-todo.md— if it exists, contains cadence-based tasks with cadence, owner/agent, last run, next due, evidence/output path, and escalation fieldstasks/history.md— exists
Expected if specs exist:
tasks/ideas.md— exists ifspecs/*.mdhas 2+ files
Phase archives:
- If
tasks/roadmap.mdhas completed phases (checked-off milestones),tasks/phases/should exist with correspondingphase-N.mdfiles
Staleness (informational, not violations):
tasks/todo.mdhas all items checked but phase isn't marked complete intasks/roadmap.mdtasks/manual-todo.mdhas unchecked items that block completed steps intasks/todo.mdtasks/record-todo.mdhas eligible items that may need promotion intotasks/todo.mdtasks/recurring-todo.mdhas due items that may need promotion intotasks/todo.mdtasks/roadmap.mdreferences phases that have no corresponding detail
4. Audit Docs (docs scope)
Skills reference sync:
- Every base core directory has a corresponding entry in
docs/skills-reference.md - Every pack directory is listed under its pack in
docs/skills-reference.md - The base core table and pack skill lists are complete (no missing, no extras)
Required docs:
CLAUDE.mdexists at project root- If
AGENTS.mdexists, it should not contradict the workflow/pipeline conventions inCLAUDE.md
Documentation template audit:
- Classify generated Markdown files by path pattern and validate them against
references/documentation-templates.md - Check canonical roots:
tasks/for roadmap, todo, history, manual tasks, record tasks, recurring tasks, phase archives, handoff, deployment ledgers, and lessonsspecs/for implementation specifications and interview logsresearch/for research docs, interview logs, search logs, experiments, and reconciliation reportsdocs/specifications/only as a fallback spec locationalignment/*.htmlfor generated browser-review alignment artifacts from planning and prototype workflows
- Check canonical root directories exist:
tasks/— Warning if absentresearch/— Info if absent; Warning if absent AND research-pattern files (icp-*.md,gtm-*.md,competitive-*.md,journey-*.md,metrics.md,monetization.md,customer-feedback*.md) exist elsewhere (e.g.,docs/)specs/— Info if absent; Warning if absent AND spec-pattern files exist elsewherealignment/— Info if present; generated HTML review pages are allowed here and should not be treated as misplaced documentation
- Flag legacy or drifted planning locations such as new
docs/plan.mdor newdocs/phases/phase archives; current workflows write plans undertasks/ - Exempt archived snapshots under
docs/history/archive/**from template checks - Treat unknown hand-written docs as Info unless they are clearly generated workflow artifacts
Universal generated-doc checks:
- First non-empty Markdown heading is exactly one
#H1 - Required sections for the file family are present once and in the expected order
- Non-ledger research/spec/task artifacts include a metadata quote block when the template requires it
- Checkable workflow docs use
- [ ]/- [x]items where later skills need task state - Main research/spec docs end with
## Next Steps, or explicitly state why no next step exists
Family-specific checks:
tasks/roadmap.mdhas a summary, phase overview, repeated## Phase N:sections, phase milestones or acceptance criteria, and cross-phase concerns when multi-phasetasks/todo.mdhas checkable work, a priority task queue, or a priority documentation todo, and does not contain the full multi-phase roadmap except during legacy migrationtasks/manual-todo.mdhas checkable human-only external items, every unchecked item includes_(blocks: Step N.X)_or_(after: Step N.X)_, and no item is repo/code/config/test/audit/CLI/API work the agent can executetasks/record-todo.mdhas checkable non-blocking record items with source, condition, non-blocking reason, required data/access, measurement/query, target note, revisit cadence/date, completion evidence, and promotion ruletasks/recurring-todo.mdhas cadence-based items with task, cadence, owner/agent, scope, trigger, last run, next due, command/skill, evidence/output path, and escalation conditionstasks/history.mdis append-only with dated entriestasks/phases/phase-N.mdhas completed steps, milestone or acceptance criteria, and an## On Completionor equivalent completion summaryspecs/*.md,specs/{app}/*.md, and fallbackdocs/specifications/*.mdhave spec sections for overview, goals, non-goals, detailed design, edge cases, test plan, acceptance criteria, and open questions or explicitNone*-interview.mdlogs include questions, options when presented, responses or decisions, and final deviations or coverage summaryresearch/*.mdandresearch/{app}/*.mdhave metadata, summary, source/evidence orientation, assumptions or risks when relevant, and next stepsresearch/*-search-log.mdfiles are clearly marked as supporting context and include queries, findings, and source attributionresearch/experiments/*.mdhas hypothesis, method, success criteria, timeline, budget, decision rules, results, and next stepssync.mduses## Dependencies,## Conflict Resolution,## Custom, and## Notificationstasks/deploys.mdhas environment headings with dated deployment ledger entries including branch, commit range, commit count, and status.agents/project.json, when present, is valid JSON and includes project designation fields used by pack-aware skills
5. Audit Codex Mirror (codex scope)
Compare Claude and Codex directories within each root:
- Every skill in
base/claude/should have a correspondingbase/codex/<name>/SKILL.md - Every skill in
packs/<pack>/claude/should have a correspondingpacks/<pack>/codex/<name>/SKILL.md - Flag skills that exist in one but not the other
- For skills that exist in both, check that the codex version has:
- Matching frontmatter
nameanddescription - An
agents/openai.yamlmanifest (if the skill is execution-oriented, not display-only)
- Matching frontmatter
Known exceptions (skills that intentionally only exist in one platform):
- Check for a
# codex-skipcomment in the claude skill's frontmatter — if present, don't flag the missing codex mirror
6. Generate Report
Categorize all findings:
| Severity | Meaning |
|---|---|
| Error | Convention violation that should be fixed (missing required field, naming mismatch) |
| Warning | Drift or gap that may be intentional (missing codex mirror, incomplete sections) |
| Info | Suggestions for improvement (long descriptions, missing optional sections) |
For documentation templates, use:
- Error for automation-breaking structure: missing checkboxes in
tasks/todo.md, missing manual blocker annotations, executable work misfiled intasks/manual-todo.md,tasks/record-todo.md, ortasks/recurring-todo.md, malformed phase numbering, multiple H1 headings, invalid.agents/project.json, or missing required task/spec sections that downstream skills parse. - Warning for template drift: missing metadata, missing
## Next Steps, missing spec acceptance criteria, research docs without source/evidence orientation, or legacy roots that should move to canonical locations. - Info for uncertain classifications, old hand-written docs, optional sections, or cleanup suggestions that do not block automation.
7. Auto-Fix (if fix mode)
Only fix mechanical, unambiguous issues:
- Add missing
argument-hint:field (empty) to frontmatter - Fix
namefield to match directory name - Create missing Codex mirror in the matching root from the Claude version (copy frontmatter + intro, add TODO for Codex-specific content)
- Add missing skill entries to the appropriate base core table or pack list in
docs/skills-reference.md - Add missing empty metadata scaffold only when the target generated-doc template explicitly requires metadata and the values can be left blank
- Normalize duplicate blank lines around headings in generated docs when it is purely mechanical
Never auto-fix:
- Missing Process/Output/Constraints sections (these need human judgment)
- Content mismatches between claude and codex versions
- Roadmap or todo content
- Summaries, sources, acceptance criteria, research claims, history entries, task status, or next-step recommendations
- Spec/research document rewrites that should use the archive-first replacement policy from the generating skill
After fixing, re-run the audit to show remaining issues.
Output
Display directly to the user (no files written in audit mode):
## Hygiene Report — [scope]
### Errors (X)
- **base/claude/foo/SKILL.md** — missing `version` field in frontmatter
- **packs/business-discovery/claude/bar/SKILL.md** — directory name `bar` doesn't match frontmatter name `baz`
### Warnings (X)
- **packs/example-pack/codex/example-skill/** — missing Codex mirror (exists in Claude only)
- **docs/skills-reference.md** — `/hygiene` not listed in the base core table
- **research/icp.md** — missing `## Next Steps` section required by the research doc template
### Info (X)
- **base/claude/ship/SKILL.md** — no `## Constraints` section (consider adding)
- **docs/architecture.md** — unknown hand-written doc; skipped strict generated-doc template checks
### Summary
- Skills: 48 checked, 2 errors, 1 warning
- Tasks: 4 checked, 0 errors
- Docs: 3 checked, 1 warning
- Codex: 46 checked, 2 warnings
In fix mode, prepend each fixed item with a checkmark:
### Fixed
- [x] Added missing `argument-hint:` to base/claude/foo/SKILL.md
- [x] Created mirror base/codex/hygiene/SKILL.md
### Remaining Errors (X)
...
Constraints
- Read-only by default. Only modify files when explicitly invoked with
fixmode. - No content generation. Auto-fix only adds structural scaffolding, never writes substantive content.
- Structural docs only. Template checks validate shape, parseability, and canonical placement; use
$reconcile-dev-docs,$reconcile-research,$research-roadmap, or$spec-driftfor truth, freshness, and contradictions. - Show evidence. Every finding must include the specific file path and what's wrong.
- No false positives. If uncertain whether something is a violation, classify it as Info, not Error.
- Respect exceptions. Check for
# codex-skipand similar markers before flagging intentional gaps. - Use subagents to parallelize scanning across skills, tasks, docs, and codex scopes when running
all.
Default Shipping Contract
Follow the shared shipping contract convention in CLAUDE.md.
04 同仓库更多 Skills
source-checkout-allowed
Valid source-checkout-only fixture.
deck-install-valid
Valid deck install fixture.
codex-pack-guard-valid
Valid Codex Pack Availability Guard fixture.
codex-missing-skill-valid
Valid Codex missing skill fallback fixture.
codex-base-skill-fallback-valid
Valid Codex base skill fallback fixture.
claude-pack-guard-valid
Valid Claude Pack Availability Guard fixture.