@chc880/everything-antigravity 1.0.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.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +54 -0
  3. package/assets/rules/common/coding-style.md +53 -0
  4. package/assets/rules/common/git-workflow.md +47 -0
  5. package/assets/rules/common/patterns.md +36 -0
  6. package/assets/rules/common/performance.md +21 -0
  7. package/assets/rules/common/security.md +34 -0
  8. package/assets/rules/common/testing.md +29 -0
  9. package/assets/rules/golang/coding-style.md +40 -0
  10. package/assets/rules/golang/patterns.md +44 -0
  11. package/assets/rules/golang/security.md +33 -0
  12. package/assets/rules/golang/testing.md +30 -0
  13. package/assets/rules/python/coding-style.md +52 -0
  14. package/assets/rules/python/patterns.md +39 -0
  15. package/assets/rules/python/security.md +30 -0
  16. package/assets/rules/python/testing.md +38 -0
  17. package/assets/rules/typescript/coding-style.md +44 -0
  18. package/assets/rules/typescript/patterns.md +50 -0
  19. package/assets/rules/typescript/security.md +27 -0
  20. package/assets/rules/typescript/testing.md +24 -0
  21. package/assets/skills/agent-guides/SKILL.md +40 -0
  22. package/assets/skills/agent-guides/references/architect.md +209 -0
  23. package/assets/skills/agent-guides/references/build-error-resolver.md +530 -0
  24. package/assets/skills/agent-guides/references/code-reviewer.md +102 -0
  25. package/assets/skills/agent-guides/references/database-reviewer.md +652 -0
  26. package/assets/skills/agent-guides/references/doc-updater.md +450 -0
  27. package/assets/skills/agent-guides/references/e2e-runner.md +795 -0
  28. package/assets/skills/agent-guides/references/go-build-resolver.md +366 -0
  29. package/assets/skills/agent-guides/references/go-reviewer.md +265 -0
  30. package/assets/skills/agent-guides/references/planner.md +117 -0
  31. package/assets/skills/agent-guides/references/python-reviewer.md +467 -0
  32. package/assets/skills/agent-guides/references/refactor-cleaner.md +304 -0
  33. package/assets/skills/agent-guides/references/security-reviewer.md +543 -0
  34. package/assets/skills/agent-guides/references/tdd-guide.md +278 -0
  35. package/assets/skills/backend-patterns/SKILL.md +587 -0
  36. package/assets/skills/clickhouse-io/SKILL.md +429 -0
  37. package/assets/skills/coding-standards/SKILL.md +520 -0
  38. package/assets/skills/cpp-testing/SKILL.md +322 -0
  39. package/assets/skills/django-patterns/SKILL.md +733 -0
  40. package/assets/skills/django-security/SKILL.md +592 -0
  41. package/assets/skills/django-tdd/SKILL.md +728 -0
  42. package/assets/skills/django-verification/SKILL.md +460 -0
  43. package/assets/skills/frontend-patterns/SKILL.md +631 -0
  44. package/assets/skills/golang-patterns/SKILL.md +673 -0
  45. package/assets/skills/golang-testing/SKILL.md +719 -0
  46. package/assets/skills/java-coding-standards/SKILL.md +138 -0
  47. package/assets/skills/jpa-patterns/SKILL.md +141 -0
  48. package/assets/skills/knowledge-management/SKILL.md +77 -0
  49. package/assets/skills/nutrient-document-processing/SKILL.md +165 -0
  50. package/assets/skills/postgres-patterns/SKILL.md +146 -0
  51. package/assets/skills/python-patterns/SKILL.md +749 -0
  52. package/assets/skills/python-testing/SKILL.md +815 -0
  53. package/assets/skills/security-hardening/SKILL.md +76 -0
  54. package/assets/skills/security-review/SKILL.md +494 -0
  55. package/assets/skills/security-review/cloud-infrastructure-security.md +361 -0
  56. package/assets/skills/springboot-patterns/SKILL.md +304 -0
  57. package/assets/skills/springboot-security/SKILL.md +119 -0
  58. package/assets/skills/springboot-tdd/SKILL.md +157 -0
  59. package/assets/skills/springboot-verification/SKILL.md +100 -0
  60. package/assets/skills/tdd-workflow/SKILL.md +409 -0
  61. package/assets/workflows/build-fix.md +50 -0
  62. package/assets/workflows/code-review.md +61 -0
  63. package/assets/workflows/e2e.md +65 -0
  64. package/assets/workflows/go-build.md +39 -0
  65. package/assets/workflows/go-review.md +44 -0
  66. package/assets/workflows/go-test.md +61 -0
  67. package/assets/workflows/plan.md +93 -0
  68. package/assets/workflows/python-review.md +95 -0
  69. package/assets/workflows/setup-pm.md +36 -0
  70. package/assets/workflows/tdd.md +75 -0
  71. package/assets/workflows/verify.md +81 -0
  72. package/bin/cli.js +69 -0
  73. package/lib/installer.js +301 -0
  74. package/package.json +34 -0
