Skip to content

Commit cca9bda

Browse files
feat: audit now applies fixes instead of just reporting
- CI audit step edits files directly (agents, skills, settings, etc.) - git add -A captures all changes, not just docs/ - Check for changes covers entire repo including new files - /audit-config command updated to apply fixes too - PR serves as review gate for all applied improvements
1 parent 1e20a80 commit cca9bda

2 files changed

Lines changed: 51 additions & 33 deletions

File tree

.github/workflows/sync-audit.yml

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -50,46 +50,48 @@ jobs:
5050
exit 1
5151
fi
5252
53-
- name: Check for changes
54-
id: changes
55-
run: |
56-
if git diff --quiet docs/; then
57-
echo "has_changes=false" >> "$GITHUB_OUTPUT"
58-
else
59-
echo "has_changes=true" >> "$GITHUB_OUTPUT"
60-
echo "### Changed files:" >> /tmp/sync-summary.txt
61-
git diff --stat docs/ >> /tmp/sync-summary.txt
62-
fi
63-
64-
- name: Run audit
65-
if: steps.changes.outputs.has_changes == 'true'
53+
- name: Run audit and apply fixes
6654
env:
6755
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
6856
run: |
6957
claude -p "$(cat <<'PROMPT'
70-
You are auditing a Claude Code configuration repository.
58+
You are auditing and improving a Claude Code configuration repository.
59+
60+
## Phase 1: Read everything
7161
72-
Read these files:
7362
1. docs/claude-cookbook-best-practices.md (just synced - reference for latest features)
7463
2. settings.json
7564
3. CLAUDE.md
7665
4. All agents: agents/*.md
7766
5. All skills: use Glob for skills/*/SKILL.md, then read each
7867
6. All commands: commands/*.md
7968
80-
Produce a concise markdown audit report. For each actionable finding:
69+
## Phase 2: Apply improvements
70+
71+
For each actionable finding, APPLY the fix directly (edit files, create missing agents, remove deprecated code, update settings).
8172
82-
**[CATEGORY] `file`** — recommendation (impact: high/medium/low)
73+
Categories to check:
74+
- SETTING: missing permissions, new settings to adopt
75+
- AGENT: missing model field, missing tools in frontmatter
76+
- SKILL: outdated patterns, missing features
77+
- COMMAND: missing allowed-tools, broken references
78+
- HOOK: new hook events to leverage
79+
- CLAUDE.MD: rules that could be settings/hooks instead
80+
- CONFLICT: duplicates, deprecated code to remove
8381
84-
Categories: AGENT, SKILL, COMMAND, SETTING, HOOK, CLAUDE.MD, CONFLICT
82+
## Rules
8583
86-
Rules:
87-
- Only flag things that would concretely improve the workflow
84+
- Only fix things that would concretely improve the workflow
8885
- Skip anything that works fine as-is
89-
- Check for conflicts with new bundled commands
90-
- Check for new features agents/skills could leverage
91-
- Check for CLAUDE.md rules that could be settings/hooks instead
92-
- Keep the report under 100 lines
86+
- Do NOT delete files without strong justification (prefer deprecation)
87+
- Do NOT modify docs/ (already synced)
88+
- Keep changes minimal and focused per finding
89+
90+
## Phase 3: Summary
91+
92+
After applying all fixes, output a concise markdown report listing what you changed:
93+
94+
**[CATEGORY] `file`** — what was changed (impact: high/medium/low)
9395
PROMPT
9496
)" \
9597
--model claude-sonnet-4-6 \
@@ -98,6 +100,20 @@ jobs:
98100
--output-format text \
99101
| tee /tmp/audit-report.txt
100102
103+
- name: Check for changes
104+
id: changes
105+
run: |
106+
if git diff --quiet && [ -z "$(git ls-files --others --exclude-standard)" ]; then
107+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
108+
else
109+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
110+
{
111+
echo "### Changed files:"
112+
git diff --stat
113+
git ls-files --others --exclude-standard | sed 's/^/ new: /'
114+
} > /tmp/sync-summary.txt
115+
fi
116+
101117
- name: Create PR
102118
if: steps.changes.outputs.has_changes == 'true'
103119
env:
@@ -113,30 +129,29 @@ jobs:
113129
done
114130
115131
git checkout -b "$BRANCH"
116-
git add docs/
117-
git commit -m "chore: sync best practices docs"
132+
git add -A
133+
git commit -m "chore: sync docs and apply audit improvements"
118134
git push -u origin "$BRANCH"
119135
120136
# Build PR body
121137
{
122-
echo "## Sync"
138+
echo "## Changes"
123139
echo ""
124140
cat /tmp/sync-summary.txt
125141
echo ""
126142
echo "---"
127143
echo ""
128-
echo "## Audit"
144+
echo "## Audit Report"
129145
echo ""
130146
if [ -f /tmp/audit-report.txt ]; then
131-
# Extract just the last meaningful section (skip Claude's verbose output)
132147
cat /tmp/audit-report.txt | tail -80
133148
else
134149
echo "No audit report generated."
135150
fi
136151
} > /tmp/pr-body.txt
137152
138153
gh pr create \
139-
--title "chore: sync best practices $(date +%Y-%m-%d)" \
154+
--title "chore: sync & improve config $(date +%Y-%m-%d)" \
140155
--body-file /tmp/pr-body.txt \
141156
--assignee nicolas-codemate
142157

commands/audit-config.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,12 @@ Only include actionable items — no vague suggestions.
125125
</output>
126126

127127
<constraints>
128-
- Do NOT apply any changes automatically — this is an audit, not a fix
129-
- Do NOT suggest changes that are purely cosmetic or subjective
128+
- APPLY fixes directly — edit files, create missing agents, update settings, remove deprecated code
129+
- Do NOT just report findings — fix them
130+
- Do NOT apply changes that are purely cosmetic or subjective
131+
- Do NOT delete files without strong justification (prefer deprecation)
132+
- Do NOT modify docs/ (already synced in Phase 1)
130133
- Focus on: new features we could use, conflicts, deterministic enforcement, context savings
131134
- Ignore: minor formatting, personal preferences, things that work fine as-is
132-
- Be critical but pragmatic — only flag things that would actually improve the workflow
135+
- Be critical but pragmatic — only fix things that would actually improve the workflow
133136
</constraints>

0 commit comments

Comments
 (0)