Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:02:42 +08:00
commit 34a2423d78
33 changed files with 12105 additions and 0 deletions

133
commands/go-ldd-analyze.md Normal file
View File

@@ -0,0 +1,133 @@
---
name: go-ldd-analyze
description: Run quality analysis only - invoke quality-analyzer agent and display combined report without auto-fixing
---
Run comprehensive quality analysis with intelligent combining of test results, linter findings, and code review feedback.
**This command does NOT auto-fix anything** - it provides read-only analysis with overlapping issue detection and root cause analysis.
Execute these steps:
## Step 1: Discover Project Commands
Search project documentation to find test and lint commands:
1. **Read project files** in order of preference:
- `CLAUDE.md` (project-specific instructions)
- `README.md` (project documentation)
- `Makefile` (look for `test:` and `lint:` targets)
- `Taskfile.yaml` (look for `test:` and `lintwithfix:` tasks)
- `.golangci.yaml` (linter configuration)
2. **Extract commands**:
- **Test command**: Look for patterns like:
- `go test ./... -v -cover`
- `make test`
- `task test`
- **Lint command**: Look for patterns like:
- `golangci-lint run --fix`
- `golangci-lint run --config .golangci.yaml --new-from-rev=origin/dev --fix ./...`
- `make lint`
- `task lintwithfix`
3. **Fallback to defaults** if not found:
- Test: `go test ./...`
- Lint: `golangci-lint run --fix`
## Step 2: Identify Changed Files
Use git to find files that have changed:
```bash
git diff --name-only --diff-filter=ACMR HEAD | grep '\.go$'
```
If no git repository or no changes, analyze all `.go` files in the project (excluding vendor/, testdata/).
## Step 3: Invoke Quality Analyzer Agent
Call the quality-analyzer agent with discovered commands and files:
```
Task(subagent_type: "quality-analyzer")
Prompt:
"Analyze code quality for this Go project.
Mode: full
Project commands:
- Test: [discovered test command]
- Lint: [discovered lint command]
Files to analyze:
[list of changed .go files, one per line]
Run all quality gates in parallel and return combined analysis."
```
## Step 4: Display Report
The agent will return a structured report with one of four statuses:
**TOOLS_UNAVAILABLE**: Display the report and suggest installing missing tools
**TEST_FAILURE**: Display test failures and suggest fixing them before quality analysis
**ISSUES_FOUND**: Display combined report with overlapping issues analysis and prioritized fix order
**CLEAN_STATE**: Display success message - all quality gates passed
## Report Format
The agent returns:
- ✅/❌ **Tests**: Pass/fail status with coverage
- ✅/❌ **Linter**: Clean/errors count
- ✅/⚠️ **Review**: Clean/findings (bugs, design debt, readability debt, polish)
- 🎯 **Overlapping Issues**: Multiple issues at same file:line with root cause analysis
- 📋 **Isolated Issues**: Single issues that don't overlap
- 🔢 **Prioritized Fix Order**: Which issues to tackle first based on impact
## Example Usage
```bash
/go-ldd-analyze
```
This will:
1. Discover test and lint commands from your project docs
2. Find changed Go files from git
3. Run tests, linter, and code review in parallel
4. Display intelligent combined analysis with overlapping issue detection
## Use Cases
- ✅ Quick quality check before committing
- ✅ Understand what issues exist without making changes
- ✅ Get intelligent combined view of tests + linter + review findings
- ✅ See overlapping issues with root cause analysis
- ✅ Identify high-impact fixes (multiple issues at same location)
## Comparison with Other Commands
| Command | Purpose | Auto-Fix | Agent |
|---------|---------|----------|-------|
| `/go-ldd-autopilot` | Complete workflow (Phase 1-6) | ✅ Yes | No |
| `/go-ldd-quickfix` | Quality gates loop with auto-fix | ✅ Yes | No |
| `/go-ldd-review` | Final verification, no auto-fix | ❌ No | No |
| `/go-ldd-analyze` | Quality analysis with intelligent combining | ❌ No | ✅ Yes |
| `/go-ldd-status` | Show workflow status | N/A | No |
## Key Benefits
1. **Parallel Execution**: Runs tests, linter, and code review simultaneously
2. **Intelligent Combining**: Identifies overlapping issues at same file:line
3. **Root Cause Analysis**: Explains why multiple issues occur at same location
4. **Prioritized Fixes**: Suggests fix order based on impact (issues resolved)
5. **Read-Only**: No auto-fix, just analysis and reporting
6. **Autonomous**: Discovers commands automatically from project docs
## Notes
- This command is equivalent to running the quality-analyzer agent standalone
- For auto-fix capability, use `/go-ldd-quickfix` instead
- For final commit-ready verification, use `/go-ldd-review` instead
- For complete workflow with implementation, use `/go-ldd-autopilot` instead

