@elvis1513/auto-coding-skill 0.3.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,9 +5,9 @@ Engineering workflow skill for:
5
5
  - Claude Code
6
6
  - Codex CLI
7
7
 
8
- This branch is specialized for Go backend + frontend monorepo projects that build Docker images locally, validate with project `docker compose`, and rely on Jenkins to auto-build and update target environments after push.
9
- It supports both Claude and Codex. During development, it prefers already available MCP servers, installed skills, plugins, and app connectors for design, research, documentation, verification, and external system updates.
10
- It also prefers multi-agent execution whenever the work can be split into parallel subtasks safely.
8
+ This skill targets Go backend + frontend monorepo projects that rely on Jenkins for build and deployment. The optimized default flow is lightweight locally, then Jenkins-first and target-environment-first for real verification.
9
+
10
+ `docs/ENGINEERING.md` is intentionally Git-tracked. The environment fields kept in that file are mandatory, must be filled with real values, and are committed as part of project maintenance. Unused environment items should be removed instead of being kept as placeholders.
11
11
 
12
12
  ## Install
13
13
 
@@ -21,6 +21,73 @@ Fallback:
21
21
  npm install -g git+https://github.com/elvis1513/auto-coding-skill.git
22
22
  ```
23
23
 
24
+ ## Release Notes
25
+
26
+ ### v0.3.1
27
+
28
+ - Added Jenkins crumb / CSRF retry support for API verification requests.
29
+ - Added finer-grained Jenkins folder / multibranch pipeline resolution.
30
+ - Added multibranch root job + branch child job support, with current Git branch inference when needed.
31
+ - Kept existing `verify-jenkins-build --git-ref` and direct `--job-url` / `--build-number` flows compatible.
32
+
33
+ ### v0.3.0
34
+
35
+ - Synced reusable workflow improvements from a production project back into this skill.
36
+ - Moved repo-side helper entrypoint to `docs/tools/autopipeline`.
37
+ - Tightened regression matrix rules: rows start as `TODO`, and `PASS` requires real execution evidence.
38
+ - Added Jenkins API verification flow with credentials sourced from `docs/ENGINEERING.md` or environment variables.
39
+
40
+ ## Optimized Standard Flow
41
+
42
+ 默认闭环:
43
+
44
+ `需求/任务记录 -> 最小设计 -> 开发 -> 本地轻量校验 -> commit/push -> Jenkins 构建部署 -> 目标环境验证 -> 闭环记录`
45
+
46
+ 具体执行顺序:
47
+
48
+ 1. 需求确认
49
+ - 明确任务范围、影响服务、是否涉及 API / 数据库 / 部署 / Jenkins / 前端页面。
50
+ 2. 最小设计记录
51
+ - 普通小改动只更新 `taskbook` 或相关设计文档的一小段。
52
+ - 跨模块、接口、数据库、部署、Jenkins、关键页面流程变更才补 DD。
53
+ 3. 开发实现
54
+ - 只修改本次任务必要文件,不做无关重构。
55
+ 4. 本地轻量校验
56
+ - build
57
+ - 单元测试或关键快速测试
58
+ - lint / typecheck
59
+ - API 文档检查
60
+ - Jenkinsfile / 脚本语法检查
61
+ - `git diff --check`
62
+ 5. 立即提交推送
63
+ - 本地轻量校验通过后,commit + push,触发 Jenkins。
64
+ 6. Jenkins 验证
65
+ - 看 Jenkins 构建、镜像、部署结果;失败则基于 Jenkins 日志修复并再次提交。
66
+ 7. 目标环境验证
67
+ - 在真实目标环境做健康检查、关键接口、关键页面或业务路径验证。
68
+ 8. 回归与证据记录
69
+ - 只有真实执行过 Jenkins / 目标环境验证,或明确要求本地运行验证时,才把 regression matrix 写成 `PASS`。
70
+ 9. 闭环记录
71
+ - 每个任务默认必须留下轻量闭环记录。
72
+
73
+ ## Default vs On-demand
74
+
75
+ 默认不做:
76
+ - 本地 Docker Compose 启动
77
+ - 本地 Docker build
78
+ - 本地完整 smoke / regression
79
+ - 每个小改动强制 `check-matrix`
80
+ - 每个小改动强制生成 summary
81
+ - 未真实执行就要求 regression matrix 全 `PASS`
82
+ - 未真实部署目标环境就生成 deployment record
83
+
84
+ 按需保留:
85
+ - `runtime-up` / `runtime-down`
86
+ - 本地 health / smoke / regression
87
+ - `check-matrix`
88
+ - `gen-summary`
89
+ - deployment runbook / deployment record
90
+
24
91
  ## Standard Workflow
25
92
 
26
93
  1. Install skill into project:
@@ -42,42 +109,60 @@ python3 .claude/skills/auto-coding-skill/scripts/ap.py --repo . install
42
109
 
43
110
  - `docs/ENGINEERING.md` frontmatter
44
111
 
45
- This frontmatter is the only manual config source (commands + local Docker runtime + Jenkins + docs paths).
112
+ This frontmatter is the only manual config source.
113
+ It must be committed to Git. Do not add it to `.gitignore`.
114
+
115
+ 重点字段:
116
+ - `commands.*`
117
+ - `target_env.*`
118
+ - `jenkins.*`
119
+ - `docs.*`
120
+
121
+ 默认必填:
122
+ - `project.name`
123
+ - `commands.build`
124
+ - `commands.quick_test` 或 `commands.test`
125
+ - `commands.lint` 或 `commands.typecheck`
126
+ - `target_env.name`
127
+ - `target_env.frontend_base_url`
128
+ - `target_env.frontend_username`
129
+ - `target_env.frontend_password`
130
+ - `target_env.backend_base_url`
131
+ - `target_env.backend_username`
132
+ - `target_env.backend_password`
133
+ - `target_env.health_base_url`
134
+ - `target_env.health_path`
135
+ - `jenkins.base_url`
136
+ - `jenkins.ui_username`
137
+ - `jenkins.ui_password`
138
+ - `jenkins.api_user`
139
+ - `jenkins.api_password`
140
+ - `jenkins.trigger_branch`
141
+ - `jenkins.image_repository`
142
+ - `jenkins.image_tag_strategy`
143
+ - `jenkins.deploy_env`
144
+ - `jenkins.job_url`
46
145
 
47
146
  4. Start AI development by constraints:
48
147
 
49
148
  - `docs/ENGINEERING.md`
50
149
  - `docs/tasks/taskbook.md`
51
- - `docs/design/**`
150
+ - `docs/tasks/closure-log.md`
52
151
  - `docs/interfaces/**`
53
152
  - `docs/testing/regression-matrix.md`
54
153
  - `docs/bugs/bug-list.md`
55
- - `docs/tasks/summaries/**`
56
154
 
57
155
  5. Tool selection rule during execution:
58
156
 
59
- - Prefer current MCP/skills/plugins/apps first.
60
- - Fall back to shell/manual work only when those capabilities are unavailable or insufficient.
157
+ - Prefer current MCP / skills / plugins / apps first.
158
+ - Fall back to shell / manual work only when those capabilities are unavailable or insufficient.
61
159
 
62
160
  6. Collaboration rule during execution:
63
161
 
64
162
  - Prefer multi-agent mode.
65
- - Split research, design, implementation, validation, and documentation into parallel subtasks whenever the boundaries are clear.
163
+ - Split research, design, implementation, verification, and documentation into parallel subtasks whenever the boundaries are clear.
66
164
  - Keep one main agent responsible for integration and final gates.
67
165
 
68
- 7. Delivery rule during execution:
69
-
70
- - Local `docker compose` validation must pass before commit.
71
- - `git push` is expected to trigger Jenkins automatically.
72
- - Task is not complete until Jenkins succeeds and the target environment health check passes.
73
-
74
- 8. Branch rule during execution:
75
-
76
- - `dev` is the long-lived integration branch.
77
- - If there is no parallel work conflict, prefer `dev`-first.
78
- - If the repo is in detached HEAD, worktree mode, or another task is already mutating `dev`, create a temporary task branch first.
79
- - Temporary branches should stay task-scoped and rebase back to latest `dev` before final integration.
80
-
81
166
  ## AGENTS.md Constraint Example
82
167
 
83
168
  ```md
@@ -86,115 +171,172 @@ This frontmatter is the only manual config source (commands + local Docker runti
86
171
  - Before any code change, read and obey:
87
172
  1) docs/ENGINEERING.md
88
173
  2) docs/tasks/taskbook.md
89
- - Execute gates using `python3 docs/tools/autopipeline/ap.py`.
174
+ - Execute workflow commands using `python3 docs/tools/autopipeline/ap.py`.
90
175
  - If required docs are missing, create/update docs first, then code.
176
+
177
+ ## Tooling Policy
178
+ - Prefer currently available MCP servers, installed skills, plugins, and app connectors before shell/manual work.
179
+ - When a connector or MCP can read or write the authoritative source directly, use it instead of retyping or duplicating state.
180
+
181
+ ## Multi-Agent Policy
182
+ - Default to multi-agent execution.
183
+ - Before substantial work, split into parallel subtasks whenever boundaries are clear:
184
+ 1) design / research
185
+ 2) backend implementation
186
+ 3) frontend implementation
187
+ 4) validation / documentation / review
188
+ - Keep one main agent responsible for task framing, integration, quality gates, and final delivery.
189
+
190
+ ## Default Gate Policy
191
+ - Default local gate is lightweight only.
192
+ - Do not require local Docker Compose or full local regression unless the task explicitly needs local runtime diagnosis.
193
+ - Push is not the finish line: Jenkins success, target environment verification, and closure record are mandatory.
91
194
  ```
92
195
 
93
196
  ## Docs Structure and Recording Rules
94
197
 
95
198
  ### 1) docs/ENGINEERING.md
96
- - Purpose: single source of project config + engineering gate rules.
97
- - How to record:
98
- - Fill YAML frontmatter once (project/commands/runtime/jenkins/docs fields).
99
- - Keep all local runtime and Jenkins info here only (compose file/service/container/image/health/job/env).
100
- - Do not duplicate config in other docs.
101
-
102
- ### 2) docs/deployment/
103
- - Files:
104
- - `docs/deployment/deploy-runbook.md`: local Compose validation + Jenkins deployment procedure.
105
- - `docs/deployment/deploy-records/<TASK_ID>-YYYYMMDD.md`: local validation + Jenkins deployment evidence.
199
+ - Purpose: single source of project config + workflow rules.
106
200
  - How to record:
107
- - Record both local Compose validation and Jenkins deployment evidence: compose file, service, container, image tag, Jenkins build, deploy env, health checks.
108
-
109
- ### 3) docs/design/
110
- - Files:
111
- - `docs/design/<TASK_ID>-<slug>.md` (from DD template).
112
- - Purpose:
113
- - Detailed design before coding (scope,方案、时序图、ER图、接口编排、测试策略、回滚).
201
+ - Fill YAML frontmatter once.
202
+ - Keep target env front/backend usernames and passwords, Jenkins UI/API usernames and passwords, commands, docs paths here only.
203
+ - This file is expected to be committed to Git and maintained in plaintext for this workflow.
204
+ - Remaining environment keys are all mandatory; blank values, TODO-like placeholders, and incorrect URL/path formats are treated as blocking errors by `doctor`.
205
+ - Do not duplicate config elsewhere.
206
+
207
+ ### 2) docs/tasks/taskbook.md
208
+ - Purpose: master task ledger.
114
209
  - How to record:
115
- - One task/subtask one DD file.
116
- - Status changes: Draft -> Reviewed -> Approved.
210
+ - Every task writes scope, risk, impact area, minimal design note, acceptance, evidence links.
117
211
 
118
- ### 4) docs/interfaces/
119
- - Files:
120
- - `docs/interfaces/api.md`: authoritative API documentation (current contract).
121
- - `docs/interfaces/api-change-log.md`: append-only API changes per task.
212
+ ### 3) docs/tasks/closure-log.md
213
+ - Purpose: default lightweight closure record.
122
214
  - How to record:
123
- - API changes must update both files in the same task.
124
- - `api.md` records latest endpoint contract.
125
- - `api-change-log.md` appends task-level delta (新增/修改/废弃/兼容策略/影响面).
215
+ - Append one record per task.
216
+ - Required fields: task, commit, Jenkins build, target env verification, result, follow-up.
217
+ - If Jenkins failed then was fixed, also record failure reason and fix commit.
126
218
 
127
- ### 5) docs/reviews/
128
- - Files:
129
- - `docs/reviews/<TASK_ID>-<timestamp>.md` (from review template).
130
- - Purpose:
131
- - Gate review evidence: static checks, Go + frontend quality, local Compose validation, Jenkins readiness, risks.
219
+ ### 4) docs/design/
220
+ - Purpose: DD for cross-module / API / DB / deployment / Jenkins / key-page-flow changes.
132
221
  - How to record:
133
- - Record commands used (lint/typecheck from docs/ENGINEERING.md frontmatter) and conclusion (Pass/Blocked).
222
+ - Small changes do not need a standalone DD file.
223
+ - Higher-risk changes create `docs/design/<TASK_ID>-<slug>.md`.
134
224
 
135
- ### 6) docs/tasks/
225
+ ### 5) docs/interfaces/
136
226
  - Files:
137
- - `docs/tasks/taskbook.md`: master task ledger (all tasks appended here).
138
- - `docs/tasks/summaries/<TASK_ID>.md`: end-of-task summary artifact.
139
- - How to record:
140
- - `taskbook.md` stores task scope/acceptance/subtasks/evidence links.
141
- - `summaries/<TASK_ID>.md` stores final objective result, change overview, gate evidence, risks, follow-ups.
227
+ - `docs/interfaces/api.md`
228
+ - `docs/interfaces/api-change-log.md`
229
+ - Rule:
230
+ - Any API change updates both files in the same task.
231
+
232
+ ### 6) docs/testing/regression-matrix.md
233
+ - Purpose: on-demand regression evidence, not default gate for every small change.
234
+ - Rule:
235
+ - Only real executed items can be marked `PASS`.
236
+ - `check-matrix` is used only when full regression is explicitly required.
237
+
238
+ ### 7) docs/tasks/summaries/
239
+ - Purpose: optional long-form summary.
240
+ - Rule:
241
+ - Only for high-risk changes, milestones, or tasks that need full retrospective.
242
+
243
+ ### 8) docs/deployment/
244
+ - Purpose: optional heavy deployment audit docs.
245
+ - Rule:
246
+ - Only for manual deploys, high-risk releases, or explicit audit requirements.
247
+
248
+ ## High-risk Changes
249
+
250
+ These categories require stronger verification and usually a DD:
251
+ - Database migration
252
+ - Authentication / authorization
253
+ - Payment / order
254
+ - Deployment / Jenkins
255
+ - Nginx / gateway
256
+ - File upload / download
257
+ - Production configuration
258
+
259
+ For these tasks, target environment verification is mandatory.
142
260
 
143
- ### 7) docs/testing/
144
- - Files:
145
- - `docs/testing/regression-matrix.md`
146
- - Purpose:
147
- - Full regression matrix against the local Compose environment; must be 0 FAIL.
148
- - How to record:
149
- - Add rows by regression ID (R-xxx), area, steps/command, expected, status, evidence.
150
- - New or unexecuted rows must stay `TODO`.
151
- - `PASS` is valid only after real execution with non-placeholder evidence.
152
- - If any row is not `PASS`, or evidence is placeholder text, gate fails.
261
+ ## Commands
153
262
 
154
- ## Branch Policy
263
+ Recommended default flow:
155
264
 
156
- - `dev` is the only long-lived integration branch.
157
- - Temporary branches are preferred when parallel worktrees or concurrent tasks would otherwise collide on `dev`.
158
- - Temporary branches should be small, task-scoped, and rebased frequently against latest `dev`.
159
- - Final integration target remains `dev`; temporary branches are not release branches.
265
+ ```bash
266
+ pip install pyyaml requests
267
+ python3 docs/tools/autopipeline/ap.py doctor
268
+ python3 docs/tools/autopipeline/ap.py light-gate
269
+ python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --msg "<TASK_ID>: <summary>" --require-light-gate --require-jenkins
270
+ python3 docs/tools/autopipeline/ap.py verify-jenkins-build --git-ref HEAD
271
+ python3 docs/tools/autopipeline/ap.py wait-health --scope target
272
+ python3 docs/tools/autopipeline/ap.py verify-target --backend-path /health --frontend-path /
273
+ python3 docs/tools/autopipeline/ap.py record-closure <TASK_ID> --commit HEAD --jenkins <build-url> --result PASS --verification "health check" --verification "key api" --verification "key page"
274
+ ```
160
275
 
161
- ## CI Trigger Strategy
276
+ Or let `commit-push` append the closure record directly:
162
277
 
163
- - Prefer split Jenkins behavior:
164
- - Branch or MR validation job for build/test/lint/typecheck and optional non-deploy runtime checks.
165
- - `dev` integration/deploy job for actual deployment-triggering pushes.
166
- - Avoid duplicate deploy triggers from both merge acceptance events and `dev` push events.
278
+ ```bash
279
+ python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> \
280
+ --msg "<TASK_ID>: <summary>" \
281
+ --require-light-gate \
282
+ --require-jenkins \
283
+ --record-closure \
284
+ --jenkins-build <build-url> \
285
+ --result PASS \
286
+ --verification "health check" \
287
+ --verification "key api" \
288
+ --verification "key page"
289
+ ```
167
290
 
168
- ## Commands
291
+ Available on-demand commands:
169
292
 
170
293
  ```bash
171
- pip install pyyaml requests
172
294
  python3 docs/tools/autopipeline/ap.py run build
173
295
  python3 docs/tools/autopipeline/ap.py run test
296
+ python3 docs/tools/autopipeline/ap.py run quick_test
174
297
  python3 docs/tools/autopipeline/ap.py run lint
175
298
  python3 docs/tools/autopipeline/ap.py run typecheck
176
- python3 docs/tools/autopipeline/ap.py run docker_build
299
+ python3 docs/tools/autopipeline/ap.py run script_syntax
300
+ python3 docs/tools/autopipeline/ap.py doctor
301
+ python3 docs/tools/autopipeline/ap.py verify-api-docs
302
+ python3 docs/tools/autopipeline/ap.py verify-jenkins
303
+ python3 docs/tools/autopipeline/ap.py verify-target --backend-path /health --frontend-path /
304
+ python3 docs/tools/autopipeline/ap.py verify-jenkins-build --job-name <job-name> --build-number <number>
305
+ python3 docs/tools/autopipeline/ap.py verify-jenkins-build --job-url <job-url> --build-number <number>
306
+ python3 docs/tools/autopipeline/ap.py verify-jenkins-build --multibranch-root-job <root-job> --branch-name <branch> --build-number <number>
177
307
  python3 docs/tools/autopipeline/ap.py runtime-up
178
- python3 docs/tools/autopipeline/ap.py wait-health
308
+ python3 docs/tools/autopipeline/ap.py wait-health --scope runtime
179
309
  python3 docs/tools/autopipeline/ap.py run smoke
180
310
  python3 docs/tools/autopipeline/ap.py run regression
181
311
  python3 docs/tools/autopipeline/ap.py runtime-down
182
- python3 docs/tools/autopipeline/ap.py verify-jenkins
183
- python3 docs/tools/autopipeline/ap.py verify-jenkins-build --git-ref HEAD
184
- python3 docs/tools/autopipeline/ap.py wait-health --scope prod
185
- python3 docs/tools/autopipeline/ap.py verify-api-docs
186
312
  python3 docs/tools/autopipeline/ap.py check-matrix
187
- python3 docs/tools/autopipeline/ap.py gen-summary T0001-1
188
- python3 docs/tools/autopipeline/ap.py commit-push T0001-1 --msg "T0001-1: <summary>" --require-runtime-health --require-jenkins --require-matrix
313
+ python3 docs/tools/autopipeline/ap.py gen-summary <TASK_ID>
189
314
  ```
190
315
 
191
- ## Quality Gate Expectations
192
-
193
- - Backend quality gate: `commands.test` must pass.
194
- - Frontend quality gate: at minimum `commands.build`, `commands.lint`, and `commands.typecheck` must pass.
195
- - Regression matrix rows must start as `TODO` until actually executed.
196
- - `PASS` requires real evidence, not placeholders.
197
- - Before final commit/push, clean temporary logs, screenshots, generated artifacts, and cache by-products. `.local/` may remain when it is the intended local runtime data directory.
316
+ ## Jenkins Build Tracking
317
+
318
+ - `verify-jenkins-build --git-ref HEAD`
319
+ - Use when Jenkins build descriptions include commit SHA and you want to find the latest build automatically.
320
+ - `verify-jenkins-build --job-name <folder/job> --build-number <N>`
321
+ - Use when you already know the Jenkins job and build number.
322
+ - `verify-jenkins-build --job-url <full-job-url> --build-number <N>`
323
+ - Use when you want to bypass configured job resolution.
324
+ - `verify-jenkins-build --multibranch-root-job <folder/repo> --branch-name <branch> --build-number <N>`
325
+ - Use for multibranch or organization-folder jobs where the branch is a child job.
326
+ - `verify-jenkins-build --multibranch-root-job <folder/repo> --git-ref HEAD`
327
+ - Use when the current Git branch should be inferred automatically.
328
+ - If Jenkins returns `403`, the script retries with crumb / CSRF handling automatically.
329
+
330
+ ## New Safeguards
331
+
332
+ - `doctor`
333
+ - Checks whether the default lightweight workflow is actually configured instead of silently skipping gates.
334
+ - `light-gate`
335
+ - Now fails if required commands are missing instead of returning `OK` after skipping everything.
336
+ - `verify-target`
337
+ - Performs real target-environment verification beyond health checks when you provide key backend/frontend paths.
338
+ - `commit-push --record-closure`
339
+ - Lets you append the closure record as part of the same close loop.
198
340
 
199
341
  ## Publish (NPM)
200
342
 
@@ -205,54 +347,35 @@ npm run sync-assets
205
347
  npm test
206
348
  ```
207
349
 
208
- 2. Bump version (required before every publish):
350
+ 2. Bump version:
209
351
 
210
352
  ```bash
211
353
  npm version patch
212
- # or: npm version minor
213
- # or: npm version major
354
+ # or: npm version minor / major
214
355
  ```
215
356
 
216
- `npm version` will update `package.json` and create a git tag.
217
-
218
- 3. Login and run release check:
357
+ 3. Release check:
219
358
 
220
359
  ```bash
221
- npm login
222
360
  npm whoami
223
361
  npm run release:check
224
362
  ```
225
363
 
226
- 4. Publish package:
364
+ 4. Publish:
227
365
 
228
366
  ```bash
229
367
  npm publish --access public
230
- # if your account requires 2FA OTP:
368
+ # or
231
369
  npm publish --access public --otp <6-digit-otp>
232
370
  ```
233
371
 
234
- 5. Verify and update clients:
372
+ 5. Verify and update:
235
373
 
236
374
  ```bash
237
375
  npm view @elvis1513/auto-coding-skill version
238
376
  npm install -g @elvis1513/auto-coding-skill@latest
239
377
  ```
240
378
 
241
- ### Common Publish Errors
242
-
243
- - `403 You cannot publish over the previously published versions`
244
- - Cause: same version already exists.
245
- - Fix: run `npm version patch` (or `minor`/`major`) then publish again.
246
- - `403 Two-factor authentication ... is required to publish`
247
- - Cause: publish requires 2FA.
248
- - Fix: use `npm publish --access public --otp <6-digit-otp>`.
249
- - `404 Not Found` when install
250
- - Cause: package not published successfully, or scope/name mismatch.
251
- - Fix: verify with `npm view @elvis1513/auto-coding-skill version` first.
252
- - `Access token expired or revoked`
253
- - Cause: npm auth token expired.
254
- - Fix: run `npm login` again and retry publish/install.
255
-
256
379
  ## License
257
380
 
258
381
  MIT