agentleFS
derjochenmeyerderjochenmeyer/claude-code-craft/skills/craft-project-audit/SKILL.md

craft-project-audit

Skill2 starsChanged 7 months agoMITView on GitHub

Fast project health check. Structure completeness, namespace purity, file staleness, hook functionality, decisions format, memory adoption, dream history, setup quality — all from local files. Works with or without git. No agents, no external fetches, ~15-30 seconds. For deep analysis with feature adoption and session patterns, use /craft-project-audit-full.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run this entire block as one bash command:

    line 18
  2. Very specific:

    If missing > 0: list the missing paths (max 5).

    line 261
  3. Very specific:

    If HAS_GIT=false: drop C commits ·.

    line 309
  4. Distinctive:

    Ask: "Apply? (y/n)"

    line 387
  5. Distinctive:

    Never remove files not created by craft

    line 392
  6. Distinctive:

    Never output TOKEN, KEY, SECRET, PASSWORD values

    line 393
  7. Distinctive:

    After all items: "Done. Run /craft-project-audit again to verify."

    line 394

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

craft-project-audit

Fast health check. Tells you: is the structure complete? are the hooks functional? are the decisions well-formed? does the memory show adoption? when does the next dream make sense?

For deep analysis (feature adoption, session patterns, new releases): /craft-project-audit-full.


Step 1: Gather data

Run this entire block as one bash command:

CWD=$(pwd)
PROJECT_NAME=$(basename "$CWD")
NOW=$(date +%s)

# Git
LAST_COMMIT_TS=$(git log -1 --format="%ct" 2>/dev/null || echo "0")
LAST_COMMIT_REL=$(git log -1 --format="%cr" 2>/dev/null || echo "no commits")
COMMITS_30D=$(git log --since="30 days ago" --oneline 2>/dev/null | wc -l | tr -d ' ')
UNCOMMITTED=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
BRANCH=$(git branch --show-current 2>/dev/null || echo "—")
HAS_GIT=false
git rev-parse --git-dir >/dev/null 2>&1 && HAS_GIT=true

# Portable age helpers
file_age() {
  local ts
  ts=$(stat -f "%m" "$1" 2>/dev/null || stat -c "%Y" "$1" 2>/dev/null)
  [[ -z "$ts" ]] && echo "missing" || echo $(( (NOW - ts) / 86400 ))
}
dir_birth() {
  local ts
  ts=$(stat -f "%B" "$1" 2>/dev/null || stat -c "%W" "$1" 2>/dev/null)
  [[ -z "$ts" || "$ts" == "0" || "$ts" == "-" ]] && echo "?" || echo $(( (NOW - ts) / 86400 ))
}

# --- Structure completeness ---
EXPECTED=(
  "CLAUDE.md"
  ".claude/settings.json"
  ".craft/PROJECT_STATE.md"
  ".craft/BACKLOG.md"
  ".craft/HANDOVER.md"
  ".craft/DECISIONS.md"
  ".craft/QUALITY.md"
  ".craft/memory/MEMORY_INDEX.md"
  ".craft/memory/learned-rules.md"
  ".craft/rules/coding.md"
)
MISSING_STRUCT=()
for p in "${EXPECTED[@]}"; do
  [[ ! -e "$p" ]] && MISSING_STRUCT+=("$p")
