oh-my-customcode 0.1.0
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/LICENSE +21 -0
- package/README.md +287 -0
- package/dist/cli/index.js +13299 -0
- package/dist/index.js +927 -0
- package/package.json +74 -0
- package/templates/.claude/contexts/dev.md +20 -0
- package/templates/.claude/contexts/ecomode.md +63 -0
- package/templates/.claude/contexts/index.yaml +41 -0
- package/templates/.claude/contexts/research.md +28 -0
- package/templates/.claude/contexts/review.md +23 -0
- package/templates/.claude/hooks/hooks.json +185 -0
- package/templates/.claude/hooks/hud/index.yaml +27 -0
- package/templates/.claude/hooks/hud/update-status.sh +32 -0
- package/templates/.claude/hooks/index.yaml +46 -0
- package/templates/.claude/hooks/memory-persistence/pre-compact.sh +37 -0
- package/templates/.claude/hooks/memory-persistence/session-end.sh +64 -0
- package/templates/.claude/hooks/memory-persistence/session-start.sh +41 -0
- package/templates/.claude/hooks/strategic-compact/suggest-compact.sh +50 -0
- package/templates/.claude/install-hooks.sh +100 -0
- package/templates/.claude/rules/MAY-optimization.md +93 -0
- package/templates/.claude/rules/MUST-agent-design.md +107 -0
- package/templates/.claude/rules/MUST-agent-identification.md +108 -0
- package/templates/.claude/rules/MUST-continuous-improvement.md +132 -0
- package/templates/.claude/rules/MUST-intent-transparency.md +199 -0
- package/templates/.claude/rules/MUST-language-policy.md +62 -0
- package/templates/.claude/rules/MUST-orchestrator-coordination.md +266 -0
- package/templates/.claude/rules/MUST-parallel-execution.md +341 -0
- package/templates/.claude/rules/MUST-permissions.md +84 -0
- package/templates/.claude/rules/MUST-safety.md +69 -0
- package/templates/.claude/rules/MUST-sync-verification.md +219 -0
- package/templates/.claude/rules/MUST-tool-identification.md +112 -0
- package/templates/.claude/rules/SHOULD-ecomode.md +145 -0
- package/templates/.claude/rules/SHOULD-error-handling.md +102 -0
- package/templates/.claude/rules/SHOULD-hud-statusline.md +89 -0
- package/templates/.claude/rules/SHOULD-interaction.md +103 -0
- package/templates/.claude/rules/SHOULD-memory-integration.md +114 -0
- package/templates/.claude/rules/SHOULD-pipeline-mode.md +165 -0
- package/templates/.claude/rules/index.yaml +125 -0
- package/templates/.claude/uninstall-hooks.sh +52 -0
- package/templates/CLAUDE.md.en +259 -0
- package/templates/CLAUDE.md.ko +259 -0
- package/templates/agents/index.yaml +237 -0
- package/templates/agents/infra-engineer/aws-expert/AGENT.md +47 -0
- package/templates/agents/infra-engineer/aws-expert/index.yaml +27 -0
- package/templates/agents/infra-engineer/docker-expert/AGENT.md +47 -0
- package/templates/agents/infra-engineer/docker-expert/index.yaml +27 -0
- package/templates/agents/manager/creator/AGENT.md +274 -0
- package/templates/agents/manager/creator/index.yaml +66 -0
- package/templates/agents/manager/gitnerd/AGENT.md +91 -0
- package/templates/agents/manager/gitnerd/index.yaml +55 -0
- package/templates/agents/manager/sauron/AGENT.md +153 -0
- package/templates/agents/manager/sauron/index.yaml +52 -0
- package/templates/agents/manager/supplier/AGENT.md +142 -0
- package/templates/agents/manager/supplier/index.yaml +31 -0
- package/templates/agents/manager/sync-checker/AGENT.md +34 -0
- package/templates/agents/manager/sync-checker/index.yaml +32 -0
- package/templates/agents/manager/updater/AGENT.md +125 -0
- package/templates/agents/manager/updater/index.yaml +31 -0
- package/templates/agents/orchestrator/dev-lead/AGENT.md +116 -0
- package/templates/agents/orchestrator/dev-lead/index.yaml +73 -0
- package/templates/agents/orchestrator/planner/AGENT.md +102 -0
- package/templates/agents/orchestrator/planner/index.yaml +38 -0
- package/templates/agents/orchestrator/qa-lead/AGENT.md +92 -0
- package/templates/agents/orchestrator/qa-lead/index.yaml +40 -0
- package/templates/agents/orchestrator/secretary/AGENT.md +132 -0
- package/templates/agents/orchestrator/secretary/index.yaml +55 -0
- package/templates/agents/qa-team/qa-engineer/AGENT.md +98 -0
- package/templates/agents/qa-team/qa-engineer/index.yaml +59 -0
- package/templates/agents/qa-team/qa-planner/AGENT.md +75 -0
- package/templates/agents/qa-team/qa-planner/index.yaml +47 -0
- package/templates/agents/qa-team/qa-writer/AGENT.md +98 -0
- package/templates/agents/qa-team/qa-writer/index.yaml +44 -0
- package/templates/agents/sw-architect/documenter/AGENT.md +120 -0
- package/templates/agents/sw-architect/documenter/index.yaml +39 -0
- package/templates/agents/sw-architect/speckit-agent/AGENT.md +127 -0
- package/templates/agents/sw-architect/speckit-agent/index.yaml +78 -0
- package/templates/agents/sw-engineer/backend/express-expert/AGENT.md +132 -0
- package/templates/agents/sw-engineer/backend/express-expert/index.yaml +36 -0
- package/templates/agents/sw-engineer/backend/fastapi-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/backend/fastapi-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/backend/go-backend-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/backend/go-backend-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/backend/nestjs-expert/AGENT.md +107 -0
- package/templates/agents/sw-engineer/backend/nestjs-expert/index.yaml +43 -0
- package/templates/agents/sw-engineer/backend/springboot-expert/AGENT.md +103 -0
- package/templates/agents/sw-engineer/backend/springboot-expert/index.yaml +69 -0
- package/templates/agents/sw-engineer/frontend/svelte-agent/AGENT.md +71 -0
- package/templates/agents/sw-engineer/frontend/svelte-agent/index.yaml +41 -0
- package/templates/agents/sw-engineer/frontend/vercel-agent/AGENT.md +67 -0
- package/templates/agents/sw-engineer/frontend/vercel-agent/index.yaml +43 -0
- package/templates/agents/sw-engineer/frontend/vuejs-agent/AGENT.md +71 -0
- package/templates/agents/sw-engineer/frontend/vuejs-agent/index.yaml +48 -0
- package/templates/agents/sw-engineer/language/golang-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/language/golang-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/language/java21-expert/AGENT.md +122 -0
- package/templates/agents/sw-engineer/language/java21-expert/index.yaml +51 -0
- package/templates/agents/sw-engineer/language/kotlin-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/language/kotlin-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/language/python-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/language/python-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/language/rust-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/language/rust-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/language/typescript-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/language/typescript-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/tooling/bun-expert/AGENT.md +73 -0
- package/templates/agents/sw-engineer/tooling/bun-expert/index.yaml +46 -0
- package/templates/agents/sw-engineer/tooling/npm-expert/AGENT.md +160 -0
- package/templates/agents/sw-engineer/tooling/npm-expert/index.yaml +45 -0
- package/templates/agents/sw-engineer/tooling/optimizer/AGENT.md +170 -0
- package/templates/agents/sw-engineer/tooling/optimizer/index.yaml +45 -0
- package/templates/agents/system/memory-keeper/AGENT.md +126 -0
- package/templates/agents/system/memory-keeper/index.yaml +45 -0
- package/templates/agents/system/naggy/AGENT.md +72 -0
- package/templates/agents/system/naggy/index.yaml +35 -0
- package/templates/commands/COMMANDS.md +136 -0
- package/templates/commands/creator/agent.md +121 -0
- package/templates/commands/dev/refactor.md +126 -0
- package/templates/commands/dev/review.md +82 -0
- package/templates/commands/git/branch.yaml +8 -0
- package/templates/commands/git/commit.yaml +4 -0
- package/templates/commands/git/pr.yaml +4 -0
- package/templates/commands/git/status.yaml +4 -0
- package/templates/commands/git/sync.yaml +4 -0
- package/templates/commands/index.yaml +225 -0
- package/templates/commands/intent/explain.md +144 -0
- package/templates/commands/memory/recall.md +164 -0
- package/templates/commands/memory/save.md +128 -0
- package/templates/commands/naggy/add.yaml +8 -0
- package/templates/commands/naggy/done.yaml +8 -0
- package/templates/commands/naggy/list.yaml +4 -0
- package/templates/commands/naggy/priority.yaml +11 -0
- package/templates/commands/naggy/remind.yaml +4 -0
- package/templates/commands/npm/audit.yaml +62 -0
- package/templates/commands/npm/publish.yaml +52 -0
- package/templates/commands/npm/version.yaml +62 -0
- package/templates/commands/optimize/analyze.yaml +34 -0
- package/templates/commands/optimize/bundle.yaml +50 -0
- package/templates/commands/optimize/report.yaml +56 -0
- package/templates/commands/pipeline/list.md +81 -0
- package/templates/commands/pipeline/run.md +127 -0
- package/templates/commands/sauron/quick.yaml +4 -0
- package/templates/commands/sauron/report.yaml +4 -0
- package/templates/commands/sauron/watch.yaml +4 -0
- package/templates/commands/supplier/audit.md +133 -0
- package/templates/commands/supplier/fix.md +121 -0
- package/templates/commands/sync/agents.yaml +4 -0
- package/templates/commands/sync/check.yaml +4 -0
- package/templates/commands/sync/commands.yaml +4 -0
- package/templates/commands/sync/docs.yaml +4 -0
- package/templates/commands/sync/fix.yaml +4 -0
- package/templates/commands/system/help.md +137 -0
- package/templates/commands/system/lists.md +86 -0
- package/templates/commands/system/status.md +163 -0
- package/templates/commands/updater/docs.md +165 -0
- package/templates/commands/updater/external.md +214 -0
- package/templates/guides/aws/common-patterns.md +169 -0
- package/templates/guides/aws/index.yaml +26 -0
- package/templates/guides/aws/well-architected.md +143 -0
- package/templates/guides/claude-code/01-overview.md +42 -0
- package/templates/guides/claude-code/03-tools.md +107 -0
- package/templates/guides/claude-code/04-agent-skills.md +90 -0
- package/templates/guides/claude-code/05-agent-sdk.md +129 -0
- package/templates/guides/claude-code/06-mcp.md +165 -0
- package/templates/guides/claude-code/07-prompt-engineering.md +100 -0
- package/templates/guides/claude-code/08-testing.md +58 -0
- package/templates/guides/claude-code/09-guardrails.md +80 -0
- package/templates/guides/claude-code/10-monitoring.md +89 -0
- package/templates/guides/claude-code/index.yaml +51 -0
- package/templates/guides/docker/compose-best-practices.md +284 -0
- package/templates/guides/docker/dockerfile-best-practices.md +262 -0
- package/templates/guides/docker/index.yaml +26 -0
- package/templates/guides/fastapi/best-practices.md +232 -0
- package/templates/guides/fastapi/index.yaml +21 -0
- package/templates/guides/go-backend/index.yaml +26 -0
- package/templates/guides/go-backend/project-layout.md +243 -0
- package/templates/guides/go-backend/uber-style.md +212 -0
- package/templates/guides/golang/concurrency.md +282 -0
- package/templates/guides/golang/effective-go.md +309 -0
- package/templates/guides/golang/error-handling.md +250 -0
- package/templates/guides/golang/index.yaml +27 -0
- package/templates/guides/index.yaml +101 -0
- package/templates/guides/kotlin/coding-conventions.md +247 -0
- package/templates/guides/kotlin/idioms.md +234 -0
- package/templates/guides/kotlin/index.yaml +26 -0
- package/templates/guides/python/index.yaml +26 -0
- package/templates/guides/python/pep8-style-guide.md +202 -0
- package/templates/guides/python/zen-of-python.md +79 -0
- package/templates/guides/rust/error-handling.md +262 -0
- package/templates/guides/rust/index.yaml +26 -0
- package/templates/guides/rust/ownership.md +180 -0
- package/templates/guides/springboot/best-practices.md +361 -0
- package/templates/guides/springboot/index.yaml +22 -0
- package/templates/guides/typescript/advanced-types.md +225 -0
- package/templates/guides/typescript/index.yaml +26 -0
- package/templates/guides/typescript/type-system.md +219 -0
- package/templates/guides/web-design/accessibility.md +66 -0
- package/templates/guides/web-design/index.yaml +20 -0
- package/templates/guides/web-design/performance.md +102 -0
- package/templates/pipelines/examples/code-review.yaml +66 -0
- package/templates/pipelines/index.yaml +18 -0
- package/templates/pipelines/templates/pipeline-template.yaml +50 -0
- package/templates/skills/backend/fastapi-best-practices/SKILL.md +269 -0
- package/templates/skills/backend/fastapi-best-practices/index.yaml +25 -0
- package/templates/skills/backend/go-backend-best-practices/SKILL.md +337 -0
- package/templates/skills/backend/go-backend-best-practices/index.yaml +26 -0
- package/templates/skills/backend/springboot-best-practices/SKILL.md +356 -0
- package/templates/skills/backend/springboot-best-practices/index.yaml +27 -0
- package/templates/skills/development/go-best-practices/SKILL.md +202 -0
- package/templates/skills/development/go-best-practices/index.yaml +25 -0
- package/templates/skills/development/kotlin-best-practices/SKILL.md +255 -0
- package/templates/skills/development/kotlin-best-practices/index.yaml +27 -0
- package/templates/skills/development/python-best-practices/SKILL.md +221 -0
- package/templates/skills/development/python-best-practices/index.yaml +25 -0
- package/templates/skills/development/react-best-practices/SKILL.md +100 -0
- package/templates/skills/development/react-best-practices/index.yaml +39 -0
- package/templates/skills/development/rust-best-practices/SKILL.md +266 -0
- package/templates/skills/development/rust-best-practices/index.yaml +26 -0
- package/templates/skills/development/typescript-best-practices/SKILL.md +320 -0
- package/templates/skills/development/typescript-best-practices/index.yaml +28 -0
- package/templates/skills/development/vercel-deploy/SKILL.md +73 -0
- package/templates/skills/development/vercel-deploy/index.yaml +30 -0
- package/templates/skills/development/web-design-guidelines/SKILL.md +117 -0
- package/templates/skills/development/web-design-guidelines/index.yaml +34 -0
- package/templates/skills/index.yaml +129 -0
- package/templates/skills/infrastructure/aws-best-practices/SKILL.md +279 -0
- package/templates/skills/infrastructure/aws-best-practices/index.yaml +27 -0
- package/templates/skills/infrastructure/docker-best-practices/SKILL.md +274 -0
- package/templates/skills/infrastructure/docker-best-practices/index.yaml +26 -0
- package/templates/skills/orchestration/intent-detection/SKILL.md +214 -0
- package/templates/skills/orchestration/intent-detection/index.yaml +30 -0
- package/templates/skills/orchestration/intent-detection/patterns/agent-triggers.yaml +333 -0
- package/templates/skills/orchestration/pipeline-execution/SKILL.md +188 -0
- package/templates/skills/orchestration/pipeline-execution/index.yaml +27 -0
- package/templates/skills/system/memory-management/SKILL.md +194 -0
- package/templates/skills/system/memory-management/index.yaml +30 -0
- package/templates/skills/system/result-aggregation/SKILL.md +163 -0
- package/templates/skills/system/result-aggregation/index.yaml +36 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Kotlin Best Practices Skill
|
|
2
|
+
|
|
3
|
+
> **Category**: Development
|
|
4
|
+
> **Source**: Internal (based on Kotlin Coding Conventions)
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
|
|
8
|
+
Apply idiomatic Kotlin patterns and best practices from official JetBrains documentation.
|
|
9
|
+
|
|
10
|
+
## Core Principles
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Concise yet readable
|
|
14
|
+
Null safety by design
|
|
15
|
+
Interoperability with Java
|
|
16
|
+
Functional when appropriate
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
|
|
21
|
+
### 1. Naming Conventions
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
packages:
|
|
25
|
+
style: lowercase, no underscores
|
|
26
|
+
example: org.example.project
|
|
27
|
+
|
|
28
|
+
classes_objects:
|
|
29
|
+
style: UpperCamelCase
|
|
30
|
+
example: DeclarationProcessor
|
|
31
|
+
|
|
32
|
+
functions_variables:
|
|
33
|
+
style: lowerCamelCase
|
|
34
|
+
example: processDeclarations, declarationCount
|
|
35
|
+
|
|
36
|
+
constants:
|
|
37
|
+
style: SCREAMING_SNAKE_CASE
|
|
38
|
+
example: const val MAX_COUNT = 8
|
|
39
|
+
|
|
40
|
+
backing_properties:
|
|
41
|
+
style: underscore prefix
|
|
42
|
+
example: private val _elementList
|
|
43
|
+
|
|
44
|
+
acronyms:
|
|
45
|
+
two_letters: both uppercase (IOStream)
|
|
46
|
+
three_plus: capitalize first only (XmlFormatter)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Source File Organization
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
file_naming:
|
|
53
|
+
single_class: name after the class (MyClass.kt)
|
|
54
|
+
multiple_classes: descriptive UpperCamelCase (ProcessDeclarations.kt)
|
|
55
|
+
platform_specific: add suffix (Platform.jvm.kt)
|
|
56
|
+
|
|
57
|
+
class_layout:
|
|
58
|
+
1: Property declarations and initializer blocks
|
|
59
|
+
2: Secondary constructors
|
|
60
|
+
3: Method declarations
|
|
61
|
+
4: Companion object
|
|
62
|
+
|
|
63
|
+
directory_structure:
|
|
64
|
+
- Follow package structure with common root omitted
|
|
65
|
+
- Example: org.example.kotlin.network → network/
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. Formatting
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
indentation:
|
|
72
|
+
- 4 spaces (no tabs)
|
|
73
|
+
- Opening brace at end of line
|
|
74
|
+
- Closing brace on separate line
|
|
75
|
+
|
|
76
|
+
horizontal_whitespace:
|
|
77
|
+
around_binary_operators: "a + b"
|
|
78
|
+
no_around_range: "0..i"
|
|
79
|
+
no_around_unary: "a++"
|
|
80
|
+
after_control_keywords: "if (condition)"
|
|
81
|
+
no_before_parentheses: "method()"
|
|
82
|
+
never_around_dot: "foo.bar()"
|
|
83
|
+
|
|
84
|
+
colons:
|
|
85
|
+
type_supertype: "class Foo : Bar"
|
|
86
|
+
declaration_type: "val x: Int"
|
|
87
|
+
always_space_after: true
|
|
88
|
+
|
|
89
|
+
trailing_commas:
|
|
90
|
+
recommended: true
|
|
91
|
+
reason: cleaner diffs, easier reordering
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 4. Functions
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
expression_bodies:
|
|
98
|
+
prefer: "fun foo() = 1"
|
|
99
|
+
over: |
|
|
100
|
+
fun foo(): Int {
|
|
101
|
+
return 1
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
default_parameters:
|
|
105
|
+
prefer: "fun foo(a: String = \"a\")"
|
|
106
|
+
over: overloaded functions
|
|
107
|
+
|
|
108
|
+
single_line_signatures:
|
|
109
|
+
if_fits: "fun foo(a: Int): String = ..."
|
|
110
|
+
otherwise: |
|
|
111
|
+
fun longMethodName(
|
|
112
|
+
argument: ArgumentType = defaultValue,
|
|
113
|
+
argument2: AnotherArgumentType,
|
|
114
|
+
): ReturnType { }
|
|
115
|
+
|
|
116
|
+
unit_return:
|
|
117
|
+
avoid: "fun foo(): Unit { }"
|
|
118
|
+
prefer: "fun foo() { }"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 5. Null Safety
|
|
122
|
+
|
|
123
|
+
```yaml
|
|
124
|
+
principles:
|
|
125
|
+
- Prefer non-null types by default
|
|
126
|
+
- Use ? only when nullability is meaningful
|
|
127
|
+
- Leverage safe calls (?.) and elvis (?:)
|
|
128
|
+
|
|
129
|
+
patterns: |
|
|
130
|
+
// Safe call
|
|
131
|
+
val length = text?.length
|
|
132
|
+
|
|
133
|
+
// Elvis operator
|
|
134
|
+
val name = user?.name ?: "Anonymous"
|
|
135
|
+
|
|
136
|
+
// Let for null checks
|
|
137
|
+
user?.let {
|
|
138
|
+
println(it.name)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Not-null assertion (use sparingly)
|
|
142
|
+
val name = user!!.name
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 6. Idiomatic Patterns
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
immutability:
|
|
149
|
+
prefer: "val over var"
|
|
150
|
+
collections: "listOf() over arrayListOf()"
|
|
151
|
+
|
|
152
|
+
conditionals:
|
|
153
|
+
binary: use if
|
|
154
|
+
multiple: use when
|
|
155
|
+
|
|
156
|
+
patterns: |
|
|
157
|
+
// if expression
|
|
158
|
+
return if (x) foo() else bar()
|
|
159
|
+
|
|
160
|
+
// when expression
|
|
161
|
+
return when(x) {
|
|
162
|
+
0 -> "zero"
|
|
163
|
+
else -> "nonzero"
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
functional:
|
|
167
|
+
prefer: "list.filter { it > 10 }.map { it * 2 }"
|
|
168
|
+
over: manual loops (except forEach)
|
|
169
|
+
|
|
170
|
+
ranges:
|
|
171
|
+
prefer: "for (i in 0..<n)"
|
|
172
|
+
avoid: "for (i in 0..n - 1)"
|
|
173
|
+
|
|
174
|
+
type_aliases:
|
|
175
|
+
use_for: |
|
|
176
|
+
typealias MouseClickHandler = (Any, MouseEvent) -> Unit
|
|
177
|
+
typealias PersonIndex = Map<String, Person>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### 7. Lambdas
|
|
181
|
+
|
|
182
|
+
```yaml
|
|
183
|
+
formatting:
|
|
184
|
+
- Spaces around curly braces: "list.filter { it > 10 }"
|
|
185
|
+
- Single lambda outside parentheses
|
|
186
|
+
- it for single parameter
|
|
187
|
+
|
|
188
|
+
patterns: |
|
|
189
|
+
// Outside parentheses
|
|
190
|
+
list.filter { it > 10 }
|
|
191
|
+
|
|
192
|
+
// Multiple parameters
|
|
193
|
+
list.fold(0) { acc, item -> acc + item }
|
|
194
|
+
|
|
195
|
+
// Destructuring
|
|
196
|
+
map.forEach { (key, value) -> println("$key = $value") }
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 8. Coroutines
|
|
200
|
+
|
|
201
|
+
```yaml
|
|
202
|
+
principles:
|
|
203
|
+
- Use suspend functions for async operations
|
|
204
|
+
- Structured concurrency with scopes
|
|
205
|
+
- Proper exception handling
|
|
206
|
+
|
|
207
|
+
patterns: |
|
|
208
|
+
// Suspend function
|
|
209
|
+
suspend fun fetchData(): Data {
|
|
210
|
+
return withContext(Dispatchers.IO) {
|
|
211
|
+
api.getData()
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Coroutine scope
|
|
216
|
+
lifecycleScope.launch {
|
|
217
|
+
val data = fetchData()
|
|
218
|
+
updateUI(data)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Exception handling
|
|
222
|
+
try {
|
|
223
|
+
val result = async { fetchData() }.await()
|
|
224
|
+
} catch (e: Exception) {
|
|
225
|
+
handleError(e)
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### 9. Documentation
|
|
230
|
+
|
|
231
|
+
```yaml
|
|
232
|
+
format: |
|
|
233
|
+
/**
|
|
234
|
+
* Returns the absolute value of the given [number].
|
|
235
|
+
*/
|
|
236
|
+
fun abs(number: Int): Int { ... }
|
|
237
|
+
|
|
238
|
+
best_practices:
|
|
239
|
+
- Incorporate parameters into description
|
|
240
|
+
- Use brackets for parameter references
|
|
241
|
+
- Use @param/@return only for lengthy descriptions
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Application
|
|
245
|
+
|
|
246
|
+
When writing or reviewing Kotlin code:
|
|
247
|
+
|
|
248
|
+
1. **Always** prefer val over var
|
|
249
|
+
2. **Always** use null-safe types appropriately
|
|
250
|
+
3. **Prefer** expression bodies for simple functions
|
|
251
|
+
4. **Prefer** functional operations over loops
|
|
252
|
+
5. **Use** default parameters over overloads
|
|
253
|
+
6. **Use** when for multiple conditions
|
|
254
|
+
7. **Leverage** extension functions
|
|
255
|
+
8. **Document** public APIs
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Kotlin Best Practices Skill
|
|
2
|
+
|
|
3
|
+
metadata:
|
|
4
|
+
name: kotlin-best-practices
|
|
5
|
+
category: development
|
|
6
|
+
description: Idiomatic Kotlin patterns from JetBrains conventions
|
|
7
|
+
|
|
8
|
+
source:
|
|
9
|
+
type: internal
|
|
10
|
+
reference:
|
|
11
|
+
- https://kotlinlang.org/docs/coding-conventions.html
|
|
12
|
+
- https://kotlinlang.org/docs/idioms.html
|
|
13
|
+
- https://developer.android.com/kotlin/style-guide
|
|
14
|
+
|
|
15
|
+
provides:
|
|
16
|
+
- Kotlin naming conventions
|
|
17
|
+
- Source file organization
|
|
18
|
+
- Formatting standards
|
|
19
|
+
- Function design patterns
|
|
20
|
+
- Null safety patterns
|
|
21
|
+
- Idiomatic expressions
|
|
22
|
+
- Lambda best practices
|
|
23
|
+
- Coroutine patterns
|
|
24
|
+
- Documentation guidelines
|
|
25
|
+
|
|
26
|
+
used_by:
|
|
27
|
+
- kotlin-expert
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Python Best Practices Skill
|
|
2
|
+
|
|
3
|
+
> **Category**: Development
|
|
4
|
+
> **Source**: Internal (based on PEP 8 and PEP 20)
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
|
|
8
|
+
Apply idiomatic Python patterns and best practices from official Python documentation.
|
|
9
|
+
|
|
10
|
+
## The Zen of Python (PEP 20)
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Beautiful is better than ugly.
|
|
14
|
+
Explicit is better than implicit.
|
|
15
|
+
Simple is better than complex.
|
|
16
|
+
Complex is better than complicated.
|
|
17
|
+
Flat is better than nested.
|
|
18
|
+
Sparse is better than dense.
|
|
19
|
+
Readability counts.
|
|
20
|
+
Special cases aren't special enough to break the rules.
|
|
21
|
+
Although practicality beats purity.
|
|
22
|
+
Errors should never pass silently.
|
|
23
|
+
Unless explicitly silenced.
|
|
24
|
+
In the face of ambiguity, refuse the temptation to guess.
|
|
25
|
+
There should be one-- and preferably only one --obvious way to do it.
|
|
26
|
+
Although that way may not be obvious at first unless you're Dutch.
|
|
27
|
+
Now is better than never.
|
|
28
|
+
Although never is often better than *right* now.
|
|
29
|
+
If the implementation is hard to explain, it's a bad idea.
|
|
30
|
+
If the implementation is easy to explain, it may be a good idea.
|
|
31
|
+
Namespaces are one honking great idea -- let's do more of those!
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Rules
|
|
35
|
+
|
|
36
|
+
### 1. Code Layout
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
indentation:
|
|
40
|
+
- Use 4 spaces per indentation level
|
|
41
|
+
- Never mix tabs and spaces
|
|
42
|
+
- Continuation lines align vertically or use hanging indent
|
|
43
|
+
|
|
44
|
+
line_length:
|
|
45
|
+
- Maximum 79 characters for code
|
|
46
|
+
- Maximum 72 characters for docstrings/comments
|
|
47
|
+
- Teams may agree on 99 characters for code
|
|
48
|
+
|
|
49
|
+
blank_lines:
|
|
50
|
+
- Two blank lines around top-level definitions
|
|
51
|
+
- One blank line between method definitions
|
|
52
|
+
- Use sparingly inside functions
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 2. Imports
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
rules:
|
|
59
|
+
- One import per line
|
|
60
|
+
- Position at file top, after docstrings
|
|
61
|
+
- Group order: standard library → third-party → local
|
|
62
|
+
- Separate groups with blank lines
|
|
63
|
+
- Prefer absolute imports
|
|
64
|
+
- Avoid wildcard imports (from X import *)
|
|
65
|
+
|
|
66
|
+
example: |
|
|
67
|
+
import os
|
|
68
|
+
import sys
|
|
69
|
+
|
|
70
|
+
from third_party import lib
|
|
71
|
+
|
|
72
|
+
from myproject import module
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 3. Whitespace
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
avoid:
|
|
79
|
+
- Extra spaces inside parentheses/brackets
|
|
80
|
+
- Spaces before commas or colons
|
|
81
|
+
- Spaces between function name and parenthesis
|
|
82
|
+
- Multiple spaces for alignment
|
|
83
|
+
|
|
84
|
+
required:
|
|
85
|
+
- Single space around binary operators
|
|
86
|
+
- Spaces around -> in annotations
|
|
87
|
+
- No spaces around = for default parameters
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 4. Naming Conventions
|
|
91
|
+
|
|
92
|
+
```yaml
|
|
93
|
+
modules_packages:
|
|
94
|
+
style: lowercase_with_underscores
|
|
95
|
+
example: my_module
|
|
96
|
+
|
|
97
|
+
classes:
|
|
98
|
+
style: CapWords
|
|
99
|
+
example: MyClass
|
|
100
|
+
|
|
101
|
+
functions_variables:
|
|
102
|
+
style: lowercase_with_underscores
|
|
103
|
+
example: my_function, my_variable
|
|
104
|
+
|
|
105
|
+
constants:
|
|
106
|
+
style: ALL_CAPS_WITH_UNDERSCORES
|
|
107
|
+
example: MAX_SIZE, DEFAULT_VALUE
|
|
108
|
+
|
|
109
|
+
exceptions:
|
|
110
|
+
style: CapWords + Error suffix
|
|
111
|
+
example: ValueError, CustomError
|
|
112
|
+
|
|
113
|
+
private:
|
|
114
|
+
single_underscore: _internal (weak internal)
|
|
115
|
+
double_underscore: __private (name mangling)
|
|
116
|
+
trailing_underscore: class_ (avoid keyword conflict)
|
|
117
|
+
|
|
118
|
+
avoid:
|
|
119
|
+
- Single characters l, O, I (ambiguous)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 5. Comments and Docstrings
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
principles:
|
|
126
|
+
- Comments contradicting code are worse than none
|
|
127
|
+
- Use complete sentences
|
|
128
|
+
- Keep comments up to date
|
|
129
|
+
|
|
130
|
+
block_comments:
|
|
131
|
+
- Indent at same level as code
|
|
132
|
+
- Start each line with # and space
|
|
133
|
+
|
|
134
|
+
inline_comments:
|
|
135
|
+
- Minimum two spaces from code
|
|
136
|
+
- Avoid obvious statements
|
|
137
|
+
|
|
138
|
+
docstrings:
|
|
139
|
+
- Write for all public modules, functions, classes, methods
|
|
140
|
+
- Use triple quotes
|
|
141
|
+
- First line: concise summary
|
|
142
|
+
- Blank line before detailed description
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 6. Programming Recommendations
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
comparisons:
|
|
149
|
+
- Use 'is' and 'is not' for None, True, False
|
|
150
|
+
- Prefer isinstance() over type()
|
|
151
|
+
- Use 'is not' rather than 'not ... is'
|
|
152
|
+
|
|
153
|
+
sequences:
|
|
154
|
+
- Test empty: if not seq: (not if len(seq) == 0)
|
|
155
|
+
- Use .startswith() and .endswith()
|
|
156
|
+
|
|
157
|
+
exceptions:
|
|
158
|
+
- Derive from Exception, not BaseException
|
|
159
|
+
- Catch specific exceptions
|
|
160
|
+
- Avoid bare except clauses
|
|
161
|
+
- Use 'raise X from Y' for chaining
|
|
162
|
+
|
|
163
|
+
functions:
|
|
164
|
+
- Use def, not lambda assignment
|
|
165
|
+
- Consistent return statements
|
|
166
|
+
- Use with for resource management
|
|
167
|
+
|
|
168
|
+
type_hints:
|
|
169
|
+
- Follow PEP 484 syntax
|
|
170
|
+
- Space after colon in annotations
|
|
171
|
+
- No space before colon
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 7. Pythonic Idioms
|
|
175
|
+
|
|
176
|
+
```yaml
|
|
177
|
+
list_comprehension:
|
|
178
|
+
prefer: "[x*2 for x in items if x > 0]"
|
|
179
|
+
over: |
|
|
180
|
+
result = []
|
|
181
|
+
for x in items:
|
|
182
|
+
if x > 0:
|
|
183
|
+
result.append(x*2)
|
|
184
|
+
|
|
185
|
+
context_managers:
|
|
186
|
+
prefer: "with open('file') as f:"
|
|
187
|
+
over: |
|
|
188
|
+
f = open('file')
|
|
189
|
+
try:
|
|
190
|
+
...
|
|
191
|
+
finally:
|
|
192
|
+
f.close()
|
|
193
|
+
|
|
194
|
+
unpacking:
|
|
195
|
+
prefer: "a, b = b, a"
|
|
196
|
+
over: |
|
|
197
|
+
temp = a
|
|
198
|
+
a = b
|
|
199
|
+
b = temp
|
|
200
|
+
|
|
201
|
+
enumerate:
|
|
202
|
+
prefer: "for i, item in enumerate(items):"
|
|
203
|
+
over: "for i in range(len(items)):"
|
|
204
|
+
|
|
205
|
+
dictionary:
|
|
206
|
+
prefer: "d.get(key, default)"
|
|
207
|
+
over: "d[key] if key in d else default"
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Application
|
|
211
|
+
|
|
212
|
+
When writing or reviewing Python code:
|
|
213
|
+
|
|
214
|
+
1. **Always** follow PEP 8 formatting
|
|
215
|
+
2. **Always** write docstrings for public APIs
|
|
216
|
+
3. **Prefer** explicit over implicit
|
|
217
|
+
4. **Prefer** simple over complex
|
|
218
|
+
5. **Prefer** flat over nested
|
|
219
|
+
6. **Avoid** premature optimization
|
|
220
|
+
7. **Use** list comprehensions when readable
|
|
221
|
+
8. **Use** context managers for resources
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Python Best Practices Skill
|
|
2
|
+
|
|
3
|
+
metadata:
|
|
4
|
+
name: python-best-practices
|
|
5
|
+
category: development
|
|
6
|
+
description: Pythonic patterns from PEP 8 and PEP 20
|
|
7
|
+
|
|
8
|
+
source:
|
|
9
|
+
type: internal
|
|
10
|
+
reference:
|
|
11
|
+
- https://peps.python.org/pep-0008/
|
|
12
|
+
- https://peps.python.org/pep-0020/
|
|
13
|
+
- https://google.github.io/styleguide/pyguide.html
|
|
14
|
+
|
|
15
|
+
provides:
|
|
16
|
+
- Python code formatting standards
|
|
17
|
+
- Naming conventions
|
|
18
|
+
- Import organization
|
|
19
|
+
- Whitespace rules
|
|
20
|
+
- Comment and docstring guidelines
|
|
21
|
+
- Programming recommendations
|
|
22
|
+
- Pythonic idioms
|
|
23
|
+
|
|
24
|
+
used_by:
|
|
25
|
+
- python-expert
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# React Best Practices
|
|
2
|
+
|
|
3
|
+
> **Source**: vercel-labs/agent-skills
|
|
4
|
+
> **Rules**: 40+ rules in 8 categories
|
|
5
|
+
|
|
6
|
+
## When to Use
|
|
7
|
+
|
|
8
|
+
- Writing React/Next.js components
|
|
9
|
+
- Data fetching implementation
|
|
10
|
+
- Performance review
|
|
11
|
+
- Bundle size optimization
|
|
12
|
+
|
|
13
|
+
## Categories by Priority
|
|
14
|
+
|
|
15
|
+
### Critical Priority
|
|
16
|
+
|
|
17
|
+
#### Waterfall Elimination
|
|
18
|
+
```
|
|
19
|
+
- Avoid sequential data fetching
|
|
20
|
+
- Use parallel data fetching
|
|
21
|
+
- Implement proper loading states
|
|
22
|
+
- Prefetch critical data
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
#### Bundle Optimization
|
|
26
|
+
```
|
|
27
|
+
- Minimize client-side JavaScript
|
|
28
|
+
- Use dynamic imports
|
|
29
|
+
- Tree-shake unused code
|
|
30
|
+
- Analyze bundle with tools
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### High Priority
|
|
34
|
+
|
|
35
|
+
#### Server-Side Performance
|
|
36
|
+
```
|
|
37
|
+
- Use Server Components by default
|
|
38
|
+
- Minimize 'use client' directives
|
|
39
|
+
- Implement streaming where possible
|
|
40
|
+
- Cache server responses
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Medium-High Priority
|
|
44
|
+
|
|
45
|
+
#### Client-Side Fetching
|
|
46
|
+
```
|
|
47
|
+
- Use SWR or React Query
|
|
48
|
+
- Implement optimistic updates
|
|
49
|
+
- Handle loading/error states
|
|
50
|
+
- Cache API responses
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Medium Priority
|
|
54
|
+
|
|
55
|
+
#### Rendering
|
|
56
|
+
```
|
|
57
|
+
- Avoid unnecessary re-renders
|
|
58
|
+
- Use React.memo strategically
|
|
59
|
+
- Implement useMemo/useCallback properly
|
|
60
|
+
- Virtualize long lists
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Caching
|
|
64
|
+
```
|
|
65
|
+
- Implement proper cache headers
|
|
66
|
+
- Use ISR for dynamic content
|
|
67
|
+
- Cache database queries
|
|
68
|
+
- CDN caching strategies
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### Code Splitting
|
|
72
|
+
```
|
|
73
|
+
- Split by route
|
|
74
|
+
- Lazy load below-fold content
|
|
75
|
+
- Dynamic import heavy libraries
|
|
76
|
+
- Preload critical chunks
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Low-Medium Priority
|
|
80
|
+
|
|
81
|
+
#### Image Optimization
|
|
82
|
+
```
|
|
83
|
+
- Use next/image
|
|
84
|
+
- Implement proper sizing
|
|
85
|
+
- Use modern formats (WebP, AVIF)
|
|
86
|
+
- Lazy load off-screen images
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Execution Flow
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
1. Identify optimization area
|
|
93
|
+
2. Check relevant category rules
|
|
94
|
+
3. Apply recommendations
|
|
95
|
+
4. Verify improvements
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Scripts
|
|
99
|
+
|
|
100
|
+
See `scripts/` directory for automation helpers.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# React Best Practices Skill
|
|
2
|
+
|
|
3
|
+
metadata:
|
|
4
|
+
name: react-best-practices
|
|
5
|
+
category: development
|
|
6
|
+
description: React/Next.js performance optimization with 40+ rules in 8 categories
|
|
7
|
+
|
|
8
|
+
source:
|
|
9
|
+
type: external
|
|
10
|
+
origin: github
|
|
11
|
+
url: https://github.com/vercel-labs/agent-skills
|
|
12
|
+
path: skills/react-best-practices
|
|
13
|
+
version: "1.0.0"
|
|
14
|
+
last_updated: "2025-01-22"
|
|
15
|
+
|
|
16
|
+
triggers:
|
|
17
|
+
- "optimize React"
|
|
18
|
+
- "performance review"
|
|
19
|
+
- "bundle size"
|
|
20
|
+
- "data fetching"
|
|
21
|
+
- "Next.js optimization"
|
|
22
|
+
|
|
23
|
+
categories:
|
|
24
|
+
- name: waterfall-elimination
|
|
25
|
+
priority: critical
|
|
26
|
+
- name: bundle-optimization
|
|
27
|
+
priority: critical
|
|
28
|
+
- name: server-performance
|
|
29
|
+
priority: high
|
|
30
|
+
- name: client-fetching
|
|
31
|
+
priority: medium-high
|
|
32
|
+
- name: rendering
|
|
33
|
+
priority: medium
|
|
34
|
+
- name: caching
|
|
35
|
+
priority: medium
|
|
36
|
+
- name: code-splitting
|
|
37
|
+
priority: medium
|
|
38
|
+
- name: image-optimization
|
|
39
|
+
priority: low-medium
|