From enterprise-harness-engineering
Automates code submission workflow: lint check, non-destructive review, verification doc, smart staging, clean commit, MR creation for Android/iOS/backend projects. Triggers on 'submit code' etc. phrases.
npx claudepluginhub addxai/enterprise-harness-engineering --plugin enterprise-harness-engineeringThis skill uses the workspace's default tool permissions.
Chains 6 stages together, each with a user confirmation gate. Core principle: **lint first, review without changing logic, human verification as backstop, clean commit to production.**
Creates git commits with repo detection, pre-commit checks, submodule support, and conventional messages. Activates on /commit or git commit requests.
Performs code reviews on uncommitted git changes or latest commits, auto-generates and inserts CHANGELOG entries if missing, runs lints, and proactively fixes P0-P1-P2 issues.
Runs parallel multi-agent code review assessing six tenants—architecture, simplicity, maintainability, correctness, test coverage, documentation—then triages findings and applies auto/manual fixes.
Share bugs, ideas, or general feedback.
Chains 6 stages together, each with a user confirmation gate. Core principle: lint first, review without changing logic, human verification as backstop, clean commit to production.
Prerequisite: The current repository remote points to gitlab.example.com and glab CLI is installed.
Parse from $ARGUMENTS:
--target=<branch>: Target branch (required), e.g., --target=test/VH_2.92.0_20260310140519--from=<stage>: Start from a specific stage (optional), values stage1 through stage6, skipping earlier stages--type=<android|ios|backend>: Force a specific project type (optional, defaults to auto-detection)If --target is not provided, you must ask the user for the target branch before continuing.
Auto-detect the current project type to determine which specific commands are used in subsequent stages.
Android: build.gradle or build.gradle.kts exists AND **/AndroidManifest.xml exists
./gradlew :<module>:lint --no-daemonsrc/test/, src/androidTest/build/, .idea/, .gradle/, debugpanel/, *.imliOS: *.xcodeproj or *.xcworkspace or Package.swift exists
swiftlint lint --reporter json*Tests/, *UITests/DerivedData/, .build/, Pods/, *.xcuserstateBackend (by language):
pom.xml exists OR (build.gradle without AndroidManifest.xml)
./gradlew checkstyleMain or ./mvnw checkstyle:checkpyproject.toml or requirements.txt exists
ruff check . or flake8go.mod exists
golangci-lint runpackage.json exists (without the above characteristic files)
npm run lint or npx eslint .Output confirmation after detection:
Project type: Android (evidence: build.gradle + AndroidManifest.xml)
Lint command: ./gradlew :<module>:lint --no-daemon
Test directories: src/test/, src/androidTest/
If the user specified --type, skip auto-detection.
Goal: Run lint before code review to avoid repeated CI failures due to lint issues
TARGET_BRANCH="<from parameter parsing>"
git fetch origin "$TARGET_BRANCH" 2>/dev/null
CHANGED_FILES=$(git diff --name-only "origin/$TARGET_BRANCH"...HEAD)
If CHANGED_FILES is empty, notify the user "no changed files relative to the target branch" and terminate.
Android:
app/src/... → :appBaseLib/xxx/src/... → :BaseLib:xxxThirdPartLib/xxx/src/... → :ThirdPartLib:xxx:app:lint./gradlew :<module>:lint --no-daemon
iOS:
.swift filesswiftlint lint --path <file1> --path <file2> --reporter json
Backend: Execute the lint command determined in Step 0 (timeout: 120000).
Android: Read build/reports/lint-results*.xml, extract severity="Error" entries.
iOS: Parse SwiftLint JSON output for severity: "error" entries.
Backend: Parse the corresponding tool's output.
For each error, list: file path + line number + error type + description.
Lint check result: 0 errors, N warnings
Continue to Code Review?
Wait for user confirmation.
Goal: Quality review only — never alter the user's designed business flow
git diff "origin/$TARGET_BRANCH"...HEAD -- '*.kt' '*.java' '*.swift' '*.py' '*.go' '*.ts' '*.js' ':!*Test*' ':!*test*' ':!*spec*' ':!*Mock*'
Only review production code; exclude test files.
Review the diff of each changed file, following these inviolable rules:
The following represent the user's design decisions — only raise questions, never modify:
Categorized by priority:
══ Code Review Suggestions ══
CRITICAL (must address)
1. [file:line] Description...
HIGH (strongly recommended)
2. [file:line] Description...
MEDIUM (suggested improvement)
3. [file:line] Description...
LOW (optional optimization)
4. [file:line] Description...
Total N suggestions (CRITICAL: X, HIGH: X, MEDIUM: X, LOW: X)
If no issues are found, output "Code Review passed — no improvements needed."
Display the suggestion list and ask the user:
Select suggestions to adopt (enter numbers like 1,3,5 or all or none):
Goal: Generate a detailed review document (flow diagrams + architecture diagrams + key code) for final human review
Read all changed files (git diff "origin/$TARGET_BRANCH"...HEAD) and analyze:
File path: docs/reviews/<branch-short-name>-review.md
<branch-short-name> takes the last segment of the branch name, e.g., bugfix/VH_2.92.0_20260310140519 → VH_2.92.0_20260310140519
Document content:
# Code Review Document
> Branch: <current branch>
> Target: <target branch>
> Generated: <YYYY-MM-DD HH:mm>
## 1. Change Summary
| File | Change Type | Description |
|------|---------|------|
| path/to/File.kt | Added/Modified/Deleted | One-line description of the change |
Total N files changed, X lines added, Y lines deleted.
## 2. Business Flow Diagram
Use Mermaid flowchart to describe the **complete business flow involving the changes** (not just the changed parts, but the full flow context where the changes occur).
Use different colors to highlight changed nodes.
## 3. Architecture Diagram
Use Mermaid classDiagram to describe the class/interface relationships involved.
Or use sequenceDiagram for key interaction flows (e.g., network request chains, event propagation chains).
If changes span multiple modules, show inter-module dependency relationships.
## 4. Key Code
List the most critical code snippets (no more than 5), each with annotations explaining:
- The design intent of this code
- Why it was implemented this way
- Boundary cases to watch for
## 5. Risk Assessment
| Risk Item | Level (High/Medium/Low) | Description | Mitigation |
|--------|---------------|------|---------|
## 6. Manual Testing Recommendations
- [ ] Normal scenario: ...
- [ ] Error scenario: ...
- [ ] Boundary scenario: ...
- [ ] Regression scenario: ... (verify that unmodified related features are not affected)
Review document generated: docs/reviews/<branch>-review.md
Please read and confirm: does the manual review pass?
You must wait for explicit user confirmation before continuing. This is the most important human verification checkpoint.
Goal: Automatically exclude test/debug code; stage only files that need to be committed
git status --porcelain
List all modified, added, and deleted files.
Classify each file based on project type:
Universal exclusions:
.idea/, *.iml, local.properties, .DS_Storebuild/, out/, dist/, target/docs/reviews/*-review.md (Stage 3 documents are for local reading only, not committed)Android additional exclusions:
src/test/ (except modifications to existing test files, e.g., updating tests for a bug fix)src/androidTest/debugpanel/ directory.gradle/ directoryiOS additional exclusions:
*Tests/*UITests/DerivedData/, .build/, Pods/*.xcuserstate, *.xcuserdataBackend additional exclusions:
tests/, test/, __tests__/*_test.go, *.test.ts, *.test.js, *_test.py filesvenv/, node_modules/, __pycache__/, .pytest_cache/Scan production code files pending staging for the following suspicious patterns:
Log.d("test, print("debug, console.log("test, fmt.Println("debug192.168., 10.0.0., http://localhost (except in config files)// TODO: remove, // FIXME, // HACK, // TEMP, // XXXBuildConfig.DEBUG conditions, #if DEBUG blocks, if __debug__ blocksFiles not matched by the above rules.
══ Staging Plan ══
Will stage (N files):
+ path/to/Feature.kt
+ path/to/layout.xml
...
Will exclude (M files):
- path/to/FeatureTest.kt (test file)
- docs/reviews/xxx-review.md (review document, local only)
...
Needs confirmation (K files):
? path/to/Utils.kt — line 42 contains Log.d("test data")
...
Confirm staging? (for "needs confirmation" files, enter numbers to exclude)
After user confirmation, stage files one by one with git add <file>. Never use git add -A or git add ..
Goal: Rebase onto the latest target branch and generate a clean commit
git fetch origin "$TARGET_BRANCH"
git rebase "origin/$TARGET_BRANCH"
If there are conflicts:
git diff --name-only --diff-filter=U to list conflicted filesgit add <resolved-file> then git rebase --continuegit rebase --abortNote: Do not auto force-push after rebase; Stage 6 handles the unified push.
git log "origin/$TARGET_BRANCH"..HEAD --oneline --no-merges
Group commits by type and format:
## Changelog
### Features
- <commit message>
### Bug Fixes
- <commit message>
### Refactoring
- <commit message>
### Other
- <commit message>
If there is only one commit, the changelog is that commit's description.
Analyze the staged file changes and generate a conventional commit message:
<type>(<scope>): <concise description>
<detailed explanation (optional, from changelog)>
type: Inferred from change content (feat/fix/refactor/docs/test/chore/perf/ci/style)scope: Module name inferred from changed file paths══ Commit Preview ══
Commit message:
feat(payment): add retry logic for Stripe payment
- Add exponential backoff for failed payments
- Handle network timeout gracefully
Staged files (N):
M path/to/PaymentRetry.kt
A path/to/RetryPolicy.kt
...
Confirm commit? (Y=commit / edit=edit message / n=cancel)
After user confirmation, execute:
git commit -m "<message>"
Goal: Create an MR with complete documentation and drive it to mergeable
git push -u origin "$(git branch --show-current)" --force-with-lease
Uses --force-with-lease (since Stage 5 performed a rebase) — safer than --force.
docs/plans/ or docs/04-user-stories/ contains documentation related to this changedocs/plans/YYYY-MM-DD-<feature-name>.mdgit add docs/plans/<doc>.md
git commit -m "docs: add <feature> design document"
git push
Construct the blob link: Parse group/project from git remote get-url origin, concatenate with branch name and file path.
glab mr create \
--title "<Stage 5 commit title>" \
--description "$(cat <<'EOF'
## Changelog
<changelog generated in Stage 5>
## Related Documents
- Design document: <GitLab blob link to docs/plans/ document>
## Change Type
- [x] <corresponding type: Bug fix / New feature / Refactoring / ...>
EOF
)" \
--target-branch "$TARGET_BRANCH"
If an MR already exists, use glab mr update to update the description.
sleep 5
glab ci status
Poll pipeline status and handle common failures:
| Failed Job | Fix Approach |
|---|---|
check:mr-documentation | Update MR description, add blob link |
check:mr-us-relevance | Modify document content to cover MR changes |
| Merge conflict | git fetch && git rebase && git push --force-with-lease |
| Other | Display failed job logs, provide fix suggestions |
Loop until CI is all green + no conflicts, or report issues that cannot be auto-fixed.
══ Submission Complete ══
MR: https://gitlab.example.com/xxx/project/-/merge_requests/XXX
CI: Passed / Running / Failed (details...)
Document: <blob link>
Changelog:
- feat: ...
- fix: ...
./gradlew and xcodebuild commands are set with timeout: 300000 (5 minutes)git add — never use git add -A or git add .--from=stageN to skip earlier stages, skipped stages are marked "skipped" in the final reportUser: /code-submit --target=test/VH_2.92.0_20260310140519
AI: Project type: Android (evidence: build.gradle + AndroidManifest.xml)
══ Stage 1: Lint Check ══
Changed modules: :app, :BaseLib:payment
Running ./gradlew :app:lint :BaseLib:payment:lint ...
Lint check result: 0 errors, 3 warnings
Continue to Code Review?
User: Y
══ Stage 2: Code Review ══
CRITICAL (must address)
1. [PaymentRetry.kt:42] Unclosed Cursor — query result in fetchPaymentHistory() is not closed
HIGH (strongly recommended)
2. [PaymentRetry.kt:78] Variable naming — `d` should be renamed to `retryDelay`
Total 2 suggestions
Select suggestions to adopt:
User: all
[Applying changes...]
══ Stage 3: Manual Verification Document ══
Review document generated: docs/reviews/VH_2.92.0_20260310140519-review.md
Please read and confirm: does the manual review pass?
User: Y
══ Stage 4: Smart Staging ══
Will stage (5 files):
+ app/src/main/.../PaymentRetry.kt
+ app/src/main/.../RetryPolicy.kt
...
Will exclude (2 files):
- app/src/test/.../PaymentRetryTest.kt (test file)
- docs/reviews/VH_2.92.0_20260310140519-review.md (review document)
Confirm staging?
User: Y
══ Stage 5: Clean Commit ══
Commit message: feat(payment): add retry logic for failed payments
Confirm commit?
User: Y
══ Stage 6: MR Creation ══
MR: https://gitlab.example.com/team/my-project/-/merge_requests/456
CI: Passed
# BAD: Code Review stage directly modified the user's if-condition logic
AI: I have changed line 35 of PaymentRetry.kt from `if (retryCount < 3)` to `if (retryCount < 5)`
because 3 retries might not be enough.
# GOOD: Only raise suggestions without directly modifying
AI: MEDIUM
3. [PaymentRetry.kt:35] Retry count — current maxRetry=3; may be insufficient for unstable networks.
Consider whether to adjust. (Note: this is a business decision, for reference only)
# BAD: Stage all files at once
git add -A
git commit -m "feat: add payment retry"
# GOOD: Stage files individually, excluding test and debug files
git add app/src/main/.../PaymentRetry.kt
git add app/src/main/.../RetryPolicy.kt
git commit -m "feat(payment): add retry logic for failed payments"