AgentSkillsCN

auditing

依据自我文档化规范、PHONY声明、变量使用以及角色分离等准则,对现有Makefile进行审计。

SKILL.md
--- frontmatter
name: auditing
description: Audit existing Makefiles against conventions for self-documentation, PHONY declarations, variable usage, and role separation.
allowed-tools:
  - Read
  - Glob
  - Grep
  - AskUserQuestion

Audit Makefiles

Analyze Makefiles against conventions and best practices.

Checks

Conventions

CheckPass Criteria
.DEFAULT_GOAL set.DEFAULT_GOAL := help present
help target existshelp: target with grep/awk pattern
Self-documentingAll public targets have ## description comment
.PHONY declarationsAll non-file targets listed in .PHONY
Private target conventionInternal targets use underscore prefix (_target)
Section separatorsComment blocks separating logical sections

Variables

CheckPass Criteria
No hardcoded pathsRegistry URLs, namespaces in variables
No hardcoded versionsVERSION derived from git or variable
Consistent namingSCREAMING_SNAKE for variables
Export where neededUV_PROJECT_ENVIRONMENT exported

Structure

CheckPass Criteria
Role separationDev targets in Makefile.local, deploy in Makefile.deploy
No mixed concernsBuild/push/deploy not mixed with test/lint/format
DRY complianceRepeated docker/helm commands use private targets
Tag-on-push patternbuild-image tags locally, push-image tags for registry

Best Practices

CheckPass Criteria
Tab indentationRecipes use tabs, not spaces
No shell assignment in recipeUse $(shell ...) in variables, not in recipes
Quiet prefix usage@ prefix on echo, not on commands that might fail
Error handling|| true only on intentional ignore

Workflow

1. Find Makefiles

text
Glob: Makefile, Makefile.*, */Makefile

2. Read and Analyze

For each Makefile:

  1. Read full content
  2. Parse targets (lines matching ^[a-zA-Z_-]+:)
  3. Parse .PHONY declarations
  4. Parse variables (lines matching ^[A-Z_]+ :=)
  5. Check each convention

3. Cross-File Analysis

  • Check role separation between Makefile.local and Makefile.deploy
  • Check root Makefile delegates correctly
  • Check consistent variable naming across files

4. Generate Report

Use the audit-report.md template. Fill in:

  • Each check with (pass), (fail), or (partial)
  • Findings grouped by category
  • Recommendations sorted by priority

5. Ask About Fixes

After presenting the report, ask via AskUserQuestion:

  • "Fix all issues" - Apply fixes
  • "Fix critical only" - Only fix high-priority items
  • "Report only" - No changes

Priority Classification

PriorityCriteria
HighMissing help target, no .PHONY, hardcoded secrets
MediumMissing self-documentation, no section separators, DRY violations
LowNaming inconsistencies, missing private prefix on internal targets