--- name: post-dev-workflow description: "MANDATORY post-development workflow orchestrating validation, synchronization, and testing phases. Automatically invoked by AI agents after code changes. BLOCKING - work is incomplete without this." version: "2.0.0" author: "SublinkPro Team" user-invocable: false mandatory: true enforcement-level: "blocking" --- # Post-Development Workflow Skill **🛑 MANDATORY AUTOMATED WORKFLOW 🛑** This workflow is **REQUIRED** after completing ANY code change, before declaring work "complete". **CRITICAL**: This workflow is a **PREREQUISITE** for committing. Do NOT proceed to commit without completing this workflow successfully. --- ## When to Use This Skill **ALWAYS** use this skill when: - Any code change is complete (backend, frontend, or both) - Before declaring work "finished" or "done" - Before preparing to commit changes - Before creating or updating a pull request **This is NOT optional for AI agents.** If an AI agent completes development without running this workflow, the work is incomplete. --- ## Workflow Phases This skill orchestrates multiple validation phases in sequence: ``` Development Complete ↓ 1. Code Validation (lint, format, build) ↓ 2. Cross-Layer Sync Check (if multi-layer change) ↓ 3. Documentation Sync Check (if behavior/API/config changed) ↓ 4. Test Execution (if key logic changed) ↓ 5. Change Summary (prepare commit message and PR description) ↓ Stage Changes (git add) ↓ Present Summary to User ↓ User Verifies/Tests ↓ User Commits When Ready ``` --- ## Phase 1: Code Validation Run validation commands for all changed layers. ### Backend Changes ```bash gofmt -w # Format golangci-lint run # Lint go test ./... # Test ``` **Required exit criteria**: - [ ] `gofmt` produces no further changes - [ ] `golangci-lint run` exits with status 0 - [ ] Relevant `go test` passes ### Frontend Changes ```bash cd webs yarn run lint # Always required yarn run build # If routing/assets/build affected ``` **Optional auto-fix**: ```bash yarn run lint:fix yarn run prettier ``` **Required exit criteria**: - [ ] `yarn run lint` exits with status 0 - [ ] `yarn run build` succeeds (if applicable) ### When Phase 1 Fails **DO NOT proceed to Phase 2** until all validation passes. Fix issues first. **Detailed validation commands and troubleshooting**: See `references/validation-commands.md` --- ## Phase 2: Cross-Layer Synchronization Check **Trigger condition**: Changes affect multiple layers (backend + frontend, code + docs, code + config) **Additional checks**: For security-critical or performance-sensitive changes, invoke specialized skills: - **Security changes**: Also invoke `.agents/skills/security-review/SKILL.md` - **Performance-critical changes**: Also invoke `.agents/skills/performance-check/SKILL.md` ### Quick Checklist | Change Type | Must Also Update | |---|---| | Backend API endpoint changed | Frontend `webs/src/api/`, `skill-sublinkpro/reference/api.md` | | Backend response structure changed | Frontend display components, state management | | Frontend behavior changed | Verify backend supports new flow | | Configuration option added/changed | Code + `docs/configuration.md` + `.zh-CN.md` + example configs + `skill-sublinkpro/reference/deploy.md` | | User-facing feature added/changed | Code + `docs/features/*.md` + `.zh-CN.md` + `README.md` | **Required exit criteria**: - [ ] All impacted layers identified - [ ] All impacted layers synchronized - [ ] Verification commands run for each layer - [ ] Documented which layers were checked ### When to Skip Phase 2 Skip only if the change is truly isolated to one layer. **Document the skip reason** in your change summary. **Detailed cross-layer sync patterns and verification**: See `references/cross-layer-sync-rules.md` --- ## Phase 3: Documentation Synchronization Check **Trigger condition**: Changes affect user-visible behavior, APIs, configuration, deployment, or developer workflows ### Quick Checklist | Change Type | Docs to Update | |---|---| | User-facing feature | `README.md` + `.zh-CN.md`, `docs/features/*.md` + `.zh-CN.md` | | API endpoint | `skill-sublinkpro/reference/api.md` | | Configuration | `docs/configuration.md` + `.zh-CN.md`, example configs | | Deployment | `docs/installation.md` + `.zh-CN.md`, `skill-sublinkpro/reference/deploy.md` | | Developer workflow | `docs/development.md` + `.zh-CN.md`, `CONTRIBUTING.md` + `.zh-CN.md` | | Architecture | `AGENTS.md` | **Bilingual requirement**: - [ ] Both English (`.md`) and Chinese (`.zh-CN.md`) versions updated - [ ] Language switch links work - [ ] Content semantically equivalent **Required exit criteria**: - [ ] All affected documentation identified - [ ] Both language versions updated - [ ] Links verified (no broken references) - [ ] Code examples accurate and tested - [ ] Documentation map updated (`skill-sublinkpro/reference/docs.md`) if new docs added ### When to Skip Phase 3 Skip only if: - Pure internal refactoring (no user-visible changes) - Bug fix that restores documented behavior (not new behavior) - Test-only changes **Document the skip reason** in your change summary. **Detailed documentation sync patterns and templates**: See `references/documentation-sync-rules.md` --- ## Phase 4: Test Execution **Trigger condition**: Changes affect key business logic, APIs, permissions, configuration semantics, migrations, scheduled tasks, mihomo integrations, protocol parsing, or data transformations ### What Needs Tests **Backend tests required when**: - [ ] Added or changed business logic in `services/` - [ ] Added or changed API handler in `api/` - [ ] Added or changed permission checks in `middlewares/` - [ ] Added or changed database migration in `models/db_migrate.go` - [ ] Added or changed scheduled task in `services/scheduler/` - [ ] Added or changed protocol in `node/protocol/` - [ ] Fixed a bug (add regression test) **Frontend tests**: - [ ] Added or changed utility functions in `webs/src/utils/` - [ ] Added or changed complex components with business logic - [ ] Added or changed API client functions in `webs/src/api/` - [ ] Fixed a bug (add regression test) ### Test Requirements ```bash # Backend: run relevant tests go test ./services/scheduler/... # Example: if scheduler changed go test ./... # Full suite if time permits # Frontend: run tests with Vitest cd webs yarn test # Run all tests yarn test --run # Run without watch mode ``` **Test quality**: - [ ] Tests cover happy path, boundaries, and error cases - [ ] Tests are isolated (no execution order dependency) - [ ] Test names describe scenario and expected outcome - [ ] Regression tests added for bug fixes **Required exit criteria**: - [ ] Relevant tests exist - [ ] All tests pass - [ ] Coverage is reasonable for the changed area ### When to Skip Phase 4 Skip only if: - Pure documentation changes - Pure UI styling changes (no logic) - Refactoring with existing test coverage **Document the skip reason** in your change summary. --- ## Phase 5: Change Summary Prepare a comprehensive summary of what was done, why, and how it was validated. ### Commit Message Format ``` ():