done
STRUCT_OK=$(( ${#EXPECTED[@]} - ${#MISSING_STRUCT[@]} ))
STRUCT_TOTAL=${#EXPECTED[@]}
CRAFT_AGE=$(dir_birth ".craft")

# --- Namespace purity: .craft/ must only contain craft-owned files ---
# Project work data (analyses, research, outputs) belongs in visible folders,
# never in .craft/. Flag anything that is not a known craft name.
CRAFT_WHITELIST="^(PROJECT_STATE\.md|BACKLOG\.md|HANDOVER\.md|DECISIONS\.md|DREAM_LOG\.md|QUALITY\.md|MEMORY_INDEX\.md|learned-rules\.md|rules|memory|dreams|archive|skills)$"
CRAFT_INTRUDERS=""
if [[ -d .craft ]]; then
  CRAFT_INTRUDERS=$(ls .craft/ 2>/dev/null | grep -vE "$CRAFT_WHITELIST" | head -10 | xargs)
fi

# --- File ages ---
STATE_AGE=$(file_age ".craft/PROJECT_STATE.md")
BACKLOG_AGE=$(file_age ".craft/BACKLOG.md")
HANDOVER_AGE=$(file_age ".craft/HANDOVER.md")
DECISIONS_AGE=$(file_age ".craft/DECISIONS.md")
CLAUDE_AGE=$(file_age "CLAUDE.md")
[[ "$CLAUDE_AGE" == "missing" ]] && CLAUDE_AGE=$(file_age ".claude/CLAUDE.md")

# --- CLAUDE.md content ---
CLAUDE_LINES=$(wc -l < CLAUDE.md 2>/dev/null || wc -l < .claude/CLAUDE.md 2>/dev/null || echo "0")
CLAUDE_LINES=$(echo "$CLAUDE_LINES" | tr -d ' ')
CLAUDE_IMPORTS=$(grep -c "^@" CLAUDE.md 2>/dev/null || grep -c "^@" .claude/CLAUDE.md 2>/dev/null || true)
CLAUDE_IMPORTS=${CLAUDE_IMPORTS:-0}
RULES_COUNT=$(ls .craft/rules/ 2>/dev/null | wc -l | tr -d ' ')
CLAUDE_WHY=$(grep -cE "\b(because|reason|why|—|->|so that)\b" CLAUDE.md 2>/dev/null || true)
CLAUDE_WHY=${CLAUDE_WHY:-0}
CLAUDE_RULES=$(grep -cE "^[-*]|^[0-9]+\." CLAUDE.md 2>/dev/null || true)
CLAUDE_RULES=${CLAUDE_RULES:-1}
[[ "$CLAUDE_RULES" == "0" ]] && CLAUDE_RULES=1
WHY_RATIO=$(( CLAUDE_WHY * 100 / (CLAUDE_RULES > 0 ? CLAUDE_RULES : 1) ))

# --- Backlog ---
BACKLOG_OPEN=$(grep -c "^- \[ \]" .craft/BACKLOG.md 2>/dev/null || true)
BACKLOG_OPEN=${BACKLOG_OPEN:-0}
BACKLOG_DONE=$(grep -c "^- \[x\]" .craft/BACKLOG.md 2>/dev/null || true)
BACKLOG_DONE=${BACKLOG_DONE:-0}

# --- Staleness: commits + file-changes since each marker file's mtime ---
changes_since() {
  local target="$1"
  [[ ! -f "$target" ]] && { echo "0|0"; return; }
  local mtime
  mtime=$(stat -f "%m" "$target" 2>/dev/null || stat -c "%Y" "$target" 2>/dev/null || echo 0)
  local commits=0 files=0
  if $HAS_GIT; then
    commits=$(git log --since="@$mtime" --oneline 2>/dev/null | wc -l | tr -d ' ')
  fi
  files=$(find . -maxdepth 3 -type f -newer "$target" \
    -not -path "./.craft/*" -not -path "./.git/*" \
    -not -path "./node_modules/*" -not -path "./dist/*" -not -path "./build/*" \
    -not -path "./.next/*" -not -path "./.astro/*" -not -path "./vendor/*" \
    -not -path "./__pycache__/*" -not -path "./.venv/*" -not -path "./venv/*" \
    2>/dev/null | wc -l | tr -d ' ')
  echo "${commits}|${files}"
}
STATE_ACTIVITY=$(changes_since ".craft/PROJECT_STATE.md")
BACKLOG_ACTIVITY=$(changes_since ".craft/BACKLOG.md")
HANDOVER_ACTIVITY=$(changes_since ".craft/HANDOVER.md")

# --- Dream history ---
DREAM_COUNT=0
LAST_DREAM_AGE="never"
if [[ -d .craft/dreams ]]; then
  DREAM_COUNT=$(ls .craft/dreams/ 2>/dev/null | wc -l | tr -d ' ')
  if [[ $DREAM_COUNT -gt 0 ]]; then
    LAST_DREAM=$(ls -t .craft/dreams/ 2>/dev/null | head -1)
    [[ -n "$LAST_DREAM" ]] && LAST_DREAM_AGE=$(file_age ".craft/dreams/$LAST_DREAM")
  fi
fi

# --- Memory adoption (defaults vs custom entries) ---
MEMORY_FILES=$(ls .craft/memory/ 2>/dev/null | wc -l | tr -d ' ')
MEM_DEFAULTS=$(ls .craft/memory/ 2>/dev/null | grep -cE "^(MEMORY_INDEX\.md|learned-rules\.md|archive)$" || true)
MEM_DEFAULTS=${MEM_DEFAULTS:-0}
MEM_CUSTOM=$(( MEMORY_FILES - MEM_DEFAULTS ))
(( MEM_CUSTOM < 0 )) && MEM_CUSTOM=0

# --- DECISIONS format ---
DEC_ENTRIES=0
DEC_WELLFORMED=0
if [[ -f .craft/DECISIONS.md ]]; then
  DEC_ENTRIES=$(grep -c "^## D[0-9]" .craft/DECISIONS.md 2>/dev/null || true)
  DEC_ENTRIES=${DEC_ENTRIES:-0}
  DEC_WELLFORMED=$(awk '
    /^## D[0-9]/ {if (in_e && date && decision && why && apply) count++; in_e=1; date=0; decision=0; why=0; apply=0; next}
    in_e && /^\*\*Date:\*\*/ {date=1}
    in_e && /^\*\*Decision:\*\*/ {decision=1}
    in_e && /^\*\*Why:\*\*/ {why=1}
    in_e && /^\*\*How to apply:\*\*/ {apply=1}
    END {if (in_e && date && decision && why && apply) count++; print count+0}
  ' .craft/DECISIONS.md 2>/dev/null)
fi

# --- Hook functionality ---
HOOK_JSON_VALID="n/a"
HOOK_EXEC_STATUS="n/a"
HOOK_COUNT=0
HOOK_FAILURES=()
if [[ -f .claude/settings.json ]]; then
  if jq empty .claude/settings.json 2>/dev/null; then
    HOOK_JSON_VALID="yes"
    HOOK_COUNT=$(jq '[.hooks // {} | to_entries[] | .value[]? | .hooks[]?] | length' .claude/settings.json 2>/dev/null)
    HOOK_EXEC_STATUS="ok"
    while IFS= read -r cmd; do
      [[ -z "$cmd" || "$cmd" == "null" ]] && continue
      output=$(bash -c "$cmd" 2>&1)
      # Valid: empty output, or output that parses as JSON
      if [[ -n "$output" ]] && ! echo "$output" | jq empty 2>/dev/null; then
        HOOK_EXEC_STATUS="fail"
        HOOK_FAILURES+=("${cmd:0:60}...")
      fi
    done < <(jq -r '.hooks // {} | to_entries[] | .value[]? | .hooks[]? | .command' .claude/settings.json 2>/dev/null)
  else
    HOOK_JSON_VALID="no"
    HOOK_EXEC_STATUS="skipped"
  fi
fi

# --- Global settings (user-level) ---
EFFORT=$(jq -r '.effortLevel // "not set"' ~/.claude/settings.json 2>/dev/null || echo "not set")
STATUSLINE=$(jq -r 'if .statusLine.command then "configured" else "not set" end' ~/.claude/settings.json 2>/dev/null || echo "not set")
HOOK_EVENTS=$(jq -r '.hooks // {} | keys | join(", ")' ~/.claude/settings.json 2>/dev/null || echo "none")

# --- Craft skills installed ---
# Array syntax used intentionally — zsh does not word-split unquoted
# strings in `for s in $VAR`, so the string form loops only once.
CRAFT_SKILLS_LIST=(
  craft-project-setup craft-project-status craft-project-audit
  craft-project-audit-full craft-project-dream craft-project-explore
  craft-global-audit craft-session-solidify craft-update-self craft-project-remember
)
MISSING_SKILLS=""
for s in "${CRAFT_SKILLS_LIST[@]}"; do
  [[ ! -d "$HOME/.claude/skills/$s" ]] && MISSING_SKILLS="$MISSING_SKILLS $s"
done
MISSING_SKILLS=$(echo "$MISSING_SKILLS" | xargs)

echo "=== DATA ==="
echo "PROJECT=$PROJECT_NAME BRANCH=$BRANCH COMMITS_30D=$COMMITS_30D HAS_GIT=$HAS_GIT"
echo "LAST_COMMIT=$LAST_COMMIT_REL LAST_COMMIT_TS=$LAST_COMMIT_TS UNCOMMITTED=$UNCOMMITTED"
echo "STRUCT_OK=$STRUCT_OK STRUCT_TOTAL=$STRUCT_TOTAL MISSING_STRUCT=${MISSING_STRUCT[*]}"
echo "CRAFT_AGE=$CRAFT_AGE"
echo "CRAFT_INTRUDERS=$CRAFT_INTRUDERS"
echo "STATE_AGE=$STATE_AGE BACKLOG_AGE=$BACKLOG_AGE HANDOVER_AGE=$HANDOVER_AGE DECISIONS_AGE=$DECISIONS_AGE CLAUDE_AGE=$CLAUDE_AGE"
echo "CLAUDE_LINES=$CLAUDE_LINES CLAUDE_IMPORTS=$CLAUDE_IMPORTS RULES_COUNT=$RULES_COUNT WHY_RATIO=$WHY_RATIO%"
echo "BACKLOG_OPEN=$BACKLOG_OPEN BACKLOG_DONE=$BACKLOG_DONE"
echo "STATE_ACTIVITY=$STATE_ACTIVITY BACKLOG_ACTIVITY=$BACKLOG_ACTIVITY HANDOVER_ACTIVITY=$HANDOVER_ACTIVITY"
echo "DREAM_COUNT=$DREAM_COUNT LAST_DREAM_AGE=$LAST_DREAM_AGE"
echo "MEMORY_FILES=$MEMORY_FILES MEM_CUSTOM=$MEM_CUSTOM"
echo "DEC_ENTRIES=$DEC_ENTRIES DEC_WELLFORMED=$DEC_WELLFORMED"
echo "HOOK_JSON_VALID=$HOOK_JSON_VALID HOOK_EXEC_STATUS=$HOOK_EXEC_STATUS HOOK_COUNT=$HOOK_COUNT HOOK_FAILURES=${HOOK_FAILURES[*]}"
echo "EFFORT=$EFFORT STATUSLINE=$STATUSLINE HOOK_EVENTS=$HOOK_EVENTS"
echo "MISSING_SKILLS=$MISSING_SKILLS"

Step 2: Classify activity and maturity

Activity: Active (COMMITS_30D ≥ 3) / Slow (1-2) / Dormant (0 and last commit >30d) / New (no commits)

Craft maturity (based on CRAFT_AGE):

  • Fresh (< 3 days) — too early to dream, memory defaults expected
  • Settling in (3-14 days) — some adoption expected, no dream yet
  • Established (15-60 days) — should have ≥1 dream if active, memory should show custom entries
  • Veteran (> 60 days) — multiple dreams, mature memory

Step 3: Output

Section 1 — Project Pulse

craft-project-audit — [PROJECT_NAME] — [today's date]

Project Pulse
  Branch:        [BRANCH]
  Last commit:   [LAST_COMMIT_REL]   ([COMMITS_30D] commits in 30 days)  →  [Active/Slow/Dormant/New]
  Uncommitted:   [UNCOMMITTED] files
  Craft age:     [CRAFT_AGE] days   →  [Fresh/Settling in/Established/Veteran]

Section 2 — Structure Completeness

Indicator:

  • ✅ all 10 expected paths present
  • ⚠️ 7-9 present
  • ❌ < 7 present or missing entirely
Structure        [✅/⚠️/❌]  [STRUCT_OK/STRUCT_TOTAL] paths present[, missing: list]
Namespace        [✅/⚠️]    .craft/ clean / intruders: [list]

If missing > 0: list the missing paths (max 5). Suggest /craft-project-setup in enhance mode.

Namespace line:

  • ✅ — .craft/ contains only craft-owned files (whitelist: PROJECT_STATE, BACKLOG, HANDOVER, DECISIONS, DREAM_LOG, QUALITY, MEMORY_INDEX, learned-rules.md, rules/, memory/, dreams/, archive/, skills/)
  • ⚠️ — intruders present. .craft/ is for craft management only; project work data (analyses, research, outputs, inventories) belongs in the project root or in visible subfolders. List up to 5 intruders and add an action-table item: "Move [X] out of .craft/ to visible location."

Section 3 — File Health

For each craft file, compute staleness relative to last commit:

DELTA = FILE_AGE_DAYS - LAST_COMMIT_AGE_DAYS
  • ✅ DELTA ≤ 7
  • ⚠️ DELTA 8-30
  • ❌ DELTA > 30 or missing
  • — dormant project — skip staleness, show age only
File Health
  PROJECT_STATE.md   [✅/⚠️/❌]  [N days ago]
  BACKLOG.md         [✅/⚠️/❌]  [N days ago]   ([OPEN] open, [DONE] done)
  HANDOVER.md        [✅/⚠️/❌]  [N days ago]
  DECISIONS.md       [✅/⚠️/❌]  [N days ago]
  CLAUDE.md          [✅/⚠️/❌]  [N days ago]   ([LINES] lines)
  Memory             [✅/⚠️/❌]  [FILES files, newest N days ago / not set up]

Section 4 — Staleness Check

Activity since each marker file's mtime. Flag if thresholds crossed.

FileStale when
PROJECT_STATE.mdcommits > 5 OR file changes > 15
BACKLOG.md(commits > 5 OR file changes > 15) AND no new [x] since file mtime
HANDOVER.mdcommits > 3 OR file changes > 10

Output format (omit segment that does not apply):

Staleness Check
  PROJECT_STATE.md   [N days] old   [C commits · ][F file changes] since         [✅/⚠️]
  BACKLOG.md         [N days] old   [C commits · ][F file changes] · [done-delta] [✅/⚠️]
  HANDOVER.md        [N days] old   [C commits · ][F file changes] since         [✅/⚠️]

If HAS_GIT=false: drop C commits ·. Zero activity: no activity since — ok.

Section 5 — Dream & Memory

Dream & Memory
  Dreams run:       [DREAM_COUNT] total[, last M days ago]
  Recommendation:   [dream recommendation — see logic below]
  Memory:           [N custom entries + M defaults][— adoption low if only defaults]

Dream recommendation logic:

  • CRAFT_AGE < 3 → "fresh setup, dream too early"
  • DREAM_COUNT == 0 && COMMITS_30D < 10 → "waiting for activity, dream after ~10 commits"
  • DREAM_COUNT == 0 && COMMITS_30D >= 10 → "⚠ dream recommended — run /craft-project-dream"
  • LAST_DREAM_AGE > 30 && COMMITS_30D >= 5 → "⚠ dream overdue — last was M days ago"
  • LAST_DREAM_AGE <= 14 → "recent dream, no action"
  • Else → "dream cadence looks fine"

Memory adoption:

  • MEM_CUSTOM == 0 && CRAFT_AGE > 14 → "only defaults after [N] days — is memory being used?"
  • MEM_CUSTOM > 0 → "adoption looks real"
  • CRAFT_AGE < 14 → no flag, too early

Section 6 — Hooks & Quality

Checks hook JSON validity and executes each hook command to verify output is valid JSON (or empty).

Hooks & Quality
  Hooks JSON:       [✅/❌]  valid / invalid JSON
  Hook execution:   [✅/❌/—]  all M commands produce valid output / N failed / no hooks
  DECISIONS format: [✅/⚠️/—]  M/N entries have all four fields / incomplete / no entries yet
  effortLevel:      [✅/❌]  [value or "not set"]
  statusLine:       [✅/❌]  configured / not set
  CLAUDE.md:        [✅/⚠️/❌]  [LINES] lines · WHY coverage [WHY_RATIO]%
  Skills:           [✅/⚠️/❌]  [N/10 installed[, missing: ...]]

Hook execution:

  • ✅ all commands produced valid JSON or empty output
  • ❌ at least one command produced non-JSON output — list up to 2 offenders
  • — .claude/settings.json not present

DECISIONS format:

  • ✅ all D-entries have Date + Decision + Why + How to apply
  • ⚠️ some entries incomplete — show M well-formed of N total
  • — no D-entries yet

CLAUDE.md WHY coverage (context-aware):

  • — ≤ 60 lines — short navigation file, WHY check skipped
  • ✅ 61-150 lines AND ratio ≥ 30%, OR > 150 lines AND ratio ≥ 60%
  • ⚠️ 61-150 lines AND ratio < 30%, OR 151-200 lines AND ratio 30-59%
  • ❌ > 200 lines (CLAUDE.md is also too long regardless of WHY ratio)

Section 7 — Action Table

Pick up to 8 findings. Sort by combined impact (structure gaps > hook failures > staleness > setup gaps > nice-to-have).

| #  | Action                                                       | Impact | Effort |
|----|--------------------------------------------------------------|--------|--------|
|  1 | ...                                                          | High   | Low    |

End with:

Reply with item numbers to implement (e.g. "1 3"), or /craft-project-audit-full for deep analysis.

Step 4: Implementation (when user replies with numbers)

For each selected item:

  1. Show exact change (file, content, diff-style preview)
  2. Ask: "Apply? (y/n)"
  3. Apply only if confirmed
  4. Confirm completion

Rules:

  • Never remove files not created by craft
  • Never output TOKEN, KEY, SECRET, PASSWORD values
  • After all items: "Done. Run /craft-project-audit again to verify."

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.