运维测试
- 作者仓库星标 1,897
- 作者更新于 实时读取
- 作者仓库 skillshare
- 领域
- 工程开发
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @runkids · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需手动接入
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- Docker
- 底层运行要求
- Docker
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: skillshare-implement-feature
description: >- Implement a feature following TDD workflow. $ARGUMENTS is a spec file path (e.g., specs/my-fe…
category: 工程开发
runtime: Docker
---
# skillshare-implement-feature 输出预览
## PART A: 任务判断
- 适用问题:代码实现、重构、调试或代码审查。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Workflow / Step 1: Understand Requirements / Step 2: Identify Affected Files”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于代码实现、重构、调试或代码审查,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Workflow / Step 1: Understand Requirements / Step 2: Identify Affected Files”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、会按任务需要访问外部网络、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文没有稳定的斜杠命令要求。安装验证后通常全局生效,直接在对话里点名这个 Skill 并描述任务即可。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“Workflow / Step 1: Understand Requirements / Step 2: Identify Affected Files”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: skillshare-implement-feature
description: >- Implement a feature following TDD workflow. $ARGUMENTS is a spec file path (e.g., specs/my-fe…
category: 工程开发
source: runkids/skillshare
---
# skillshare-implement-feature
## 什么时候使用
- 把工程方向的常用动作沉淀成 Agent 可调用的技能 适合处理工程开发场景下的代码实现、调试、重构、测试或代码审查,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代…
- 面向代码实现、重构、调试或代码审查,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Workflow / Step 1: Understand Requirements / Step 2: Identify Affected Files」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "skillshare-implement-feature" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Workflow / Step 1: Understand Requirements / Step 2: Identify Affected Files
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Docker | 读取文件、写入/修改文件、执行终端命令 | 会按任务需要访问外部网络
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Implement a feature following TDD workflow. $ARGUMENTS is a spec file path (e.g., specs/my-feature.md) or a plain-text feature description.
Scope: This skill writes Go code and tests. It does NOT update website docs (use update-docs after) or CHANGELOG (use changelog after).
Workflow
Step 1: Understand Requirements
If $ARGUMENTS is a file path:
- Read the spec file
- Extract acceptance criteria and edge cases
- Identify affected packages
If $ARGUMENTS is a description:
- Search existing code for related functionality
- Identify the right package to extend
- Confirm scope with user before proceeding
Step 2: Identify Affected Files
List all files that will be created or modified:
# Typical pattern for a new command
cmd/skillshare/<command>.go # Command handler
cmd/skillshare/<command>_project.go # Project-mode handler (if dual-mode)
internal/<package>/<feature>.go # Core logic
tests/integration/<command>_test.go # Integration test
Display the file list and continue. If scope is unclear, ask the user.
Step 3: Write Failing Tests First (RED)
Write integration tests using testutil.Sandbox:
func TestFeature_BasicCase(t *testing.T) {
sb := testutil.NewSandbox(t)
defer sb.Cleanup()
// Setup
sb.CreateSkill("test-skill", map[string]string{
"SKILL.md": "---\nname: test-skill\n---\n# Content",
})
// Act
result := sb.RunCLI("command", "args...")
// Assert
result.AssertSuccess()
result.AssertOutputContains("expected output")
}
Verify tests fail:
make test-int
# or run specific test:
go test ./tests/integration -run TestFeature_BasicCase
Step 4: Implement (GREEN)
Write minimal code to make tests pass:
- Follow existing patterns in
cmd/skillshare/andinternal/ - Use
internal/uifor terminal output (colors, spinners, boxes) - Add oplog instrumentation for mutating commands:
start := time.Now() // ... do work ... e := oplog.NewEntry("command-name", statusFromErr(err), time.Since(start)) oplog.Write(configPath, oplog.OpsFile, e) - Register command in
main.gocommands map if new command
Verify tests pass:
make test-int
Step 5: Refactor and Verify
- Clean up code while keeping tests green
- Run full quality check:
make check # fmt-check + lint + test - Fix any formatting or lint issues
Project Patterns Reference
These patterns appear throughout the codebase. Follow them when implementing new features.
Handler Split Convention
Large commands are split by concern rather than kept in a single file. When a command handler grows beyond ~300 lines, split it:
| Suffix | Purpose | Example |
|---|---|---|
<cmd>.go |
Flag parsing + mode routing (dispatch) | install.go |
_handlers.go |
Core handler logic | install_handlers.go |
_render.go / _audit_render.go |
Output rendering | audit_render.go |
_prompt.go / _prompt_tui.go |
Decision/prompt logic | install_prompt.go |
_tui.go |
Full-screen TUI (bubbletea) | list_tui.go |
_batch.go |
Batch operation orchestration | update_batch.go |
_resolve.go |
Target/skill resolution | update_resolve.go |
_context.go |
Mode-specific context struct | install_context.go |
_format.go |
Output formatting helpers | log_format.go |
Principle: dispatch file does ONLY flag parsing + mode routing. Logic goes in sub-files.
Dual-Mode Command Pattern
Most commands support both global (-g) and project (-p) mode:
func handleMyCommand(args []string) error {
mode, rest, err := parseModeArgs(args)
if err != nil { return err }
switch mode {
case modeProject:
return handleMyCommandProject(rest)
default:
return handleMyCommandGlobal(rest)
}
}
Create <cmd>_project.go for project-mode handler. Use parseModeArgs() from mode.go.
TUI Components (bubbletea)
All interactive prompts use bubbletea (not survey). Key components:
checklist_tui.go— shared checklist/radio pickerlist_tui.go— filterable list with detail panelsearch_tui.go— multi-select checkbox list
Color palette: cyan Color("6"), gray Color("8"), yellow #D4D93C.
Dispatch order: JSON output → TUI (if TTY + items + !--no-tui) → empty check → plain text.
Web API Endpoint
If the feature needs a Web UI endpoint, add internal/server/handler_<name>.go:
func (s *Server) handle<Name>(w http.ResponseWriter, r *http.Request) {
// ...
writeJSON(w, result) // 200 OK with JSON
// writeError(w, 400, msg) // for errors
}
Register in server.go route setup. Branch on s.IsProjectMode() for mode-specific behavior.
Oplog Instrumentation
All mutating commands log to operations.log (JSONL):
start := time.Now()
// ... do work ...
e := oplog.NewEntry("command-name", statusFromErr(err), time.Since(start))
e.Args = map[string]any{"key": value}
oplog.Write(configPath, oplog.OpsFile, e)
Security scans write to oplog.AuditFile instead.
Step 6: E2E Runbook (Major Features Only)
If the feature meets any of these criteria, generate an E2E runbook:
- New command or subcommand
- Changes to install/uninstall/sync flow
- Security-related (audit, hash verification, rollback)
- Multi-step user workflow (init → install → sync → verify)
- Edge cases that integration tests alone can't cover (Docker, network, file permissions)
Generate ai_docs/tests/<slug>_runbook.md following the existing convention:
# CLI E2E Runbook: <Title>
<One-line summary of what this validates.>
**Origin**: <version> — <why this runbook exists>
## Scope
- <bullet list of behaviors being validated>
## Environment
Run inside devcontainer with `ssenv` isolation.
## Steps
### 1. Setup: <description>
\```bash
<commands>
\```
**Expected**: <what should happen>
### 2. <Action>: <description>
...
## Pass Criteria
- All steps marked PASS
- <additional criteria>
Key conventions:
- YAML-free, pure Markdown
- Each step has
bashblock +Expectedblock ss=skillshare,~= ssenv-isolated HOME- Runbook can be executed by the
cli-e2e-testskill
If the feature does not meet the criteria above, skip this step.
Step 7: Stage and Report
- List all created/modified files
- Confirm each acceptance criterion is met with test evidence
- Remind user to run
update-docsif the feature affects CLI flags or user-visible behavior
Rules
- Test-first — always write failing test before implementation
- Minimal code — only write what's needed to pass tests
- Follow patterns — match existing code style in each package
- 3-strike rule — if a test fails 3 times after fixes, stop and report what's blocking
- No docs — this skill writes code only; use
update-docsfor documentation - No changelog — use
changelogskill for release notes - Spec ambiguity — ask the user rather than guessing
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核