View File

@@ -0,0 +1,16 @@
---
name: go-ldd-autopilot
description: Start complete linter-driven autopilot workflow (Phase 1-6)
---
Invoke the @linter-driven-development skill to run the complete autopilot workflow from design through commit-ready.
The skill will automatically:
1. Run Pre-Flight Check (detect intent, find commands, verify Go project)
2. Execute all 6 phases with 2 quality gates
3. Use parallel analysis (tests + linter + go-code-reviewer agent)
4. Generate intelligent combined reports
5. Auto-fix all issues iteratively
6. Prepare commit-ready summary
This is the full workflow - use for implementing features or fixes from start to finish.

View File

@@ -0,0 +1,31 @@
---
name: go-ldd-quickfix
description: Run quality gates loop until all green (tests+linter+review → fix → repeat)
---
Execute the quality gates loop for already-implemented code that needs cleanup.
Run these phases from @linter-driven-development skill:
**Phase 2**: Parallel Analysis
- Discover project test/lint commands
- Launch 3 tools simultaneously: tests, linter, go-code-reviewer agent
- Wait for all results
**Phase 3**: Intelligent Combined Report
- Merge findings from linter + review
- Identify overlapping issues at same file:line
- Analyze root causes
- Generate unified fix strategies
- Prioritize: Impact × Effort × Risk
**Phase 4**: Iterative Fix Loop
- Apply fixes using @refactoring skill (auto, no confirmation)
- Re-verify with parallel analysis (incremental review mode)
- Repeat until all green
**Loop until**:
✅ Tests pass | ✅ Linter clean | ✅ Review clean
Use this when code is already written but needs to pass quality gates.
Skip the implementation phase (Phase 1) and go straight to fixing issues.

25
commands/go-ldd-review.md Normal file
View File

@@ -0,0 +1,25 @@
---
name: go-ldd-review
description: Check if code is commit-ready (final verification, no auto-fix)
---
Run final verification checks **without** the auto-fix loop.
Execute these steps:
1. **Discover commands** from project docs (README, CLAUDE.md, Makefile, etc.)
2. **Run in parallel**:
- Tests: Bash([PROJECT_TEST_COMMAND])
- Linter: Bash([PROJECT_LINT_COMMAND])
- Review: Task(subagent_type: "go-code-reviewer") with mode: full
3. **Generate commit readiness report**:
- ✅/❌ Tests: [pass/fail] + coverage
- ✅/❌ Linter: [clean/errors]
- ✅/❌ Review: [clean/findings]
- 📝 Files in scope: [list with +/- lines]
- 💡 Suggested commit message
**Does NOT auto-fix anything** - just reports current state.
Use when you want to verify code is ready without making changes.
Equivalent to Phase 2 (Parallel Analysis) + Gate 2 (Final Verification) only.

24
commands/go-ldd-status.md Normal file
View File

@@ -0,0 +1,24 @@
---
name: go-ldd-status
description: Show current workflow status and progress
---
Display current implementation status:
📍 Current Context:
- Active plan: [file path or "conversation"]
- Current step: [step number]
- Phase: [design/testing/linting/refactoring/review/docs/commit]
📊 Last Results:
Tests: [status + coverage]
Linter: [status + error count]
Review: [status + finding count]
📝 Files Modified:
[list with +/- lines]
🎯 Next Action:
[What happens next in the workflow]
Perfect for: "where are we?", "what's the status?", "what's next?"