{"id":"f4882331-e25e-468e-9c6c-db62e451c376","entityType":"agent","slug":"clawhub-athola-nm-pensive-makefile-review","name":"makefile-review","canonicalUrl":"https://www.xpersona.co/agent/clawhub-athola-nm-pensive-makefile-review","canonicalPath":"/agent/clawhub-athola-nm-pensive-makefile-review","generatedAt":"2026-10-10T13:33:33.856Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-10T09:56:38.640Z","emptyReason":null},"description":"Audits Makefiles for build correctness, portability, and recipe duplication Skill: makefile-review Owner: athola Summary: Audits Makefiles for build correctness, portability, and recipe duplication Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:18:53.332Z | user Release v1.9.19 v1.9.17 | 2026-07-30T05:39:06.878Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:55:48.848Z | user Release v1.9.16 v1.9.14 | 2026-06-30T18:04:10.129Z | user Release v1.9.14 v1.9.13 | 2026-06-27T16:22:11","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.5K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-pensive-makefile-review","sourceUrl":"https://clawhub.ai/athola/nm-pensive-makefile-review","homepage":"https://clawhub.ai/athola/skills/nm-pensive-makefile-review","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/athola/nm-pensive-makefile-review","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/athola/skills/nm-pensive-makefile-review","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":64,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Audits Makefiles for build correctness, portability, and recipe duplication Skill: makefile-review Owner: athola Summary: Audits Makefiles for build correctness"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T09:56:38.640Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T09:56:38.640Z","emptyReason":null},"stars":null,"forks":null,"downloads":1510,"packageName":null,"latestVersion":"1.9.19","tractionLabel":"1.5K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T09:56:38.639Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T09:56:38.640Z","lastCrawledAt":"2026-10-10T09:56:38.639Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T09:56:38.639Z","lastVerifiedAt":null,"highlights":[{"version":"1.9.19","createdAt":"2026-08-26T13:18:53.332Z","changelog":"Release v1.9.19","fileCount":8,"zipByteSize":10468},{"version":"1.9.17","createdAt":"2026-07-30T05:39:06.878Z","changelog":"Release v1.9.17","fileCount":8,"zipByteSize":10389},{"version":"1.9.16","createdAt":"2026-07-14T19:55:48.848Z","changelog":"Release v1.9.16","fileCount":8,"zipByteSize":10402},{"version":"1.9.14","createdAt":"2026-06-30T18:04:10.129Z","changelog":"Release v1.9.14","fileCount":8,"zipByteSize":10303},{"version":"1.9.13","createdAt":"2026-06-27T16:22:11.675Z","changelog":"Release v1.9.13","fileCount":8,"zipByteSize":10354},{"version":"1.9.12","createdAt":"2026-06-19T03:17:19.578Z","changelog":"Release v1.9.12","fileCount":8,"zipByteSize":10386},{"version":"1.0.3","createdAt":"2026-06-18T14:12:11.672Z","changelog":"Release v1.9.12","fileCount":8,"zipByteSize":10457},{"version":"1.0.2","createdAt":"2026-05-09T02:19:17.319Z","changelog":"Release v1.9.5","fileCount":8,"zipByteSize":10387}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-pensive-makefile-review","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-pensive-makefile-review/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-pensive-makefile-review/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-pensive-makefile-review/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-pensive-makefile-review/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-pensive-makefile-review/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-pensive-makefile-review/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T13:33:33.854Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-pensive-makefile-review/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-pensive-makefile-review/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-pensive-makefile-review/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-pensive-makefile-review/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-10T09:56:38.640Z","emptyReason":null},"readme":"Skill: makefile-review\n\nOwner: athola\n\nSummary: Audits Makefiles for build correctness, portability, and recipe duplication\n\nTags: latest:1.9.19\n\nVersion history:\n\nv1.9.19 | 2026-08-26T13:18:53.332Z | user\n\nRelease v1.9.19\n\nv1.9.17 | 2026-07-30T05:39:06.878Z | user\n\nRelease v1.9.17\n\nv1.9.16 | 2026-07-14T19:55:48.848Z | user\n\nRelease v1.9.16\n\nv1.9.14 | 2026-06-30T18:04:10.129Z | user\n\nRelease v1.9.14\n\nv1.9.13 | 2026-06-27T16:22:11.675Z | user\n\nRelease v1.9.13\n\nv1.9.12 | 2026-06-19T03:17:19.578Z | user\n\nRelease v1.9.12\n\nv1.0.3 | 2026-06-18T14:12:11.672Z | user\n\nRelease v1.9.12\n\nv1.0.2 | 2026-05-09T02:19:17.319Z | user\n\nRelease v1.9.5\n\nv1.0.1 | 2026-05-06T14:20:30.285Z | user\n\nRelease v1.9.4\n\nv1.0.0 | 2026-04-15T14:01:56.130Z | auto\n\n- Initial release of the Makefile review skill.\n- Audits Makefiles for build correctness, portability, and recipe duplication.\n- Guides users through a defined workflow: context mapping, dependency graph construction, deduplication audit, portability check, and evidence logging.\n- Includes detailed output format and testing instructions.\n- Provides troubleshooting tips for common issues like missing Makefiles or unresolved includes.\n\nArchive index:\n\nArchive v1.9.19: 8 files, 10468 bytes\n\nFiles: modules/best-practices.md (4064b), modules/deduplication-patterns.md (2530b), modules/dependency-graph.md (1306b), modules/plugin-dogfood-checks.md (3322b), modules/portability-checks.md (2735b), skill-card.md (2195b), SKILL.md (4535b), _meta.json (146b)\n\nFile v1.9.19:SKILL.md\n\n---\nname: makefile-review\ndescription: Audits Makefiles for build correctness, portability, and recipe duplication\nversion: 1.9.8\ntriggers:\n  - makefile\n  - build\n  - make\n  - portability\n  - automation\n  - reviewing a Makefile or before committing Makefile changes\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/pensive\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.pensive:shared\", \"night-market.imbue:proof-of-work\"]}}}\nsource: claude-night-market\nsource_plugin: pensive\n---\n\n> **Night Market Skill** — ported from [claude-night-market/pensive](https://github.com/athola/claude-night-market/tree/master/plugins/pensive). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Workflow](#workflow)\n- [Step 1: Map Context (`makefile-review:context-mapped`)](#step-1:-map-context-(makefile-review:context-mapped))\n- [Step 2: Dependency Graph (`makefile-review:dependency-graph`)](#step-2:-dependency-graph-(makefile-review:dependency-graph))\n- [Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)](#step-3:-deduplication-audit-(makefile-review:dedup-candidates))\n- [Step 4: Portability Check (`makefile-review:tooling-alignment`)](#step-4:-portability-check-(makefile-review:tooling-alignment))\n- [Step 5: Evidence Log (`makefile-review:evidence-logged`)](#step-5:-evidence-log-(makefile-review:evidence-logged))\n- [Progressive Loading](#progressive-loading)\n- [Output Format](#output-format)\n- [Summary](#summary)\n- [Testing](#testing)\n\n## Testing\n\nRun `pytest plugins/pensive/tests/skills/test_makefile_review.py` to verify review logic.\n\n# Makefile Review Workflow\n\nAudit Makefiles for best practices, deduplication, and portability.\n\n## Quick Start\n\n```bash\n/makefile-review\n```\n\n## When To Use\n\n- Makefile changes or additions\n- Build system optimization\n- Portability improvements\n- CI/CD pipeline updates\n- Developer experience improvements\n\n## When NOT To Use\n\n- Creating new Makefiles - use abstract:make-dogfood\n- Architecture review - use architecture-review\n\n## Required TodoWrite Items\n\n1. `makefile-review:context-mapped`\n2. `makefile-review:dependency-graph`\n3. `makefile-review:dedup-candidates`\n4. `makefile-review:tooling-alignment`\n5. `makefile-review:evidence-logged`\n\n## Workflow\n\n### Step 1: Map Context (`makefile-review:context-mapped`)\n\nConfirm baseline:\n```bash\npwd && git status -sb && git diff --stat\n```\n**Verification:** Run `git status` to confirm working tree state.\n\nFind Make-related files:\n```bash\nrg -n \"^include\" -g'Makefile*'\nrg --files -g '*.mk'\n```\n\nDocument changed targets, project goals, and tooling requirements.\n\n### Step 2: Dependency Graph (`makefile-review:dependency-graph`)\n\n@include modules/dependency-graph.md\n\n### Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)\n\n@include modules/deduplication-patterns.md\n\n### Step 4: Portability Check (`makefile-review:tooling-alignment`)\n\n@include modules/portability-checks.md\n\n### Step 5: Evidence Log (`makefile-review:evidence-logged`)\n\nUse `imbue:proof-of-work` to record command outputs with file:line references.\n\nSummarize findings:\n- Severity (critical, major, minor)\n- Expected impact\n- Suggested refactors\n- Owners and dates for follow-ups\n\n## Progressive Loading\n\nLoad additional context as needed:\n\n**Best Practices & Examples**: `@include modules/best-practices.md`\n\n**Plugin Dogfood Checks**: `@include modules/plugin-dogfood-checks.md` - Makefile completeness analysis, target generation, and dogfooding validation.\n\n## Output Format\n\n```markdown\n## Summary\nMakefile review findings\n\n## Context\n- Files reviewed: [list]\n- Targets changed: [list]\n\n## Dependency Analysis\n[graph and issues]\n\n## Duplication Candidates\n### [D1] Repeated command\n- Locations: [list]\n- Recommendation: [pattern rule]\n\n## Portability Issues\n[cross-platform concerns]\n\n## Missing Targets\n- [ ] help\n- [ ] format\n- [ ] lint\n\n## Recommendation\nApprove / Approve with actions / Block\n```\n\n## Exit Criteria\n\n- Context mapped\n- Dependencies analyzed\n- Deduplication reviewed\n- Portability checked\n- Evidence logged\n## Troubleshooting\n\n### Common Issues\n\n**No Makefile found**\nEnsure `Makefile` or `*.mk` files exist in the project root or specify paths explicitly.\n\n**Include directives not resolved**\nRun `rg -n \"^include\" -g'Makefile*'` to trace include chains manually.\n\nFile v1.9.19:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-pensive-makefile-review\",\n  \"version\": \"1.9.19\",\n  \"publishedAt\": 1787750333332\n}\n\nFile v1.9.19:modules/best-practices.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: best-practices\ndescription: Makefile structure patterns, examples, and anti-patterns to avoid\ntags: [best-practices, patterns, anti-patterns, examples]\n---\n\n# Makefile Best Practices\n\n## Structure Pattern\n\nRecommended organization:\n```makefile\n# 1. Variables at top\nPROJECT := myproject\nSRC_DIR := src\nBUILD_DIR := build\nVERSION := 1.0.0\n\n# 2. Default goal\n.DEFAULT_GOAL := help\n\n# 3. PHONY declarations\n.PHONY: all build test clean help\n\n# 4. Help target (self-documenting)\nhelp: ## Show this help\n\t@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \\\n\t\tawk 'BEGIN {FS = \":.*?## \"}; {printf \"%-15s %s\\n\", $$1, $$2}'\n\n# 5. Main targets with inline docs\nbuild: ## Build the project\n\t$(MAKE) -C $(SRC_DIR)\n\ntest: build ## Run tests\n\tpytest tests/\n\nclean: ## Clean build artifacts\n\trm -rf $(BUILD_DIR)\n```\n\n## Pattern Rule Examples\n\n### File Conversion\n```makefile\n# Markdown to HTML\n%.html: %.md\n\tpandoc $< -o $@\n\n# Source to object\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t@mkdir -p $(@D)\n\t$(CC) $(CFLAGS) -c $< -o $@\n\n# Template expansion\n%/config.json: templates/config.json.tmpl\n\t@mkdir -p $(@D)\n\tenvsubst < $< > $@\n```\n\n### Testing Patterns\n```makefile\n# Test by subdirectory\ntest-%:\n\tpytest tests/$*\n\n# Test by type\ntest-unit test-integration test-e2e: test-%:\n\tpytest tests/$* -v\n```\n\n## Function Examples\n\n### Reusable Command Sequences\n```makefile\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest -v\n\t@echo \"Done: $(1)\"\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\n### Multi-line Recipes\n```makefile\ndefine docker_build\n\tdocker build \\\n\t\t--build-arg VERSION=$(VERSION) \\\n\t\t--tag $(1):$(VERSION) \\\n\t\t--tag $(1):latest \\\n\t\t.\nendef\n\nimage:\n\t$(call docker_build,$(PROJECT))\n```\n\n## Anti-Patterns to Avoid\n\n### Repeated Commands\n```makefile\n# Bad - duplicated logic\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\n### Missing PHONY\n```makefile\n# Bad - 'clean' file blocks target\nclean:\n\trm -rf build/\n\n# Good\n.PHONY: clean\nclean:\n\trm -rf build/\n```\n\n### Hardcoded Paths\n```makefile\n# Bad - not portable\nclean:\n\trm -rf /home/user/project/build\n\n# Good - variables\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Shell-Specific Commands\n```makefile\n# Bad - Bash-only\ncheck:\n\t[[ -f config.yaml ]] && echo \"Found\"\n\n# Good - POSIX compatible\ncheck:\n\t[ -f config.yaml ] && echo \"Found\"\n```\n\n### Unguarded Variable References\n```makefile\n# Bad - fails if undefined\nclean:\n\trm -rf $(BUILD_DIR)\n\n# Good - with default\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Non-Idempotent Targets\n```makefile\n# Bad - appends every time\nconfigure:\n\techo \"DEBUG=1\" >> config.mk\n\n# Good - idempotent\nconfigure:\n\t@echo \"DEBUG=1\" > config.mk\n```\n\n## Error Handling\n\n### Check Prerequisites\n```makefile\n.PHONY: check-deps\ncheck-deps:\n\t@command -v python3 >/dev/null || (echo \"python3 required\"; exit 1)\n\t@command -v pytest >/dev/null || (echo \"pytest required\"; exit 1)\n\ntest: check-deps\n\tpytest tests/\n```\n\n### Delete on Error\n```makefile\n# Automatically delete targets on error\n.DELETE_ON_ERROR:\n\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n### Pipeline Exit Code Propagation\n```makefile\n# Bad - pipeline exit code is from grep, not make\ncheck:\n\t@$(MAKE) typecheck 2>&1 | grep -v \"^make\\[\"\n\n# Good - capture exit code explicitly in wrapper scripts\n# See shell-review skill for bash pipeline patterns\ncheck:\n\t@$(MAKE) typecheck || { echo \"Type check failed\"; exit 1; }\n\n# Good - use .SHELLFLAGS for pipefail in recipes\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n```\n\nWhen recipes use pipelines, ensure exit codes propagate correctly. In bash, the default behavior is that pipeline exit code equals the last command's exit code. Use `set -o pipefail` or capture output and exit codes separately.\n\n## Parallel Execution\n\n```makefile\n# Enable parallel by default\nMAKEFLAGS += -j$(shell nproc 2>/dev/null || echo 1)\n\n# Or disable for specific targets\n.NOTPARALLEL: install deploy\n```\n\nFile v1.9.19:modules/deduplication-patterns.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: deduplication-patterns\ndescription: Detect and eliminate recipe duplication using pattern rules and functions\ntags: [deduplication, pattern-rules, functions, automatic-variables]\n---\n\n# Deduplication Patterns\n\n## Recipe Duplication Detection\n\nSearch for repeated command patterns:\n```bash\n# Common test commands\nrg -n \"cargo test\" -g'Makefile*'\nrg -n \"pytest\" -g'Makefile*'\nrg -n \"npm run\" -g'Makefile*'\nrg -n \"go test\" -g'Makefile*'\n\n# Build commands\nrg -n \"docker build\" -g'Makefile*'\nrg -n \"gcc.*-o\" -g'Makefile*'\n```\n\n## Pattern Rules\n\nReplace repeated rules with patterns:\n```makefile\n# Bad - repeated\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\ntest-e2e:\n\tpytest tests/e2e\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\nPattern rule for file conversion:\n```makefile\n# Convert all .md to .html\n%.html: %.md\n\tpandoc $< -o $@\n\n# Build objects from sources\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Static Pattern Rules\n\nFor specific targets with patterns:\n```makefile\nSOURCES := foo.c bar.c baz.c\nOBJECTS := $(SOURCES:.c=.o)\n\n$(OBJECTS): %.o: %.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Functions and Define Blocks\n\nReusable command sequences:\n```makefile\n# Define reusable function\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\nMulti-line define blocks:\n```makefile\ndefine install_package\n\t@echo \"Installing $(1)...\"\n\tpip install --quiet $(1)\n\t@echo \"Done: $(1)\"\nendef\n\ndeps:\n\t$(call install_package,pytest)\n\t$(call install_package,black)\n```\n\n## Automatic Variables Reference\n\nUse automatic variables to reduce duplication:\n\n| Variable | Meaning | Use Case |\n|----------|---------|----------|\n| `$@` | Target name | Output file path |\n| `$<` | First prerequisite | Main input file |\n| `$^` | All prerequisites | Link all objects |\n| `$?` | Newer prerequisites | Incremental builds |\n| `$*` | Stem match | Pattern rule matching |\n| `$(@D)` | Directory of target | mkdir parent |\n| `$(<D)` | Directory of first prerequisite | Source dirs |\n\nExample:\n```makefile\n# Before\nbuild/foo.o: src/foo.c\n\t$(CC) $(CFLAGS) -c src/foo.c -o build/foo.o\n\n# After\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Clean Target Best Practices\n\n```makefile\n# Good - use variables, don't duplicate paths\nBUILD_DIR ?= build\nDIST_DIR ?= dist\n\n.PHONY: clean distclean\n\nclean:\n\trm -rf $(BUILD_DIR)\n\ndistclean: clean\n\trm -rf $(DIST_DIR)\n```\n\nFile v1.9.19:modules/dependency-graph.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: dependency-graph\ndescription: Make database inspection and dependency analysis\ntags: [dependencies, phony, circular-deps, includes]\n---\n\n# Dependency Graph Analysis\n\n## Make Database Inspection\n\nInspect the complete expanded database:\n```bash\nmake -pn | less\n```\n\nThis shows:\n- All rules (implicit and explicit)\n- Variable assignments\n- Default values\n- Pattern rules\n\n## PHONY Detection\n\nCheck for `.PHONY` declarations:\n```bash\nrg -n \"^\\.PHONY:\" -g'Makefile*'\n```\n\nCommon PHONY targets that should be declared:\n- `all`, `build`, `test`, `clean`, `install`\n- `help`, `format`, `lint`, `release`\n- `distclean`, `check`, `docs`\n\n## Circular Dependency Checks\n\nLook for circular dependencies:\n```bash\nmake -pn 2>&1 | grep -i \"circular\"\n```\n\nCommon patterns:\n```makefile\n# Bad - circular\nA: B\nB: A\n\n# Good - linear\nA: B\nB: C\n```\n\n## Include File Patterns\n\nFind include directives:\n```bash\nrg -n \"^include|^-include\" -g'Makefile*'\n```\n\nCheck for:\n- Redundant includes\n- Missing includes\n- Include order issues\n- Conditional includes\n\nValidate included files exist:\n```bash\n# List includes\nrg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'\n\n# Check they exist\nfor f in $(rg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'); do\n  [ -f \"$f\" ] || echo \"Missing: $f\"\ndone\n```\n\nFile v1.9.19:modules/plugin-dogfood-checks.md\n\n# Plugin Dogfood Checks\n\nAnalyzes Makefiles to identify gaps in user-facing functionality, safely tests existing targets, and generates missing targets with contextually appropriate templates.\n\n## Overview\n\nThis module provides detailed Makefile analysis and enhancement for the claude-night-market project. It validates that all plugins have complete, consistent, and functional Makefile targets that support common user workflows.\n\n## Workflow\n\n### 1. Discovery Phase\n```bash\nmakefile_dogfooder.py --scope all --mode analyze\n```\n\nThe discovery phase:\n- Recursively searches for Makefile, makefile, GNUmakefile, and *.mk files\n- Parses target definitions with dependencies and commands\n- Extracts variable assignments and include statements\n- Builds dependency graphs and detects plugin type (leaf vs aggregator)\n\n### 2. Analysis Phase\n```bash\nmakefile_dogfooder.py --mode analyze --output json\n```\n\nThe analysis phase evaluates:\n- **Essential targets** (help, clean, .PHONY) - 20 points each\n- **Recommended targets** (test, lint, format, install, status) - 10 points each\n- **Convenience targets** (demo, dogfood, check, quick-run) - 5 points each\n- **Anti-patterns** (missing .PHONY, no error handling)\n- **Consistency** across multiple Makefiles\n\n### 3. Testing Phase\n```bash\nmakefile_dogfooder.py --mode test\n```\n\nThe testing phase performs:\n- Syntax validation with `make -n`\n- Help target functionality checks\n- Variable dependency verification\n- Common runtime issue detection\n\n### 4. Generation Phase\n```bash\nmakefile_dogfooder.py --mode full --apply\n```\n\nThe generation phase creates:\n- **Demo targets** to showcase plugin functionality\n- **Dogfood targets** for self-testing\n- **Quick-run targets** for common workflows\n- **Check-all targets** for aggregator Makefiles\n\n## Best Practices\n\n### For Leaf Plugins\n- Always include: help, clean, test, lint\n- Add demo target to showcase functionality\n- Include dogfood target for self-testing\n- Use shared includes from abstract when possible\n\n### For Aggregator Makefiles\n- Delegate to plugin Makefiles with pattern targets\n- Include check-all target for detailed validation\n- Maintain consistent target naming across plugins\n- Provide helpful aggregate status information\n\n### Target Naming\n- Use kebab-case for target names\n- Include brief description with `##` comment\n- Group related targets with prefixes (test-, dev-, docs-)\n- Follow alphabetical ordering for readability\n\n## Demo Target Philosophy\n\nDemo targets must run ACTUAL functionality, not just echo static information.\n\n| BAD (Static/Informational) | GOOD (Live/Functional) |\n|-------------------------------|---------------------------|\n| `@echo \"Skills: 5\"` | `$(UV_RUN) python scripts/validator.py --scan` |\n| `@find skills/ \\| wc -l` | `$(UV_RUN) python scripts/cli.py analyze .` |\n| `@echo \"Feature: validation\"` | `$(UV_RUN) python scripts/validator.py --target .` |\n\n## Integration\n\n### With Slash Commands\n```bash\n/make-dogfood --scope plugins --mode full\n```\n\n### With CI/CD\n```yaml\n- name: Validate Makefiles\n  run: makefile_dogfooder.py --mode test --output json\n```\n\n## Scoring\n\nEach Makefile is scored 0-100 based on target coverage:\n- Essential targets: 20 points each\n- Recommended targets: 10 points each\n- Convenience targets: 5 points each\n- Anti-pattern penalties: -5 to -10 each\n\nFile v1.9.19:modules/portability-checks.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: portability-checks\ndescription: Cross-platform compatibility and POSIX vs GNU Make feature detection\ntags: [portability, posix, gnu-make, cross-platform]\n---\n\n# Portability Checks\n\n## GNU Make Features\n\nCheck for GNU-specific features that may not be portable:\n\n### Advanced Directives\n```bash\nrg -n \"^\\\\.ONESHELL:\" -g'Makefile*'\nrg -n \"^\\\\.NOTPARALLEL:\" -g'Makefile*'\nrg -n \"^\\\\.DELETE_ON_ERROR:\" -g'Makefile*'\n```\n\n- `.ONESHELL` - Single shell per recipe (GNU Make 3.82+)\n- `.NOTPARALLEL` - Disable parallel execution\n- `.DELETE_ON_ERROR` - Delete targets on error\n\n### Order-Only Prerequisites\n```bash\nrg -n \"\\|[^|]\" -g'Makefile*'\n```\n\nOrder-only prerequisites (`target: normal | order-only`) are GNU Make only.\n\n### GNU Functions\n```bash\nrg -n \"\\$\\(shell \" -g'Makefile*'\nrg -n \"\\$\\(wildcard \" -g'Makefile*'\nrg -n \"\\$\\(foreach \" -g'Makefile*'\nrg -n \"\\$\\(eval \" -g'Makefile*'\n```\n\nCommon GNU functions:\n- `$(shell ...)` - Execute shell command\n- `$(wildcard pattern)` - File globbing\n- `$(foreach var,list,text)` - Loop\n- `$(eval text)` - Dynamic evaluation\n\n## POSIX Compatibility\n\nFor maximum portability:\n```makefile\n# POSIX-compatible shell\nSHELL := /bin/sh\n\n# Avoid Bash-specific features\n# - Arrays: arr=(1 2 3)\n# - [[ ]]: use [ ] instead\n# - Process substitution: <(cmd)\n# - Brace expansion: {1..10}\n```\n\n## Shell Configuration\n\n### Good: POSIX Compatible\n```makefile\nSHELL := /bin/sh\n```\n\n### If Bash Required\nDocument and configure properly:\n```makefile\n# Requires Bash 4.0+\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n\n# -e: exit on error\n# -u: error on undefined variable\n# -o pipefail: pipe fails if any command fails\n# -c: execute command\n```\n\n## Cross-Platform Safety\n\n### Path Separators\n```makefile\n# Good - portable\nSRC_DIR := src\nBUILD_DIR := build\n\n# Bad - hardcoded separator\nSRC_DIR := src/main/resources\n```\n\n### Command Portability\n```makefile\n# Check for required commands\nifeq ($(shell command -v pandoc 2>/dev/null),)\n$(error pandoc is required but not installed)\nendif\n```\n\n### Platform Detection\n```makefile\nUNAME := $(shell uname -s)\n\nifeq ($(UNAME),Linux)\n  # Linux-specific\nendif\nifeq ($(UNAME),Darwin)\n  # macOS-specific\nendif\n```\n\n## Quality Gate Targets\n\nvalidate standard targets exist:\n```bash\nrg -n \"^help:\" -g'Makefile*'\nrg -n \"^format:\" -g'Makefile*'\nrg -n \"^lint:\" -g'Makefile*'\nrg -n \"^test:\" -g'Makefile*'\nrg -n \"^build:\" -g'Makefile*'\nrg -n \"^clean:\" -g'Makefile*'\n```\n\nRecommended targets:\n- `help` - Show available targets\n- `format` - Code formatting\n- `lint` - Linting checks\n- `test` - Run test suite\n- `build` - Build artifacts\n- `clean` - Clean build artifacts\n- `release` - Production build\n- `install` - Install artifacts\n\nFile v1.9.19:skill-card.md\n\n## Description:\n\nAudits Makefiles for build correctness, portability, and recipe duplication.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[athola](https://clawhub.ai/user/athola)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and engineers use this skill when reviewing Makefile changes, improving build automation, checking portability, identifying duplicated recipes, and deciding whether build-system changes are ready to approve.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Make-related inspection or testing commands may execute project-defined Makefile logic in the reviewed repository.\n\nMitigation: For untrusted repositories, avoid make -pn, make -n, and target testing unless explicitly approved in a sandbox with secrets removed.\n\nRisk: Generated Makefile changes or --apply workflows may alter build behavior without enough containment.\n\nMitigation: Only allow apply-style generation after explicit approval, then review the resulting clean diff before accepting changes.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-pensive-makefile-review)\n- [ClawHub publisher profile](https://clawhub.ai/user/athola)\n- [OpenClaw homepage](https://github.com/athola/claude-night-market/tree/master/plugins/pensive)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, code, configuration, guidance]\n\n**Output Format:** [Markdown review report with command snippets, findings, recommendations, and optional generated Makefile target templates]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May include severity labels, file and target context, dependency analysis, duplication candidates, portability findings, missing-target checklists, and approve/block recommendations.]\n\n## Skill Version(s):\n\n1.9.19 (source: ClawHub release metadata; artifact frontmatter reports 1.9.8)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.9.17: 8 files, 10389 bytes\n\nFiles: modules/best-practices.md (4064b), modules/deduplication-patterns.md (2530b), modules/dependency-graph.md (1306b), modules/plugin-dogfood-checks.md (3322b), modules/portability-checks.md (2735b), skill-card.md (2077b), SKILL.md (4535b), _meta.json (146b)\n\nFile v1.9.17:SKILL.md\n\n---\nname: makefile-review\ndescription: Audits Makefiles for build correctness, portability, and recipe duplication\nversion: 1.9.8\ntriggers:\n  - makefile\n  - build\n  - make\n  - portability\n  - automation\n  - reviewing a Makefile or before committing Makefile changes\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/pensive\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.pensive:shared\", \"night-market.imbue:proof-of-work\"]}}}\nsource: claude-night-market\nsource_plugin: pensive\n---\n\n> **Night Market Skill** — ported from [claude-night-market/pensive](https://github.com/athola/claude-night-market/tree/master/plugins/pensive). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Workflow](#workflow)\n- [Step 1: Map Context (`makefile-review:context-mapped`)](#step-1:-map-context-(makefile-review:context-mapped))\n- [Step 2: Dependency Graph (`makefile-review:dependency-graph`)](#step-2:-dependency-graph-(makefile-review:dependency-graph))\n- [Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)](#step-3:-deduplication-audit-(makefile-review:dedup-candidates))\n- [Step 4: Portability Check (`makefile-review:tooling-alignment`)](#step-4:-portability-check-(makefile-review:tooling-alignment))\n- [Step 5: Evidence Log (`makefile-review:evidence-logged`)](#step-5:-evidence-log-(makefile-review:evidence-logged))\n- [Progressive Loading](#progressive-loading)\n- [Output Format](#output-format)\n- [Summary](#summary)\n- [Testing](#testing)\n\n## Testing\n\nRun `pytest plugins/pensive/tests/skills/test_makefile_review.py` to verify review logic.\n\n# Makefile Review Workflow\n\nAudit Makefiles for best practices, deduplication, and portability.\n\n## Quick Start\n\n```bash\n/makefile-review\n```\n\n## When To Use\n\n- Makefile changes or additions\n- Build system optimization\n- Portability improvements\n- CI/CD pipeline updates\n- Developer experience improvements\n\n## When NOT To Use\n\n- Creating new Makefiles - use abstract:make-dogfood\n- Architecture review - use architecture-review\n\n## Required TodoWrite Items\n\n1. `makefile-review:context-mapped`\n2. `makefile-review:dependency-graph`\n3. `makefile-review:dedup-candidates`\n4. `makefile-review:tooling-alignment`\n5. `makefile-review:evidence-logged`\n\n## Workflow\n\n### Step 1: Map Context (`makefile-review:context-mapped`)\n\nConfirm baseline:\n```bash\npwd && git status -sb && git diff --stat\n```\n**Verification:** Run `git status` to confirm working tree state.\n\nFind Make-related files:\n```bash\nrg -n \"^include\" -g'Makefile*'\nrg --files -g '*.mk'\n```\n\nDocument changed targets, project goals, and tooling requirements.\n\n### Step 2: Dependency Graph (`makefile-review:dependency-graph`)\n\n@include modules/dependency-graph.md\n\n### Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)\n\n@include modules/deduplication-patterns.md\n\n### Step 4: Portability Check (`makefile-review:tooling-alignment`)\n\n@include modules/portability-checks.md\n\n### Step 5: Evidence Log (`makefile-review:evidence-logged`)\n\nUse `imbue:proof-of-work` to record command outputs with file:line references.\n\nSummarize findings:\n- Severity (critical, major, minor)\n- Expected impact\n- Suggested refactors\n- Owners and dates for follow-ups\n\n## Progressive Loading\n\nLoad additional context as needed:\n\n**Best Practices & Examples**: `@include modules/best-practices.md`\n\n**Plugin Dogfood Checks**: `@include modules/plugin-dogfood-checks.md` - Makefile completeness analysis, target generation, and dogfooding validation.\n\n## Output Format\n\n```markdown\n## Summary\nMakefile review findings\n\n## Context\n- Files reviewed: [list]\n- Targets changed: [list]\n\n## Dependency Analysis\n[graph and issues]\n\n## Duplication Candidates\n### [D1] Repeated command\n- Locations: [list]\n- Recommendation: [pattern rule]\n\n## Portability Issues\n[cross-platform concerns]\n\n## Missing Targets\n- [ ] help\n- [ ] format\n- [ ] lint\n\n## Recommendation\nApprove / Approve with actions / Block\n```\n\n## Exit Criteria\n\n- Context mapped\n- Dependencies analyzed\n- Deduplication reviewed\n- Portability checked\n- Evidence logged\n## Troubleshooting\n\n### Common Issues\n\n**No Makefile found**\nEnsure `Makefile` or `*.mk` files exist in the project root or specify paths explicitly.\n\n**Include directives not resolved**\nRun `rg -n \"^include\" -g'Makefile*'` to trace include chains manually.\n\nFile v1.9.17:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-pensive-makefile-review\",\n  \"version\": \"1.9.17\",\n  \"publishedAt\": 1785389946878\n}\n\nFile v1.9.17:modules/best-practices.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: best-practices\ndescription: Makefile structure patterns, examples, and anti-patterns to avoid\ntags: [best-practices, patterns, anti-patterns, examples]\n---\n\n# Makefile Best Practices\n\n## Structure Pattern\n\nRecommended organization:\n```makefile\n# 1. Variables at top\nPROJECT := myproject\nSRC_DIR := src\nBUILD_DIR := build\nVERSION := 1.0.0\n\n# 2. Default goal\n.DEFAULT_GOAL := help\n\n# 3. PHONY declarations\n.PHONY: all build test clean help\n\n# 4. Help target (self-documenting)\nhelp: ## Show this help\n\t@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \\\n\t\tawk 'BEGIN {FS = \":.*?## \"}; {printf \"%-15s %s\\n\", $$1, $$2}'\n\n# 5. Main targets with inline docs\nbuild: ## Build the project\n\t$(MAKE) -C $(SRC_DIR)\n\ntest: build ## Run tests\n\tpytest tests/\n\nclean: ## Clean build artifacts\n\trm -rf $(BUILD_DIR)\n```\n\n## Pattern Rule Examples\n\n### File Conversion\n```makefile\n# Markdown to HTML\n%.html: %.md\n\tpandoc $< -o $@\n\n# Source to object\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t@mkdir -p $(@D)\n\t$(CC) $(CFLAGS) -c $< -o $@\n\n# Template expansion\n%/config.json: templates/config.json.tmpl\n\t@mkdir -p $(@D)\n\tenvsubst < $< > $@\n```\n\n### Testing Patterns\n```makefile\n# Test by subdirectory\ntest-%:\n\tpytest tests/$*\n\n# Test by type\ntest-unit test-integration test-e2e: test-%:\n\tpytest tests/$* -v\n```\n\n## Function Examples\n\n### Reusable Command Sequences\n```makefile\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest -v\n\t@echo \"Done: $(1)\"\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\n### Multi-line Recipes\n```makefile\ndefine docker_build\n\tdocker build \\\n\t\t--build-arg VERSION=$(VERSION) \\\n\t\t--tag $(1):$(VERSION) \\\n\t\t--tag $(1):latest \\\n\t\t.\nendef\n\nimage:\n\t$(call docker_build,$(PROJECT))\n```\n\n## Anti-Patterns to Avoid\n\n### Repeated Commands\n```makefile\n# Bad - duplicated logic\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\n### Missing PHONY\n```makefile\n# Bad - 'clean' file blocks target\nclean:\n\trm -rf build/\n\n# Good\n.PHONY: clean\nclean:\n\trm -rf build/\n```\n\n### Hardcoded Paths\n```makefile\n# Bad - not portable\nclean:\n\trm -rf /home/user/project/build\n\n# Good - variables\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Shell-Specific Commands\n```makefile\n# Bad - Bash-only\ncheck:\n\t[[ -f config.yaml ]] && echo \"Found\"\n\n# Good - POSIX compatible\ncheck:\n\t[ -f config.yaml ] && echo \"Found\"\n```\n\n### Unguarded Variable References\n```makefile\n# Bad - fails if undefined\nclean:\n\trm -rf $(BUILD_DIR)\n\n# Good - with default\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Non-Idempotent Targets\n```makefile\n# Bad - appends every time\nconfigure:\n\techo \"DEBUG=1\" >> config.mk\n\n# Good - idempotent\nconfigure:\n\t@echo \"DEBUG=1\" > config.mk\n```\n\n## Error Handling\n\n### Check Prerequisites\n```makefile\n.PHONY: check-deps\ncheck-deps:\n\t@command -v python3 >/dev/null || (echo \"python3 required\"; exit 1)\n\t@command -v pytest >/dev/null || (echo \"pytest required\"; exit 1)\n\ntest: check-deps\n\tpytest tests/\n```\n\n### Delete on Error\n```makefile\n# Automatically delete targets on error\n.DELETE_ON_ERROR:\n\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n### Pipeline Exit Code Propagation\n```makefile\n# Bad - pipeline exit code is from grep, not make\ncheck:\n\t@$(MAKE) typecheck 2>&1 | grep -v \"^make\\[\"\n\n# Good - capture exit code explicitly in wrapper scripts\n# See shell-review skill for bash pipeline patterns\ncheck:\n\t@$(MAKE) typecheck || { echo \"Type check failed\"; exit 1; }\n\n# Good - use .SHELLFLAGS for pipefail in recipes\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n```\n\nWhen recipes use pipelines, ensure exit codes propagate correctly. In bash, the default behavior is that pipeline exit code equals the last command's exit code. Use `set -o pipefail` or capture output and exit codes separately.\n\n## Parallel Execution\n\n```makefile\n# Enable parallel by default\nMAKEFLAGS += -j$(shell nproc 2>/dev/null || echo 1)\n\n# Or disable for specific targets\n.NOTPARALLEL: install deploy\n```\n\nFile v1.9.17:modules/deduplication-patterns.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: deduplication-patterns\ndescription: Detect and eliminate recipe duplication using pattern rules and functions\ntags: [deduplication, pattern-rules, functions, automatic-variables]\n---\n\n# Deduplication Patterns\n\n## Recipe Duplication Detection\n\nSearch for repeated command patterns:\n```bash\n# Common test commands\nrg -n \"cargo test\" -g'Makefile*'\nrg -n \"pytest\" -g'Makefile*'\nrg -n \"npm run\" -g'Makefile*'\nrg -n \"go test\" -g'Makefile*'\n\n# Build commands\nrg -n \"docker build\" -g'Makefile*'\nrg -n \"gcc.*-o\" -g'Makefile*'\n```\n\n## Pattern Rules\n\nReplace repeated rules with patterns:\n```makefile\n# Bad - repeated\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\ntest-e2e:\n\tpytest tests/e2e\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\nPattern rule for file conversion:\n```makefile\n# Convert all .md to .html\n%.html: %.md\n\tpandoc $< -o $@\n\n# Build objects from sources\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Static Pattern Rules\n\nFor specific targets with patterns:\n```makefile\nSOURCES := foo.c bar.c baz.c\nOBJECTS := $(SOURCES:.c=.o)\n\n$(OBJECTS): %.o: %.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Functions and Define Blocks\n\nReusable command sequences:\n```makefile\n# Define reusable function\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\nMulti-line define blocks:\n```makefile\ndefine install_package\n\t@echo \"Installing $(1)...\"\n\tpip install --quiet $(1)\n\t@echo \"Done: $(1)\"\nendef\n\ndeps:\n\t$(call install_package,pytest)\n\t$(call install_package,black)\n```\n\n## Automatic Variables Reference\n\nUse automatic variables to reduce duplication:\n\n| Variable | Meaning | Use Case |\n|----------|---------|----------|\n| `$@` | Target name | Output file path |\n| `$<` | First prerequisite | Main input file |\n| `$^` | All prerequisites | Link all objects |\n| `$?` | Newer prerequisites | Incremental builds |\n| `$*` | Stem match | Pattern rule matching |\n| `$(@D)` | Directory of target | mkdir parent |\n| `$(<D)` | Directory of first prerequisite | Source dirs |\n\nExample:\n```makefile\n# Before\nbuild/foo.o: src/foo.c\n\t$(CC) $(CFLAGS) -c src/foo.c -o build/foo.o\n\n# After\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Clean Target Best Practices\n\n```makefile\n# Good - use variables, don't duplicate paths\nBUILD_DIR ?= build\nDIST_DIR ?= dist\n\n.PHONY: clean distclean\n\nclean:\n\trm -rf $(BUILD_DIR)\n\ndistclean: clean\n\trm -rf $(DIST_DIR)\n```\n\nFile v1.9.17:modules/dependency-graph.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: dependency-graph\ndescription: Make database inspection and dependency analysis\ntags: [dependencies, phony, circular-deps, includes]\n---\n\n# Dependency Graph Analysis\n\n## Make Database Inspection\n\nInspect the complete expanded database:\n```bash\nmake -pn | less\n```\n\nThis shows:\n- All rules (implicit and explicit)\n- Variable assignments\n- Default values\n- Pattern rules\n\n## PHONY Detection\n\nCheck for `.PHONY` declarations:\n```bash\nrg -n \"^\\.PHONY:\" -g'Makefile*'\n```\n\nCommon PHONY targets that should be declared:\n- `all`, `build`, `test`, `clean`, `install`\n- `help`, `format`, `lint`, `release`\n- `distclean`, `check`, `docs`\n\n## Circular Dependency Checks\n\nLook for circular dependencies:\n```bash\nmake -pn 2>&1 | grep -i \"circular\"\n```\n\nCommon patterns:\n```makefile\n# Bad - circular\nA: B\nB: A\n\n# Good - linear\nA: B\nB: C\n```\n\n## Include File Patterns\n\nFind include directives:\n```bash\nrg -n \"^include|^-include\" -g'Makefile*'\n```\n\nCheck for:\n- Redundant includes\n- Missing includes\n- Include order issues\n- Conditional includes\n\nValidate included files exist:\n```bash\n# List includes\nrg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'\n\n# Check they exist\nfor f in $(rg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'); do\n  [ -f \"$f\" ] || echo \"Missing: $f\"\ndone\n```\n\nFile v1.9.17:modules/plugin-dogfood-checks.md\n\n# Plugin Dogfood Checks\n\nAnalyzes Makefiles to identify gaps in user-facing functionality, safely tests existing targets, and generates missing targets with contextually appropriate templates.\n\n## Overview\n\nThis module provides detailed Makefile analysis and enhancement for the claude-night-market project. It validates that all plugins have complete, consistent, and functional Makefile targets that support common user workflows.\n\n## Workflow\n\n### 1. Discovery Phase\n```bash\nmakefile_dogfooder.py --scope all --mode analyze\n```\n\nThe discovery phase:\n- Recursively searches for Makefile, makefile, GNUmakefile, and *.mk files\n- Parses target definitions with dependencies and commands\n- Extracts variable assignments and include statements\n- Builds dependency graphs and detects plugin type (leaf vs aggregator)\n\n### 2. Analysis Phase\n```bash\nmakefile_dogfooder.py --mode analyze --output json\n```\n\nThe analysis phase evaluates:\n- **Essential targets** (help, clean, .PHONY) - 20 points each\n- **Recommended targets** (test, lint, format, install, status) - 10 points each\n- **Convenience targets** (demo, dogfood, check, quick-run) - 5 points each\n- **Anti-patterns** (missing .PHONY, no error handling)\n- **Consistency** across multiple Makefiles\n\n### 3. Testing Phase\n```bash\nmakefile_dogfooder.py --mode test\n```\n\nThe testing phase performs:\n- Syntax validation with `make -n`\n- Help target functionality checks\n- Variable dependency verification\n- Common runtime issue detection\n\n### 4. Generation Phase\n```bash\nmakefile_dogfooder.py --mode full --apply\n```\n\nThe generation phase creates:\n- **Demo targets** to showcase plugin functionality\n- **Dogfood targets** for self-testing\n- **Quick-run targets** for common workflows\n- **Check-all targets** for aggregator Makefiles\n\n## Best Practices\n\n### For Leaf Plugins\n- Always include: help, clean, test, lint\n- Add demo target to showcase functionality\n- Include dogfood target for self-testing\n- Use shared includes from abstract when possible\n\n### For Aggregator Makefiles\n- Delegate to plugin Makefiles with pattern targets\n- Include check-all target for detailed validation\n- Maintain consistent target naming across plugins\n- Provide helpful aggregate status information\n\n### Target Naming\n- Use kebab-case for target names\n- Include brief description with `##` comment\n- Group related targets with prefixes (test-, dev-, docs-)\n- Follow alphabetical ordering for readability\n\n## Demo Target Philosophy\n\nDemo targets must run ACTUAL functionality, not just echo static information.\n\n| BAD (Static/Informational) | GOOD (Live/Functional) |\n|-------------------------------|---------------------------|\n| `@echo \"Skills: 5\"` | `$(UV_RUN) python scripts/validator.py --scan` |\n| `@find skills/ \\| wc -l` | `$(UV_RUN) python scripts/cli.py analyze .` |\n| `@echo \"Feature: validation\"` | `$(UV_RUN) python scripts/validator.py --target .` |\n\n## Integration\n\n### With Slash Commands\n```bash\n/make-dogfood --scope plugins --mode full\n```\n\n### With CI/CD\n```yaml\n- name: Validate Makefiles\n  run: makefile_dogfooder.py --mode test --output json\n```\n\n## Scoring\n\nEach Makefile is scored 0-100 based on target coverage:\n- Essential targets: 20 points each\n- Recommended targets: 10 points each\n- Convenience targets: 5 points each\n- Anti-pattern penalties: -5 to -10 each\n\nFile v1.9.17:modules/portability-checks.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: portability-checks\ndescription: Cross-platform compatibility and POSIX vs GNU Make feature detection\ntags: [portability, posix, gnu-make, cross-platform]\n---\n\n# Portability Checks\n\n## GNU Make Features\n\nCheck for GNU-specific features that may not be portable:\n\n### Advanced Directives\n```bash\nrg -n \"^\\\\.ONESHELL:\" -g'Makefile*'\nrg -n \"^\\\\.NOTPARALLEL:\" -g'Makefile*'\nrg -n \"^\\\\.DELETE_ON_ERROR:\" -g'Makefile*'\n```\n\n- `.ONESHELL` - Single shell per recipe (GNU Make 3.82+)\n- `.NOTPARALLEL` - Disable parallel execution\n- `.DELETE_ON_ERROR` - Delete targets on error\n\n### Order-Only Prerequisites\n```bash\nrg -n \"\\|[^|]\" -g'Makefile*'\n```\n\nOrder-only prerequisites (`target: normal | order-only`) are GNU Make only.\n\n### GNU Functions\n```bash\nrg -n \"\\$\\(shell \" -g'Makefile*'\nrg -n \"\\$\\(wildcard \" -g'Makefile*'\nrg -n \"\\$\\(foreach \" -g'Makefile*'\nrg -n \"\\$\\(eval \" -g'Makefile*'\n```\n\nCommon GNU functions:\n- `$(shell ...)` - Execute shell command\n- `$(wildcard pattern)` - File globbing\n- `$(foreach var,list,text)` - Loop\n- `$(eval text)` - Dynamic evaluation\n\n## POSIX Compatibility\n\nFor maximum portability:\n```makefile\n# POSIX-compatible shell\nSHELL := /bin/sh\n\n# Avoid Bash-specific features\n# - Arrays: arr=(1 2 3)\n# - [[ ]]: use [ ] instead\n# - Process substitution: <(cmd)\n# - Brace expansion: {1..10}\n```\n\n## Shell Configuration\n\n### Good: POSIX Compatible\n```makefile\nSHELL := /bin/sh\n```\n\n### If Bash Required\nDocument and configure properly:\n```makefile\n# Requires Bash 4.0+\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n\n# -e: exit on error\n# -u: error on undefined variable\n# -o pipefail: pipe fails if any command fails\n# -c: execute command\n```\n\n## Cross-Platform Safety\n\n### Path Separators\n```makefile\n# Good - portable\nSRC_DIR := src\nBUILD_DIR := build\n\n# Bad - hardcoded separator\nSRC_DIR := src/main/resources\n```\n\n### Command Portability\n```makefile\n# Check for required commands\nifeq ($(shell command -v pandoc 2>/dev/null),)\n$(error pandoc is required but not installed)\nendif\n```\n\n### Platform Detection\n```makefile\nUNAME := $(shell uname -s)\n\nifeq ($(UNAME),Linux)\n  # Linux-specific\nendif\nifeq ($(UNAME),Darwin)\n  # macOS-specific\nendif\n```\n\n## Quality Gate Targets\n\nvalidate standard targets exist:\n```bash\nrg -n \"^help:\" -g'Makefile*'\nrg -n \"^format:\" -g'Makefile*'\nrg -n \"^lint:\" -g'Makefile*'\nrg -n \"^test:\" -g'Makefile*'\nrg -n \"^build:\" -g'Makefile*'\nrg -n \"^clean:\" -g'Makefile*'\n```\n\nRecommended targets:\n- `help` - Show available targets\n- `format` - Code formatting\n- `lint` - Linting checks\n- `test` - Run test suite\n- `build` - Build artifacts\n- `clean` - Clean build artifacts\n- `release` - Production build\n- `install` - Install artifacts\n\nFile v1.9.17:skill-card.md\n\n## Description: <br>\nAudits Makefiles for build correctness, portability, and recipe duplication. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and build engineers use this skill before committing Makefile changes, CI/CD updates, or build-system refactors to identify dependency, portability, duplication, and target-coverage issues. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill can move from review into broad Makefile modification when apply-style workflows are used. <br>\nMitigation: Review all proposed Makefile edits before allowing apply workflows, especially changes that affect CI, release, install, cleanup, or recursive target behavior. <br>\nRisk: Generated or suggested Makefile targets can alter project automation behavior. <br>\nMitigation: Run dry-run or syntax checks such as make -n on affected targets and compare the working tree diff before committing changes. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-pensive-makefile-review) <br>\n- [Project homepage from metadata](https://github.com/athola/claude-night-market/tree/master/plugins/pensive) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, shell commands, code, guidance] <br>\n**Output Format:** [Markdown review report with findings, file references, command snippets, and recommendations.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include suggested Makefile target changes; review proposed edits before applying them.] <br>\n\n## Skill Version(s): <br>\n1.9.17 (source: server release metadata) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.16: 8 files, 10402 bytes\n\nFiles: modules/best-practices.md (4064b), modules/deduplication-patterns.md (2530b), modules/dependency-graph.md (1306b), modules/plugin-dogfood-checks.md (3322b), modules/portability-checks.md (2735b), skill-card.md (2128b), SKILL.md (4535b), _meta.json (146b)\n\nFile v1.9.16:SKILL.md\n\n---\nname: makefile-review\ndescription: Audits Makefiles for build correctness, portability, and recipe duplication\nversion: 1.9.8\ntriggers:\n  - makefile\n  - build\n  - make\n  - portability\n  - automation\n  - reviewing a Makefile or before committing Makefile changes\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/pensive\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.pensive:shared\", \"night-market.imbue:proof-of-work\"]}}}\nsource: claude-night-market\nsource_plugin: pensive\n---\n\n> **Night Market Skill** — ported from [claude-night-market/pensive](https://github.com/athola/claude-night-market/tree/master/plugins/pensive). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Workflow](#workflow)\n- [Step 1: Map Context (`makefile-review:context-mapped`)](#step-1:-map-context-(makefile-review:context-mapped))\n- [Step 2: Dependency Graph (`makefile-review:dependency-graph`)](#step-2:-dependency-graph-(makefile-review:dependency-graph))\n- [Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)](#step-3:-deduplication-audit-(makefile-review:dedup-candidates))\n- [Step 4: Portability Check (`makefile-review:tooling-alignment`)](#step-4:-portability-check-(makefile-review:tooling-alignment))\n- [Step 5: Evidence Log (`makefile-review:evidence-logged`)](#step-5:-evidence-log-(makefile-review:evidence-logged))\n- [Progressive Loading](#progressive-loading)\n- [Output Format](#output-format)\n- [Summary](#summary)\n- [Testing](#testing)\n\n## Testing\n\nRun `pytest plugins/pensive/tests/skills/test_makefile_review.py` to verify review logic.\n\n# Makefile Review Workflow\n\nAudit Makefiles for best practices, deduplication, and portability.\n\n## Quick Start\n\n```bash\n/makefile-review\n```\n\n## When To Use\n\n- Makefile changes or additions\n- Build system optimization\n- Portability improvements\n- CI/CD pipeline updates\n- Developer experience improvements\n\n## When NOT To Use\n\n- Creating new Makefiles - use abstract:make-dogfood\n- Architecture review - use architecture-review\n\n## Required TodoWrite Items\n\n1. `makefile-review:context-mapped`\n2. `makefile-review:dependency-graph`\n3. `makefile-review:dedup-candidates`\n4. `makefile-review:tooling-alignment`\n5. `makefile-review:evidence-logged`\n\n## Workflow\n\n### Step 1: Map Context (`makefile-review:context-mapped`)\n\nConfirm baseline:\n```bash\npwd && git status -sb && git diff --stat\n```\n**Verification:** Run `git status` to confirm working tree state.\n\nFind Make-related files:\n```bash\nrg -n \"^include\" -g'Makefile*'\nrg --files -g '*.mk'\n```\n\nDocument changed targets, project goals, and tooling requirements.\n\n### Step 2: Dependency Graph (`makefile-review:dependency-graph`)\n\n@include modules/dependency-graph.md\n\n### Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)\n\n@include modules/deduplication-patterns.md\n\n### Step 4: Portability Check (`makefile-review:tooling-alignment`)\n\n@include modules/portability-checks.md\n\n### Step 5: Evidence Log (`makefile-review:evidence-logged`)\n\nUse `imbue:proof-of-work` to record command outputs with file:line references.\n\nSummarize findings:\n- Severity (critical, major, minor)\n- Expected impact\n- Suggested refactors\n- Owners and dates for follow-ups\n\n## Progressive Loading\n\nLoad additional context as needed:\n\n**Best Practices & Examples**: `@include modules/best-practices.md`\n\n**Plugin Dogfood Checks**: `@include modules/plugin-dogfood-checks.md` - Makefile completeness analysis, target generation, and dogfooding validation.\n\n## Output Format\n\n```markdown\n## Summary\nMakefile review findings\n\n## Context\n- Files reviewed: [list]\n- Targets changed: [list]\n\n## Dependency Analysis\n[graph and issues]\n\n## Duplication Candidates\n### [D1] Repeated command\n- Locations: [list]\n- Recommendation: [pattern rule]\n\n## Portability Issues\n[cross-platform concerns]\n\n## Missing Targets\n- [ ] help\n- [ ] format\n- [ ] lint\n\n## Recommendation\nApprove / Approve with actions / Block\n```\n\n## Exit Criteria\n\n- Context mapped\n- Dependencies analyzed\n- Deduplication reviewed\n- Portability checked\n- Evidence logged\n## Troubleshooting\n\n### Common Issues\n\n**No Makefile found**\nEnsure `Makefile` or `*.mk` files exist in the project root or specify paths explicitly.\n\n**Include directives not resolved**\nRun `rg -n \"^include\" -g'Makefile*'` to trace include chains manually.\n\nFile v1.9.16:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-pensive-makefile-review\",\n  \"version\": \"1.9.16\",\n  \"publishedAt\": 1784058948848\n}\n\nFile v1.9.16:modules/best-practices.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: best-practices\ndescription: Makefile structure patterns, examples, and anti-patterns to avoid\ntags: [best-practices, patterns, anti-patterns, examples]\n---\n\n# Makefile Best Practices\n\n## Structure Pattern\n\nRecommended organization:\n```makefile\n# 1. Variables at top\nPROJECT := myproject\nSRC_DIR := src\nBUILD_DIR := build\nVERSION := 1.0.0\n\n# 2. Default goal\n.DEFAULT_GOAL := help\n\n# 3. PHONY declarations\n.PHONY: all build test clean help\n\n# 4. Help target (self-documenting)\nhelp: ## Show this help\n\t@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \\\n\t\tawk 'BEGIN {FS = \":.*?## \"}; {printf \"%-15s %s\\n\", $$1, $$2}'\n\n# 5. Main targets with inline docs\nbuild: ## Build the project\n\t$(MAKE) -C $(SRC_DIR)\n\ntest: build ## Run tests\n\tpytest tests/\n\nclean: ## Clean build artifacts\n\trm -rf $(BUILD_DIR)\n```\n\n## Pattern Rule Examples\n\n### File Conversion\n```makefile\n# Markdown to HTML\n%.html: %.md\n\tpandoc $< -o $@\n\n# Source to object\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t@mkdir -p $(@D)\n\t$(CC) $(CFLAGS) -c $< -o $@\n\n# Template expansion\n%/config.json: templates/config.json.tmpl\n\t@mkdir -p $(@D)\n\tenvsubst < $< > $@\n```\n\n### Testing Patterns\n```makefile\n# Test by subdirectory\ntest-%:\n\tpytest tests/$*\n\n# Test by type\ntest-unit test-integration test-e2e: test-%:\n\tpytest tests/$* -v\n```\n\n## Function Examples\n\n### Reusable Command Sequences\n```makefile\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest -v\n\t@echo \"Done: $(1)\"\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\n### Multi-line Recipes\n```makefile\ndefine docker_build\n\tdocker build \\\n\t\t--build-arg VERSION=$(VERSION) \\\n\t\t--tag $(1):$(VERSION) \\\n\t\t--tag $(1):latest \\\n\t\t.\nendef\n\nimage:\n\t$(call docker_build,$(PROJECT))\n```\n\n## Anti-Patterns to Avoid\n\n### Repeated Commands\n```makefile\n# Bad - duplicated logic\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\n### Missing PHONY\n```makefile\n# Bad - 'clean' file blocks target\nclean:\n\trm -rf build/\n\n# Good\n.PHONY: clean\nclean:\n\trm -rf build/\n```\n\n### Hardcoded Paths\n```makefile\n# Bad - not portable\nclean:\n\trm -rf /home/user/project/build\n\n# Good - variables\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Shell-Specific Commands\n```makefile\n# Bad - Bash-only\ncheck:\n\t[[ -f config.yaml ]] && echo \"Found\"\n\n# Good - POSIX compatible\ncheck:\n\t[ -f config.yaml ] && echo \"Found\"\n```\n\n### Unguarded Variable References\n```makefile\n# Bad - fails if undefined\nclean:\n\trm -rf $(BUILD_DIR)\n\n# Good - with default\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Non-Idempotent Targets\n```makefile\n# Bad - appends every time\nconfigure:\n\techo \"DEBUG=1\" >> config.mk\n\n# Good - idempotent\nconfigure:\n\t@echo \"DEBUG=1\" > config.mk\n```\n\n## Error Handling\n\n### Check Prerequisites\n```makefile\n.PHONY: check-deps\ncheck-deps:\n\t@command -v python3 >/dev/null || (echo \"python3 required\"; exit 1)\n\t@command -v pytest >/dev/null || (echo \"pytest required\"; exit 1)\n\ntest: check-deps\n\tpytest tests/\n```\n\n### Delete on Error\n```makefile\n# Automatically delete targets on error\n.DELETE_ON_ERROR:\n\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n### Pipeline Exit Code Propagation\n```makefile\n# Bad - pipeline exit code is from grep, not make\ncheck:\n\t@$(MAKE) typecheck 2>&1 | grep -v \"^make\\[\"\n\n# Good - capture exit code explicitly in wrapper scripts\n# See shell-review skill for bash pipeline patterns\ncheck:\n\t@$(MAKE) typecheck || { echo \"Type check failed\"; exit 1; }\n\n# Good - use .SHELLFLAGS for pipefail in recipes\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n```\n\nWhen recipes use pipelines, ensure exit codes propagate correctly. In bash, the default behavior is that pipeline exit code equals the last command's exit code. Use `set -o pipefail` or capture output and exit codes separately.\n\n## Parallel Execution\n\n```makefile\n# Enable parallel by default\nMAKEFLAGS += -j$(shell nproc 2>/dev/null || echo 1)\n\n# Or disable for specific targets\n.NOTPARALLEL: install deploy\n```\n\nFile v1.9.16:modules/deduplication-patterns.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: deduplication-patterns\ndescription: Detect and eliminate recipe duplication using pattern rules and functions\ntags: [deduplication, pattern-rules, functions, automatic-variables]\n---\n\n# Deduplication Patterns\n\n## Recipe Duplication Detection\n\nSearch for repeated command patterns:\n```bash\n# Common test commands\nrg -n \"cargo test\" -g'Makefile*'\nrg -n \"pytest\" -g'Makefile*'\nrg -n \"npm run\" -g'Makefile*'\nrg -n \"go test\" -g'Makefile*'\n\n# Build commands\nrg -n \"docker build\" -g'Makefile*'\nrg -n \"gcc.*-o\" -g'Makefile*'\n```\n\n## Pattern Rules\n\nReplace repeated rules with patterns:\n```makefile\n# Bad - repeated\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\ntest-e2e:\n\tpytest tests/e2e\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\nPattern rule for file conversion:\n```makefile\n# Convert all .md to .html\n%.html: %.md\n\tpandoc $< -o $@\n\n# Build objects from sources\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Static Pattern Rules\n\nFor specific targets with patterns:\n```makefile\nSOURCES := foo.c bar.c baz.c\nOBJECTS := $(SOURCES:.c=.o)\n\n$(OBJECTS): %.o: %.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Functions and Define Blocks\n\nReusable command sequences:\n```makefile\n# Define reusable function\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\nMulti-line define blocks:\n```makefile\ndefine install_package\n\t@echo \"Installing $(1)...\"\n\tpip install --quiet $(1)\n\t@echo \"Done: $(1)\"\nendef\n\ndeps:\n\t$(call install_package,pytest)\n\t$(call install_package,black)\n```\n\n## Automatic Variables Reference\n\nUse automatic variables to reduce duplication:\n\n| Variable | Meaning | Use Case |\n|----------|---------|----------|\n| `$@` | Target name | Output file path |\n| `$<` | First prerequisite | Main input file |\n| `$^` | All prerequisites | Link all objects |\n| `$?` | Newer prerequisites | Incremental builds |\n| `$*` | Stem match | Pattern rule matching |\n| `$(@D)` | Directory of target | mkdir parent |\n| `$(<D)` | Directory of first prerequisite | Source dirs |\n\nExample:\n```makefile\n# Before\nbuild/foo.o: src/foo.c\n\t$(CC) $(CFLAGS) -c src/foo.c -o build/foo.o\n\n# After\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Clean Target Best Practices\n\n```makefile\n# Good - use variables, don't duplicate paths\nBUILD_DIR ?= build\nDIST_DIR ?= dist\n\n.PHONY: clean distclean\n\nclean:\n\trm -rf $(BUILD_DIR)\n\ndistclean: clean\n\trm -rf $(DIST_DIR)\n```\n\nFile v1.9.16:modules/dependency-graph.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: dependency-graph\ndescription: Make database inspection and dependency analysis\ntags: [dependencies, phony, circular-deps, includes]\n---\n\n# Dependency Graph Analysis\n\n## Make Database Inspection\n\nInspect the complete expanded database:\n```bash\nmake -pn | less\n```\n\nThis shows:\n- All rules (implicit and explicit)\n- Variable assignments\n- Default values\n- Pattern rules\n\n## PHONY Detection\n\nCheck for `.PHONY` declarations:\n```bash\nrg -n \"^\\.PHONY:\" -g'Makefile*'\n```\n\nCommon PHONY targets that should be declared:\n- `all`, `build`, `test`, `clean`, `install`\n- `help`, `format`, `lint`, `release`\n- `distclean`, `check`, `docs`\n\n## Circular Dependency Checks\n\nLook for circular dependencies:\n```bash\nmake -pn 2>&1 | grep -i \"circular\"\n```\n\nCommon patterns:\n```makefile\n# Bad - circular\nA: B\nB: A\n\n# Good - linear\nA: B\nB: C\n```\n\n## Include File Patterns\n\nFind include directives:\n```bash\nrg -n \"^include|^-include\" -g'Makefile*'\n```\n\nCheck for:\n- Redundant includes\n- Missing includes\n- Include order issues\n- Conditional includes\n\nValidate included files exist:\n```bash\n# List includes\nrg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'\n\n# Check they exist\nfor f in $(rg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'); do\n  [ -f \"$f\" ] || echo \"Missing: $f\"\ndone\n```\n\nFile v1.9.16:modules/plugin-dogfood-checks.md\n\n# Plugin Dogfood Checks\n\nAnalyzes Makefiles to identify gaps in user-facing functionality, safely tests existing targets, and generates missing targets with contextually appropriate templates.\n\n## Overview\n\nThis module provides detailed Makefile analysis and enhancement for the claude-night-market project. It validates that all plugins have complete, consistent, and functional Makefile targets that support common user workflows.\n\n## Workflow\n\n### 1. Discovery Phase\n```bash\nmakefile_dogfooder.py --scope all --mode analyze\n```\n\nThe discovery phase:\n- Recursively searches for Makefile, makefile, GNUmakefile, and *.mk files\n- Parses target definitions with dependencies and commands\n- Extracts variable assignments and include statements\n- Builds dependency graphs and detects plugin type (leaf vs aggregator)\n\n### 2. Analysis Phase\n```bash\nmakefile_dogfooder.py --mode analyze --output json\n```\n\nThe analysis phase evaluates:\n- **Essential targets** (help, clean, .PHONY) - 20 points each\n- **Recommended targets** (test, lint, format, install, status) - 10 points each\n- **Convenience targets** (demo, dogfood, check, quick-run) - 5 points each\n- **Anti-patterns** (missing .PHONY, no error handling)\n- **Consistency** across multiple Makefiles\n\n### 3. Testing Phase\n```bash\nmakefile_dogfooder.py --mode test\n```\n\nThe testing phase performs:\n- Syntax validation with `make -n`\n- Help target functionality checks\n- Variable dependency verification\n- Common runtime issue detection\n\n### 4. Generation Phase\n```bash\nmakefile_dogfooder.py --mode full --apply\n```\n\nThe generation phase creates:\n- **Demo targets** to showcase plugin functionality\n- **Dogfood targets** for self-testing\n- **Quick-run targets** for common workflows\n- **Check-all targets** for aggregator Makefiles\n\n## Best Practices\n\n### For Leaf Plugins\n- Always include: help, clean, test, lint\n- Add demo target to showcase functionality\n- Include dogfood target for self-testing\n- Use shared includes from abstract when possible\n\n### For Aggregator Makefiles\n- Delegate to plugin Makefiles with pattern targets\n- Include check-all target for detailed validation\n- Maintain consistent target naming across plugins\n- Provide helpful aggregate status information\n\n### Target Naming\n- Use kebab-case for target names\n- Include brief description with `##` comment\n- Group related targets with prefixes (test-, dev-, docs-)\n- Follow alphabetical ordering for readability\n\n## Demo Target Philosophy\n\nDemo targets must run ACTUAL functionality, not just echo static information.\n\n| BAD (Static/Informational) | GOOD (Live/Functional) |\n|-------------------------------|---------------------------|\n| `@echo \"Skills: 5\"` | `$(UV_RUN) python scripts/validator.py --scan` |\n| `@find skills/ \\| wc -l` | `$(UV_RUN) python scripts/cli.py analyze .` |\n| `@echo \"Feature: validation\"` | `$(UV_RUN) python scripts/validator.py --target .` |\n\n## Integration\n\n### With Slash Commands\n```bash\n/make-dogfood --scope plugins --mode full\n```\n\n### With CI/CD\n```yaml\n- name: Validate Makefiles\n  run: makefile_dogfooder.py --mode test --output json\n```\n\n## Scoring\n\nEach Makefile is scored 0-100 based on target coverage:\n- Essential targets: 20 points each\n- Recommended targets: 10 points each\n- Convenience targets: 5 points each\n- Anti-pattern penalties: -5 to -10 each\n\nFile v1.9.16:modules/portability-checks.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: portability-checks\ndescription: Cross-platform compatibility and POSIX vs GNU Make feature detection\ntags: [portability, posix, gnu-make, cross-platform]\n---\n\n# Portability Checks\n\n## GNU Make Features\n\nCheck for GNU-specific features that may not be portable:\n\n### Advanced Directives\n```bash\nrg -n \"^\\\\.ONESHELL:\" -g'Makefile*'\nrg -n \"^\\\\.NOTPARALLEL:\" -g'Makefile*'\nrg -n \"^\\\\.DELETE_ON_ERROR:\" -g'Makefile*'\n```\n\n- `.ONESHELL` - Single shell per recipe (GNU Make 3.82+)\n- `.NOTPARALLEL` - Disable parallel execution\n- `.DELETE_ON_ERROR` - Delete targets on error\n\n### Order-Only Prerequisites\n```bash\nrg -n \"\\|[^|]\" -g'Makefile*'\n```\n\nOrder-only prerequisites (`target: normal | order-only`) are GNU Make only.\n\n### GNU Functions\n```bash\nrg -n \"\\$\\(shell \" -g'Makefile*'\nrg -n \"\\$\\(wildcard \" -g'Makefile*'\nrg -n \"\\$\\(foreach \" -g'Makefile*'\nrg -n \"\\$\\(eval \" -g'Makefile*'\n```\n\nCommon GNU functions:\n- `$(shell ...)` - Execute shell command\n- `$(wildcard pattern)` - File globbing\n- `$(foreach var,list,text)` - Loop\n- `$(eval text)` - Dynamic evaluation\n\n## POSIX Compatibility\n\nFor maximum portability:\n```makefile\n# POSIX-compatible shell\nSHELL := /bin/sh\n\n# Avoid Bash-specific features\n# - Arrays: arr=(1 2 3)\n# - [[ ]]: use [ ] instead\n# - Process substitution: <(cmd)\n# - Brace expansion: {1..10}\n```\n\n## Shell Configuration\n\n### Good: POSIX Compatible\n```makefile\nSHELL := /bin/sh\n```\n\n### If Bash Required\nDocument and configure properly:\n```makefile\n# Requires Bash 4.0+\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n\n# -e: exit on error\n# -u: error on undefined variable\n# -o pipefail: pipe fails if any command fails\n# -c: execute command\n```\n\n## Cross-Platform Safety\n\n### Path Separators\n```makefile\n# Good - portable\nSRC_DIR := src\nBUILD_DIR := build\n\n# Bad - hardcoded separator\nSRC_DIR := src/main/resources\n```\n\n### Command Portability\n```makefile\n# Check for required commands\nifeq ($(shell command -v pandoc 2>/dev/null),)\n$(error pandoc is required but not installed)\nendif\n```\n\n### Platform Detection\n```makefile\nUNAME := $(shell uname -s)\n\nifeq ($(UNAME),Linux)\n  # Linux-specific\nendif\nifeq ($(UNAME),Darwin)\n  # macOS-specific\nendif\n```\n\n## Quality Gate Targets\n\nvalidate standard targets exist:\n```bash\nrg -n \"^help:\" -g'Makefile*'\nrg -n \"^format:\" -g'Makefile*'\nrg -n \"^lint:\" -g'Makefile*'\nrg -n \"^test:\" -g'Makefile*'\nrg -n \"^build:\" -g'Makefile*'\nrg -n \"^clean:\" -g'Makefile*'\n```\n\nRecommended targets:\n- `help` - Show available targets\n- `format` - Code formatting\n- `lint` - Linting checks\n- `test` - Run test suite\n- `build` - Build artifacts\n- `clean` - Clean build artifacts\n- `release` - Production build\n- `install` - Install artifacts\n\nFile v1.9.16:skill-card.md\n\n## Description: <br>\nAudits Makefiles for build correctness, portability, and recipe duplication. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and engineers use this skill to review Makefile changes, map dependencies, identify duplicated recipes, check portability, and summarize recommended follow-up actions before committing build-system changes. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill may run Make-related validation commands against repository files. <br>\nMitigation: Use it in a trusted or sandboxed repository, review proposed commands first, and avoid executing generated Make targets from untrusted projects. <br>\nRisk: The plugin dogfood workflow can apply generated build targets when an --apply flow is used. <br>\nMitigation: Require a diff and explicit confirmation before applying changes, then review modified Makefiles before committing. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-pensive-makefile-review) <br>\n- [OpenClaw homepage](https://github.com/athola/claude-night-market/tree/master/plugins/pensive) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [analysis, markdown, shell commands, code, guidance] <br>\n**Output Format:** [Markdown with findings, context, dependency analysis, duplication candidates, portability issues, missing targets, and a recommendation.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include Makefile target suggestions and command outputs with file and line references.] <br>\n\n## Skill Version(s): <br>\n1.9.16 (source: server release metadata; artifact frontmatter reports 1.9.8) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.14: 8 files, 10303 bytes\n\nFiles: modules/best-practices.md (4064b), modules/deduplication-patterns.md (2530b), modules/dependency-graph.md (1306b), modules/plugin-dogfood-checks.md (3322b), modules/portability-checks.md (2735b), skill-card.md (1873b), SKILL.md (4535b), _meta.json (146b)\n\nFile v1.9.14:SKILL.md\n\n---\nname: makefile-review\ndescription: Audits Makefiles for build correctness, portability, and recipe duplication\nversion: 1.9.8\ntriggers:\n  - makefile\n  - build\n  - make\n  - portability\n  - automation\n  - reviewing a Makefile or before committing Makefile changes\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/pensive\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.pensive:shared\", \"night-market.imbue:proof-of-work\"]}}}\nsource: claude-night-market\nsource_plugin: pensive\n---\n\n> **Night Market Skill** — ported from [claude-night-market/pensive](https://github.com/athola/claude-night-market/tree/master/plugins/pensive). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Workflow](#workflow)\n- [Step 1: Map Context (`makefile-review:context-mapped`)](#step-1:-map-context-(makefile-review:context-mapped))\n- [Step 2: Dependency Graph (`makefile-review:dependency-graph`)](#step-2:-dependency-graph-(makefile-review:dependency-graph))\n- [Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)](#step-3:-deduplication-audit-(makefile-review:dedup-candidates))\n- [Step 4: Portability Check (`makefile-review:tooling-alignment`)](#step-4:-portability-check-(makefile-review:tooling-alignment))\n- [Step 5: Evidence Log (`makefile-review:evidence-logged`)](#step-5:-evidence-log-(makefile-review:evidence-logged))\n- [Progressive Loading](#progressive-loading)\n- [Output Format](#output-format)\n- [Summary](#summary)\n- [Testing](#testing)\n\n## Testing\n\nRun `pytest plugins/pensive/tests/skills/test_makefile_review.py` to verify review logic.\n\n# Makefile Review Workflow\n\nAudit Makefiles for best practices, deduplication, and portability.\n\n## Quick Start\n\n```bash\n/makefile-review\n```\n\n## When To Use\n\n- Makefile changes or additions\n- Build system optimization\n- Portability improvements\n- CI/CD pipeline updates\n- Developer experience improvements\n\n## When NOT To Use\n\n- Creating new Makefiles - use abstract:make-dogfood\n- Architecture review - use architecture-review\n\n## Required TodoWrite Items\n\n1. `makefile-review:context-mapped`\n2. `makefile-review:dependency-graph`\n3. `makefile-review:dedup-candidates`\n4. `makefile-review:tooling-alignment`\n5. `makefile-review:evidence-logged`\n\n## Workflow\n\n### Step 1: Map Context (`makefile-review:context-mapped`)\n\nConfirm baseline:\n```bash\npwd && git status -sb && git diff --stat\n```\n**Verification:** Run `git status` to confirm working tree state.\n\nFind Make-related files:\n```bash\nrg -n \"^include\" -g'Makefile*'\nrg --files -g '*.mk'\n```\n\nDocument changed targets, project goals, and tooling requirements.\n\n### Step 2: Dependency Graph (`makefile-review:dependency-graph`)\n\n@include modules/dependency-graph.md\n\n### Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)\n\n@include modules/deduplication-patterns.md\n\n### Step 4: Portability Check (`makefile-review:tooling-alignment`)\n\n@include modules/portability-checks.md\n\n### Step 5: Evidence Log (`makefile-review:evidence-logged`)\n\nUse `imbue:proof-of-work` to record command outputs with file:line references.\n\nSummarize findings:\n- Severity (critical, major, minor)\n- Expected impact\n- Suggested refactors\n- Owners and dates for follow-ups\n\n## Progressive Loading\n\nLoad additional context as needed:\n\n**Best Practices & Examples**: `@include modules/best-practices.md`\n\n**Plugin Dogfood Checks**: `@include modules/plugin-dogfood-checks.md` - Makefile completeness analysis, target generation, and dogfooding validation.\n\n## Output Format\n\n```markdown\n## Summary\nMakefile review findings\n\n## Context\n- Files reviewed: [list]\n- Targets changed: [list]\n\n## Dependency Analysis\n[graph and issues]\n\n## Duplication Candidates\n### [D1] Repeated command\n- Locations: [list]\n- Recommendation: [pattern rule]\n\n## Portability Issues\n[cross-platform concerns]\n\n## Missing Targets\n- [ ] help\n- [ ] format\n- [ ] lint\n\n## Recommendation\nApprove / Approve with actions / Block\n```\n\n## Exit Criteria\n\n- Context mapped\n- Dependencies analyzed\n- Deduplication reviewed\n- Portability checked\n- Evidence logged\n## Troubleshooting\n\n### Common Issues\n\n**No Makefile found**\nEnsure `Makefile` or `*.mk` files exist in the project root or specify paths explicitly.\n\n**Include directives not resolved**\nRun `rg -n \"^include\" -g'Makefile*'` to trace include chains manually.\n\nFile v1.9.14:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-pensive-makefile-review\",\n  \"version\": \"1.9.14\",\n  \"publishedAt\": 1782842650129\n}\n\nFile v1.9.14:modules/best-practices.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: best-practices\ndescription: Makefile structure patterns, examples, and anti-patterns to avoid\ntags: [best-practices, patterns, anti-patterns, examples]\n---\n\n# Makefile Best Practices\n\n## Structure Pattern\n\nRecommended organization:\n```makefile\n# 1. Variables at top\nPROJECT := myproject\nSRC_DIR := src\nBUILD_DIR := build\nVERSION := 1.0.0\n\n# 2. Default goal\n.DEFAULT_GOAL := help\n\n# 3. PHONY declarations\n.PHONY: all build test clean help\n\n# 4. Help target (self-documenting)\nhelp: ## Show this help\n\t@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \\\n\t\tawk 'BEGIN {FS = \":.*?## \"}; {printf \"%-15s %s\\n\", $$1, $$2}'\n\n# 5. Main targets with inline docs\nbuild: ## Build the project\n\t$(MAKE) -C $(SRC_DIR)\n\ntest: build ## Run tests\n\tpytest tests/\n\nclean: ## Clean build artifacts\n\trm -rf $(BUILD_DIR)\n```\n\n## Pattern Rule Examples\n\n### File Conversion\n```makefile\n# Markdown to HTML\n%.html: %.md\n\tpandoc $< -o $@\n\n# Source to object\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t@mkdir -p $(@D)\n\t$(CC) $(CFLAGS) -c $< -o $@\n\n# Template expansion\n%/config.json: templates/config.json.tmpl\n\t@mkdir -p $(@D)\n\tenvsubst < $< > $@\n```\n\n### Testing Patterns\n```makefile\n# Test by subdirectory\ntest-%:\n\tpytest tests/$*\n\n# Test by type\ntest-unit test-integration test-e2e: test-%:\n\tpytest tests/$* -v\n```\n\n## Function Examples\n\n### Reusable Command Sequences\n```makefile\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest -v\n\t@echo \"Done: $(1)\"\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\n### Multi-line Recipes\n```makefile\ndefine docker_build\n\tdocker build \\\n\t\t--build-arg VERSION=$(VERSION) \\\n\t\t--tag $(1):$(VERSION) \\\n\t\t--tag $(1):latest \\\n\t\t.\nendef\n\nimage:\n\t$(call docker_build,$(PROJECT))\n```\n\n## Anti-Patterns to Avoid\n\n### Repeated Commands\n```makefile\n# Bad - duplicated logic\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\n### Missing PHONY\n```makefile\n# Bad - 'clean' file blocks target\nclean:\n\trm -rf build/\n\n# Good\n.PHONY: clean\nclean:\n\trm -rf build/\n```\n\n### Hardcoded Paths\n```makefile\n# Bad - not portable\nclean:\n\trm -rf /home/user/project/build\n\n# Good - variables\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Shell-Specific Commands\n```makefile\n# Bad - Bash-only\ncheck:\n\t[[ -f config.yaml ]] && echo \"Found\"\n\n# Good - POSIX compatible\ncheck:\n\t[ -f config.yaml ] && echo \"Found\"\n```\n\n### Unguarded Variable References\n```makefile\n# Bad - fails if undefined\nclean:\n\trm -rf $(BUILD_DIR)\n\n# Good - with default\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Non-Idempotent Targets\n```makefile\n# Bad - appends every time\nconfigure:\n\techo \"DEBUG=1\" >> config.mk\n\n# Good - idempotent\nconfigure:\n\t@echo \"DEBUG=1\" > config.mk\n```\n\n## Error Handling\n\n### Check Prerequisites\n```makefile\n.PHONY: check-deps\ncheck-deps:\n\t@command -v python3 >/dev/null || (echo \"python3 required\"; exit 1)\n\t@command -v pytest >/dev/null || (echo \"pytest required\"; exit 1)\n\ntest: check-deps\n\tpytest tests/\n```\n\n### Delete on Error\n```makefile\n# Automatically delete targets on error\n.DELETE_ON_ERROR:\n\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n### Pipeline Exit Code Propagation\n```makefile\n# Bad - pipeline exit code is from grep, not make\ncheck:\n\t@$(MAKE) typecheck 2>&1 | grep -v \"^make\\[\"\n\n# Good - capture exit code explicitly in wrapper scripts\n# See shell-review skill for bash pipeline patterns\ncheck:\n\t@$(MAKE) typecheck || { echo \"Type check failed\"; exit 1; }\n\n# Good - use .SHELLFLAGS for pipefail in recipes\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n```\n\nWhen recipes use pipelines, ensure exit codes propagate correctly. In bash, the default behavior is that pipeline exit code equals the last command's exit code. Use `set -o pipefail` or capture output and exit codes separately.\n\n## Parallel Execution\n\n```makefile\n# Enable parallel by default\nMAKEFLAGS += -j$(shell nproc 2>/dev/null || echo 1)\n\n# Or disable for specific targets\n.NOTPARALLEL: install deploy\n```\n\nFile v1.9.14:modules/deduplication-patterns.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: deduplication-patterns\ndescription: Detect and eliminate recipe duplication using pattern rules and functions\ntags: [deduplication, pattern-rules, functions, automatic-variables]\n---\n\n# Deduplication Patterns\n\n## Recipe Duplication Detection\n\nSearch for repeated command patterns:\n```bash\n# Common test commands\nrg -n \"cargo test\" -g'Makefile*'\nrg -n \"pytest\" -g'Makefile*'\nrg -n \"npm run\" -g'Makefile*'\nrg -n \"go test\" -g'Makefile*'\n\n# Build commands\nrg -n \"docker build\" -g'Makefile*'\nrg -n \"gcc.*-o\" -g'Makefile*'\n```\n\n## Pattern Rules\n\nReplace repeated rules with patterns:\n```makefile\n# Bad - repeated\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\ntest-e2e:\n\tpytest tests/e2e\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\nPattern rule for file conversion:\n```makefile\n# Convert all .md to .html\n%.html: %.md\n\tpandoc $< -o $@\n\n# Build objects from sources\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Static Pattern Rules\n\nFor specific targets with patterns:\n```makefile\nSOURCES := foo.c bar.c baz.c\nOBJECTS := $(SOURCES:.c=.o)\n\n$(OBJECTS): %.o: %.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Functions and Define Blocks\n\nReusable command sequences:\n```makefile\n# Define reusable function\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\nMulti-line define blocks:\n```makefile\ndefine install_package\n\t@echo \"Installing $(1)...\"\n\tpip install --quiet $(1)\n\t@echo \"Done: $(1)\"\nendef\n\ndeps:\n\t$(call install_package,pytest)\n\t$(call install_package,black)\n```\n\n## Automatic Variables Reference\n\nUse automatic variables to reduce duplication:\n\n| Variable | Meaning | Use Case |\n|----------|---------|----------|\n| `$@` | Target name | Output file path |\n| `$<` | First prerequisite | Main input file |\n| `$^` | All prerequisites | Link all objects |\n| `$?` | Newer prerequisites | Incremental builds |\n| `$*` | Stem match | Pattern rule matching |\n| `$(@D)` | Directory of target | mkdir parent |\n| `$(<D)` | Directory of first prerequisite | Source dirs |\n\nExample:\n```makefile\n# Before\nbuild/foo.o: src/foo.c\n\t$(CC) $(CFLAGS) -c src/foo.c -o build/foo.o\n\n# After\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Clean Target Best Practices\n\n```makefile\n# Good - use variables, don't duplicate paths\nBUILD_DIR ?= build\nDIST_DIR ?= dist\n\n.PHONY: clean distclean\n\nclean:\n\trm -rf $(BUILD_DIR)\n\ndistclean: clean\n\trm -rf $(DIST_DIR)\n```\n\nFile v1.9.14:modules/dependency-graph.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: dependency-graph\ndescription: Make database inspection and dependency analysis\ntags: [dependencies, phony, circular-deps, includes]\n---\n\n# Dependency Graph Analysis\n\n## Make Database Inspection\n\nInspect the complete expanded database:\n```bash\nmake -pn | less\n```\n\nThis shows:\n- All rules (implicit and explicit)\n- Variable assignments\n- Default values\n- Pattern rules\n\n## PHONY Detection\n\nCheck for `.PHONY` declarations:\n```bash\nrg -n \"^\\.PHONY:\" -g'Makefile*'\n```\n\nCommon PHONY targets that should be declared:\n- `all`, `build`, `test`, `clean`, `install`\n- `help`, `format`, `lint`, `release`\n- `distclean`, `check`, `docs`\n\n## Circular Dependency Checks\n\nLook for circular dependencies:\n```bash\nmake -pn 2>&1 | grep -i \"circular\"\n```\n\nCommon patterns:\n```makefile\n# Bad - circular\nA: B\nB: A\n\n# Good - linear\nA: B\nB: C\n```\n\n## Include File Patterns\n\nFind include directives:\n```bash\nrg -n \"^include|^-include\" -g'Makefile*'\n```\n\nCheck for:\n- Redundant includes\n- Missing includes\n- Include order issues\n- Conditional includes\n\nValidate included files exist:\n```bash\n# List includes\nrg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'\n\n# Check they exist\nfor f in $(rg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'); do\n  [ -f \"$f\" ] || echo \"Missing: $f\"\ndone\n```\n\nFile v1.9.14:modules/plugin-dogfood-checks.md\n\n# Plugin Dogfood Checks\n\nAnalyzes Makefiles to identify gaps in user-facing functionality, safely tests existing targets, and generates missing targets with contextually appropriate templates.\n\n## Overview\n\nThis module provides detailed Makefile analysis and enhancement for the claude-night-market project. It validates that all plugins have complete, consistent, and functional Makefile targets that support common user workflows.\n\n## Workflow\n\n### 1. Discovery Phase\n```bash\nmakefile_dogfooder.py --scope all --mode analyze\n```\n\nThe discovery phase:\n- Recursively searches for Makefile, makefile, GNUmakefile, and *.mk files\n- Parses target definitions with dependencies and commands\n- Extracts variable assignments and include statements\n- Builds dependency graphs and detects plugin type (leaf vs aggregator)\n\n### 2. Analysis Phase\n```bash\nmakefile_dogfooder.py --mode analyze --output json\n```\n\nThe analysis phase evaluates:\n- **Essential targets** (help, clean, .PHONY) - 20 points each\n- **Recommended targets** (test, lint, format, install, status) - 10 points each\n- **Convenience targets** (demo, dogfood, check, quick-run) - 5 points each\n- **Anti-patterns** (missing .PHONY, no error handling)\n- **Consistency** across multiple Makefiles\n\n### 3. Testing Phase\n```bash\nmakefile_dogfooder.py --mode test\n```\n\nThe testing phase performs:\n- Syntax validation with `make -n`\n- Help target functionality checks\n- Variable dependency verification\n- Common runtime issue detection\n\n### 4. Generation Phase\n```bash\nmakefile_dogfooder.py --mode full --apply\n```\n\nThe generation phase creates:\n- **Demo targets** to showcase plugin functionality\n- **Dogfood targets** for self-testing\n- **Quick-run targets** for common workflows\n- **Check-all targets** for aggregator Makefiles\n\n## Best Practices\n\n### For Leaf Plugins\n- Always include: help, clean, test, lint\n- Add demo target to showcase functionality\n- Include dogfood target for self-testing\n- Use shared includes from abstract when possible\n\n### For Aggregator Makefiles\n- Delegate to plugin Makefiles with pattern targets\n- Include check-all target for detailed validation\n- Maintain consistent target naming across plugins\n- Provide helpful aggregate status information\n\n### Target Naming\n- Use kebab-case for target names\n- Include brief description with `##` comment\n- Group related targets with prefixes (test-, dev-, docs-)\n- Follow alphabetical ordering for readability\n\n## Demo Target Philosophy\n\nDemo targets must run ACTUAL functionality, not just echo static information.\n\n| BAD (Static/Informational) | GOOD (Live/Functional) |\n|-------------------------------|---------------------------|\n| `@echo \"Skills: 5\"` | `$(UV_RUN) python scripts/validator.py --scan` |\n| `@find skills/ \\| wc -l` | `$(UV_RUN) python scripts/cli.py analyze .` |\n| `@echo \"Feature: validation\"` | `$(UV_RUN) python scripts/validator.py --target .` |\n\n## Integration\n\n### With Slash Commands\n```bash\n/make-dogfood --scope plugins --mode full\n```\n\n### With CI/CD\n```yaml\n- name: Validate Makefiles\n  run: makefile_dogfooder.py --mode test --output json\n```\n\n## Scoring\n\nEach Makefile is scored 0-100 based on target coverage:\n- Essential targets: 20 points each\n- Recommended targets: 10 points each\n- Convenience targets: 5 points each\n- Anti-pattern penalties: -5 to -10 each\n\nFile v1.9.14:modules/portability-checks.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: portability-checks\ndescription: Cross-platform compatibility and POSIX vs GNU Make feature detection\ntags: [portability, posix, gnu-make, cross-platform]\n---\n\n# Portability Checks\n\n## GNU Make Features\n\nCheck for GNU-specific features that may not be portable:\n\n### Advanced Directives\n```bash\nrg -n \"^\\\\.ONESHELL:\" -g'Makefile*'\nrg -n \"^\\\\.NOTPARALLEL:\" -g'Makefile*'\nrg -n \"^\\\\.DELETE_ON_ERROR:\" -g'Makefile*'\n```\n\n- `.ONESHELL` - Single shell per recipe (GNU Make 3.82+)\n- `.NOTPARALLEL` - Disable parallel execution\n- `.DELETE_ON_ERROR` - Delete targets on error\n\n### Order-Only Prerequisites\n```bash\nrg -n \"\\|[^|]\" -g'Makefile*'\n```\n\nOrder-only prerequisites (`target: normal | order-only`) are GNU Make only.\n\n### GNU Functions\n```bash\nrg -n \"\\$\\(shell \" -g'Makefile*'\nrg -n \"\\$\\(wildcard \" -g'Makefile*'\nrg -n \"\\$\\(foreach \" -g'Makefile*'\nrg -n \"\\$\\(eval \" -g'Makefile*'\n```\n\nCommon GNU functions:\n- `$(shell ...)` - Execute shell command\n- `$(wildcard pattern)` - File globbing\n- `$(foreach var,list,text)` - Loop\n- `$(eval text)` - Dynamic evaluation\n\n## POSIX Compatibility\n\nFor maximum portability:\n```makefile\n# POSIX-compatible shell\nSHELL := /bin/sh\n\n# Avoid Bash-specific features\n# - Arrays: arr=(1 2 3)\n# - [[ ]]: use [ ] instead\n# - Process substitution: <(cmd)\n# - Brace expansion: {1..10}\n```\n\n## Shell Configuration\n\n### Good: POSIX Compatible\n```makefile\nSHELL := /bin/sh\n```\n\n### If Bash Required\nDocument and configure properly:\n```makefile\n# Requires Bash 4.0+\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n\n# -e: exit on error\n# -u: error on undefined variable\n# -o pipefail: pipe fails if any command fails\n# -c: execute command\n```\n\n## Cross-Platform Safety\n\n### Path Separators\n```makefile\n# Good - portable\nSRC_DIR := src\nBUILD_DIR := build\n\n# Bad - hardcoded separator\nSRC_DIR := src/main/resources\n```\n\n### Command Portability\n```makefile\n# Check for required commands\nifeq ($(shell command -v pandoc 2>/dev/null),)\n$(error pandoc is required but not installed)\nendif\n```\n\n### Platform Detection\n```makefile\nUNAME := $(shell uname -s)\n\nifeq ($(UNAME),Linux)\n  # Linux-specific\nendif\nifeq ($(UNAME),Darwin)\n  # macOS-specific\nendif\n```\n\n## Quality Gate Targets\n\nvalidate standard targets exist:\n```bash\nrg -n \"^help:\" -g'Makefile*'\nrg -n \"^format:\" -g'Makefile*'\nrg -n \"^lint:\" -g'Makefile*'\nrg -n \"^test:\" -g'Makefile*'\nrg -n \"^build:\" -g'Makefile*'\nrg -n \"^clean:\" -g'Makefile*'\n```\n\nRecommended targets:\n- `help` - Show available targets\n- `format` - Code formatting\n- `lint` - Linting checks\n- `test` - Run test suite\n- `build` - Build artifacts\n- `clean` - Clean build artifacts\n- `release` - Production build\n- `install` - Install artifacts\n\nFile v1.9.14:skill-card.md\n\n## Description: <br>\nAudits Makefiles for build correctness, portability, and recipe duplication. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and engineers use this skill to review Makefiles before committing build changes, focusing on dependency structure, recipe duplication, portability, and common quality targets. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Optional Makefile-changing guidance or target-generation steps could introduce unintended build behavior if applied automatically. <br>\nMitigation: Run the skill on a clean branch, inspect diffs before accepting changes, and avoid applying generated targets without human review. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-pensive-makefile-review) <br>\n- [clawdis homepage](https://github.com/athola/claude-night-market/tree/master/plugins/pensive) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, shell commands, code, guidance] <br>\n**Output Format:** [Markdown with inline shell and Makefile code blocks] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include findings, file references, dependency analysis, duplication candidates, portability issues, missing targets, and approval recommendations.] <br>\n\n## Skill Version(s): <br>\n1.9.14 (source: server release metadata; artifact frontmatter reports 1.9.8) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.13: 8 files, 10354 bytes\n\nFiles: modules/best-practices.md (4064b), modules/deduplication-patterns.md (2530b), modules/dependency-graph.md (1306b), modules/plugin-dogfood-checks.md (3322b), modules/portability-checks.md (2735b), skill-card.md (2033b), SKILL.md (4535b), _meta.json (146b)\n\nFile v1.9.13:SKILL.md\n\n---\nname: makefile-review\ndescription: Audits Makefiles for build correctness, portability, and recipe duplication\nversion: 1.9.8\ntriggers:\n  - makefile\n  - build\n  - make\n  - portability\n  - automation\n  - reviewing a Makefile or before committing Makefile changes\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/pensive\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.pensive:shared\", \"night-market.imbue:proof-of-work\"]}}}\nsource: claude-night-market\nsource_plugin: pensive\n---\n\n> **Night Market Skill** — ported from [claude-night-market/pensive](https://github.com/athola/claude-night-market/tree/master/plugins/pensive). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Workflow](#workflow)\n- [Step 1: Map Context (`makefile-review:context-mapped`)](#step-1:-map-context-(makefile-review:context-mapped))\n- [Step 2: Dependency Graph (`makefile-review:dependency-graph`)](#step-2:-dependency-graph-(makefile-review:dependency-graph))\n- [Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)](#step-3:-deduplication-audit-(makefile-review:dedup-candidates))\n- [Step 4: Portability Check (`makefile-review:tooling-alignment`)](#step-4:-portability-check-(makefile-review:tooling-alignment))\n- [Step 5: Evidence Log (`makefile-review:evidence-logged`)](#step-5:-evidence-log-(makefile-review:evidence-logged))\n- [Progressive Loading](#progressive-loading)\n- [Output Format](#output-format)\n- [Summary](#summary)\n- [Testing](#testing)\n\n## Testing\n\nRun `pytest plugins/pensive/tests/skills/test_makefile_review.py` to verify review logic.\n\n# Makefile Review Workflow\n\nAudit Makefiles for best practices, deduplication, and portability.\n\n## Quick Start\n\n```bash\n/makefile-review\n```\n\n## When To Use\n\n- Makefile changes or additions\n- Build system optimization\n- Portability improvements\n- CI/CD pipeline updates\n- Developer experience improvements\n\n## When NOT To Use\n\n- Creating new Makefiles - use abstract:make-dogfood\n- Architecture review - use architecture-review\n\n## Required TodoWrite Items\n\n1. `makefile-review:context-mapped`\n2. `makefile-review:dependency-graph`\n3. `makefile-review:dedup-candidates`\n4. `makefile-review:tooling-alignment`\n5. `makefile-review:evidence-logged`\n\n## Workflow\n\n### Step 1: Map Context (`makefile-review:context-mapped`)\n\nConfirm baseline:\n```bash\npwd && git status -sb && git diff --stat\n```\n**Verification:** Run `git status` to confirm working tree state.\n\nFind Make-related files:\n```bash\nrg -n \"^include\" -g'Makefile*'\nrg --files -g '*.mk'\n```\n\nDocument changed targets, project goals, and tooling requirements.\n\n### Step 2: Dependency Graph (`makefile-review:dependency-graph`)\n\n@include modules/dependency-graph.md\n\n### Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)\n\n@include modules/deduplication-patterns.md\n\n### Step 4: Portability Check (`makefile-review:tooling-alignment`)\n\n@include modules/portability-checks.md\n\n### Step 5: Evidence Log (`makefile-review:evidence-logged`)\n\nUse `imbue:proof-of-work` to record command outputs with file:line references.\n\nSummarize findings:\n- Severity (critical, major, minor)\n- Expected impact\n- Suggested refactors\n- Owners and dates for follow-ups\n\n## Progressive Loading\n\nLoad additional context as needed:\n\n**Best Practices & Examples**: `@include modules/best-practices.md`\n\n**Plugin Dogfood Checks**: `@include modules/plugin-dogfood-checks.md` - Makefile completeness analysis, target generation, and dogfooding validation.\n\n## Output Format\n\n```markdown\n## Summary\nMakefile review findings\n\n## Context\n- Files reviewed: [list]\n- Targets changed: [list]\n\n## Dependency Analysis\n[graph and issues]\n\n## Duplication Candidates\n### [D1] Repeated command\n- Locations: [list]\n- Recommendation: [pattern rule]\n\n## Portability Issues\n[cross-platform concerns]\n\n## Missing Targets\n- [ ] help\n- [ ] format\n- [ ] lint\n\n## Recommendation\nApprove / Approve with actions / Block\n```\n\n## Exit Criteria\n\n- Context mapped\n- Dependencies analyzed\n- Deduplication reviewed\n- Portability checked\n- Evidence logged\n## Troubleshooting\n\n### Common Issues\n\n**No Makefile found**\nEnsure `Makefile` or `*.mk` files exist in the project root or specify paths explicitly.\n\n**Include directives not resolved**\nRun `rg -n \"^include\" -g'Makefile*'` to trace include chains manually.\n\nFile v1.9.13:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-pensive-makefile-review\",\n  \"version\": \"1.9.13\",\n  \"publishedAt\": 1782577331675\n}\n\nFile v1.9.13:modules/best-practices.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: best-practices\ndescription: Makefile structure patterns, examples, and anti-patterns to avoid\ntags: [best-practices, patterns, anti-patterns, examples]\n---\n\n# Makefile Best Practices\n\n## Structure Pattern\n\nRecommended organization:\n```makefile\n# 1. Variables at top\nPROJECT := myproject\nSRC_DIR := src\nBUILD_DIR := build\nVERSION := 1.0.0\n\n# 2. Default goal\n.DEFAULT_GOAL := help\n\n# 3. PHONY declarations\n.PHONY: all build test clean help\n\n# 4. Help target (self-documenting)\nhelp: ## Show this help\n\t@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \\\n\t\tawk 'BEGIN {FS = \":.*?## \"}; {printf \"%-15s %s\\n\", $$1, $$2}'\n\n# 5. Main targets with inline docs\nbuild: ## Build the project\n\t$(MAKE) -C $(SRC_DIR)\n\ntest: build ## Run tests\n\tpytest tests/\n\nclean: ## Clean build artifacts\n\trm -rf $(BUILD_DIR)\n```\n\n## Pattern Rule Examples\n\n### File Conversion\n```makefile\n# Markdown to HTML\n%.html: %.md\n\tpandoc $< -o $@\n\n# Source to object\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t@mkdir -p $(@D)\n\t$(CC) $(CFLAGS) -c $< -o $@\n\n# Template expansion\n%/config.json: templates/config.json.tmpl\n\t@mkdir -p $(@D)\n\tenvsubst < $< > $@\n```\n\n### Testing Patterns\n```makefile\n# Test by subdirectory\ntest-%:\n\tpytest tests/$*\n\n# Test by type\ntest-unit test-integration test-e2e: test-%:\n\tpytest tests/$* -v\n```\n\n## Function Examples\n\n### Reusable Command Sequences\n```makefile\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest -v\n\t@echo \"Done: $(1)\"\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\n### Multi-line Recipes\n```makefile\ndefine docker_build\n\tdocker build \\\n\t\t--build-arg VERSION=$(VERSION) \\\n\t\t--tag $(1):$(VERSION) \\\n\t\t--tag $(1):latest \\\n\t\t.\nendef\n\nimage:\n\t$(call docker_build,$(PROJECT))\n```\n\n## Anti-Patterns to Avoid\n\n### Repeated Commands\n```makefile\n# Bad - duplicated logic\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\n### Missing PHONY\n```makefile\n# Bad - 'clean' file blocks target\nclean:\n\trm -rf build/\n\n# Good\n.PHONY: clean\nclean:\n\trm -rf build/\n```\n\n### Hardcoded Paths\n```makefile\n# Bad - not portable\nclean:\n\trm -rf /home/user/project/build\n\n# Good - variables\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Shell-Specific Commands\n```makefile\n# Bad - Bash-only\ncheck:\n\t[[ -f config.yaml ]] && echo \"Found\"\n\n# Good - POSIX compatible\ncheck:\n\t[ -f config.yaml ] && echo \"Found\"\n```\n\n### Unguarded Variable References\n```makefile\n# Bad - fails if undefined\nclean:\n\trm -rf $(BUILD_DIR)\n\n# Good - with default\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Non-Idempotent Targets\n```makefile\n# Bad - appends every time\nconfigure:\n\techo \"DEBUG=1\" >> config.mk\n\n# Good - idempotent\nconfigure:\n\t@echo \"DEBUG=1\" > config.mk\n```\n\n## Error Handling\n\n### Check Prerequisites\n```makefile\n.PHONY: check-deps\ncheck-deps:\n\t@command -v python3 >/dev/null || (echo \"python3 required\"; exit 1)\n\t@command -v pytest >/dev/null || (echo \"pytest required\"; exit 1)\n\ntest: check-deps\n\tpytest tests/\n```\n\n### Delete on Error\n```makefile\n# Automatically delete targets on error\n.DELETE_ON_ERROR:\n\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n### Pipeline Exit Code Propagation\n```makefile\n# Bad - pipeline exit code is from grep, not make\ncheck:\n\t@$(MAKE) typecheck 2>&1 | grep -v \"^make\\[\"\n\n# Good - capture exit code explicitly in wrapper scripts\n# See shell-review skill for bash pipeline patterns\ncheck:\n\t@$(MAKE) typecheck || { echo \"Type check failed\"; exit 1; }\n\n# Good - use .SHELLFLAGS for pipefail in recipes\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n```\n\nWhen recipes use pipelines, ensure exit codes propagate correctly. In bash, the default behavior is that pipeline exit code equals the last command's exit code. Use `set -o pipefail` or capture output and exit codes separately.\n\n## Parallel Execution\n\n```makefile\n# Enable parallel by default\nMAKEFLAGS += -j$(shell nproc 2>/dev/null || echo 1)\n\n# Or disable for specific targets\n.NOTPARALLEL: install deploy\n```\n\nFile v1.9.13:modules/deduplication-patterns.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: deduplication-patterns\ndescription: Detect and eliminate recipe duplication using pattern rules and functions\ntags: [deduplication, pattern-rules, functions, automatic-variables]\n---\n\n# Deduplication Patterns\n\n## Recipe Duplication Detection\n\nSearch for repeated command patterns:\n```bash\n# Common test commands\nrg -n \"cargo test\" -g'Makefile*'\nrg -n \"pytest\" -g'Makefile*'\nrg -n \"npm run\" -g'Makefile*'\nrg -n \"go test\" -g'Makefile*'\n\n# Build commands\nrg -n \"docker build\" -g'Makefile*'\nrg -n \"gcc.*-o\" -g'Makefile*'\n```\n\n## Pattern Rules\n\nReplace repeated rules with patterns:\n```makefile\n# Bad - repeated\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\ntest-e2e:\n\tpytest tests/e2e\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\nPattern rule for file conversion:\n```makefile\n# Convert all .md to .html\n%.html: %.md\n\tpandoc $< -o $@\n\n# Build objects from sources\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Static Pattern Rules\n\nFor specific targets with patterns:\n```makefile\nSOURCES := foo.c bar.c baz.c\nOBJECTS := $(SOURCES:.c=.o)\n\n$(OBJECTS): %.o: %.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Functions and Define Blocks\n\nReusable command sequences:\n```makefile\n# Define reusable function\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\nMulti-line define blocks:\n```makefile\ndefine install_package\n\t@echo \"Installing $(1)...\"\n\tpip install --quiet $(1)\n\t@echo \"Done: $(1)\"\nendef\n\ndeps:\n\t$(call install_package,pytest)\n\t$(call install_package,black)\n```\n\n## Automatic Variables Reference\n\nUse automatic variables to reduce duplication:\n\n| Variable | Meaning | Use Case |\n|----------|---------|----------|\n| `$@` | Target name | Output file path |\n| `$<` | First prerequisite | Main input file |\n| `$^` | All prerequisites | Link all objects |\n| `$?` | Newer prerequisites | Incremental builds |\n| `$*` | Stem match | Pattern rule matching |\n| `$(@D)` | Directory of target | mkdir parent |\n| `$(<D)` | Directory of first prerequisite | Source dirs |\n\nExample:\n```makefile\n# Before\nbuild/foo.o: src/foo.c\n\t$(CC) $(CFLAGS) -c src/foo.c -o build/foo.o\n\n# After\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Clean Target Best Practices\n\n```makefile\n# Good - use variables, don't duplicate paths\nBUILD_DIR ?= build\nDIST_DIR ?= dist\n\n.PHONY: clean distclean\n\nclean:\n\trm -rf $(BUILD_DIR)\n\ndistclean: clean\n\trm -rf $(DIST_DIR)\n```\n\nFile v1.9.13:modules/dependency-graph.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: dependency-graph\ndescription: Make database inspection and dependency analysis\ntags: [dependencies, phony, circular-deps, includes]\n---\n\n# Dependency Graph Analysis\n\n## Make Database Inspection\n\nInspect the complete expanded database:\n```bash\nmake -pn | less\n```\n\nThis shows:\n- All rules (implicit and explicit)\n- Variable assignments\n- Default values\n- Pattern rules\n\n## PHONY Detection\n\nCheck for `.PHONY` declarations:\n```bash\nrg -n \"^\\.PHONY:\" -g'Makefile*'\n```\n\nCommon PHONY targets that should be declared:\n- `all`, `build`, `test`, `clean`, `install`\n- `help`, `format`, `lint`, `release`\n- `distclean`, `check`, `docs`\n\n## Circular Dependency Checks\n\nLook for circular dependencies:\n```bash\nmake -pn 2>&1 | grep -i \"circular\"\n```\n\nCommon patterns:\n```makefile\n# Bad - circular\nA: B\nB: A\n\n# Good - linear\nA: B\nB: C\n```\n\n## Include File Patterns\n\nFind include directives:\n```bash\nrg -n \"^include|^-include\" -g'Makefile*'\n```\n\nCheck for:\n- Redundant includes\n- Missing includes\n- Include order issues\n- Conditional includes\n\nValidate included files exist:\n```bash\n# List includes\nrg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'\n\n# Check they exist\nfor f in $(rg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'); do\n  [ -f \"$f\" ] || echo \"Missing: $f\"\ndone\n```\n\nFile v1.9.13:modules/plugin-dogfood-checks.md\n\n# Plugin Dogfood Checks\n\nAnalyzes Makefiles to identify gaps in user-facing functionality, safely tests existing targets, and generates missing targets with contextually appropriate templates.\n\n## Overview\n\nThis module provides detailed Makefile analysis and enhancement for the claude-night-market project. It validates that all plugins have complete, consistent, and functional Makefile targets that support common user workflows.\n\n## Workflow\n\n### 1. Discovery Phase\n```bash\nmakefile_dogfooder.py --scope all --mode analyze\n```\n\nThe discovery phase:\n- Recursively searches for Makefile, makefile, GNUmakefile, and *.mk files\n- Parses target definitions with dependencies and commands\n- Extracts variable assignments and include statements\n- Builds dependency graphs and detects plugin type (leaf vs aggregator)\n\n### 2. Analysis Phase\n```bash\nmakefile_dogfooder.py --mode analyze --output json\n```\n\nThe analysis phase evaluates:\n- **Essential targets** (help, clean, .PHONY) - 20 points each\n- **Recommended targets** (test, lint, format, install, status) - 10 points each\n- **Convenience targets** (demo, dogfood, check, quick-run) - 5 points each\n- **Anti-patterns** (missing .PHONY, no error handling)\n- **Consistency** across multiple Makefiles\n\n### 3. Testing Phase\n```bash\nmakefile_dogfooder.py --mode test\n```\n\nThe testing phase performs:\n- Syntax validation with `make -n`\n- Help target functionality checks\n- Variable dependency verification\n- Common runtime issue detection\n\n### 4. Generation Phase\n```bash\nmakefile_dogfooder.py --mode full --apply\n```\n\nThe generation phase creates:\n- **Demo targets** to showcase plugin functionality\n- **Dogfood targets** for self-testing\n- **Quick-run targets** for common workflows\n- **Check-all targets** for aggregator Makefiles\n\n## Best Practices\n\n### For Leaf Plugins\n- Always include: help, clean, test, lint\n- Add demo target to showcase functionality\n- Include dogfood target for self-testing\n- Use shared includes from abstract when possible\n\n### For Aggregator Makefiles\n- Delegate to plugin Makefiles with pattern targets\n- Include check-all target for detailed validation\n- Maintain consistent target naming across plugins\n- Provide helpful aggregate status information\n\n### Target Naming\n- Use kebab-case for target names\n- Include brief description with `##` comment\n- Group related targets with prefixes (test-, dev-, docs-)\n- Follow alphabetical ordering for readability\n\n## Demo Target Philosophy\n\nDemo targets must run ACTUAL functionality, not just echo static information.\n\n| BAD (Static/Informational) | GOOD (Live/Functional) |\n|-------------------------------|---------------------------|\n| `@echo \"Skills: 5\"` | `$(UV_RUN) python scripts/validator.py --scan` |\n| `@find skills/ \\| wc -l` | `$(UV_RUN) python scripts/cli.py analyze .` |\n| `@echo \"Feature: validation\"` | `$(UV_RUN) python scripts/validator.py --target .` |\n\n## Integration\n\n### With Slash Commands\n```bash\n/make-dogfood --scope plugins --mode full\n```\n\n### With CI/CD\n```yaml\n- name: Validate Makefiles\n  run: makefile_dogfooder.py --mode test --output json\n```\n\n## Scoring\n\nEach Makefile is scored 0-100 based on target coverage:\n- Essential targets: 20 points each\n- Recommended targets: 10 points each\n- Convenience targets: 5 points each\n- Anti-pattern penalties: -5 to -10 each\n\nFile v1.9.13:modules/portability-checks.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: portability-checks\ndescription: Cross-platform compatibility and POSIX vs GNU Make feature detection\ntags: [portability, posix, gnu-make, cross-platform]\n---\n\n# Portability Checks\n\n## GNU Make Features\n\nCheck for GNU-specific features that may not be portable:\n\n### Advanced Directives\n```bash\nrg -n \"^\\\\.ONESHELL:\" -g'Makefile*'\nrg -n \"^\\\\.NOTPARALLEL:\" -g'Makefile*'\nrg -n \"^\\\\.DELETE_ON_ERROR:\" -g'Makefile*'\n```\n\n- `.ONESHELL` - Single shell per recipe (GNU Make 3.82+)\n- `.NOTPARALLEL` - Disable parallel execution\n- `.DELETE_ON_ERROR` - Delete targets on error\n\n### Order-Only Prerequisites\n```bash\nrg -n \"\\|[^|]\" -g'Makefile*'\n```\n\nOrder-only prerequisites (`target: normal | order-only`) are GNU Make only.\n\n### GNU Functions\n```bash\nrg -n \"\\$\\(shell \" -g'Makefile*'\nrg -n \"\\$\\(wildcard \" -g'Makefile*'\nrg -n \"\\$\\(foreach \" -g'Makefile*'\nrg -n \"\\$\\(eval \" -g'Makefile*'\n```\n\nCommon GNU functions:\n- `$(shell ...)` - Execute shell command\n- `$(wildcard pattern)` - File globbing\n- `$(foreach var,list,text)` - Loop\n- `$(eval text)` - Dynamic evaluation\n\n## POSIX Compatibility\n\nFor maximum portability:\n```makefile\n# POSIX-compatible shell\nSHELL := /bin/sh\n\n# Avoid Bash-specific features\n# - Arrays: arr=(1 2 3)\n# - [[ ]]: use [ ] instead\n# - Process substitution: <(cmd)\n# - Brace expansion: {1..10}\n```\n\n## Shell Configuration\n\n### Good: POSIX Compatible\n```makefile\nSHELL := /bin/sh\n```\n\n### If Bash Required\nDocument and configure properly:\n```makefile\n# Requires Bash 4.0+\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n\n# -e: exit on error\n# -u: error on undefined variable\n# -o pipefail: pipe fails if any command fails\n# -c: execute command\n```\n\n## Cross-Platform Safety\n\n### Path Separators\n```makefile\n# Good - portable\nSRC_DIR := src\nBUILD_DIR := build\n\n# Bad - hardcoded separator\nSRC_DIR := src/main/resources\n```\n\n### Command Portability\n```makefile\n# Check for required commands\nifeq ($(shell command -v pandoc 2>/dev/null),)\n$(error pandoc is required but not installed)\nendif\n```\n\n### Platform Detection\n```makefile\nUNAME := $(shell uname -s)\n\nifeq ($(UNAME),Linux)\n  # Linux-specific\nendif\nifeq ($(UNAME),Darwin)\n  # macOS-specific\nendif\n```\n\n## Quality Gate Targets\n\nvalidate standard targets exist:\n```bash\nrg -n \"^help:\" -g'Makefile*'\nrg -n \"^format:\" -g'Makefile*'\nrg -n \"^lint:\" -g'Makefile*'\nrg -n \"^test:\" -g'Makefile*'\nrg -n \"^build:\" -g'Makefile*'\nrg -n \"^clean:\" -g'Makefile*'\n```\n\nRecommended targets:\n- `help` - Show available targets\n- `format` - Code formatting\n- `lint` - Linting checks\n- `test` - Run test suite\n- `build` - Build artifacts\n- `clean` - Clean build artifacts\n- `release` - Production build\n- `install` - Install artifacts\n\nFile v1.9.13:skill-card.md\n\n## Description: <br>\nAudits Makefiles for build correctness, portability, and recipe duplication. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and engineers use this skill to review Makefile changes, build automation, CI/CD updates, and portability improvements before committing or releasing them. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Broad Makefile and build automation triggers may activate the skill outside an intended audit. <br>\nMitigation: Use the skill only for explicit Makefile review requests or narrowly scoped build automation audits. <br>\nRisk: The artifact documents an apply mode that can modify executable build automation. <br>\nMitigation: Inspect proposed diffs before applying changes and avoid apply mode unless the reviewer is comfortable changing Makefile behavior. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-pensive-makefile-review) <br>\n- [Pensive plugin homepage](https://github.com/athola/claude-night-market/tree/master/plugins/pensive) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [analysis, markdown, shell commands, configuration, guidance] <br>\n**Output Format:** [Markdown with findings, file references, command snippets, and approval recommendations] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Findings are organized by context, dependency analysis, duplication candidates, portability issues, missing targets, and recommendation.] <br>\n\n## Skill Version(s): <br>\n1.9.13 (source: ClawHub release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.12: 8 files, 10386 bytes\n\nFiles: modules/best-practices.md (4064b), modules/deduplication-patterns.md (2530b), modules/dependency-graph.md (1306b), modules/plugin-dogfood-checks.md (3322b), modules/portability-checks.md (2735b), skill-card.md (2083b), SKILL.md (4535b), _meta.json (146b)\n\nFile v1.9.12:SKILL.md\n\n---\nname: makefile-review\ndescription: Audits Makefiles for build correctness, portability, and recipe duplication\nversion: 1.9.8\ntriggers:\n  - makefile\n  - build\n  - make\n  - portability\n  - automation\n  - reviewing a Makefile or before committing Makefile changes\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/pensive\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.pensive:shared\", \"night-market.imbue:proof-of-work\"]}}}\nsource: claude-night-market\nsource_plugin: pensive\n---\n\n> **Night Market Skill** — ported from [claude-night-market/pensive](https://github.com/athola/claude-night-market/tree/master/plugins/pensive). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Workflow](#workflow)\n- [Step 1: Map Context (`makefile-review:context-mapped`)](#step-1:-map-context-(makefile-review:context-mapped))\n- [Step 2: Dependency Graph (`makefile-review:dependency-graph`)](#step-2:-dependency-graph-(makefile-review:dependency-graph))\n- [Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)](#step-3:-deduplication-audit-(makefile-review:dedup-candidates))\n- [Step 4: Portability Check (`makefile-review:tooling-alignment`)](#step-4:-portability-check-(makefile-review:tooling-alignment))\n- [Step 5: Evidence Log (`makefile-review:evidence-logged`)](#step-5:-evidence-log-(makefile-review:evidence-logged))\n- [Progressive Loading](#progressive-loading)\n- [Output Format](#output-format)\n- [Summary](#summary)\n- [Testing](#testing)\n\n## Testing\n\nRun `pytest plugins/pensive/tests/skills/test_makefile_review.py` to verify review logic.\n\n# Makefile Review Workflow\n\nAudit Makefiles for best practices, deduplication, and portability.\n\n## Quick Start\n\n```bash\n/makefile-review\n```\n\n## When To Use\n\n- Makefile changes or additions\n- Build system optimization\n- Portability improvements\n- CI/CD pipeline updates\n- Developer experience improvements\n\n## When NOT To Use\n\n- Creating new Makefiles - use abstract:make-dogfood\n- Architecture review - use architecture-review\n\n## Required TodoWrite Items\n\n1. `makefile-review:context-mapped`\n2. `makefile-review:dependency-graph`\n3. `makefile-review:dedup-candidates`\n4. `makefile-review:tooling-alignment`\n5. `makefile-review:evidence-logged`\n\n## Workflow\n\n### Step 1: Map Context (`makefile-review:context-mapped`)\n\nConfirm baseline:\n```bash\npwd && git status -sb && git diff --stat\n```\n**Verification:** Run `git status` to confirm working tree state.\n\nFind Make-related files:\n```bash\nrg -n \"^include\" -g'Makefile*'\nrg --files -g '*.mk'\n```\n\nDocument changed targets, project goals, and tooling requirements.\n\n### Step 2: Dependency Graph (`makefile-review:dependency-graph`)\n\n@include modules/dependency-graph.md\n\n### Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)\n\n@include modules/deduplication-patterns.md\n\n### Step 4: Portability Check (`makefile-review:tooling-alignment`)\n\n@include modules/portability-checks.md\n\n### Step 5: Evidence Log (`makefile-review:evidence-logged`)\n\nUse `imbue:proof-of-work` to record command outputs with file:line references.\n\nSummarize findings:\n- Severity (critical, major, minor)\n- Expected impact\n- Suggested refactors\n- Owners and dates for follow-ups\n\n## Progressive Loading\n\nLoad additional context as needed:\n\n**Best Practices & Examples**: `@include modules/best-practices.md`\n\n**Plugin Dogfood Checks**: `@include modules/plugin-dogfood-checks.md` - Makefile completeness analysis, target generation, and dogfooding validation.\n\n## Output Format\n\n```markdown\n## Summary\nMakefile review findings\n\n## Context\n- Files reviewed: [list]\n- Targets changed: [list]\n\n## Dependency Analysis\n[graph and issues]\n\n## Duplication Candidates\n### [D1] Repeated command\n- Locations: [list]\n- Recommendation: [pattern rule]\n\n## Portability Issues\n[cross-platform concerns]\n\n## Missing Targets\n- [ ] help\n- [ ] format\n- [ ] lint\n\n## Recommendation\nApprove / Approve with actions / Block\n```\n\n## Exit Criteria\n\n- Context mapped\n- Dependencies analyzed\n- Deduplication reviewed\n- Portability checked\n- Evidence logged\n## Troubleshooting\n\n### Common Issues\n\n**No Makefile found**\nEnsure `Makefile` or `*.mk` files exist in the project root or specify paths explicitly.\n\n**Include directives not resolved**\nRun `rg -n \"^include\" -g'Makefile*'` to trace include chains manually.\n\nFile v1.9.12:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-pensive-makefile-review\",\n  \"version\": \"1.9.12\",\n  \"publishedAt\": 1781839039578\n}\n\nFile v1.9.12:modules/best-practices.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: best-practices\ndescription: Makefile structure patterns, examples, and anti-patterns to avoid\ntags: [best-practices, patterns, anti-patterns, examples]\n---\n\n# Makefile Best Practices\n\n## Structure Pattern\n\nRecommended organization:\n```makefile\n# 1. Variables at top\nPROJECT := myproject\nSRC_DIR := src\nBUILD_DIR := build\nVERSION := 1.0.0\n\n# 2. Default goal\n.DEFAULT_GOAL := help\n\n# 3. PHONY declarations\n.PHONY: all build test clean help\n\n# 4. Help target (self-documenting)\nhelp: ## Show this help\n\t@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \\\n\t\tawk 'BEGIN {FS = \":.*?## \"}; {printf \"%-15s %s\\n\", $$1, $$2}'\n\n# 5. Main targets with inline docs\nbuild: ## Build the project\n\t$(MAKE) -C $(SRC_DIR)\n\ntest: build ## Run tests\n\tpytest tests/\n\nclean: ## Clean build artifacts\n\trm -rf $(BUILD_DIR)\n```\n\n## Pattern Rule Examples\n\n### File Conversion\n```makefile\n# Markdown to HTML\n%.html: %.md\n\tpandoc $< -o $@\n\n# Source to object\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t@mkdir -p $(@D)\n\t$(CC) $(CFLAGS) -c $< -o $@\n\n# Template expansion\n%/config.json: templates/config.json.tmpl\n\t@mkdir -p $(@D)\n\tenvsubst < $< > $@\n```\n\n### Testing Patterns\n```makefile\n# Test by subdirectory\ntest-%:\n\tpytest tests/$*\n\n# Test by type\ntest-unit test-integration test-e2e: test-%:\n\tpytest tests/$* -v\n```\n\n## Function Examples\n\n### Reusable Command Sequences\n```makefile\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest -v\n\t@echo \"Done: $(1)\"\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\n### Multi-line Recipes\n```makefile\ndefine docker_build\n\tdocker build \\\n\t\t--build-arg VERSION=$(VERSION) \\\n\t\t--tag $(1):$(VERSION) \\\n\t\t--tag $(1):latest \\\n\t\t.\nendef\n\nimage:\n\t$(call docker_build,$(PROJECT))\n```\n\n## Anti-Patterns to Avoid\n\n### Repeated Commands\n```makefile\n# Bad - duplicated logic\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\n### Missing PHONY\n```makefile\n# Bad - 'clean' file blocks target\nclean:\n\trm -rf build/\n\n# Good\n.PHONY: clean\nclean:\n\trm -rf build/\n```\n\n### Hardcoded Paths\n```makefile\n# Bad - not portable\nclean:\n\trm -rf /home/user/project/build\n\n# Good - variables\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Shell-Specific Commands\n```makefile\n# Bad - Bash-only\ncheck:\n\t[[ -f config.yaml ]] && echo \"Found\"\n\n# Good - POSIX compatible\ncheck:\n\t[ -f config.yaml ] && echo \"Found\"\n```\n\n### Unguarded Variable References\n```makefile\n# Bad - fails if undefined\nclean:\n\trm -rf $(BUILD_DIR)\n\n# Good - with default\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Non-Idempotent Targets\n```makefile\n# Bad - appends every time\nconfigure:\n\techo \"DEBUG=1\" >> config.mk\n\n# Good - idempotent\nconfigure:\n\t@echo \"DEBUG=1\" > config.mk\n```\n\n## Error Handling\n\n### Check Prerequisites\n```makefile\n.PHONY: check-deps\ncheck-deps:\n\t@command -v python3 >/dev/null || (echo \"python3 required\"; exit 1)\n\t@command -v pytest >/dev/null || (echo \"pytest required\"; exit 1)\n\ntest: check-deps\n\tpytest tests/\n```\n\n### Delete on Error\n```makefile\n# Automatically delete targets on error\n.DELETE_ON_ERROR:\n\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n### Pipeline Exit Code Propagation\n```makefile\n# Bad - pipeline exit code is from grep, not make\ncheck:\n\t@$(MAKE) typecheck 2>&1 | grep -v \"^make\\[\"\n\n# Good - capture exit code explicitly in wrapper scripts\n# See shell-review skill for bash pipeline patterns\ncheck:\n\t@$(MAKE) typecheck || { echo \"Type check failed\"; exit 1; }\n\n# Good - use .SHELLFLAGS for pipefail in recipes\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n```\n\nWhen recipes use pipelines, ensure exit codes propagate correctly. In bash, the default behavior is that pipeline exit code equals the last command's exit code. Use `set -o pipefail` or capture output and exit codes separately.\n\n## Parallel Execution\n\n```makefile\n# Enable parallel by default\nMAKEFLAGS += -j$(shell nproc 2>/dev/null || echo 1)\n\n# Or disable for specific targets\n.NOTPARALLEL: install deploy\n```\n\nFile v1.9.12:modules/deduplication-patterns.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: deduplication-patterns\ndescription: Detect and eliminate recipe duplication using pattern rules and functions\ntags: [deduplication, pattern-rules, functions, automatic-variables]\n---\n\n# Deduplication Patterns\n\n## Recipe Duplication Detection\n\nSearch for repeated command patterns:\n```bash\n# Common test commands\nrg -n \"cargo test\" -g'Makefile*'\nrg -n \"pytest\" -g'Makefile*'\nrg -n \"npm run\" -g'Makefile*'\nrg -n \"go test\" -g'Makefile*'\n\n# Build commands\nrg -n \"docker build\" -g'Makefile*'\nrg -n \"gcc.*-o\" -g'Makefile*'\n```\n\n## Pattern Rules\n\nReplace repeated rules with patterns:\n```makefile\n# Bad - repeated\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\ntest-e2e:\n\tpytest tests/e2e\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\nPattern rule for file conversion:\n```makefile\n# Convert all .md to .html\n%.html: %.md\n\tpandoc $< -o $@\n\n# Build objects from sources\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Static Pattern Rules\n\nFor specific targets with patterns:\n```makefile\nSOURCES := foo.c bar.c baz.c\nOBJECTS := $(SOURCES:.c=.o)\n\n$(OBJECTS): %.o: %.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Functions and Define Blocks\n\nReusable command sequences:\n```makefile\n# Define reusable function\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\nMulti-line define blocks:\n```makefile\ndefine install_package\n\t@echo \"Installing $(1)...\"\n\tpip install --quiet $(1)\n\t@echo \"Done: $(1)\"\nendef\n\ndeps:\n\t$(call install_package,pytest)\n\t$(call install_package,black)\n```\n\n## Automatic Variables Reference\n\nUse automatic variables to reduce duplication:\n\n| Variable | Meaning | Use Case |\n|----------|---------|----------|\n| `$@` | Target name | Output file path |\n| `$<` | First prerequisite | Main input file |\n| `$^` | All prerequisites | Link all objects |\n| `$?` | Newer prerequisites | Incremental builds |\n| `$*` | Stem match | Pattern rule matching |\n| `$(@D)` | Directory of target | mkdir parent |\n| `$(<D)` | Directory of first prerequisite | Source dirs |\n\nExample:\n```makefile\n# Before\nbuild/foo.o: src/foo.c\n\t$(CC) $(CFLAGS) -c src/foo.c -o build/foo.o\n\n# After\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Clean Target Best Practices\n\n```makefile\n# Good - use variables, don't duplicate paths\nBUILD_DIR ?= build\nDIST_DIR ?= dist\n\n.PHONY: clean distclean\n\nclean:\n\trm -rf $(BUILD_DIR)\n\ndistclean: clean\n\trm -rf $(DIST_DIR)\n```\n\nFile v1.9.12:modules/dependency-graph.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: dependency-graph\ndescription: Make database inspection and dependency analysis\ntags: [dependencies, phony, circular-deps, includes]\n---\n\n# Dependency Graph Analysis\n\n## Make Database Inspection\n\nInspect the complete expanded database:\n```bash\nmake -pn | less\n```\n\nThis shows:\n- All rules (implicit and explicit)\n- Variable assignments\n- Default values\n- Pattern rules\n\n## PHONY Detection\n\nCheck for `.PHONY` declarations:\n```bash\nrg -n \"^\\.PHONY:\" -g'Makefile*'\n```\n\nCommon PHONY targets that should be declared:\n- `all`, `build`, `test`, `clean`, `install`\n- `help`, `format`, `lint`, `release`\n- `distclean`, `check`, `docs`\n\n## Circular Dependency Checks\n\nLook for circular dependencies:\n```bash\nmake -pn 2>&1 | grep -i \"circular\"\n```\n\nCommon patterns:\n```makefile\n# Bad - circular\nA: B\nB: A\n\n# Good - linear\nA: B\nB: C\n```\n\n## Include File Patterns\n\nFind include directives:\n```bash\nrg -n \"^include|^-include\" -g'Makefile*'\n```\n\nCheck for:\n- Redundant includes\n- Missing includes\n- Include order issues\n- Conditional includes\n\nValidate included files exist:\n```bash\n# List includes\nrg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'\n\n# Check they exist\nfor f in $(rg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'); do\n  [ -f \"$f\" ] || echo \"Missing: $f\"\ndone\n```\n\nFile v1.9.12:modules/plugin-dogfood-checks.md\n\n# Plugin Dogfood Checks\n\nAnalyzes Makefiles to identify gaps in user-facing functionality, safely tests existing targets, and generates missing targets with contextually appropriate templates.\n\n## Overview\n\nThis module provides detailed Makefile analysis and enhancement for the claude-night-market project. It validates that all plugins have complete, consistent, and functional Makefile targets that support common user workflows.\n\n## Workflow\n\n### 1. Discovery Phase\n```bash\nmakefile_dogfooder.py --scope all --mode analyze\n```\n\nThe discovery phase:\n- Recursively searches for Makefile, makefile, GNUmakefile, and *.mk files\n- Parses target definitions with dependencies and commands\n- Extracts variable assignments and include statements\n- Builds dependency graphs and detects plugin type (leaf vs aggregator)\n\n### 2. Analysis Phase\n```bash\nmakefile_dogfooder.py --mode analyze --output json\n```\n\nThe analysis phase evaluates:\n- **Essential targets** (help, clean, .PHONY) - 20 points each\n- **Recommended targets** (test, lint, format, install, status) - 10 points each\n- **Convenience targets** (demo, dogfood, check, quick-run) - 5 points each\n- **Anti-patterns** (missing .PHONY, no error handling)\n- **Consistency** across multiple Makefiles\n\n### 3. Testing Phase\n```bash\nmakefile_dogfooder.py --mode test\n```\n\nThe testing phase performs:\n- Syntax validation with `make -n`\n- Help target functionality checks\n- Variable dependency verification\n- Common runtime issue detection\n\n### 4. Generation Phase\n```bash\nmakefile_dogfooder.py --mode full --apply\n```\n\nThe generation phase creates:\n- **Demo targets** to showcase plugin functionality\n- **Dogfood targets** for self-testing\n- **Quick-run targets** for common workflows\n- **Check-all targets** for aggregator Makefiles\n\n## Best Practices\n\n### For Leaf Plugins\n- Always include: help, clean, test, lint\n- Add demo target to showcase functionality\n- Include dogfood target for self-testing\n- Use shared includes from abstract when possible\n\n### For Aggregator Makefiles\n- Delegate to plugin Makefiles with pattern targets\n- Include check-all target for detailed validation\n- Maintain consistent target naming across plugins\n- Provide helpful aggregate status information\n\n### Target Naming\n- Use kebab-case for target names\n- Include brief description with `##` comment\n- Group related targets with prefixes (test-, dev-, docs-)\n- Follow alphabetical ordering for readability\n\n## Demo Target Philosophy\n\nDemo targets must run ACTUAL functionality, not just echo static information.\n\n| BAD (Static/Informational) | GOOD (Live/Functional) |\n|-------------------------------|---------------------------|\n| `@echo \"Skills: 5\"` | `$(UV_RUN) python scripts/validator.py --scan` |\n| `@find skills/ \\| wc -l` | `$(UV_RUN) python scripts/cli.py analyze .` |\n| `@echo \"Feature: validation\"` | `$(UV_RUN) python scripts/validator.py --target .` |\n\n## Integration\n\n### With Slash Commands\n```bash\n/make-dogfood --scope plugins --mode full\n```\n\n### With CI/CD\n```yaml\n- name: Validate Makefiles\n  run: makefile_dogfooder.py --mode test --output json\n```\n\n## Scoring\n\nEach Makefile is scored 0-100 based on target coverage:\n- Essential targets: 20 points each\n- Recommended targets: 10 points each\n- Convenience targets: 5 points each\n- Anti-pattern penalties: -5 to -10 each\n\nFile v1.9.12:modules/portability-checks.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: portability-checks\ndescription: Cross-platform compatibility and POSIX vs GNU Make feature detection\ntags: [portability, posix, gnu-make, cross-platform]\n---\n\n# Portability Checks\n\n## GNU Make Features\n\nCheck for GNU-specific features that may not be portable:\n\n### Advanced Directives\n```bash\nrg -n \"^\\\\.ONESHELL:\" -g'Makefile*'\nrg -n \"^\\\\.NOTPARALLEL:\" -g'Makefile*'\nrg -n \"^\\\\.DELETE_ON_ERROR:\" -g'Makefile*'\n```\n\n- `.ONESHELL` - Single shell per recipe (GNU Make 3.82+)\n- `.NOTPARALLEL` - Disable parallel execution\n- `.DELETE_ON_ERROR` - Delete targets on error\n\n### Order-Only Prerequisites\n```bash\nrg -n \"\\|[^|]\" -g'Makefile*'\n```\n\nOrder-only prerequisites (`target: normal | order-only`) are GNU Make only.\n\n### GNU Functions\n```bash\nrg -n \"\\$\\(shell \" -g'Makefile*'\nrg -n \"\\$\\(wildcard \" -g'Makefile*'\nrg -n \"\\$\\(foreach \" -g'Makefile*'\nrg -n \"\\$\\(eval \" -g'Makefile*'\n```\n\nCommon GNU functions:\n- `$(shell ...)` - Execute shell command\n- `$(wildcard pattern)` - File globbing\n- `$(foreach var,list,text)` - Loop\n- `$(eval text)` - Dynamic evaluation\n\n## POSIX Compatibility\n\nFor maximum portability:\n```makefile\n# POSIX-compatible shell\nSHELL := /bin/sh\n\n# Avoid Bash-specific features\n# - Arrays: arr=(1 2 3)\n# - [[ ]]: use [ ] instead\n# - Process substitution: <(cmd)\n# - Brace expansion: {1..10}\n```\n\n## Shell Configuration\n\n### Good: POSIX Compatible\n```makefile\nSHELL := /bin/sh\n```\n\n### If Bash Required\nDocument and configure properly:\n```makefile\n# Requires Bash 4.0+\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n\n# -e: exit on error\n# -u: error on undefined variable\n# -o pipefail: pipe fails if any command fails\n# -c: execute command\n```\n\n## Cross-Platform Safety\n\n### Path Separators\n```makefile\n# Good - portable\nSRC_DIR := src\nBUILD_DIR := build\n\n# Bad - hardcoded separator\nSRC_DIR := src/main/resources\n```\n\n### Command Portability\n```makefile\n# Check for required commands\nifeq ($(shell command -v pandoc 2>/dev/null),)\n$(error pandoc is required but not installed)\nendif\n```\n\n### Platform Detection\n```makefile\nUNAME := $(shell uname -s)\n\nifeq ($(UNAME),Linux)\n  # Linux-specific\nendif\nifeq ($(UNAME),Darwin)\n  # macOS-specific\nendif\n```\n\n## Quality Gate Targets\n\nvalidate standard targets exist:\n```bash\nrg -n \"^help:\" -g'Makefile*'\nrg -n \"^format:\" -g'Makefile*'\nrg -n \"^lint:\" -g'Makefile*'\nrg -n \"^test:\" -g'Makefile*'\nrg -n \"^build:\" -g'Makefile*'\nrg -n \"^clean:\" -g'Makefile*'\n```\n\nRecommended targets:\n- `help` - Show available targets\n- `format` - Code formatting\n- `lint` - Linting checks\n- `test` - Run test suite\n- `build` - Build artifacts\n- `clean` - Clean build artifacts\n- `release` - Production build\n- `install` - Install artifacts\n\nFile v1.9.12:skill-card.md\n\n## Description: <br>\nAudits Makefiles for build correctness, portability, and recipe duplication. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and engineers use this skill to review Makefiles before committing build, automation, CI/CD, or portability changes. It helps map Make-related files, analyze dependencies and duplicated recipes, identify portability issues, and summarize recommended follow-up actions. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill recommends command execution while reviewing Makefiles. <br>\nMitigation: Inspect every suggested command before running it and limit use to deliberate Makefile auditing tasks. <br>\nRisk: The skill can lead to applied Makefile target generation or repository changes. <br>\nMitigation: Use any --apply or generated-target workflow only in a clean git diff or sandbox after explicitly deciding that Makefile changes are intended. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/nm-pensive-makefile-review) <br>\n- [OpenClaw homepage metadata](https://github.com/athola/claude-night-market/tree/master/plugins/pensive) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Analysis, Markdown, Shell commands, Guidance] <br>\n**Output Format:** [Markdown with review findings, file references, recommendations, and inline shell commands] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include suggested Makefile refactors or target-generation guidance that should be reviewed before use.] <br>\n\n## Skill Version(s): <br>\n1.9.12 (source: ClawHub release metadata) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.0.3: 8 files, 10457 bytes\n\nFiles: modules/best-practices.md (4064b), modules/deduplication-patterns.md (2530b), modules/dependency-graph.md (1306b), modules/plugin-dogfood-checks.md (3322b), modules/portability-checks.md (2735b), skill-card.md (2263b), SKILL.md (4535b), _meta.json (145b)\n\nFile v1.0.3:SKILL.md\n\n---\nname: makefile-review\ndescription: Audits Makefiles for build correctness, portability, and recipe duplication\nversion: 1.9.8\ntriggers:\n  - makefile\n  - build\n  - make\n  - portability\n  - automation\n  - reviewing a Makefile or before committing Makefile changes\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/pensive\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.pensive:shared\", \"night-market.imbue:proof-of-work\"]}}}\nsource: claude-night-market\nsource_plugin: pensive\n---\n\n> **Night Market Skill** — ported from [claude-night-market/pensive](https://github.com/athola/claude-night-market/tree/master/plugins/pensive). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Workflow](#workflow)\n- [Step 1: Map Context (`makefile-review:context-mapped`)](#step-1:-map-context-(makefile-review:context-mapped))\n- [Step 2: Dependency Graph (`makefile-review:dependency-graph`)](#step-2:-dependency-graph-(makefile-review:dependency-graph))\n- [Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)](#step-3:-deduplication-audit-(makefile-review:dedup-candidates))\n- [Step 4: Portability Check (`makefile-review:tooling-alignment`)](#step-4:-portability-check-(makefile-review:tooling-alignment))\n- [Step 5: Evidence Log (`makefile-review:evidence-logged`)](#step-5:-evidence-log-(makefile-review:evidence-logged))\n- [Progressive Loading](#progressive-loading)\n- [Output Format](#output-format)\n- [Summary](#summary)\n- [Testing](#testing)\n\n## Testing\n\nRun `pytest plugins/pensive/tests/skills/test_makefile_review.py` to verify review logic.\n\n# Makefile Review Workflow\n\nAudit Makefiles for best practices, deduplication, and portability.\n\n## Quick Start\n\n```bash\n/makefile-review\n```\n\n## When To Use\n\n- Makefile changes or additions\n- Build system optimization\n- Portability improvements\n- CI/CD pipeline updates\n- Developer experience improvements\n\n## When NOT To Use\n\n- Creating new Makefiles - use abstract:make-dogfood\n- Architecture review - use architecture-review\n\n## Required TodoWrite Items\n\n1. `makefile-review:context-mapped`\n2. `makefile-review:dependency-graph`\n3. `makefile-review:dedup-candidates`\n4. `makefile-review:tooling-alignment`\n5. `makefile-review:evidence-logged`\n\n## Workflow\n\n### Step 1: Map Context (`makefile-review:context-mapped`)\n\nConfirm baseline:\n```bash\npwd && git status -sb && git diff --stat\n```\n**Verification:** Run `git status` to confirm working tree state.\n\nFind Make-related files:\n```bash\nrg -n \"^include\" -g'Makefile*'\nrg --files -g '*.mk'\n```\n\nDocument changed targets, project goals, and tooling requirements.\n\n### Step 2: Dependency Graph (`makefile-review:dependency-graph`)\n\n@include modules/dependency-graph.md\n\n### Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)\n\n@include modules/deduplication-patterns.md\n\n### Step 4: Portability Check (`makefile-review:tooling-alignment`)\n\n@include modules/portability-checks.md\n\n### Step 5: Evidence Log (`makefile-review:evidence-logged`)\n\nUse `imbue:proof-of-work` to record command outputs with file:line references.\n\nSummarize findings:\n- Severity (critical, major, minor)\n- Expected impact\n- Suggested refactors\n- Owners and dates for follow-ups\n\n## Progressive Loading\n\nLoad additional context as needed:\n\n**Best Practices & Examples**: `@include modules/best-practices.md`\n\n**Plugin Dogfood Checks**: `@include modules/plugin-dogfood-checks.md` - Makefile completeness analysis, target generation, and dogfooding validation.\n\n## Output Format\n\n```markdown\n## Summary\nMakefile review findings\n\n## Context\n- Files reviewed: [list]\n- Targets changed: [list]\n\n## Dependency Analysis\n[graph and issues]\n\n## Duplication Candidates\n### [D1] Repeated command\n- Locations: [list]\n- Recommendation: [pattern rule]\n\n## Portability Issues\n[cross-platform concerns]\n\n## Missing Targets\n- [ ] help\n- [ ] format\n- [ ] lint\n\n## Recommendation\nApprove / Approve with actions / Block\n```\n\n## Exit Criteria\n\n- Context mapped\n- Dependencies analyzed\n- Deduplication reviewed\n- Portability checked\n- Evidence logged\n## Troubleshooting\n\n### Common Issues\n\n**No Makefile found**\nEnsure `Makefile` or `*.mk` files exist in the project root or specify paths explicitly.\n\n**Include directives not resolved**\nRun `rg -n \"^include\" -g'Makefile*'` to trace include chains manually.\n\nFile v1.0.3:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-pensive-makefile-review\",\n  \"version\": \"1.0.3\",\n  \"publishedAt\": 1781791931672\n}\n\nFile v1.0.3:modules/best-practices.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: best-practices\ndescription: Makefile structure patterns, examples, and anti-patterns to avoid\ntags: [best-practices, patterns, anti-patterns, examples]\n---\n\n# Makefile Best Practices\n\n## Structure Pattern\n\nRecommended organization:\n```makefile\n# 1. Variables at top\nPROJECT := myproject\nSRC_DIR := src\nBUILD_DIR := build\nVERSION := 1.0.0\n\n# 2. Default goal\n.DEFAULT_GOAL := help\n\n# 3. PHONY declarations\n.PHONY: all build test clean help\n\n# 4. Help target (self-documenting)\nhelp: ## Show this help\n\t@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \\\n\t\tawk 'BEGIN {FS = \":.*?## \"}; {printf \"%-15s %s\\n\", $$1, $$2}'\n\n# 5. Main targets with inline docs\nbuild: ## Build the project\n\t$(MAKE) -C $(SRC_DIR)\n\ntest: build ## Run tests\n\tpytest tests/\n\nclean: ## Clean build artifacts\n\trm -rf $(BUILD_DIR)\n```\n\n## Pattern Rule Examples\n\n### File Conversion\n```makefile\n# Markdown to HTML\n%.html: %.md\n\tpandoc $< -o $@\n\n# Source to object\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t@mkdir -p $(@D)\n\t$(CC) $(CFLAGS) -c $< -o $@\n\n# Template expansion\n%/config.json: templates/config.json.tmpl\n\t@mkdir -p $(@D)\n\tenvsubst < $< > $@\n```\n\n### Testing Patterns\n```makefile\n# Test by subdirectory\ntest-%:\n\tpytest tests/$*\n\n# Test by type\ntest-unit test-integration test-e2e: test-%:\n\tpytest tests/$* -v\n```\n\n## Function Examples\n\n### Reusable Command Sequences\n```makefile\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest -v\n\t@echo \"Done: $(1)\"\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\n### Multi-line Recipes\n```makefile\ndefine docker_build\n\tdocker build \\\n\t\t--build-arg VERSION=$(VERSION) \\\n\t\t--tag $(1):$(VERSION) \\\n\t\t--tag $(1):latest \\\n\t\t.\nendef\n\nimage:\n\t$(call docker_build,$(PROJECT))\n```\n\n## Anti-Patterns to Avoid\n\n### Repeated Commands\n```makefile\n# Bad - duplicated logic\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\n### Missing PHONY\n```makefile\n# Bad - 'clean' file blocks target\nclean:\n\trm -rf build/\n\n# Good\n.PHONY: clean\nclean:\n\trm -rf build/\n```\n\n### Hardcoded Paths\n```makefile\n# Bad - not portable\nclean:\n\trm -rf /home/user/project/build\n\n# Good - variables\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Shell-Specific Commands\n```makefile\n# Bad - Bash-only\ncheck:\n\t[[ -f config.yaml ]] && echo \"Found\"\n\n# Good - POSIX compatible\ncheck:\n\t[ -f config.yaml ] && echo \"Found\"\n```\n\n### Unguarded Variable References\n```makefile\n# Bad - fails if undefined\nclean:\n\trm -rf $(BUILD_DIR)\n\n# Good - with default\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Non-Idempotent Targets\n```makefile\n# Bad - appends every time\nconfigure:\n\techo \"DEBUG=1\" >> config.mk\n\n# Good - idempotent\nconfigure:\n\t@echo \"DEBUG=1\" > config.mk\n```\n\n## Error Handling\n\n### Check Prerequisites\n```makefile\n.PHONY: check-deps\ncheck-deps:\n\t@command -v python3 >/dev/null || (echo \"python3 required\"; exit 1)\n\t@command -v pytest >/dev/null || (echo \"pytest required\"; exit 1)\n\ntest: check-deps\n\tpytest tests/\n```\n\n### Delete on Error\n```makefile\n# Automatically delete targets on error\n.DELETE_ON_ERROR:\n\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n### Pipeline Exit Code Propagation\n```makefile\n# Bad - pipeline exit code is from grep, not make\ncheck:\n\t@$(MAKE) typecheck 2>&1 | grep -v \"^make\\[\"\n\n# Good - capture exit code explicitly in wrapper scripts\n# See shell-review skill for bash pipeline patterns\ncheck:\n\t@$(MAKE) typecheck || { echo \"Type check failed\"; exit 1; }\n\n# Good - use .SHELLFLAGS for pipefail in recipes\nSHELL := /bin/bash\n.SHELLFLAGS := -eu -o pipefail -c\n```\n\nWhen recipes use pipelines, ensure exit codes propagate correctly. In bash, the default behavior is that pipeline exit code equals the last command's exit code. Use `set -o pipefail` or capture output and exit codes separately.\n\n## Parallel Execution\n\n```makefile\n# Enable parallel by default\nMAKEFLAGS += -j$(shell nproc 2>/dev/null || echo 1)\n\n# Or disable for specific targets\n.NOTPARALLEL: install deploy\n```\n\nFile v1.0.3:modules/deduplication-patterns.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: deduplication-patterns\ndescription: Detect and eliminate recipe duplication using pattern rules and functions\ntags: [deduplication, pattern-rules, functions, automatic-variables]\n---\n\n# Deduplication Patterns\n\n## Recipe Duplication Detection\n\nSearch for repeated command patterns:\n```bash\n# Common test commands\nrg -n \"cargo test\" -g'Makefile*'\nrg -n \"pytest\" -g'Makefile*'\nrg -n \"npm run\" -g'Makefile*'\nrg -n \"go test\" -g'Makefile*'\n\n# Build commands\nrg -n \"docker build\" -g'Makefile*'\nrg -n \"gcc.*-o\" -g'Makefile*'\n```\n\n## Pattern Rules\n\nReplace repeated rules with patterns:\n```makefile\n# Bad - repeated\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\ntest-e2e:\n\tpytest tests/e2e\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\nPattern rule for file conversion:\n```makefile\n# Convert all .md to .html\n%.html: %.md\n\tpandoc $< -o $@\n\n# Build objects from sources\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Static Pattern Rules\n\nFor specific targets with patterns:\n```makefile\nSOURCES := foo.c bar.c baz.c\nOBJECTS := $(SOURCES:.c=.o)\n\n$(OBJECTS): %.o: %.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Functions and Define Blocks\n\nReusable command sequences:\n```makefile\n# Define reusable function\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\nMulti-line define blocks:\n```makefile\ndefine install_package\n\t@echo \"Installing $(1)...\"\n\tpip install --quiet $(1)\n\t@echo \"Done: $(1)\"\nendef\n\ndeps:\n\t$(call install_package,pytest)\n\t$(call install_package,black)\n```\n\n## Automatic Variables Reference\n\nUse automatic variables to reduce duplication:\n\n| Variable | Meaning | Use Case |\n|----------|---------|----------|\n| `$@` | Target name | Output file path |\n| `$<` | First prerequisite | Main input file |\n| `$^` | All prerequisites | Link all objects |\n| `$?` | Newer prerequisites | Incremental builds |\n| `$*` | Stem match | Pattern rule matching |\n| `$(@D)` | Directory of target | mkdir parent |\n| `$(<D)` | Directory of first prerequisite | Source dirs |\n\nExample:\n```makefile\n# Before\nbuild/foo.o: src/foo.c\n\t$(CC) $(CFLAGS) -c src/foo.c -o build/foo.o\n\n# After\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Clean Target Best Practices\n\n```makefile\n# Good - use variables, don't duplicate paths\nBUILD_DIR ?= build\nDIST_DIR ?= dist\n\n.PHONY: clean distclean\n\nclean:\n\trm -rf $(BUILD_DIR)\n\ndistclean: clean\n\trm -rf $(DIST_DIR)\n```\n\nFile v1.0.3:modules/dependency-graph.md\n\n---\nparent_skill: pensive:makefile-review\nmodule: dependency-graph\ndescription: Make database inspection and dependency analysis\ntags: [dependencies, phony, circular-deps, includes]\n---\n\n# Dependency Graph Analysis\n\n## Make Database Inspection\n\nInspect the complete expanded database:\n```bash\nmake -pn | less\n```\n\nThis shows:\n- All rules (implicit and explicit)\n- Variable assignments\n- Default values\n- Pattern rules\n\n## PHONY Detection\n\nCheck for `.PHONY` declarations:\n```bash\nrg -n \"^\\.PHONY:\" -g'Makefile*'\n```\n\nCommon PHONY targets that should be declared:\n- `all`, `build`, `test`, `clean`, `install`\n- `help`, `format`, `lint`, `release`\n- `distclean`, `check`, `docs`\n\n## Circular Dependency Checks\n\nLook for circular dependencies:\n```bash\nmake -pn 2>&1 | grep -i \"circular\"\n```\n\nCommon patterns:\n```makefile\n# Bad - circular\nA: B\nB: A\n\n# Good - linear\nA: B\nB: C\n```\n\n## Include File Patterns\n\nFind include directives:\n```bash\nrg -n \"^include|^-include\" -g'Makefile*'\n```\n\nCheck for:\n- Redundant includes\n- Missing includes\n- Include order issues\n- Conditional includes\n\nValidate included files exist:\n```bash\n# List includes\nrg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'\n\n# Check they exist\nfor f in $(rg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'); do\n  [ -f \"$f\" ] || echo \"Missing: $f\"\ndone\n```\n\nFile v1.0.3:modules/plugin-dogfood-checks.md\n\n# Plugin Dogfood Checks\n\nAnalyzes Makefiles to identify gaps in user-facing functionality, safely tests existing targets, and generates missing targets with contextually appropriate templates.\n\n## Overview\n\nThis module provides detailed Makefile analysis and enhancement for the claude-night-market project. It validates that all plugins have complete, consistent, and functional Makefile targets that support common user workflows.\n\n## Workflow\n\n### 1. Discovery Phase\n```bash\nmakefile_dogfooder.py --scope all --mode analyze\n```\n\nThe discovery phase:\n- Recursively searches for Makefile, makefile, GNUmakefile, and *.mk files\n- Parses target definitions with dependencies and commands\n- Extracts variable assignments and include statements\n- Builds dependency graphs and detects plugin type (leaf vs aggregator)\n\n### 2. Analysis Phase\n```bash\nmakefile_dogfooder.py --mode analyze --output json\n```\n\nThe analysis phase evaluates:\n- **Essential targets** (help, clean, .PHONY) - 20 points each\n- **Recommended targets** (test, lint, format, install, status) - 10 points each\n- **Convenience targets** (demo, dogfood, check, quick-run) - 5 points each\n- **Anti-patterns** (missing .PHONY, no error handling)\n- **Consistency** across multiple Makefiles\n\n### 3. Testing Phase\n```bash\nmakefile_dogfooder.py --mode test\n```\n\nThe testing phase performs:\n- Syntax validation with `make -n`\n- Help target functionality checks\n- Variable dependency verification\n- Common runtime issue detection\n\n### 4. Generation Phase\n```bash\nmakefile_dogfooder.py --mode full --apply\n```\n\nThe generation phase creates:\n- **Demo targets** to showcase plugin functionality\n- **Dogfood targets** for self-testing\n- **Quick-run targets** for common workflows\n- **Check-all targets** for aggregator Makefiles\n\n## Best Practices\n\n### For Leaf Plugins\n- Always include: help, clean, test, lint\n- Add demo target to showcase functionality\n- Include dogfood target for self-testing\n- Use shared includes from abstract when possible\n\n### For Aggregator Makefiles\n- Delegate to plugin Makefiles with pattern targets\n- Include check-all target for detailed validation\n- Maintain consistent target naming across plugins\n- Provide helpful aggregate status information\n\n### Target Naming\n- Use kebab-case for target names\n- Include brief description with `##` comment\n- Group related targets with prefixes (test-, dev-, docs-)\n- Follow alphabetical ordering for readability\n\n## Demo Target Philosophy\n\nDemo targets must run ACTUAL functionality, not just echo static information.\n\n| BAD (Static/Informational) | GOOD (Live/Functional) |\n|-------------------------------|---------------------------|\n| `@echo \"Skills: 5\"` | `$(UV_RUN) python scripts/validator.py --scan` |\n| `@find skills/ \\| wc -l` | `$(UV_RUN) python scripts/cli.py analyze .` |\n| `@echo \"Feature: validation\"` | `$(UV_RUN) python scripts/validator.py --target .` |\n\n## Integration\n\n### With Slash Commands\n```bash\n/make-dogfood --scope plugins --mode full\n```\n\n### With CI/CD\n```yaml\n- name: Validate Makefiles\n  run: makefile_dogfooder.py --mode test --output json\n```\n\n## Scoring\n\nEach Makefile is scored 0-100 based on target coverage:\n- Essential targets: 20 points each\n- Recommended targets: 10 points each\n- Convenience targe\n\nArchive v1.0.2: 8 files, 10387 bytes\n\nFiles: modules/best-practices.md (4064b), modules/deduplication-patterns.md (2530b), modules/dependency-graph.md (1306b), modules/plugin-dogfood-checks.md (3322b), modules/portability-checks.md (2735b), skill-card.md (2102b), SKILL.md (4471b), _meta.json (145b)\n\nArchive v1.0.1: 7 files, 9222 bytes\n\nFiles: modules/best-practices.md (4064b), modules/deduplication-patterns.md (2530b), modules/dependency-graph.md (1306b), modules/plugin-dogfood-checks.md (3322b), modules/portability-checks.md (2735b), SKILL.md (4471b), _meta.json (145b)\n\nArchive v1.0.0: 7 files, 9221 bytes\n\nFiles: modules/best-practices.md (4064b), modules/deduplication-patterns.md (2530b), modules/dependency-graph.md (1306b), modules/plugin-dogfood-checks.md (3322b), modules/portability-checks.md (2735b), SKILL.md (4471b), _meta.json (145b)","readmeExcerpt":"Skill: makefile-review Owner: athola Summary: Audits Makefiles for build correctness, portability, and recipe duplication Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:18:53.332Z | user Release v1.9.19 v1.9.17 | 2026-07-30T05:39:06.878Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:55:48.848Z | user Release v1.9.16 v1.9.14 | 2026-06-30T18:04:10.129Z | user Release v1.9.14 v1.9.13 | 2026-06-27T16:22:11","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"/makefile-review"},{"language":"bash","snippet":"pwd && git status -sb && git diff --stat"},{"language":"bash","snippet":"rg -n \"^include\" -g'Makefile*'\nrg --files -g '*.mk'"},{"language":"markdown","snippet":"## Summary\nMakefile review findings\n\n## Context\n- Files reviewed: [list]\n- Targets changed: [list]\n\n## Dependency Analysis\n[graph and issues]\n\n## Duplication Candidates\n### [D1] Repeated command\n- Locations: [list]\n- Recommendation: [pattern rule]\n\n## Portability Issues\n[cross-platform concerns]\n\n## Missing Targets\n- [ ] help\n- [ ] format\n- [ ] lint\n\n## Recommendation\nApprove / Approve with actions / Block"},{"language":"makefile","snippet":"# 1. Variables at top\nPROJECT := myproject\nSRC_DIR := src\nBUILD_DIR := build\nVERSION := 1.0.0\n\n# 2. Default goal\n.DEFAULT_GOAL := help\n\n# 3. PHONY declarations\n.PHONY: all build test clean help\n\n# 4. Help target (self-documenting)\nhelp: ## Show this help\n\t@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \\\n\t\tawk 'BEGIN {FS = \":.*?## \"}; {printf \"%-15s %s\\n\", $$1, $$2}'\n\n# 5. Main targets with inline docs\nbuild: ## Build the project\n\t$(MAKE) -C $(SRC_DIR)\n\ntest: build ## Run tests\n\tpytest tests/\n\nclean: ## Clean build artifacts\n\trm -rf $(BUILD_DIR)"},{"language":"makefile","snippet":"# Markdown to HTML\n%.html: %.md\n\tpandoc $< -o $@\n\n# Source to object\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t@mkdir -p $(@D)\n\t$(CC) $(CFLAGS) -c $< -o $@\n\n# Template expansion\n%/config.json: templates/config.json.tmpl\n\t@mkdir -p $(@D)\n\tenvsubst < $< > $@"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: makefile-review\ndescription: Audits Makefiles for build correctness, portability, and recipe duplication\nversion: 1.9.8\ntriggers:\n  - makefile\n  - build\n  - make\n  - portability\n  - automation\n  - reviewing a Makefile or before committing Makefile changes\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/pensive\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.pensive:shared\", \"night-market.imbue:proof-of-work\"]}}}\nsource: claude-night-market\nsource_plugin: pensive\n---\n\n> **Night Market Skill** — ported from [claude-night-market/pensive](https://github.com/athola/claude-night-market/tree/master/plugins/pensive). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Workflow](#workflow)\n- [Step 1: Map Context (`makefile-review:context-mapped`)](#step-1:-map-context-(makefile-review:context-mapped))\n- [Step 2: Dependency Graph (`makefile-review:dependency-graph`)](#step-2:-dependency-graph-(makefile-review:dependency-graph))\n- [Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)](#step-3:-deduplication-audit-(makefile-review:dedup-candidates))\n- [Step 4: Portability Check (`makefile-review:tooling-alignment`)](#step-4:-portability-check-(makefile-review:tooling-alignment))\n- [Step 5: Evidence Log (`makefile-review:evidence-logged`)](#step-5:-evidence-log-(makefile-review:evidence-logged))\n- [Progressive Loading](#progressive-loading)\n- [Output Format](#output-format)\n- [Summary](#summary)\n- [Testing](#testing)\n\n## Testing\n\nRun `pytest plugins/pensive/tests/skills/test_makefile_review.py` to verify review logic.\n\n# Makefile Review Workflow\n\nAudit Makefiles for best practices, deduplication, and portability.\n\n## Quick Start\n\n```bash\n/makefile-review\n```\n\n## When To Use\n\n- Makefile changes or additions\n- Build system optimization\n- Portability improvements\n- CI/CD pipeline updates\n- Developer experience improvements\n\n## When NOT To Use\n\n- Creating new Makefiles - use abstract:make-dogfood\n- Architecture review - use architecture-review\n\n## Required TodoWrite Items\n\n1. `makefile-review:context-mapped`\n2. `makefile-review:dependency-graph`\n3. `makefile-review:dedup-candidates`\n4. `makefile-review:tooling-alignment`\n5. `makefile-review:evidence-logged`\n\n## Workflow\n\n### Step 1: Map Context (`makefile-review:context-mapped`)\n\nConfirm baseline:\n```bash\npwd && git status -sb && git diff --stat\n```\n**Verification:** Run `git status` to confirm working tree state.\n\nFind Make-related files:\n```bash\nrg -n \"^include\" -g'Makefile*'\nrg --files -g '*.mk'\n```\n\nDocument changed targets, project goals, and tooling requirements.\n\n### Step 2: Dependency Graph (`makefile-review:dependency-graph`)\n\n@include modules/dependency-graph.md\n\n### Step 3: Deduplication Audit (`makefile-review:dedup-candidates`)\n\n@"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-pensive-makefile-review\",\n  \"version\": \"1.9.19\",\n  \"publishedAt\": 1787750333332\n}"},{"path":"modules/best-practices.md","content":"---\nparent_skill: pensive:makefile-review\nmodule: best-practices\ndescription: Makefile structure patterns, examples, and anti-patterns to avoid\ntags: [best-practices, patterns, anti-patterns, examples]\n---\n\n# Makefile Best Practices\n\n## Structure Pattern\n\nRecommended organization:\n```makefile\n# 1. Variables at top\nPROJECT := myproject\nSRC_DIR := src\nBUILD_DIR := build\nVERSION := 1.0.0\n\n# 2. Default goal\n.DEFAULT_GOAL := help\n\n# 3. PHONY declarations\n.PHONY: all build test clean help\n\n# 4. Help target (self-documenting)\nhelp: ## Show this help\n\t@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \\\n\t\tawk 'BEGIN {FS = \":.*?## \"}; {printf \"%-15s %s\\n\", $$1, $$2}'\n\n# 5. Main targets with inline docs\nbuild: ## Build the project\n\t$(MAKE) -C $(SRC_DIR)\n\ntest: build ## Run tests\n\tpytest tests/\n\nclean: ## Clean build artifacts\n\trm -rf $(BUILD_DIR)\n```\n\n## Pattern Rule Examples\n\n### File Conversion\n```makefile\n# Markdown to HTML\n%.html: %.md\n\tpandoc $< -o $@\n\n# Source to object\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t@mkdir -p $(@D)\n\t$(CC) $(CFLAGS) -c $< -o $@\n\n# Template expansion\n%/config.json: templates/config.json.tmpl\n\t@mkdir -p $(@D)\n\tenvsubst < $< > $@\n```\n\n### Testing Patterns\n```makefile\n# Test by subdirectory\ntest-%:\n\tpytest tests/$*\n\n# Test by type\ntest-unit test-integration test-e2e: test-%:\n\tpytest tests/$* -v\n```\n\n## Function Examples\n\n### Reusable Command Sequences\n```makefile\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest -v\n\t@echo \"Done: $(1)\"\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\n### Multi-line Recipes\n```makefile\ndefine docker_build\n\tdocker build \\\n\t\t--build-arg VERSION=$(VERSION) \\\n\t\t--tag $(1):$(VERSION) \\\n\t\t--tag $(1):latest \\\n\t\t.\nendef\n\nimage:\n\t$(call docker_build,$(PROJECT))\n```\n\n## Anti-Patterns to Avoid\n\n### Repeated Commands\n```makefile\n# Bad - duplicated logic\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\n### Missing PHONY\n```makefile\n# Bad - 'clean' file blocks target\nclean:\n\trm -rf build/\n\n# Good\n.PHONY: clean\nclean:\n\trm -rf build/\n```\n\n### Hardcoded Paths\n```makefile\n# Bad - not portable\nclean:\n\trm -rf /home/user/project/build\n\n# Good - variables\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Shell-Specific Commands\n```makefile\n# Bad - Bash-only\ncheck:\n\t[[ -f config.yaml ]] && echo \"Found\"\n\n# Good - POSIX compatible\ncheck:\n\t[ -f config.yaml ] && echo \"Found\"\n```\n\n### Unguarded Variable References\n```makefile\n# Bad - fails if undefined\nclean:\n\trm -rf $(BUILD_DIR)\n\n# Good - with default\nBUILD_DIR ?= build\nclean:\n\trm -rf $(BUILD_DIR)\n```\n\n### Non-Idempotent Targets\n```makefile\n# Bad - appends every time\nconfigure:\n\techo \"DEBUG=1\" >> config.mk\n\n# Good - idempotent\nconfigure:\n\t@echo \"DEBUG=1\" > config.mk\n```\n\n## Error Handling\n\n### Check Prerequisites\n```makefile\n.PHONY: check-deps\ncheck-deps:\n\t@command -v python3 >/dev/null || (echo \"python3 required\"; exit 1)\n\t@command -v pytest >/dev/null ||"},{"path":"modules/deduplication-patterns.md","content":"---\nparent_skill: pensive:makefile-review\nmodule: deduplication-patterns\ndescription: Detect and eliminate recipe duplication using pattern rules and functions\ntags: [deduplication, pattern-rules, functions, automatic-variables]\n---\n\n# Deduplication Patterns\n\n## Recipe Duplication Detection\n\nSearch for repeated command patterns:\n```bash\n# Common test commands\nrg -n \"cargo test\" -g'Makefile*'\nrg -n \"pytest\" -g'Makefile*'\nrg -n \"npm run\" -g'Makefile*'\nrg -n \"go test\" -g'Makefile*'\n\n# Build commands\nrg -n \"docker build\" -g'Makefile*'\nrg -n \"gcc.*-o\" -g'Makefile*'\n```\n\n## Pattern Rules\n\nReplace repeated rules with patterns:\n```makefile\n# Bad - repeated\ntest-unit:\n\tpytest tests/unit\n\ntest-integration:\n\tpytest tests/integration\n\ntest-e2e:\n\tpytest tests/e2e\n\n# Good - pattern rule\ntest-%:\n\tpytest tests/$*\n```\n\nPattern rule for file conversion:\n```makefile\n# Convert all .md to .html\n%.html: %.md\n\tpandoc $< -o $@\n\n# Build objects from sources\n$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Static Pattern Rules\n\nFor specific targets with patterns:\n```makefile\nSOURCES := foo.c bar.c baz.c\nOBJECTS := $(SOURCES:.c=.o)\n\n$(OBJECTS): %.o: %.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Functions and Define Blocks\n\nReusable command sequences:\n```makefile\n# Define reusable function\ndefine run_tests\n\t@echo \"Testing $(1)...\"\n\tcd $(1) && pytest\nendef\n\ntest-all:\n\t$(call run_tests,module1)\n\t$(call run_tests,module2)\n```\n\nMulti-line define blocks:\n```makefile\ndefine install_package\n\t@echo \"Installing $(1)...\"\n\tpip install --quiet $(1)\n\t@echo \"Done: $(1)\"\nendef\n\ndeps:\n\t$(call install_package,pytest)\n\t$(call install_package,black)\n```\n\n## Automatic Variables Reference\n\nUse automatic variables to reduce duplication:\n\n| Variable | Meaning | Use Case |\n|----------|---------|----------|\n| `$@` | Target name | Output file path |\n| `$<` | First prerequisite | Main input file |\n| `$^` | All prerequisites | Link all objects |\n| `$?` | Newer prerequisites | Incremental builds |\n| `$*` | Stem match | Pattern rule matching |\n| `$(@D)` | Directory of target | mkdir parent |\n| `$(<D)` | Directory of first prerequisite | Source dirs |\n\nExample:\n```makefile\n# Before\nbuild/foo.o: src/foo.c\n\t$(CC) $(CFLAGS) -c src/foo.c -o build/foo.o\n\n# After\nbuild/%.o: src/%.c\n\t$(CC) $(CFLAGS) -c $< -o $@\n```\n\n## Clean Target Best Practices\n\n```makefile\n# Good - use variables, don't duplicate paths\nBUILD_DIR ?= build\nDIST_DIR ?= dist\n\n.PHONY: clean distclean\n\nclean:\n\trm -rf $(BUILD_DIR)\n\ndistclean: clean\n\trm -rf $(DIST_DIR)\n```"},{"path":"modules/dependency-graph.md","content":"---\nparent_skill: pensive:makefile-review\nmodule: dependency-graph\ndescription: Make database inspection and dependency analysis\ntags: [dependencies, phony, circular-deps, includes]\n---\n\n# Dependency Graph Analysis\n\n## Make Database Inspection\n\nInspect the complete expanded database:\n```bash\nmake -pn | less\n```\n\nThis shows:\n- All rules (implicit and explicit)\n- Variable assignments\n- Default values\n- Pattern rules\n\n## PHONY Detection\n\nCheck for `.PHONY` declarations:\n```bash\nrg -n \"^\\.PHONY:\" -g'Makefile*'\n```\n\nCommon PHONY targets that should be declared:\n- `all`, `build`, `test`, `clean`, `install`\n- `help`, `format`, `lint`, `release`\n- `distclean`, `check`, `docs`\n\n## Circular Dependency Checks\n\nLook for circular dependencies:\n```bash\nmake -pn 2>&1 | grep -i \"circular\"\n```\n\nCommon patterns:\n```makefile\n# Bad - circular\nA: B\nB: A\n\n# Good - linear\nA: B\nB: C\n```\n\n## Include File Patterns\n\nFind include directives:\n```bash\nrg -n \"^include|^-include\" -g'Makefile*'\n```\n\nCheck for:\n- Redundant includes\n- Missing includes\n- Include order issues\n- Conditional includes\n\nValidate included files exist:\n```bash\n# List includes\nrg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'\n\n# Check they exist\nfor f in $(rg \"^include\\s+(\\S+)\" -or '$1' -g'Makefile*'); do\n  [ -f \"$f\" ] || echo \"Missing: $f\"\ndone\n```"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Audits Makefiles for build correctness, portability, and recipe duplication Skill: makefile-review Owner: athola Summary: Audits Makefiles for build correctness, portability, and recipe duplication Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:18:53.332Z | user Release v1.9.19 v1.9.17 | 2026-07-30T05:39:06.878Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:55:48.848Z | user Release v1.9.16 v1.9.14 | 2026-06-30T18:04:10.129Z | user Release v1.9.14 v1.9.13 | 2026-06-27T16:22:11","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":992,"uniquenessScore":51,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T09:56:38.640Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-10T09:56:38.640Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T13:33:33.856Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}