@robot-inventor/agent-skills 0.0.0 → 0.7.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.
@@ -1,27 +1,27 @@
1
- ---
2
- name: simple-engineering
3
- description: A skill outlining the fundamental principles to keep in mind when writing or editing code. Read this skill before developing an implementation plan or writing or reviewing code, and apply it to your work.
4
- license: MIT
5
- metadata:
6
- author: Robot-Inventor
7
- ---
8
-
9
- # Simple Engineering
10
-
11
- ## Keep it simple and elegant
12
-
13
- Overengineering is a shameful and foolish act, and it is important to always pursue simple and elegant solutions.
14
-
15
- Before implementing a feature or fixing a bug, consider all options. Instead of just listing similar choices or being bound by preconceptions and previous thinking, consider all options, including completely different approaches. Among the available options, choose the one that is the clearest, simplest, requires the fewest lines of code, and meets the user's requirements. There is no need to use iron plates and nails to repair torn clothes. Choose a right-sized, simple approach rather than an overly large and complex one.
16
-
17
- Also avoid bringing unnecessary complexity into your code. Carefully examine related processing to ensure there are no impossible conditional branches or unnecessary try-catch blocks. Check the type definitions and actual processing, and remove any impossible conditional branches. There is no need to wrap code in a new try-catch block if an exception is unlikely to occur normally or if a try-catch already exists inside the called function.
18
-
19
- ## Avoid reinventing the wheel
20
-
21
- Reinventing the wheel should be avoided. Before adding code, check whether existing code in the project or the project's dependencies already provide functionality that covers part or all of that processing. When implementing complex processing, investigate whether a popular and well-maintained library that achieves equivalent functionality exists, and if so, propose using it to the user.
22
-
23
- ## Keep only necessary changes
24
-
25
- Keep the YAGNI (You aren't gonna need it) principle in mind. You should not introduce complexity just because you might need it in the future. Also, there is no need to maintain backward compatibility for unreleased features.
26
-
27
- The code ultimately delivered to the user should be such that every line of change is necessary and no unnecessary code remains. Carefully review the diff line by line, rather than file by file, to ensure that all changes are truly necessary.
1
+ ---
2
+ name: simple-engineering
3
+ description: A skill outlining the fundamental principles to keep in mind when writing or editing code. Read this skill before developing an implementation plan or writing or reviewing code, and apply it to your work.
4
+ license: MIT
5
+ metadata:
6
+ author: Robot-Inventor
7
+ ---
8
+
9
+ # Simple Engineering
10
+
11
+ ## Keep it simple and elegant
12
+
13
+ Overengineering is a shameful and foolish act, and it is important to always pursue simple and elegant solutions.
14
+
15
+ Before implementing a feature or fixing a bug, consider all options. Instead of just listing similar choices or being bound by preconceptions and previous thinking, consider all options, including completely different approaches. Among the available options, choose the one that is the clearest, simplest, requires the fewest lines of code, and meets the user's requirements. There is no need to use iron plates and nails to repair torn clothes. Choose a right-sized, simple approach rather than an overly large and complex one.
16
+
17
+ Also avoid bringing unnecessary complexity into your code. Carefully examine related processing to ensure there are no impossible conditional branches or unnecessary try-catch blocks. Check the type definitions and actual processing, and remove any impossible conditional branches. There is no need to wrap code in a new try-catch block if an exception is unlikely to occur normally or if a try-catch already exists inside the called function.
18
+
19
+ ## Avoid reinventing the wheel
20
+
21
+ Reinventing the wheel should be avoided. Before adding code, check whether existing code in the project or the project's dependencies already provide functionality that covers part or all of that processing. When implementing complex processing, investigate whether a popular and well-maintained library that achieves equivalent functionality exists, and if so, propose using it to the user.
22
+
23
+ ## Keep only necessary changes
24
+
25
+ Keep the YAGNI (You aren't gonna need it) principle in mind. You should not introduce complexity just because you might need it in the future. Also, there is no need to maintain backward compatibility for unreleased features.
26
+
27
+ The code ultimately delivered to the user should be such that every line of change is necessary and no unnecessary code remains. Carefully review the diff line by line, rather than file by file, to ensure that all changes are truly necessary.
@@ -1,109 +1,109 @@
1
- ---
2
- name: web-master
3
- description: A skill outlining the fundamental principles to keep in mind when writing or editing web-related code. Read this skill before developing an implementation plan or writing or reviewing code for web-related tasks, and apply it to your work.
4
- license: MIT
5
- metadata:
6
- author: Robot-Inventor
7
- ---
8
-
9
- # Web Master
10
-
11
- Follow these instructions when writing web-related code.
12
-
13
- ## TypeScript
14
-
15
- ### Do not use type assertions
16
-
17
- Do not reach for type assertions unless you need one. Never add a type assertion up front because you think you might need it later. You may use a type assertion only when all of these conditions apply:
18
-
19
- - You first write the code without a type assertion and encounter a type error.
20
- - You cannot resolve that type error by improving type definitions elsewhere.
21
- - Adding the type assertion does not compromise type safety.
22
-
23
- ### Do not use `ReturnType`
24
-
25
- Do not use `ReturnType` unless you need it. Use the following approaches instead.
26
-
27
- If you need to use the return type of a specific function defined in the project somewhere other than that function:
28
-
29
- - For a simple primitive type such as `boolean` or `string`, write the type directly.
30
- - For a complex type, define a named type, specify it as the function's return type (`(): T => {}`), and reuse `T`.
31
-
32
- If you need the return type of a library function:
33
-
34
- - Check the function's type definitions first.
35
- - If the library exports that type, use the exported type.
36
- - If you need to pass the return type of another library function as a type argument and the library does not export that function's return type, you may use `ReturnType` inside the type argument.
37
- - If the library does not export the type:
38
- - Write the type directly if it is a simple primitive type.
39
- - Otherwise, you may use `ReturnType`.
40
-
41
- ```ts
42
- // Incorrect
43
- import foo from "foo";
44
-
45
- const myFunc = (): string => {...};
46
-
47
- const myFunc2 = (arg: ReturnType<typeof foo>, arg2: ReturnType<typeof myFunc>): number => {...};
48
-
49
- // Correct
50
- import type { FooResult } from "foo";
51
-
52
- const myFunc = (): string => {...};
53
-
54
- const myFunc2 = (arg: FooResult, arg2: string): number => {...};
55
- ```
56
-
57
- ### Prefer `as const satisfies` over type annotations
58
-
59
- Do not add type annotations unless you need them. Start by writing the code without a type annotation. If that causes a type error, first try to resolve it by improving type definitions elsewhere. Use a type annotation only as a last resort when those changes cannot solve the problem.
60
-
61
- When you write an object and need to guarantee that it conforms to a specific type, use `satisfies`. If the object will not change, also use `as const`.
62
-
63
- ```ts
64
- // Incorrect
65
- const foo: Record<string, string> = {
66
- bar: "bar",
67
- };
68
-
69
- // Correct
70
- const foo = {
71
- bar: "bar",
72
- } as const satisfies T;
73
- ```
74
-
75
- ### Do not disable ESLint rules
76
-
77
- Do not disable ESLint rules as an easy workaround. ESLint errors usually identify low-quality code rather than create pointless obstacles. Disabling a rule to silence an error leaves the underlying problem in place.
78
-
79
- Disable an ESLint rule only as a last resort when no better option exists. Handle ESLint errors as follows:
80
-
81
- 1. Understand what ESLint is reporting. Identify the affected code and the purpose behind the rule.
82
- 2. Improve the code in a way that addresses that purpose.
83
- 3. Disable the rule only when complying with it would make the code **excessively** complex, the warning is a clear false positive, you have another legitimate reason to disable it, or a possible fix would conflict with the rule's underlying intent.
84
-
85
- #### Examples
86
-
87
- The ESLint `sort-imports` rule defines a consistent import order. In properly modularized code, behavior should not depend on import order, so you should follow the rule.
88
-
89
- ```ts
90
- // Incorrect
91
- /* eslint-disable sort-imports */
92
- import foo from "foo";
93
- import bar from "bar";
94
-
95
- // Correct
96
- import bar from "bar";
97
- import foo from "foo";
98
- ```
99
-
100
- The `no-magic-numbers` rule exists to give numeric values meaningful names when their purpose would otherwise be unclear. You do not need to force an obvious value, such as `60` when it represents the number of seconds in a minute, into a constant just to satisfy the rule. In that case, disabling the rule is acceptable. Replacing `1` with a constant named `ONE` also defeats the purpose of `no-magic-numbers`. Give the value a meaningful name instead, or disable the rule if its meaning is already obvious. Also consider whether the number needs to be hard-coded in the first place.
101
-
102
- ```ts
103
- // Incorrect
104
- // eslint-disable-next-line no-magic-numbers
105
- if (myArray.length !== 0) {...}
106
-
107
- // Correct
108
- if (myArray.length) {...}
109
- ```
1
+ ---
2
+ name: web-master
3
+ description: A skill outlining the fundamental principles to keep in mind when writing or editing web-related code. Read this skill before developing an implementation plan or writing or reviewing code for web-related tasks, and apply it to your work.
4
+ license: MIT
5
+ metadata:
6
+ author: Robot-Inventor
7
+ ---
8
+
9
+ # Web Master
10
+
11
+ Follow these instructions when writing web-related code.
12
+
13
+ ## TypeScript
14
+
15
+ ### Do not use type assertions
16
+
17
+ Do not reach for type assertions unless you need one. Never add a type assertion up front because you think you might need it later. You may use a type assertion only when all of these conditions apply:
18
+
19
+ - You first write the code without a type assertion and encounter a type error.
20
+ - You cannot resolve that type error by improving type definitions elsewhere.
21
+ - Adding the type assertion does not compromise type safety.
22
+
23
+ ### Do not use `ReturnType`
24
+
25
+ Do not use `ReturnType` unless you need it. Use the following approaches instead.
26
+
27
+ If you need to use the return type of a specific function defined in the project somewhere other than that function:
28
+
29
+ - For a simple primitive type such as `boolean` or `string`, write the type directly.
30
+ - For a complex type, define a named type, specify it as the function's return type (`(): T => {}`), and reuse `T`.
31
+
32
+ If you need the return type of a library function:
33
+
34
+ - Check the function's type definitions first.
35
+ - If the library exports that type, use the exported type.
36
+ - If you need to pass the return type of another library function as a type argument and the library does not export that function's return type, you may use `ReturnType` inside the type argument.
37
+ - If the library does not export the type:
38
+ - Write the type directly if it is a simple primitive type.
39
+ - Otherwise, you may use `ReturnType`.
40
+
41
+ ```ts
42
+ // Incorrect
43
+ import foo from "foo";
44
+
45
+ const myFunc = (): string => {...};
46
+
47
+ const myFunc2 = (arg: ReturnType<typeof foo>, arg2: ReturnType<typeof myFunc>): number => {...};
48
+
49
+ // Correct
50
+ import type { FooResult } from "foo";
51
+
52
+ const myFunc = (): string => {...};
53
+
54
+ const myFunc2 = (arg: FooResult, arg2: string): number => {...};
55
+ ```
56
+
57
+ ### Prefer `as const satisfies` over type annotations
58
+
59
+ Do not add type annotations unless you need them. Start by writing the code without a type annotation. If that causes a type error, first try to resolve it by improving type definitions elsewhere. Use a type annotation only as a last resort when those changes cannot solve the problem.
60
+
61
+ When you write an object and need to guarantee that it conforms to a specific type, use `satisfies`. If the object will not change, also use `as const`.
62
+
63
+ ```ts
64
+ // Incorrect
65
+ const foo: Record<string, string> = {
66
+ bar: "bar",
67
+ };
68
+
69
+ // Correct
70
+ const foo = {
71
+ bar: "bar",
72
+ } as const satisfies T;
73
+ ```
74
+
75
+ ### Do not disable ESLint rules
76
+
77
+ Do not disable ESLint rules as an easy workaround. ESLint errors usually identify low-quality code rather than create pointless obstacles. Disabling a rule to silence an error leaves the underlying problem in place.
78
+
79
+ Disable an ESLint rule only as a last resort when no better option exists. Handle ESLint errors as follows:
80
+
81
+ 1. Understand what ESLint is reporting. Identify the affected code and the purpose behind the rule.
82
+ 2. Improve the code in a way that addresses that purpose.
83
+ 3. Disable the rule only when complying with it would make the code **excessively** complex, the warning is a clear false positive, you have another legitimate reason to disable it, or a possible fix would conflict with the rule's underlying intent.
84
+
85
+ #### Examples
86
+
87
+ The ESLint `sort-imports` rule defines a consistent import order. In properly modularized code, behavior should not depend on import order, so you should follow the rule.
88
+
89
+ ```ts
90
+ // Incorrect
91
+ /* eslint-disable sort-imports */
92
+ import foo from "foo";
93
+ import bar from "bar";
94
+
95
+ // Correct
96
+ import bar from "bar";
97
+ import foo from "foo";
98
+ ```
99
+
100
+ The `no-magic-numbers` rule exists to give numeric values meaningful names when their purpose would otherwise be unclear. You do not need to force an obvious value, such as `60` when it represents the number of seconds in a minute, into a constant just to satisfy the rule. In that case, disabling the rule is acceptable. Replacing `1` with a constant named `ONE` also defeats the purpose of `no-magic-numbers`. Give the value a meaningful name instead, or disable the rule if its meaning is already obvious. Also consider whether the number needs to be hard-coded in the first place.
101
+
102
+ ```ts
103
+ // Incorrect
104
+ // eslint-disable-next-line no-magic-numbers
105
+ if (myArray.length !== 0) {...}
106
+
107
+ // Correct
108
+ if (myArray.length) {...}
109
+ ```