example
Saves reusable code examples to the examples library with metadata and tags.
- License 许可
- MIT
- 所属仓库
- goffity/dev-km
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- example
- description
- Saves reusable code examples to the examples library with metadata and tags.
- argument-hint
- [language] [name]
- user-invocable
- true
02 资源文件 10
- 参考文档_meta.json137 B
- 参考文档_shared/chain-support.md2.3 KB
- 参考文档_shared/preflight.md4.3 KB
- 参考文档references/cli-reference.md31.9 KB
- 参考文档references/eip7702-upgrade.md5.5 KB
- 参考文档references/gas-station.md59.1 KB
- 参考文档references/troubleshooting.md13.9 KB
- 参考文档skill-card.md3.0 KB
- 参考文档SOURCE.md280 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Example - Code Examples Library
Save and organize reusable code snippets with metadata.
Usage
/example [language] [name]
Output: $PROJECT_ROOT/kb/02-patterns/examples/[language]/[name].[ext]
Instructions
Language Setting
Check
LANGUAGEindocs/current.md. Ifth, translate output perreferences/language-guide.md. Seereferences/bash-helpers.mdfor detection snippet.
- Parse arguments: language (go, typescript, python, bash, etc.) and name (kebab-case)
- Determine file extension from language:
- go → .go
- typescript/ts → .ts
- javascript/js → .js
- python/py → .py
- bash/sh → .sh
- rust → .rs
- java → .java
- Gather context: Look at recent code in conversation, ask user what code to save if unclear
- Create directory:
kb/02-patterns/examples/[language]/ - Generate file with metadata header and code
- Confirm with user
File Format
Go Example
// Title: [Descriptive Title]
// Tags: [tag1, tag2, tag3]
// Related: [link to knowledge-base or learnings if any]
// Created: YYYY-MM-DD
package examples
// [Description of what this code does]
// Usage:
// [usage example]
[code]
TypeScript/JavaScript Example
// Title: [Descriptive Title]
// Tags: [tag1, tag2, tag3]
// Related: [link to knowledge-base if any]
// Created: YYYY-MM-DD
// [Description]
// Usage:
// [usage example]
[code]
Python Example
# Title: [Descriptive Title]
# Tags: [tag1, tag2, tag3]
# Related: [link to knowledge-base if any]
# Created: YYYY-MM-DD
# [Description]
# Usage:
# [usage example]
[code]
Bash Example
#!/bin/bash
# Title: [Descriptive Title]
# Tags: [tag1, tag2, tag3]
# Related: [link to knowledge-base if any]
# Created: YYYY-MM-DD
# [Description]
# Usage:
# [usage example]
[code]
Guidelines
- Code should be runnable or at minimum compilable
- Include usage examples in comments
- Add relevant tags for searchability
- Link to related knowledge-base entries if they exist
- Keep examples focused on one concept/pattern
- Use descriptive names (e.g.,
retry-with-backoff,api-client-wrapper)
Listing Examples
To browse existing examples:
find kb/02-patterns/examples -type f | sort
Related Commands
| Command | Purpose |
|---|---|
/mem |
Quick knowledge capture |
/distill |
Extract patterns to knowledge base |
/example |
Save code examples (you are here) |
04 同仓库更多 Skills
wait-what
Stop. That last message did not land: re-pitch it.
tdd
Test-driven development loop (red-green-refactor) with commit-based phase state and Jira traceability. Use when the user wants to build a feature or fix a bug test-first, mentions "tdd", "red-green-refactor", or "test-first". Replaces the tdg plugin — combines its commit/phase discipline with seam-based test quality rules from kb Testing Standards.
td
Creates post-task retrospectives with Before/After context and session documentation.
summary
Generates weekly or monthly session summaries from retrospectives and activity logs.
share
Shares knowledge across projects by copying to shared-knowledge directory with cross-project metadata.
session-analyzer
Analyzes git changes and creates retrospective drafts with Before/After context.