@@ -0,0 +1,322 @@
1
+ ---
2
+ name: cpp-testing
3
+ description: Use only when writing/updating/fixing C++ tests, configuring GoogleTest/CTest, diagnosing failing or flaky tests, or adding coverage/sanitizers.
4
+ ---
5
+
6
+ # C++ Testing (Agent Skill)
7
+
8
+ Agent-focused testing workflow for modern C++ (C++17/20) using GoogleTest/GoogleMock with CMake/CTest.
9
+
10
+ ## When to Use
11
+
12
+ - Writing new C++ tests or fixing existing tests
13
+ - Designing unit/integration test coverage for C++ components
14
+ - Adding test coverage, CI gating, or regression protection
15
+ - Configuring CMake/CTest workflows for consistent execution
16
+ - Investigating test failures or flaky behavior
17
+ - Enabling sanitizers for memory/race diagnostics
18
+
19
+ ### When NOT to Use
20
+
21
+ - Implementing new product features without test changes
22
+ - Large-scale refactors unrelated to test coverage or failures
23
+ - Performance tuning without test regressions to validate
24
+ - Non-C++ projects or non-test tasks
25
+
26
+ ## Core Concepts
27
+
28
+ - **TDD loop**: red → green → refactor (tests first, minimal fix, then cleanups).
29
+ - **Isolation**: prefer dependency injection and fakes over global state.
30
+ - **Test layout**: `tests/unit`, `tests/integration`, `tests/testdata`.
31
+ - **Mocks vs fakes**: mock for interactions, fake for stateful behavior.
32
+ - **CTest discovery**: use `gtest_discover_tests()` for stable test discovery.
33
+ - **CI signal**: run subset first, then full suite with `--output-on-failure`.
34
+
35
+ ## TDD Workflow
36
+
37
+ Follow the RED → GREEN → REFACTOR loop:
38
+
39
+ 1. **RED**: write a failing test that captures the new behavior
40
+ 2. **GREEN**: implement the smallest change to pass
41
+ 3. **REFACTOR**: clean up while tests stay green
42
+
43
+ ```cpp
44
+ // tests/add_test.cpp
45
+ #include <gtest/gtest.h>
46
+
47
+ int Add(int a, int b); // Provided by production code.
48
+
49
+ TEST(AddTest, AddsTwoNumbers) { // RED
50
+ EXPECT_EQ(Add(2, 3), 5);
51
+ }
52
+
53
+ // src/add.cpp
54
+ int Add(int a, int b) { // GREEN
55
+ return a + b;
56
+ }
57
+
58
+ // REFACTOR: simplify/rename once tests pass
59
+ ```
60
+
61
+ ## Code Examples
62
+
63
+ ### Basic Unit Test (gtest)
64
+
65
+ ```cpp
66
+ // tests/calculator_test.cpp
67
+ #include <gtest/gtest.h>
68
+
69
+ int Add(int a, int b); // Provided by production code.
70
+
71
+ TEST(CalculatorTest, AddsTwoNumbers) {
72
+ EXPECT_EQ(Add(2, 3), 5);
73
+ }
74
+ ```
75
+
76
+ ### Fixture (gtest)
77
+
78
+ ```cpp
79
+ // tests/user_store_test.cpp
80
+ // Pseudocode stub: replace UserStore/User with project types.
81
+ #include <gtest/gtest.h>
82
+ #include <memory>
83
+ #include <optional>
84
+ #include <string>
85
+
86
+ struct User { std::string name; };
87
+ class UserStore {
88
+ public:
89
+ explicit UserStore(std::string /*path*/) {}
90
+ void Seed(std::initializer_list<User> /*users*/) {}
91
+ std::optional<User> Find(const std::string &/*name*/) { return User{"alice"}; }
92
+ };
93
+
94
+ class UserStoreTest : public ::testing::Test {
95
+ protected:
96
+ void SetUp() override {
97
+ store = std::make_unique<UserStore>(":memory:");
98
+ store->Seed({{"alice"}, {"bob"}});
99
+ }
100
+
101
+ std::unique_ptr<UserStore> store;
102
+ };
103
+
104
+ TEST_F(UserStoreTest, FindsExistingUser) {
105
+ auto user = store->Find("alice");
106
+ ASSERT_TRUE(user.has_value());
107
+ EXPECT_EQ(user->name, "alice");
108
+ }
109
+ ```
110
+
111
+ ### Mock (gmock)
112
+
113
+ ```cpp
114
+ // tests/notifier_test.cpp
115
+ #include <gmock/gmock.h>
116
+ #include <gtest/gtest.h>
117
+ #include <string>
118
+
119
+ class Notifier {
120
+ public:
121
+ virtual ~Notifier() = default;
122
+ virtual void Send(const std::string &message) = 0;
123
+ };
124
+
125
+ class MockNotifier : public Notifier {
126
+ public:
127
+ MOCK_METHOD(void, Send, (const std::string &message), (override));
128
+ };
129
+
130
+ class Service {
131
+ public:
132
+ explicit Service(Notifier &notifier) : notifier_(notifier) {}
133
+ void Publish(const std::string &message) { notifier_.Send(message); }
134
+
135
+ private:
136
+ Notifier &notifier_;
137
+ };
138
+
139
+ TEST(ServiceTest, SendsNotifications) {
140
+ MockNotifier notifier;
141
+ Service service(notifier);
142
+
143
+ EXPECT_CALL(notifier, Send("hello")).Times(1);
144
+ service.Publish("hello");
145
+ }
146
+ ```
147
+
148
+ ### CMake/CTest Quickstart
149
+
150
+ ```cmake
151
+ # CMakeLists.txt (excerpt)
152
+ cmake_minimum_required(VERSION 3.20)
153
+ project(example LANGUAGES CXX)
154
+
155
+ set(CMAKE_CXX_STANDARD 20)
156
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
157
+
158
+ include(FetchContent)
159
+ # Prefer project-locked versions. If using a tag, use a pinned version per project policy.
160
+ set(GTEST_VERSION v1.17.0) # Adjust to project policy.
161
+ FetchContent_Declare(
162
+ googletest
163
+ URL https://github.com/google/googletest/archive/refs/tags/${GTEST_VERSION}.zip
164
+ )
165
+ FetchContent_MakeAvailable(googletest)
166
+
167
+ add_executable(example_tests
168
+ tests/calculator_test.cpp
169
+ src/calculator.cpp
170
+ )
171
+ target_link_libraries(example_tests GTest::gtest GTest::gmock GTest::gtest_main)
172
+
173
+ enable_testing()
174
+ include(GoogleTest)
175
+ gtest_discover_tests(example_tests)
176
+ ```
177
+
178
+ ```bash
179
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
180
+ cmake --build build -j
181
+ ctest --test-dir build --output-on-failure
182
+ ```
183
+
184
+ ## Running Tests
185
+
186
+ ```bash
187
+ ctest --test-dir build --output-on-failure
188
+ ctest --test-dir build -R ClampTest
189
+ ctest --test-dir build -R "UserStoreTest.*" --output-on-failure
190
+ ```
191
+
192
+ ```bash
193
+ ./build/example_tests --gtest_filter=ClampTest.*
194
+ ./build/example_tests --gtest_filter=UserStoreTest.FindsExistingUser
195
+ ```
196
+
197
+ ## Debugging Failures
198
+
199
+ 1. Re-run the single failing test with gtest filter.
200
+ 2. Add scoped logging around the failing assertion.
201
+ 3. Re-run with sanitizers enabled.
202
+ 4. Expand to full suite once the root cause is fixed.
203
+
204
+ ## Coverage
205
+
206
+ Prefer target-level settings instead of global flags.
207
+
208
+ ```cmake
209
+ option(ENABLE_COVERAGE "Enable coverage flags" OFF)
210
+
211
+ if(ENABLE_COVERAGE)
212
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
213
+ target_compile_options(example_tests PRIVATE --coverage)
214
+ target_link_options(example_tests PRIVATE --coverage)
215
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
216
+ target_compile_options(example_tests PRIVATE -fprofile-instr-generate -fcoverage-mapping)
217
+ target_link_options(example_tests PRIVATE -fprofile-instr-generate)
218
+ endif()
219
+ endif()
220
+ ```
221
+
222
+ GCC + gcov + lcov:
223
+
224
+ ```bash
225
+ cmake -S . -B build-cov -DENABLE_COVERAGE=ON
226
+ cmake --build build-cov -j
227
+ ctest --test-dir build-cov
228
+ lcov --capture --directory build-cov --output-file coverage.info
229
+ lcov --remove coverage.info '/usr/*' --output-file coverage.info
230
+ genhtml coverage.info --output-directory coverage
231
+ ```
232
+
233
+ Clang + llvm-cov:
234
+
235
+ ```bash
236
+ cmake -S . -B build-llvm -DENABLE_COVERAGE=ON -DCMAKE_CXX_COMPILER=clang++
237
+ cmake --build build-llvm -j
238
+ LLVM_PROFILE_FILE="build-llvm/default.profraw" ctest --test-dir build-llvm
239
+ llvm-profdata merge -sparse build-llvm/default.profraw -o build-llvm/default.profdata
240
+ llvm-cov report build-llvm/example_tests -instr-profile=build-llvm/default.profdata
241
+ ```
242
+
243
+ ## Sanitizers
244
+
245
+ ```cmake
246
+ option(ENABLE_ASAN "Enable AddressSanitizer" OFF)
247
+ option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer" OFF)
248
+ option(ENABLE_TSAN "Enable ThreadSanitizer" OFF)
249
+
250
+ if(ENABLE_ASAN)
251
+ add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
252
+ add_link_options(-fsanitize=address)
253
+ endif()
254
+ if(ENABLE_UBSAN)
255
+ add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer)
256
+ add_link_options(-fsanitize=undefined)
257
+ endif()
258
+ if(ENABLE_TSAN)
259
+ add_compile_options(-fsanitize=thread)
260
+ add_link_options(-fsanitize=thread)
261
+ endif()
262
+ ```
263
+
264
+ ## Flaky Tests Guardrails
265
+
266
+ - Never use `sleep` for synchronization; use condition variables or latches.
267
+ - Make temp directories unique per test and always clean them.
268
+ - Avoid real time, network, or filesystem dependencies in unit tests.
269
+ - Use deterministic seeds for randomized inputs.
270
+
271
+ ## Best Practices
272
+
273
+ ### DO
274
+
275
+ - Keep tests deterministic and isolated
276
+ - Prefer dependency injection over globals
277
+ - Use `ASSERT_*` for preconditions, `EXPECT_*` for multiple checks
278
+ - Separate unit vs integration tests in CTest labels or directories
279
+ - Run sanitizers in CI for memory and race detection
280
+
281
+ ### DON'T
282
+
283
+ - Don't depend on real time or network in unit tests
284
+ - Don't use sleeps as synchronization when a condition variable can be used
285
+ - Don't over-mock simple value objects
286
+ - Don't use brittle string matching for non-critical logs
287
+
288
+ ### Common Pitfalls
289
+
290
+ - **Using fixed temp paths** → Generate unique temp directories per test and clean them.
291
+ - **Relying on wall clock time** → Inject a clock or use fake time sources.
292
+ - **Flaky concurrency tests** → Use condition variables/latches and bounded waits.
293
+ - **Hidden global state** → Reset global state in fixtures or remove globals.
294
+ - **Over-mocking** → Prefer fakes for stateful behavior and only mock interactions.
295
+ - **Missing sanitizer runs** → Add ASan/UBSan/TSan builds in CI.
296
+ - **Coverage on debug-only builds** → Ensure coverage targets use consistent flags.
297
+
298
+ ## Optional Appendix: Fuzzing / Property Testing
299
+
300
+ Only use if the project already supports LLVM/libFuzzer or a property-testing library.
301
+
302
+ - **libFuzzer**: best for pure functions with minimal I/O.
303
+ - **RapidCheck**: property-based tests to validate invariants.
304
+
305
+ Minimal libFuzzer harness (pseudocode: replace ParseConfig):
306
+
307
+ ```cpp
308
+ #include <cstddef>
309
+ #include <cstdint>
310
+ #include <string>
311
+
312
+ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
313
+ std::string input(reinterpret_cast<const char *>(data), size);
314
+ // ParseConfig(input); // project function
315
+ return 0;
316
+ }
317
+ ```
318
+
319
+ ## Alternatives to GoogleTest
320
+
321
+ - **Catch2**: header-only, expressive matchers
322
+ - **doctest**: lightweight, minimal compile overhead