waitsec 0.5.0 → 0.5.2

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.
@@ -2,7 +2,7 @@
2
2
  "name": "waitsec",
3
3
  "displayName": "waitsec",
4
4
  "description": "Practical guardrails for AI coding agents. Hold on, think first, code less.",
5
- "version": "0.5.0",
5
+ "version": "0.5.2",
6
6
  "author": {
7
7
  "name": "fastroware"
8
8
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waitsec",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Practical guardrails for AI coding agents. Hold on, think first, code less.",
5
5
  "main": "rules/waitsec.md",
6
6
  "bin": {
package/plugin.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "waitsec",
3
3
  "description": "Practical guardrails for AI coding agents. Hold on, think first, code less.",
4
- "version": "0.5.0"
4
+ "version": "0.5.2"
5
5
  }
@@ -11,20 +11,27 @@ Do not turn a simple 10-line requirement into a 12-file enterprise architecture.
11
11
 
12
12
  ---
13
13
 
14
- ## Anti-Patterns (The Tells)
14
+ ## Detailed Pitfalls & The 5-Point Rule
15
15
 
16
16
  ### 1. Architecture Theater
17
- - **Tell:** For a simple database query or form submission, the agent creates an Interface, a Repository class, a Data Transfer Object (DTO), an Event class, an Event Listener, and a Service Layer class across 6 different directories.
18
- - **Why:** The AI is showing off patterns it learned from enterprise codebases, adding cognitive overhead and boilerplate with zero practical benefit.
19
- - **Fix:** Write the logic directly in the existing controller or domain handler using standard framework idioms. Introduce layers only when concrete business complexity demands it.
17
+
18
+ * **The Bad Habit:** For a simple database query or form submission, the agent creates an Interface, a Repository class, a Data Transfer Object (DTO), an Event class, an Event Listener, and a Service Layer class across 6 different directories.
19
+ * **The Problem:** Six new files and several layers of indirection now wrap logic that could live in one method.
20
+ * **Why It Fails:** Every extra layer must be read, wired, and maintained. The real behavior is buried under boilerplate, so reviews and bug hunts take longer.
21
+ * **Clean Fix:** Write the logic directly in the existing controller or domain handler using standard framework idioms. Introduce a layer only when concrete business complexity demands it.
22
+ * **The Waitsec Way:** Build for today's requirement. Complexity must be earned by a real problem, not added as decoration.
20
23
 
21
24
  ### 2. Speculative Future-Proofing
22
- - **Tell:** Writing code with plugin architectures, abstract factories, or strategy patterns for hypothetical requirements that may never exist ("in case we switch database engines later").
23
- - **Why:** YAGNI (You Aren't Gonna Need It). Speculative architecture is technical debt written before the feature is even used.
24
- - **Fix:** Build for the current requirement. Refactor when the second concrete use case arrives, not before.
25
+
26
+ * **The Bad Habit:** Writing plugin architectures, abstract factories, or strategy patterns for requirements that may never exist ("in case we switch database engines later").
27
+ * **The Problem:** The code carries branches and abstractions that are never actually exercised.
28
+ * **Why It Fails:** YAGNI (You Aren't Gonna Need It). Speculative architecture is technical debt written before the feature is even used.
29
+ * **Clean Fix:** Build for the current requirement. Refactor when the second concrete use case arrives, not before.
30
+ * **The Waitsec Way:** Solve the problem in front of you. Let real needs pull the design forward.
25
31
 
26
32
  ### 3. Empty Wrapper Abstractions
27
- - **Tell:** Creating helper functions or classes that merely pass arguments straight through to an underlying library method with no added logic:
33
+
34
+ * **The Bad Habit:** Creating helper functions or classes that only pass arguments straight through to an underlying library method with no added logic:
28
35
  ```php
29
36
  class StringHelper {
30
37
  public static function toLower($str) {
@@ -32,13 +39,18 @@ Do not turn a simple 10-line requirement into a 12-file enterprise architecture.
32
39
  }
33
40
  }
34
41
  ```
35
- - **Why:** It adds an extra layer of indirection to read and maintain for zero added value.
36
- - **Fix:** Call the native or framework method directly.
42
+ * **The Problem:** Every caller now travels through an extra layer that adds nothing.
43
+ * **Why It Fails:** Readers have to open the wrapper to learn it does nothing. The indirection costs time and invites more pointless wrappers.
44
+ * **Clean Fix:** Call the native or framework method directly.
45
+ * **The Waitsec Way:** A function must add behavior or clarify intent. If it does neither, delete it.
37
46
 
38
47
  ### 4. Dependency Addiction
39
- - **Tell:** Pulling in a third-party npm package, composer package, or Python module to solve a trivial problem that can be handled in 3 lines of native code (e.g. date formatting or string padding).
40
- - **Why:** Every third-party dependency introduces supply-chain security risks, version conflicts, and maintenance burden.
41
- - **Fix:** Use native language and framework utilities first.
48
+
49
+ * **The Bad Habit:** Pulling in a third-party npm package, composer package, or Python module to solve a trivial problem that can be handled in 3 lines of native code (e.g. date formatting or string padding).
50
+ * **The Problem:** A new dependency appears in the manifest for work the standard library already does.
51
+ * **Why It Fails:** Every third-party dependency introduces supply-chain security risks, version conflicts, and maintenance burden for the whole team.
52
+ * **Clean Fix:** Use native language and framework utilities first. Add a package only when it solves genuinely complex work.
53
+ * **The Waitsec Way:** Every dependency is a long-term promise. Make it only when it clearly pays off.
42
54
 
43
55
  ---
44
56
 
@@ -101,7 +113,7 @@ The following security practices are **mandatory in all generated code**:
101
113
 
102
114
  ### Task: "Add an endpoint to cancel an order"
103
115
 
104
- **Bad (Overengineered):**
116
+ **Bad (Overengineered):**
105
117
  - `CancelOrderCommand.php`
106
118
  - `CancelOrderCommandHandler.php`
107
119
  - `OrderRepositoryInterface.php`
@@ -110,7 +122,7 @@ The following security practices are **mandatory in all generated code**:
110
122
  - `OrderCancellationDTO.php`
111
123
  - Total: 6 files, 150 lines of boilerplate, yet forgot to check if the order belongs to the logged-in user!
112
124
 
113
- **Good (Lean & Secure):**
125
+ **Good (Lean & Secure):**
114
126
  - `OrderController.php` (checks `$this->authorize('cancel', $order)`, updates status, dispatches existing notification).
115
127
  - Total: 1 file, 15 lines of clear, secure, readable code.
116
128
 
@@ -11,27 +11,39 @@ When requirements are ambiguous, do not invent answers. Stop, pause, and clarify
11
11
 
12
12
  ---
13
13
 
14
- ## Anti-Patterns (The Tells)
14
+ ## Detailed Pitfalls & The 5-Point Rule
15
15
 
16
16
  ### 1. Premature Scaffolding
17
- - **Tell:** User says "add photo upload", and the agent immediately writes database migrations, thumbnail background jobs, AWS S3 storage adapters, and cleanup cron tasks without asking a single question.
18
- - **Why:** The user might only have wanted a temporary avatar upload saved to local disk. Generating infrastructure based on unconfirmed assumptions wastes tokens and creates code the user has to delete.
19
- - **Fix:** Stop before writing code. Identify what is missing (storage target, max size, accepted formats, single vs multiple) and confirm the essentials.
17
+
18
+ * **The Bad Habit:** The user says "add photo upload", and the agent immediately writes database migrations, thumbnail background jobs, cloud storage adapters, and cleanup cron tasks without asking a single question.
19
+ * **The Problem:** The agent produces infrastructure the user never confirmed. The feature might only need to save one avatar to local disk.
20
+ * **Why It Fails:** The user has to review and delete code they never asked for. Tokens are wasted, and the bloated diff hides the real feature.
21
+ * **Clean Fix:** Stop before writing code. List what is genuinely missing (storage target, max size, allowed formats, one file or many) and confirm the essentials first.
22
+ * **The Waitsec Way:** Confirm the shape of the feature before you build it. A short question costs far less than a wrong implementation.
20
23
 
21
24
  ### 2. Inventing Business Rules
22
- - **Tell:** User asks for "a discount calculation on checkout", and the agent invents a 15% VIP tier, coupon expiration policies, and minimum spend rules that were never mentioned.
23
- - **Why:** AI hallucinates business logic out of habit to make the code look "complete". Invented rules confuse the product requirements.
24
- - **Fix:** If rules are unspecified, ask the user, or implement only the direct formula requested with a clean placeholder for future rules.
25
+
26
+ * **The Bad Habit:** The user asks for "a discount calculation on checkout", and the agent invents a 15% VIP tier, coupon expiration rules, and minimum spend limits that were never mentioned.
27
+ * **The Problem:** The code ships with product rules that came from the model, not from the user.
28
+ * **Why It Fails:** Invented rules quietly change how the product behaves. The user then has to hunt through the diff to find decisions they never approved.
29
+ * **Clean Fix:** If a rule is unspecified, ask. If you cannot ask, implement only the exact formula requested and leave one clear placeholder for future rules.
30
+ * **The Waitsec Way:** You are not the product owner. Never fill a business gap with a guess.
25
31
 
26
32
  ### 3. Destructive Replacement
27
- - **Tell:** User asks to "improve the navigation bar", and the agent completely deletes the existing navbar component and replaces it with a completely different framework or design.
28
- - **Why:** The agent assumes replacement is always preferred over enhancement.
29
- - **Fix:** Clarify whether the existing implementation should be modified in place or replaced from scratch.
33
+
34
+ * **The Bad Habit:** The user asks to "improve the navigation bar", and the agent deletes the existing component and rebuilds it with a different framework or design.
35
+ * **The Problem:** Working, tested code is thrown away and replaced by an unrequested rewrite.
36
+ * **Why It Fails:** Edge cases and accessibility details handled by the original are lost. The user asked for an improvement and got unpredictable regressions instead.
37
+ * **Clean Fix:** Clarify whether the current implementation should be edited in place or replaced from scratch. Default to editing in place.
38
+ * **The Waitsec Way:** Improve what already exists before replacing it. Respect the code the team already trusts.
30
39
 
31
40
  ### 4. Trivia Interrogation (The Opposite Extreme)
32
- - **Tell:** The agent stops and bombards the user with 10 pedantic questions about internal variable names, CSS class naming conventions, or folder structures that have obvious conventions.
33
- - **Why:** Over-asking frustrates the user and defeats the purpose of an autonomous coding assistant.
34
- - **Fix:** Ask only questions that materially change the architecture or user-facing behavior. Use sensible defaults for everything else.
41
+
42
+ * **The Bad Habit:** The agent stops and fires 10 pedantic questions about internal variable names, CSS class names, or folder structure.
43
+ * **The Problem:** The user is blocked on decisions that have obvious conventions and almost no consequence.
44
+ * **Why It Fails:** Over-asking frustrates the user and removes the value of an autonomous assistant. The work stalls on details.
45
+ * **Clean Fix:** Ask only what changes the architecture or user-facing behavior. Use sensible defaults for everything else, and state the defaults you chose.
46
+ * **The Waitsec Way:** Ask about decisions that are expensive to reverse, not about details you can settle with existing conventions.
35
47
 
36
48
  ---
37
49
 
@@ -9,27 +9,39 @@ Never guess the cause of an error when real technical evidence is available. Do
9
9
 
10
10
  ---
11
11
 
12
- ## Anti-Patterns (The Tells)
12
+ ## Detailed Pitfalls & The 5-Point Rule
13
13
 
14
14
  ### 1. The Shotgun Guess
15
- - **Tell:** A test fails or a crash occurs, and the agent immediately edits three different files, tweaking logic in random places without identifying why execution failed.
16
- - **Why:** The AI acts on statistical intuition rather than empirical debugging, often introducing new bugs while failing to fix the original one.
17
- - **Fix:** Never touch a single line of code until you have identified the exact file, line number, and runtime state that triggered the failure.
15
+
16
+ * **The Bad Habit:** A test fails or a crash occurs, and the agent immediately edits three different files, tweaking logic in random places without identifying why execution failed.
17
+ * **The Problem:** Changes land in files that may have nothing to do with the failure, and the original bug remains.
18
+ * **Why It Fails:** The AI acts on statistical intuition rather than empirical debugging, often introducing new bugs while failing to fix the original one.
19
+ * **Clean Fix:** Never touch a single line of code until you have identified the exact file, line number, and runtime state that triggered the failure.
20
+ * **The Waitsec Way:** Read the evidence first. A fix without a cause is just another guess.
18
21
 
19
22
  ### 2. Silent Error Swallowing
20
- - **Tell:** When an exception is thrown, the agent wraps the crashing block in a generic `try/catch` and leaves the catch block empty, or returns an empty fallback (`return null;`) just to stop the crash from bubbling up.
21
- - **Why:** Silencing errors masks underlying data corruption and turns a loud, easily fixable bug into a silent, catastrophic production failure.
22
- - **Fix:** Fix the root cause so the operation succeeds safely. If catching an exception is truly necessary, log the error with full diagnostic context and handle the failure gracefully.
23
+
24
+ * **The Bad Habit:** When an exception is thrown, the agent wraps the crashing block in a generic `try/catch` and leaves the catch block empty, or returns an empty fallback (`return null;`) just to stop the crash from bubbling up.
25
+ * **The Problem:** The crash disappears, but the broken state that caused it stays in place.
26
+ * **Why It Fails:** Silencing errors masks underlying data corruption and turns a loud, easily fixable bug into a silent, catastrophic production failure.
27
+ * **Clean Fix:** Fix the root cause so the operation succeeds safely. If catching an exception is truly necessary, log the error with full diagnostic context and handle the failure gracefully.
28
+ * **The Waitsec Way:** Never hide an error to make the output look clean. Silence is not a fix.
23
29
 
24
30
  ### 3. Surface Symptom Patching
25
- - **Tell:** Seeing `TypeError: Cannot read property 'id' of undefined`, the agent adds optional chaining (`user?.id`) or a null check (`if (!user) return;`), without checking *why* `user` was undefined in the first place.
26
- - **Why:** Masking a missing variable upstream causes corrupted state downstream.
27
- - **Fix:** Trace the data flow backwards. Find where `user` was loaded, why it failed to resolve, and fix the source query or relationship.
31
+
32
+ * **The Bad Habit:** Seeing `TypeError: Cannot read property 'id' of undefined`, the agent adds optional chaining (`user?.id`) or a null check (`if (!user) return;`), without checking *why* `user` was undefined in the first place.
33
+ * **The Problem:** The symptom is masked and the missing value flows deeper into the system.
34
+ * **Why It Fails:** Masking a missing variable upstream causes corrupted state downstream, where the real damage is harder to trace.
35
+ * **Clean Fix:** Trace the data flow backwards. Find where `user` was loaded, why it failed to resolve, and fix the source query or relationship.
36
+ * **The Waitsec Way:** Fix the source, not the symptom. Chase the cause one step up the chain.
28
37
 
29
38
  ### 4. Hallucinating Missing Dependencies
30
- - **Tell:** An import fails or a class is not found (often due to a typo or incorrect namespace), and the agent immediately attempts to run `npm install <random-package>` or `composer require`.
31
- - **Why:** The agent assumes missing functionality means missing packages, cluttering the project with unneeded external dependencies.
32
- - **Fix:** Check for typos, path mismatches, autoloading issues, or missing exports first.
39
+
40
+ * **The Bad Habit:** An import fails or a class is not found (often due to a typo or incorrect namespace), and the agent immediately attempts to run `npm install <random-package>` or `composer require`.
41
+ * **The Problem:** The project gains a new dependency to solve what was really a typo or a path mistake.
42
+ * **Why It Fails:** The agent assumes missing functionality means missing packages, cluttering the project with unneeded external dependencies.
43
+ * **Clean Fix:** Check for typos, path mismatches, autoloading issues, or missing exports first.
44
+ * **The Waitsec Way:** Confirm the cause before adding weight. Most "missing" things are already there, just named wrong.
33
45
 
34
46
  ---
35
47
 
@@ -9,27 +9,39 @@ Do not turn a one-line bug fix into a 15-file git diff. Keep your changes laser-
9
9
 
10
10
  ---
11
11
 
12
- ## Anti-Patterns (The Tells)
12
+ ## Detailed Pitfalls & The 5-Point Rule
13
13
 
14
14
  ### 1. Collateral Reformatting
15
- - **Tell:** Fixing a bug on line 42, but running an aggressive formatter that reformats 300 lines of whitespace, indentation, quote styles, or trailing commas across the entire file.
16
- - **Why:** Pollutes git history, makes `git blame` useless, and introduces merge conflicts for teammates working on the same branch.
17
- - **Fix:** Format only the lines you touched. Leave existing indentation and formatting untouched.
15
+
16
+ * **The Bad Habit:** Fixing a bug on line 42, but running an aggressive formatter that reformats 300 lines of whitespace, indentation, quote styles, or trailing commas across the entire file.
17
+ * **The Problem:** The real fix is now buried inside a wall of unrelated formatting changes.
18
+ * **Why It Fails:** It pollutes git history, makes `git blame` useless, and creates merge conflicts for teammates working on the same branch.
19
+ * **Clean Fix:** Format only the lines you touched. Leave existing indentation and formatting untouched.
20
+ * **The Waitsec Way:** A diff should show the solution, not a style argument. Touch only what the task requires.
18
21
 
19
22
  ### 2. Gratuitous Renaming & Style Imposition
20
- - **Tell:** Changing working code to suit personal style preferences (e.g. converting traditional functions to arrow functions, switching `let` to `const` on unrelated variables, renaming helper methods) in sections unrelated to the prompt.
21
- - **Why:** Every modified line carries the risk of unintended regression and distraction during code review.
22
- - **Fix:** Keep your hands off working code outside the prompt scope. Respect the prevailing style of the file.
23
+
24
+ * **The Bad Habit:** Changing working code to suit personal style preferences (e.g. converting traditional functions to arrow functions, switching `let` to `const` on unrelated variables, renaming helper methods) in sections unrelated to the prompt.
25
+ * **The Problem:** The diff fills with cosmetic edits that have nothing to do with the request.
26
+ * **Why It Fails:** Every modified line carries the risk of unintended regression and distracts the reviewer from the actual change.
27
+ * **Clean Fix:** Keep your hands off working code outside the prompt scope. Respect the prevailing style of the file.
28
+ * **The Waitsec Way:** Match the file you are editing, not the style in your head. Consistency beats personal preference.
23
29
 
24
30
  ### 3. File Scope Creep
25
- - **Tell:** Asked to change the label of a button, the agent touches the button component, the router, the global theme CSS, and updates `package.json` dependencies.
26
- - **Why:** The AI over-reaches, treating every task as an invitation to overhaul the project.
27
- - **Fix:** Modify only the files strictly required to implement the request. If touching a secondary file seems necessary, verify whether a simpler solution exists that avoids it.
31
+
32
+ * **The Bad Habit:** Asked to change the label of a button, the agent touches the button component, the router, the global theme CSS, and updates `package.json` dependencies.
33
+ * **The Problem:** Four files changed for a one-word edit.
34
+ * **Why It Fails:** The AI over-reaches, treating every task as an invitation to overhaul the project. This hides the real change and multiplies the chance of breakage.
35
+ * **Clean Fix:** Modify only the files strictly required to implement the request. If touching a secondary file seems necessary, verify whether a simpler solution exists that avoids it.
36
+ * **The Waitsec Way:** Stay inside the blast radius of the prompt. Small changes stay easy to review and easy to revert.
28
37
 
29
38
  ### 4. Wholesale File Rewriting
30
- - **Tell:** Replacing a 400-line file with a newly generated version when only 5 lines needed an update, accidentally stripping out edge-case logic or comments that existed in the original.
31
- - **Why:** Generative models love generating whole files from scratch rather than performing surgical edits.
32
- - **Fix:** Use targeted diffs or line-level edits. Always inspect the original file to ensure existing functionality is preserved.
39
+
40
+ * **The Bad Habit:** Replacing a 400-line file with a newly generated version when only 5 lines needed an update, accidentally stripping out edge-case logic or comments that existed in the original.
41
+ * **The Problem:** The new file looks clean but silently drops behavior the original had.
42
+ * **Why It Fails:** Generative models love generating whole files from scratch rather than performing surgical edits. That habit erases years of accumulated fixes.
43
+ * **Clean Fix:** Use targeted diffs or line-level edits. Always inspect the original file to ensure existing functionality is preserved.
44
+ * **The Waitsec Way:** Edit the file you have, do not replace it. The original carries context that a fresh generation cannot.
33
45
 
34
46
  ---
35
47
 
@@ -11,27 +11,39 @@ Never say "I'm done" or "The bug is fixed" without concrete technical proof. Alw
11
11
 
12
12
  ---
13
13
 
14
- ## Anti-Patterns (The Tells)
14
+ ## Detailed Pitfalls & The 5-Point Rule
15
15
 
16
16
  ### 1. The Premature Victory Lap
17
- - **Tell:** The agent modifies code, never runs a test or build command, and immediately announces: *"I have fixed the issue and implemented all requirements!"*
18
- - **Why:** The AI relies on statistical confidence instead of empirical execution. In reality, a missing semicolon, wrong import, or syntax error often lurks on the first line.
19
- - **Fix:** Run the relevant test suite, build command, or reproduction script before writing your closing message.
17
+
18
+ * **The Bad Habit:** The agent modifies code, never runs a test or build command, and immediately announces: *"I have fixed the issue and implemented all requirements!"*
19
+ * **The Problem:** The claim of success has no command output behind it.
20
+ * **Why It Fails:** The AI relies on statistical confidence instead of empirical execution. In reality, a missing semicolon, wrong import, or syntax error often lurks on the first line.
21
+ * **Clean Fix:** Run the relevant test suite, build command, or reproduction script before writing your closing message.
22
+ * **The Waitsec Way:** Done means proven. Confidence is not evidence.
20
23
 
21
24
  ### 2. Regression Blindness
22
- - **Tell:** Fixing a bug in component A, but accidentally breaking components B and C because shared state, schema, or props were modified without running the full test suite.
23
- - **Why:** The AI focuses narrowly on the prompt and ignores downstream dependencies.
24
- - **Fix:** If the project has automated tests (`npm test`, `pytest`, `php artisan test`, `go test`), run them to ensure no regressions were introduced.
25
+
26
+ * **The Bad Habit:** Fixing a bug in component A, but accidentally breaking components B and C because shared state, schema, or props were modified without running the full test suite.
27
+ * **The Problem:** The targeted fix silently damages neighboring features.
28
+ * **Why It Fails:** The AI focuses narrowly on the prompt and ignores downstream dependencies, so the team discovers the breakage in production.
29
+ * **Clean Fix:** If the project has automated tests (`npm test`, `pytest`, `php artisan test`, `go test`), run them to ensure no regressions were introduced.
30
+ * **The Waitsec Way:** A local fix is only safe when the whole system still works. Check the neighbors.
25
31
 
26
32
  ### 3. Phantom Verification
27
- - **Tell:** The agent claims *"I tested the login endpoint and it returned status 200"* when no terminal command, curl request, or test runner was actually executed in the environment.
28
- - **Why:** Generative models hallucinate successful outcomes based on expectation.
29
- - **Fix:** Real verification produces real output. If execution tools are available, run the command and inspect the actual stdout/stderr. If tools are unavailable, instruct the user on the exact command to run.
33
+
34
+ * **The Bad Habit:** The agent claims *"I tested the login endpoint and it returned status 200"* when no terminal command, curl request, or test runner was actually executed in the environment.
35
+ * **The Problem:** The stated result is invented, not observed.
36
+ * **Why It Fails:** Generative models hallucinate successful outcomes based on expectation. The user trusts a report that never happened.
37
+ * **Clean Fix:** Real verification produces real output. If execution tools are available, run the command and inspect the actual stdout/stderr. If tools are unavailable, instruct the user on the exact command to run.
38
+ * **The Waitsec Way:** Report only what you actually ran. If you did not run it, say so.
30
39
 
31
40
  ### 4. Happy-Path Myopia
32
- - **Tell:** Testing only the success state (e.g. valid login) while completely ignoring error states (wrong password, empty inputs, network failure, unauthorized access).
33
- - **Why:** AI naturally gravitates toward the ideal flow.
34
- - **Fix:** Verify both the happy path and at least one failure/edge case before declaring completion.
41
+
42
+ * **The Bad Habit:** Testing only the success state (e.g. valid login) while completely ignoring error states (wrong password, empty inputs, network failure, unauthorized access).
43
+ * **The Problem:** The feature looks complete until a real user triggers a failure case.
44
+ * **Why It Fails:** AI naturally gravitates toward the ideal flow, so the failure branches ship untested and break at the worst time.
45
+ * **Clean Fix:** Verify both the happy path and at least one failure/edge case before declaring completion.
46
+ * **The Waitsec Way:** The edges are where software breaks. Verify the failure path, not just the demo path.
35
47
 
36
48
  ---
37
49
 
@@ -21,21 +21,96 @@ Activate this skill whenever:
21
21
 
22
22
  ---
23
23
 
24
- ## Core Guardrails
24
+ ## Part 1: Comments and Noise
25
25
 
26
- ### 1. Anti-Comment Pollution
27
- - **Explain Why, Never What:** Do not write comments that narrate what the next line of code does (`// Loop through users`, `// Return response`). Code should read like plain English.
28
- - **Self-Documenting Code:** If a code block needs explanation, extract it into a descriptively named helper function or variable instead of writing explanatory comments.
29
- - **Zero Dead Code:** Remove commented-out code blocks immediately. Version control handles history.
26
+ ### 1. Narration Comments
30
27
 
31
- ### 2. Clean Code & Simplicity
32
- - **Single Responsibility:** Functions must do one thing well. Break functions exceeding 30-40 lines into focused, composable helpers.
33
- - **Flatten Nesting:** Use early returns (guard clauses) to avoid deeply nested `if/else` statements. Keep cyclomatic complexity low.
34
- - **Intent-Revealing Naming:** Use domain-accurate, pronounceable names. Avoid vague acronyms, generic names (`data`, `info`, `temp`), or type suffixes in identifiers.
28
+ * **The Bad Habit:** Adding comments that narrate the next line of code (`// Loop through users`, `// Return response`).
29
+ * **The Problem:** The code says the same thing twice: once in the comment, once in the line below.
30
+ * **Why It Fails:** Comments rot. When the logic changes, the narration stays stale and misleads the next reader, and it pads every diff with noise.
31
+ * **Clean Fix:** Delete the narration. If a block genuinely needs explaining, extract it into a well-named function or variable:
32
+ ```js
33
+ // Bad: the comment repeats the code
34
+ // Calculate total with tax
35
+ const t = price + price * 0.1;
35
36
 
36
- ### 3. Dependency Hygiene
37
- - **Native-First:** Use built-in standard library utilities (native `fetch`, standard date methods, built-in string functions) before reaching for external packages.
38
- - **Audit Footprint:** Before suggesting a new dependency, verify that the package is actively maintained, light, and solves a genuinely complex problem.
37
+ // Good: the name explains it
38
+ const totalWithTax = price + price * taxRate;
39
+ ```
40
+ * **The Waitsec Way:** Code should read like plain English. Explain why when it is not obvious, never what the line already says.
41
+
42
+ ### 2. Dead Commented-Out Code
43
+
44
+ * **The Bad Habit:** Leaving old code commented out "just in case", or commenting a block out instead of deleting it.
45
+ * **The Problem:** The file carries ghost code that no compiler or test touches.
46
+ * **Why It Fails:** Readers cannot tell whether the block is a plan, a workaround, or garbage. It hides the real change and grows the diff.
47
+ * **Clean Fix:** Delete it. Version control keeps the history, and the file stays honest.
48
+ * **The Waitsec Way:** The current file should describe the current system only. The past belongs to git.
49
+
50
+ ---
51
+
52
+ ## Part 2: Structure and Size
53
+
54
+ ### 3. Functions That Do Too Much
55
+
56
+ * **The Bad Habit:** Writing one long function that validates input, queries the database, maps a response, and sends an email.
57
+ * **The Problem:** The function grows past 30 to 40 lines and now has several reasons to change.
58
+ * **Why It Fails:** Tests need to set up all of those jobs at once, and a fix for one job risks breaking the others.
59
+ * **Clean Fix:** Split by responsibility: validate in one place, query in another, respond in another. Keep each function focused on one thing.
60
+ * **The Waitsec Way:** One function, one job. Small pieces are easier to test, reuse, and trust.
61
+
62
+ ### 4. Deeply Nested Conditionals
63
+
64
+ * **The Bad Habit:** Nesting `if/else` blocks five levels deep until the happy path sits in the middle.
65
+ * **The Problem:** The reader must hold every condition in their head at the same time.
66
+ * **Why It Fails:** Deep nesting hides edge cases and makes the exit conditions hard to see. Bugs love that.
67
+ * **Clean Fix:** Use guard clauses and early returns to handle invalid cases first, then leave the main path flat:
68
+ ```js
69
+ // Bad: nested
70
+ if (user) {
71
+ if (user.active) {
72
+ if (user.role === 'admin') {
73
+ return doWork(user);
74
+ }
75
+ }
76
+ }
77
+ return null;
78
+
79
+ // Good: flat
80
+ if (!user) return null;
81
+ if (!user.active) return null;
82
+ if (user.role !== 'admin') return null;
83
+ return doWork(user);
84
+ ```
85
+ * **The Waitsec Way:** Handle what is wrong up front. Keep the main path at the top level.
86
+
87
+ ---
88
+
89
+ ## Part 3: Naming
90
+
91
+ ### 5. Vague Names
92
+
93
+ * **The Bad Habit:** Naming things `data`, `info`, `temp`, `handleStuff`, or `process2`.
94
+ * **The Problem:** The name tells the reader nothing about what the value holds or does.
95
+ * **Why It Fails:** Every reader has to trace the value back to its source to understand it, which slows the whole team.
96
+ * **Clean Fix:** Use domain names that reveal intent (`activeOrders`, `invoiceTotal`, `retryCount`). Rename when the purpose becomes clear.
97
+ * **The Waitsec Way:** Names are documentation. A precise name removes the need for a comment.
98
+
99
+ ---
100
+
101
+ ## Part 4: Dependencies
102
+
103
+ ### 6. A Dependency for a Three-Line Problem
104
+
105
+ * **The Bad Habit:** Installing a package to format a date, pad a string, or check an email.
106
+ * **The Problem:** The manifest grows for work the standard library already does.
107
+ * **Why It Fails:** Each dependency adds supply-chain risk, version conflicts, and updates you must track for the life of the project.
108
+ * **Clean Fix:** Use built-in utilities first. Add a package only when it solves something genuinely complex:
109
+ ```js
110
+ // Instead of a date library
111
+ const formatted = new Intl.DateTimeFormat('en-US', { dateStyle: 'medium' }).format(new Date());
112
+ ```
113
+ * **The Waitsec Way:** Native first. A dependency is a long-term commitment, not a shortcut.
39
114
 
40
115
  ---
41
116