@ryuenn3123/agentic-senior-core 6.15.0 → 6.16.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 (44) hide show
  1. package/.agents/plugins/agentic-senior-core/.codex-plugin/plugin.json +1 -1
  2. package/.agents/plugins/agentic-senior-core/commands/asc-reference.md +1 -1
  3. package/.agents/plugins/agentic-senior-core/commands/asc-reference.toml +2 -3
  4. package/.agents/plugins/agentic-senior-core/commands/asc-test.md +2 -0
  5. package/.agents/plugins/agentic-senior-core/commands/asc-test.toml +3 -0
  6. package/.agents/plugins/agentic-senior-core/hooks/lib/known-ui-slop-patterns.json +81 -1
  7. package/.agents/plugins/agentic-senior-core/plugin.json +1 -1
  8. package/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +3 -2
  9. package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +15 -6
  10. package/.agents/plugins/agentic-senior-core/skills/asc/references/writing-skills.md +72 -0
  11. package/.agents/plugins/agentic-senior-core/skills/asc-develop/SKILL.md +3 -4
  12. package/.agents/plugins/agentic-senior-core/skills/asc-reference/SKILL.md +55 -67
  13. package/.agents/plugins/agentic-senior-core/skills/asc-reference/references/api.md +108 -0
  14. package/.agents/plugins/agentic-senior-core/skills/asc-reference/references/database.md +97 -0
  15. package/.agents/plugins/agentic-senior-core/skills/asc-reference/references/infrastructure.md +102 -0
  16. package/.agents/plugins/agentic-senior-core/skills/asc-reference/references/resilience.md +87 -0
  17. package/.agents/plugins/agentic-senior-core/skills/asc-review/SKILL.md +20 -7
  18. package/.agents/plugins/agentic-senior-core/skills/asc-test/SKILL.md +104 -0
  19. package/.agents/plugins/agentic-senior-core/skills/asc-test/references/e2e-playwright.md +89 -0
  20. package/.agents/plugins/agentic-senior-core/skills/asc-test/references/flaky-tests.md +96 -0
  21. package/.agents/plugins/agentic-senior-core/skills/asc-test/references/regression-proof.md +58 -0
  22. package/.agents/plugins/agentic-senior-core/skills/asc-test/references/tdd-cycle.md +62 -0
  23. package/.agents/plugins/agentic-senior-core/skills/asc-test/references/test-design.md +75 -0
  24. package/.agents/plugins/agentic-senior-core/skills/asc-test/references/uat.md +62 -0
  25. package/.agents/plugins/agentic-senior-core/skills/asc-ui/SKILL.md +61 -127
  26. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/accessibility.md +102 -0
  27. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/copy-i18n.md +103 -0
  28. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/browser-surfaces.md +69 -0
  29. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/color-surfaces.md +46 -0
  30. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/motion.md +55 -0
  31. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/typography.md +49 -0
  32. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/divergence.md +127 -0
  33. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/mobile-responsive.md +115 -0
  34. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/experience.md +27 -0
  35. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/operate.md +53 -0
  36. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/persuade.md +72 -0
  37. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/read.md +43 -0
  38. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/redesign-audit.md +71 -0
  39. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/reflexes.md +59 -0
  40. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/states-feedback.md +148 -0
  41. package/README.md +1 -1
  42. package/gemini-extension.json +1 -1
  43. package/package.json +1 -1
  44. package/plugin.yaml +3 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-senior-core",
3
- "version": "6.15.0",
3
+ "version": "6.16.0",
4
4
  "description": "Universal AI coding rules. Write code like a staff engineer.",
5
5
  "skills": "./skills/",
6
6
  "hooks": "./hooks/hooks.json",
@@ -1 +1 @@
1
- Apply domain-specific engineering standards from skills/asc-reference/SKILL.md (RFC API design, database N+1/transactions, isolation testing contracts, infrastructure, and resilience).
1
+ Apply domain-specific engineering standards from skills/asc-reference/SKILL.md (RFC API design, database N+1/transactions, infrastructure configs, and service resilience).
@@ -1,3 +1,2 @@
1
- description = "Domain reference for APIs, database queries, testing, and resilience"
2
- prompt = "Load and follow the asc-reference skill. Apply standards for RFC API design, database N+1/transactions, isolation testing contracts, and service resilience."
3
-
1
+ description = "Domain reference for APIs, database queries, infrastructure, and resilience"
2
+ prompt = "Load and follow the asc-reference skill. Apply standards for RFC API design, database N+1/transactions, infrastructure configurations, and service resilience."
@@ -0,0 +1,2 @@
1
+ Run the testing, TDD, verification, and UAT standards from skills/asc-test/SKILL.md. Enforce the Iron Law (no production code without a failing test first), apply verification gates with fresh execution evidence, reproduce bugfixes with regression proofs, design boundary-isolated tests, and diagnose flaky tests.
2
+
@@ -0,0 +1,3 @@
1
+ description = "Test-driven development, verification gates, Playwright E2E, and UAT"
2
+ prompt = "Load and follow the asc-test skill. Enforce the Iron Law of TDD (no production code without a failing test first), apply verification gates with fresh execution evidence, perform regression proofs on bugfixes, design boundary-isolated tests without mocking the unit under test, and trace flaky tests."
3
+
@@ -59,6 +59,86 @@
59
59
  "id": "code-step-narration",
60
60
  "regex": "//\\s*Step\\s+[0-9]+:\\s*|//\\s*Initialize\\s+(?:the\\s+)?[a-zA-Z0-9_]+",
61
61
  "message": "note: procedural line-by-line comment narration detected. Describe non-obvious intent and constraints instead of restating the obvious code flow."
62
+ },
63
+ {
64
+ "id": "ui-eyebrow-tracked-caps",
65
+ "regex": "text-\\[(?:10|11|12)px\\][^\\n\"']*uppercase[^\\n\"']*tracking-(?:wider|widest)|uppercase[^\\n\"']*tracking-(?:wider|widest)[^\\n\"']*text-\\[(?:10|11|12)px\\]",
66
+ "message": "note: 'eyebrow micro-label' (tracked uppercase kicker above headings) is an AI template habit. Let headings carry their own weight."
67
+ },
68
+ {
69
+ "id": "ui-hard-offset-shadow",
70
+ "regex": "box-?shadow:\\s*['\"]?[1-9]px\\s+[1-9]px\\s+0\\b|shadow-\\[[1-9]px_[1-9]px_0",
71
+ "message": "note: 'hard offset shadow' (neo-brutalist block shadow) detected. Verify this matches project design language, or use subtle stepped elevation."
72
+ },
73
+ {
74
+ "id": "ui-zero-offset-glow",
75
+ "regex": "shadow-\\[0_0_[0-9]+px|box-shadow:\\s*0\\s+0\\s+[0-9]+px",
76
+ "message": "note: 'zero-offset glow' (neon ambient halo) is an AI aesthetic cliché. Prefer crisp 1px borders or directional elevation shadows."
77
+ },
78
+ {
79
+ "id": "ui-ghost-card",
80
+ "regex": "border\\s+border-[a-z0-9/-]+\\s+[^\\n\"']*shadow-(?:lg|xl|2xl)|shadow-(?:lg|xl|2xl)\\s+[^\\n\"']*border\\s+border-[a-z0-9/-]+",
81
+ "message": "note: 'ghost card' (declaring elevation twice with border + heavy shadow) detected. Choose one elevation model: a crisp 1px border OR an elevation shadow."
82
+ },
83
+ {
84
+ "id": "ui-viewport-100vh-mobile",
85
+ "regex": "(?:\\bh-screen\\b|height:\\s*100vh\\b)(?!.*dvh)",
86
+ "message": "warning: '100vh' / 'h-screen' causes content clipping under mobile browser address bars. Use '100dvh' or 'min-h-dvh' instead."
87
+ },
88
+ {
89
+ "id": "ui-fixed-button-width",
90
+ "regex": "<button[^>]*class(?:Name)?=[\"'][^\"']*\\bw-\\[[0-9]+px\\]|<button[^>]*style=[\"'][^\"']*width:\\s*[0-9]+px",
91
+ "message": "note: fixed-width button detected. Hardcoded widths cause text clipping in non-English locales (+20% to +40% expansion). Use padding and min-width."
92
+ },
93
+ {
94
+ "id": "ui-empty-state-essay",
95
+ "regex": "(?:looks like you haven't|blank canvas awaiting|getting started is easy and fun|your workspace is empty)",
96
+ "message": "note: flowery empty state copy detected. Keep empty states to 1 factual sentence plus a direct action button."
97
+ },
98
+ {
99
+ "id": "ui-modal-by-default",
100
+ "regex": "<(?:Dialog|Modal)[^>]*>(?=[\\s\\S]{0,500}<form)",
101
+ "message": "note: modal dialog enclosing simple form detected. Prefer inline progressive disclosure or dedicated route canvas over disruptive modals."
102
+ },
103
+ {
104
+ "id": "ui-missing-reduced-motion",
105
+ "regex": "@keyframes\\s+[a-zA-Z0-9_-]+(?![\\s\\S]{1,600}prefers-reduced-motion)",
106
+ "message": "note: CSS @keyframes animation without 'prefers-reduced-motion' query detected. Provide a static or reduced motion fallback."
107
+ },
108
+ {
109
+ "id": "ui-hover-scale-bounce",
110
+ "regex": "hover:scale-(?:105|110|125)",
111
+ "message": "note: 'hover:scale-105' bounce on buttons feels gimmicky in operational UI. Use snappy micro-feedback (transition-colors or active:scale-[0.98])."
112
+ },
113
+ {
114
+ "id": "copy-hybrid-neologism",
115
+ "regex": "\\b(meng-generate|di-submit|di-approve|di-cancel|meng-handle|di-delete|men-delete|me-restore|di-update|meng-update)\\b",
116
+ "message": "warning: hybrid neologism ('di-submit', 'meng-generate') detected. Maintain strict single-language purity (use native Indonesian terms or pure English)."
117
+ },
118
+ {
119
+ "id": "ui-card-in-card-nesting",
120
+ "regex": "class(?:Name)?=[\"'][^\"']*rounded-(?:xl|2xl)[^\"']*[\"'][^>]*>(?=[\\s\\S]{0,350}class(?:Name)?=[\"'][^\"']*rounded-(?:lg|xl|2xl))",
121
+ "message": "note: nested card containers ('card-in-card') detected. Use flat lists, hairline dividers, or recessed well surfaces instead of nesting cards."
122
+ },
123
+ {
124
+ "id": "ui-terracotta-cream-cliche",
125
+ "regex": "(?:bg-(?:amber|orange|yellow)-50|#fdfbf7)[\\s\\S]{0,250}(?:text-(?:amber|orange)-800|#c2410c)",
126
+ "message": "note: unprompted 'cream ground + terracotta accent' (Wave 3 AI editorial cliché) detected. Derive palette from project tokens or authentic material instead."
127
+ },
128
+ {
129
+ "id": "ui-index-number-trope",
130
+ "regex": "(?:\\b0[1-9]\\s*/\\s*0[1-9]\\b|\\(00[1-9]\\)|Step\\s+0[1-9])",
131
+ "message": "note: decorative index numbering ('01 / 02', '(001)') detected. Order sections by typography scale and content rather than performative index tags."
132
+ },
133
+ {
134
+ "id": "ui-broadsheet-cosplay",
135
+ "regex": "border-(?:t|b|l|r)\\s+border-border\\/[0-9]+\\s+rounded-none",
136
+ "message": "note: 'broadsheet cosplay' (dense hairline dividers with zero border-radius) detected. Structure layouts with spatial padding and tonal contrast."
137
+ },
138
+ {
139
+ "id": "ui-agency-micro-meta",
140
+ "regex": "(?:\\b\\d{1,2}\\.\\d+°\\s*[NSEW]\\b|©\\s*20\\d\\d\\s*—\\s*Scroll)",
141
+ "message": "note: performative agency metadata (geographic coordinates, fake version/scroll stamps) detected. Remove ornamental meta."
62
142
  }
63
143
  ]
64
- }
144
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-senior-core",
3
- "version": "6.15.0",
3
+ "version": "6.16.0",
4
4
  "description": "Universal AI coding rules. Because your AI writes code like it gets paid by the line.",
5
5
  "contextFileName": "rules/agentic-senior-core.md",
6
6
  "rules": [
@@ -82,8 +82,9 @@ When picking step 5 or 6 (unless trivial):
82
82
 
83
83
  ## Domain References & Skills (On-Demand)
84
84
  Detailed domain guidelines are loaded on-demand via skills or scoped rules:
85
- - **Testing, API Design, Database, Frontend, Infrastructure, Resilience** → run `/asc-reference`
86
- - **UI/UX Engineering & Anti-Slop Design** → run `/asc-ui`
85
+ - **Testing, TDD, Verification, E2E & UAT** → run `/asc-test`
86
+ - **API Design, Database, Infrastructure, Resilience** → run `/asc-reference`
87
+ - **Frontend UI/UX Engineering & Anti-Slop Design** → run `/asc-ui`
87
88
  - **Engineering Lifecycle & Features** → run `/asc-develop`
88
89
  - **Quality, Security & Duplication Audit** → run `/asc-review`
89
90
  - **Repository Meta & Configuration** → run `/asc`
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc
3
3
  description: >
4
- Trigger this skill when the user asks: "what are the rules", "coding guidelines", "best practices", "how should I write this", "staff engineer approach", "map this codebase", "document our patterns", "fingerprint this repository", "learn my preferences", "bootstrap preferences", "log this debt", "add to debt ledger", "install ASC", "configure for Cursor", "set up adapter", "apa aturannya", "panduan koding", "petakan codebase", "pasang asc". Covers Core Overview, Codebase Fingerprinting, Adaptive Preferences, Debt Tracking, and IDE Adapters.
4
+ Trigger this skill when the user asks: "what are the rules", "coding guidelines", "best practices", "how should I write this", "staff engineer approach", "map this codebase", "document our patterns", "fingerprint this repository", "learn my preferences", "bootstrap preferences", "log this debt", "add to debt ledger", "install ASC", "configure for Cursor", "set up adapter", "apa aturannya", "panduan koding", "petakan codebase", "pasang asc".
5
5
  ---
6
6
 
7
7
  # Agentic Senior Core: Architecture & Meta-Tools (`asc`)
@@ -10,15 +10,16 @@ Universal AI coding rules and meta-tooling playbook. Grounded in Google Engineer
10
10
 
11
11
  ---
12
12
 
13
- ## 1. The 5 Core Meta-Skills Architecture
13
+ ## 1. The 6 Core Meta-Skills Architecture
14
14
 
15
- Agentic Senior Core organizes operational guidance into 5 high-density, non-overlapping playbooks:
15
+ Agentic Senior Core organizes operational guidance into 6 high-density, non-overlapping playbooks:
16
16
 
17
- 1. **`/asc` (This Skill)**: Core engineering rules, codebase convention fingerprinting, adaptive preferences, debt tracking, and IDE adapter setup.
17
+ 1. **`/asc` (This Skill)**: Core engineering rules, codebase convention fingerprinting, adaptive preferences, debt tracking, skill authoring, and IDE adapter setup.
18
18
  2. **`/asc-develop`**: Engineering lifecycle for greenfield scaffolding, brownfield feature implementation, and structured refactoring.
19
19
  3. **`/asc-review`**: Quality and security assurance: production PR reviews, deep vulnerability audits (OWASP / ASI), and code clone deduplication.
20
- 4. **`/asc-reference`**: Domain architecture reference for REST/GraphQL APIs, database queries/migrations, testing contracts, infrastructure, and resilience.
21
- 5. **`/asc-ui`**: Human-interface engineering: UI visuals, UX microcopy hygiene, strict single-language localization, mobile reflow (`dvh`/`clamp`), and WCAG 2.2 AA accessibility.
20
+ 4. **`/asc-test`**: Dedicated testing playbook: the Iron Law of TDD, verification gates, Playwright E2E, UAT acceptance checklists, regression proofs, and flaky test remediation.
21
+ 5. **`/asc-reference`**: Domain architecture reference for REST/GraphQL APIs, database indexing/transactions/migrations, infrastructure configs, and service resilience.
22
+ 6. **`/asc-ui`**: Human-interface engineering: surface modes (Operate, Persuade, Read, Experience), UX microcopy hygiene, single-language localization, mobile reflow (`dvh`/`clamp`), and WCAG 2.2 AA accessibility.
22
23
 
23
24
  ---
24
25
 
@@ -73,3 +74,11 @@ asc adapter --all # Generate workspace adapters for all detected IDEs
73
74
  asc adapter --cursor # Generate adapter specifically for Cursor
74
75
  asc uninstall # Clean up adapter files and hooks
75
76
  ```
77
+
78
+ ---
79
+
80
+ ## 6. On-Demand Reference Library
81
+
82
+ | Topic | Reference Path |
83
+ |---|---|
84
+ | Authoring skills, trigger descriptions & 150-line routers | [references/writing-skills.md](references/writing-skills.md) |
@@ -0,0 +1,72 @@
1
+ # Authoring Agentic Skills & Routers
2
+
3
+ Engineering guidelines for creating high-performance, token-efficient skills for Antigravity, Claude Code, Codex, and other AI coding agents.
4
+
5
+ ---
6
+
7
+ ## 1. The Discovery & Routing Trap
8
+
9
+ Research into agent skill selection shows that models degrade in tool and skill routing when descriptions summarize internal workflows.
10
+
11
+ ### 1.1 The Description Rules
12
+ 1. **Trigger-Only Content:** Descriptions must contain ONLY triggering conditions: user tasks, symptom phrases, and file match patterns.
13
+ 2. **Zero Workflow Summaries:** Never describe how the skill works or what steps it executes inside the description. When a description outlines the workflow, the agent executes the summary directly and skips loading the full skill body.
14
+ 3. **Character Budget:** Keep descriptions concise (under 500 characters).
15
+ 4. **Symptom Keywords:** Include authentic user vocabulary, colloquial complaints (*"too slow"*, *"flaky"*, *"looks broken on mobile"*), and non-English equivalents (*"bikin tes"*, *"rapikan tampilan"*).
16
+
17
+ | Anti-Pattern Description (Banned) | Deterministic Trigger Description (Enforced) |
18
+ |---|---|
19
+ | `description: Handles Greenfield, Brownfield, and Refactoring workflows by researching analogous code, making a plan, and running tests.` | `description: Trigger when building a new feature, creating an endpoint, adding components, scaffolding a project, or refactoring existing code. Trigger when user says: 'add a feature', 'build endpoint', 'refactor this', 'clean up'.` |
20
+
21
+ ---
22
+
23
+ ## 2. The Router + On-Demand References Pattern
24
+
25
+ Loading complete domain encyclopedias into every agent session wastes prompt cache tokens and causes attention degradation.
26
+
27
+ ```
28
+ ┌────────────────────────────────────────────────────────┐
29
+ │ SKILL.md (Router: < 150 Lines) │
30
+ ├────────────────────────────────────────────────────────┤
31
+ │ 1. Trigger Frontmatter │
32
+ │ 2. The Quality Floor (Bans & Invariants) │
33
+ │ 3. Core Pre-flight & Classification Decision Tree │
34
+ │ 4. Reference Routing Table ────────┐ │
35
+ │ 5. Verification & Handoff Sweep │ │
36
+ └────────────────────────────────────┼───────────────────┘
37
+ │
38
+ ┌───────────────┴───────────────┐
39
+ ▼ ▼
40
+ ┌───────────────────────────┐ ┌───────────────────────────┐
41
+ │ references/domain-a.md │ │ references/domain-b.md │
42
+ │ (Loaded on demand only) │ │ (Loaded on demand only) │
43
+ └───────────────────────────┘ └───────────────────────────┘
44
+ ```
45
+
46
+ ### 2.1 The 150-Line Router Budget
47
+ `SKILL.md` must stay under 150 lines:
48
+ - **The Floor:** 10–15 unbending bans or architectural invariants.
49
+ - **Decision Engine:** High-level classification (Surface Modes, TDD tiers, Refine vs. Redesign).
50
+ - **Load Map:** A concise markdown table linking user tasks to specific files in `references/`.
51
+ - **Handoff Sweep:** Mechanical checklist executed before claiming completion.
52
+
53
+ ### 2.2 Deep Domain References (`references/*.md`)
54
+ Offload detailed explanations, code examples, schemas, and nuance to separate markdown files in `references/`. The agent reads only the relevant reference file when that specific branch of work executes.
55
+
56
+ ---
57
+
58
+ ## 3. The Zero Disk Checkpoint Invariant
59
+
60
+ Skills must never clutter user repositories with transient agent state files.
61
+
62
+ - **Banned:** Writing `PRD.md`, `workflow-gate.json`, `test-checklist.json`, or temporary progress trackers into the user's project root.
63
+ - **Enforced:** Store transient plans and state in conversation memory or agent brain artifacts (`brain/<id>/`). Read existing project documentation (`DESIGN.md`, `CONVENTIONS.md`) if present, but never mutate project directories without user instruction.
64
+
65
+ ---
66
+
67
+ ## 4. Verification Gates Over Written Promises
68
+
69
+ A skill without a verifiable gate is merely a suggestion.
70
+ - Every modification must be coupled with an automated verification command (linter, unit test, Playwright run, or slop pattern check).
71
+ - Mandate fresh execution evidence: require the agent to execute the runner fresh and verify exit code 0 before claiming completion.
72
+
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc-develop
3
3
  description: >
4
- Trigger this skill when the user is: building a new feature, creating an endpoint, adding components, scaffolding a new project, starting from scratch, or refactoring existing code. Trigger when the user says: "add a feature", "build this endpoint", "implement this", "extend this", "wire up", "create a new route", "add a new page", "tambah fitur", "bikin endpoint", "new project", "start from scratch", "scaffold this", "bootstrap app", "bikin project baru", "buat aplikasi baru", "refactor this", "clean up this code", "rewrite this", "extract this into", "simplify this module", "rapikan kode ini", "refactor ini". Handles Greenfield, Brownfield, and Refactoring workflows.
4
+ Trigger this skill when the user is: building a new feature, creating an endpoint, adding components, scaffolding a new project, starting from scratch, or refactoring existing code. Trigger when the user says: "add a feature", "build this endpoint", "implement this", "extend this", "wire up", "create a new route", "add a new page", "tambah fitur", "bikin endpoint", "new project", "start from scratch", "scaffold this", "bootstrap app", "bikin project baru", "buat aplikasi baru", "refactor this", "clean up this code", "rewrite this", "extract this into", "simplify this module", "rapikan kode ini", "refactor ini".
5
5
  ---
6
6
 
7
7
  # Engineering Lifecycle Playbook (`asc-develop`)
@@ -53,8 +53,8 @@ Use when adding endpoints, components, pages, or capabilities to an existing cod
53
53
  - How can the system recover? (Retry, cached fallback, degraded mode).
54
54
  3. If building UI, ensure compliance with `/asc-ui` (zero marketing fluff, single-language consistency, mobile reflow, WCAG AA contrast).
55
55
 
56
- ### Step 3: Implement & Validate
57
- 1. Implement the feature following the approved plan.
56
+ ### Step 3: Implement & Validate (TDD Integration)
57
+ 1. Follow the TDD cycle via `/asc-test`: write the failing test first (RED), write minimal code to pass (GREEN), then refactor.
58
58
  2. **Zero-Fake-Done Testing**: Run the project test suite (`ascx test`, `npm test`, `pytest`, `cargo test`). The test runner **MUST** exit with code 0.
59
59
  3. Never weaken or delete test assertions to simulate a passing run. Fix the underlying business logic.
60
60
 
@@ -82,4 +82,3 @@ Use when restructuring, simplifying, or modernizing code without changing extern
82
82
  ### Step 3: Verification
83
83
  1. Re-run tests to confirm that behavior, public contracts, and error handling remain identical.
84
84
  2. For every changed module, confirm that readability, maintainability, and safety have improved.
85
-
@@ -1,73 +1,61 @@
1
1
  ---
2
2
  name: asc-reference
3
3
  description: >
4
- Trigger this skill when the user is working on: unit tests, integration tests, REST APIs, GraphQL APIs, SQL queries, database migrations, React components, frontend layouts, Docker configs, CI/CD pipelines, Kubernetes manifests, or service resilience (retries, circuit breakers, rate limiting). Also trigger when the user says: "how should I test this", "design this API", "optimize this query", "set up Docker", "add retry logic", "write a test", "add pagination", "handle errors", "add loading state", "set up CI", "it keeps failing", "make it try again if it fails", "it's too slow with lots of data", "looks broken on mobile", "how do I deploy this", "will this break anything", "bagaimana cara ngetes ini", "bikin tes", "kok lambat banget", "tampilan di hp rusak", "cara deploy ini". Also trigger when editing files matching: `*.test.*`, `*.spec.*`, `Dockerfile`, `docker-compose.*`, `.github/workflows/*`, `*.sql`, or migration files.
4
+ Trigger this skill when working on: REST APIs, GraphQL APIs, SQL queries, database indexing, transactions, migrations, Docker configs, CI/CD pipelines, Kubernetes manifests, or service resilience. Also trigger when the user says: "design this API", "optimize query", "database transaction", "set up Docker", "add retry logic", "add pagination", "handle errors", "set up CI", "kok lambat banget", "cara deploy ini". Also trigger when editing files matching: `Dockerfile`, `docker-compose.*`, `.github/workflows/*`, `*.sql`, or migration files.
5
5
  ---
6
6
 
7
- # ASC Domain Reference
8
-
9
- Domain-specific coding rules for testing, API design, database queries, frontend components, infrastructure configs, and service resilience. Load this skill when working on any of these domains.
10
-
11
- Grounded in: WCAG 2.2 AA (accessibility), Fowler's Money Pattern (monetary types), Nygard's Release It! (resilience patterns), AWS Well-Architected Reliability Pillar (backoff/circuit breakers), OWASP Secure Coding Practices (input validation, logging).
12
-
13
- ## Testing
14
-
15
- - New business logic requires at least one happy path test and one primary failure mode test.
16
- - Never mock the unit under test — mock only external dependencies and boundaries. Prefer real in-process doubles (e.g. `node:sqlite`, in-memory repositories, or MSW network interceptors) over fragile behavioral mock spies.
17
- - Tests assert behavior and contracts, not implementation details. Must be fast, isolated, deterministic.
18
- - Cover happy path, error paths, edge cases, and empty states.
19
- - Integration tests for critical data paths. Sensitive mutations need idempotency or duplicate-submit coverage.
20
- - CI pipelines block on test failures.
21
-
22
- ## API Design
23
-
24
- - Consistent resource naming and HTTP semantics (follow RFC 9110; RFC 9457 for problem details).
25
- - Bounded list reads: always paginate or set explicit limits.
26
- - Idempotent for side-effect mutations (support `Idempotency-Key` headers for safe retries). Document retry behavior.
27
- - Backward-compatible by default. Version breaking changes explicitly.
28
- - Sync docs in the same commit when changing API, CLI, or schema.
29
-
30
- ## Database
31
-
32
- - Use eager loading or batching to eliminate N+1 queries.
33
- - Paginate all growable datasets. No unbounded queries.
34
- - Multi-table mutations run inside transactions.
35
- - Monetary amounts: integer minor units or exact decimal. Never floats.
36
- - Timestamps in UTC. No naive timestamps.
37
- - Schema changes require versioned, reversible migrations.
38
- - Never modify merged migrations. Create new ones.
39
-
40
- ## Frontend
41
-
42
- - Match the project's existing styling paradigm (Tailwind, CSS Modules, Vanilla CSS, styled-components, etc.). Do not introduce a new CSS framework or build tool without explicit user confirmation.
43
- - UI Component Reusability: Primitive UI elements (buttons, inputs, cards, dialogs, badges) must have a single source of truth in the shared component directory (`components/` or `ui/`). Never recreate ad-hoc variants or duplicate JSX structures across individual pages. Extend existing components with props or variants instead of cloning.
44
- - Design Consistency: Consume shared design tokens, CSS variables, or theme configuration for colors, spacing, and border-radius. Do not hardcode arbitrary raw color hexes or inconsistent spacing that causes visual design drift between pages.
45
- - Action Feedback & Mutations: Any user-initiated mutation (form submit, delete, upload, toggle) must provide immediate pending feedback (disabled button, inline spinner) and a visible completion notification (toast or alert banner with retry). Never silently swallow mutation errors.
46
- - Form Validation: Render field errors inline directly next to the affected input with `aria-describedby` and `aria-invalid="true"`. Never use floating toasts for individual form input validation.
47
- - Data-Fetching State Quad: Data components must explicitly handle 4 states — loading skeleton/spinner, empty state (friendly message + call to action), error fallback (clear message + retry button), and populated data.
48
- - Component Error Boundaries: Wrap major widgets, dashboards, and routes in localized Error Boundaries with fallback UI cards to prevent a single rendering crash from taking down the entire page.
49
- - Accessible Notifications: Toast and status messages must use ARIA live regions (`role="status"`, `aria-live="polite"` for non-urgent feedback; `role="alert"` for critical errors). Never steal keyboard focus for toasts.
50
- - WCAG 2.2 AA accessibility floor. Responsive by default.
51
- - No placeholder, lorem, or TODO content in production UI.
52
- - UI/UX Microcopy & Anti-Slop: For comprehensive UX writing, redundancy elimination, single-language localization hygiene, and layout de-sloppification, load the dedicated `/asc-ui` skill (`skills/asc-ui/SKILL.md`).
53
-
54
- ## Infrastructure
55
-
56
- - Container configs: multi-stage builds, minimal base images, non-root users, no baked secrets.
57
- - Configuration from environment, validated at startup. Fail fast if invalid.
58
- - Structured logging with correlation IDs. No PII in logs.
59
-
60
- ## Resilience
61
-
62
- - Every outbound network call has a strict timeout (client and server).
63
- - Retries use exponential backoff with jitter and max attempt limits.
64
- - Only retry idempotent operations (GET, PUT, DELETE, or requests with `Idempotency-Key`).
65
- - Dependency Fallback Strategy (Hard vs Soft):
66
- - Hard dependencies (core workflow blocks without them): Fail fast, roll back transactions, return structured RFC 9457 error with actionable explanation.
67
- - Soft dependencies (non-critical enhancements): Provide graceful fallbacks:
68
- - *Static Fallback*: Return safe default values, static placeholders, or empty collections instead of throwing unhandled exceptions.
69
- - *Stale Cache Fallback*: Serve last-known-good cached state (`stale-while-revalidate`) with an offline/stale indicator.
70
- - *Degraded Mode*: Isolate and disable the failing peripheral widget while preserving core user journeys.
71
- - Circuit breakers for unhealthy dependencies to fail fast and prevent thread/resource exhaustion.
72
- - Offline Detection: Detect offline network status and notify users before initiating network requests that are guaranteed to fail.
7
+ # Domain Engineering Reference Router
73
8
 
9
+ Staff-grade architectural standards for APIs, databases, infrastructure, and distributed resilience. Enforces baseline invariants and routes deep domain guidance on demand.
10
+
11
+ ---
12
+
13
+ ## 1. The Core Engineering Floor
14
+
15
+ Every backend and infrastructure change must satisfy these baseline invariants:
16
+
17
+ 1. **RFC 9457 Problem Details:** All API error responses must return structured JSON problem details with actionable error types and HTTP status codes.
18
+ 2. **Bounded Reads:** Every list query or API endpoint must enforce pagination or explicit limits. Unbounded scans are forbidden.
19
+ 3. **Idempotent Mutations:** Side-effect mutations must accept an `Idempotency-Key` header and return cached responses on repeat requests.
20
+ 4. **ACID Transactions:** Any multi-table mutation or read-then-write sequence must run inside an explicit database transaction.
21
+ 5. **No N+1 Queries:** Database queries inside loops are forbidden; use eager loading, joins, or batching (DataLoader).
22
+ 6. **Precision Data Types:** Monetary amounts must use integer minor units (cents) or `NUMERIC(18, 4)`. Floating point (`FLOAT`/`DOUBLE`) for currency is banned.
23
+ 7. **UTC Timestamps:** All dates and times must be stored in UTC (`TIMESTAMPTZ` or ISO-8601 strings).
24
+ 8. **Reversible Migrations:** Schema changes require reversible migrations using Expand-and-Contract for zero-downtime evolution.
25
+ 9. **Container Security:** Multi-stage Docker builds, non-root users (`USER node`/`USER 10001`), and zero baked credentials.
26
+ 10. **Zero-Hang Timeouts:** Every outbound network call must specify explicit connection and read timeouts.
27
+ 11. **Jittered Backoff:** Retries must use exponential backoff with full jitter and limit attempts to safe idempotent methods.
28
+
29
+ ---
30
+
31
+ ## 2. On-Demand Reference Library
32
+
33
+ Load these references only when working on that specific domain:
34
+
35
+ | Domain | Scope & Substance | Reference Path |
36
+ |---|---|---|
37
+ | **API Design** | REST semantics, cursor pagination, RFC 9457, GraphQL DataLoader, query complexity | [references/api.md](references/api.md) |
38
+ | **Database** | B-Tree indexing, N+1 prevention, row locking (`FOR UPDATE`), expand-and-contract | [references/database.md](references/database.md) |
39
+ | **Infrastructure** | Multi-stage Docker, non-root users, 12-factor env validation, liveness/readiness | [references/infrastructure.md](references/infrastructure.md) |
40
+ | **Resilience** | Timeouts, full jitter backoff, circuit breakers, hard vs soft dependency fallbacks | [references/resilience.md](references/resilience.md) |
41
+
42
+ ---
43
+
44
+ ## 3. Dependency Classification: Hard vs. Soft
45
+
46
+ Before writing integration code, classify external services:
47
+ - **Hard Dependency (Core Workflow):** Fail fast, roll back local database transactions, and return an RFC 9457 error to the caller.
48
+ - **Soft Dependency (Auxiliary/Enhancement):** Provide graceful fallback:
49
+ 1. *Stale Cache:* Return last-known-good cached state (`stale-while-revalidate`).
50
+ 2. *Static Safe Default:* Return empty collections or static safe placeholders.
51
+ 3. *Degraded Mode:* Isolate and disable the peripheral widget without breaking primary journeys.
52
+
53
+ ---
54
+
55
+ ## 4. Verification & Handoff Sweep
56
+
57
+ Before completing backend or infrastructure work:
58
+ 1. Verify query execution plan (`EXPLAIN ANALYZE`) for newly introduced SQL queries.
59
+ 2. Verify all outbound network calls have timeout parameters.
60
+ 3. Validate startup configuration fails fast on missing environment variables.
61
+ 4. Confirm migrations run cleanly in both `up` and `down` directions.
@@ -0,0 +1,108 @@
1
+ # API Design: REST & GraphQL Standards
2
+
3
+ Production APIs must be predictable, idempotent, strictly typed, and backward-compatible.
4
+
5
+ ---
6
+
7
+ ## 1. REST API Architecture & HTTP Semantics (RFC 9110)
8
+
9
+ ### 1.1 Resource Naming & URI Grammar
10
+ - Use plural nouns for resource collections: `/v1/projects`, `/v1/projects/{id}/deployments`.
11
+ - Use HTTP verbs for actions:
12
+ - `GET`: Safe, idempotent retrieval. No body.
13
+ - `POST`: Create a resource or trigger a non-idempotent operation.
14
+ - `PUT`: Idempotent full replacement of the resource.
15
+ - `PATCH`: Partial update of specific fields (prefer JSON Merge Patch RFC 7396).
16
+ - `DELETE`: Idempotent removal of the resource.
17
+
18
+ ### 1.2 Bounded Collections & Pagination
19
+ Every endpoint returning a list must enforce an upper limit to prevent memory exhaustion:
20
+ - **Cursor-based pagination (Recommended for real-time/large datasets):**
21
+ - Query parameters: `?after=cursor_xyz&limit=50`.
22
+ - Response envelope:
23
+ ```json
24
+ {
25
+ "items": [...],
26
+ "page_info": {
27
+ "has_next_page": true,
28
+ "end_cursor": "cursor_xyz"
29
+ }
30
+ }
31
+ ```
32
+ - **Offset pagination (For simple admin portals):**
33
+ - Query parameters: `?page=1&per_page=25` (enforce max `per_page=100`).
34
+ - Return pagination metadata in headers: `X-Total-Count`, `Link: <...>; rel="next"`.
35
+
36
+ ### 1.3 Mutation Idempotency (The `Idempotency-Key` Header)
37
+ Critical mutations (payments, resource creation, batch operations) must accept an `Idempotency-Key` header:
38
+ 1. When receiving a mutation request with `Idempotency-Key: <uuid>`:
39
+ - Check cache/database for existing key within TTL (e.g. 24 hours).
40
+ - If key exists and processing is in progress: return `409 Conflict` or wait.
41
+ - If key exists and completed: return the cached response (headers + body) immediately.
42
+ - If new key: save key with state `PENDING`, execute mutation in transaction, store result, return response.
43
+
44
+ ---
45
+
46
+ ## 2. Structured Error Details (RFC 9457)
47
+
48
+ Never return generic error strings like `{"error": "Something went wrong"}`. Use RFC 9457 Problem Details:
49
+
50
+ ```json
51
+ {
52
+ "type": "https://api.example.com/errors/validation-failed",
53
+ "title": "Validation Failed",
54
+ "status": 422,
55
+ "detail": "The request payload failed validation constraints.",
56
+ "instance": "/v1/projects/proj_982/deployments",
57
+ "invalid_params": [
58
+ {
59
+ "name": "branch",
60
+ "reason": "Branch 'feature/beta' does not exist in the connected repository."
61
+ }
62
+ ]
63
+ }
64
+ ```
65
+
66
+ - Always return the appropriate HTTP status code (`400`, `401`, `403`, `404`, `409`, `422`, `429`, `500`, `503`).
67
+ - Set `Content-Type: application/problem+json`.
68
+
69
+ ---
70
+
71
+ ## 3. GraphQL Standards
72
+
73
+ ### 3.1 N+1 Query Elimination via DataLoader
74
+ GraphQL resolvers execute independently, naturally producing N+1 database queries.
75
+ - **Enforced:** Wrap database lookups in a batching mechanism (e.g., `DataLoader` in JS, `graphene-dataloader` in Python):
76
+ ```typescript
77
+ const userLoader = new DataLoader(async (userIds: readonly string[]) => {
78
+ const users = await db.users.findMany({ where: { id: { in: [...userIds] } } });
79
+ const userMap = new Map(users.map(u => [u.id, u]));
80
+ return userIds.map(id => userMap.get(id) || null);
81
+ });
82
+ ```
83
+
84
+ ### 3.2 Query Depth & Complexity Limits
85
+ Protect GraphQL endpoints against Denial-of-Service (DoS) via deeply nested circular queries:
86
+ - Configure maximum query depth (e.g., maximum depth of 6).
87
+ - Implement query cost analysis: reject queries whose calculated complexity score exceeds budget.
88
+
89
+ ### 3.3 Explicit Mutation Errors (Result Unions)
90
+ Model business failures as schema types rather than top-level GraphQL errors:
91
+ ```graphql
92
+ type TransferSuccess {
93
+ transactionId: ID!
94
+ newBalance: Float!
95
+ }
96
+
97
+ type InsufficientFundsError {
98
+ available: Float!
99
+ required: Float!
100
+ }
101
+
102
+ union TransferResult = TransferSuccess | InsufficientFundsError
103
+
104
+ type Mutation {
105
+ transferMoney(input: TransferInput!): TransferResult!
106
+ }
107
+ ```
108
+
@@ -0,0 +1,97 @@
1
+ # Database Engineering: Indexing, Transactions & Migrations
2
+
3
+ Relational and document databases underpin application state. High-traffic systems fail most frequently at the database boundary.
4
+
5
+ ---
6
+
7
+ ## 1. Indexing Strategies & Query Optimization
8
+
9
+ Indexes turn full table scans ($O(N)$) into logarithmic tree lookups ($O(\log N)$). Unindexed queries are the primary source of production latency spikes.
10
+
11
+ ### 1.1 Index Placement Rules
12
+ - **Foreign Keys:** Always index foreign key columns (`author_id`, `org_id`). Database engines do not automatically index foreign keys, leading to full table scans during cascade checks and joins.
13
+ - **Filter & Sort Predicates:** Index columns present in `WHERE`, `ORDER BY`, and `GROUP BY` clauses.
14
+ - **Leftmost Prefix Rule for Composite Indexes:** An index on `(org_id, status, created_at)` accelerates:
15
+ - `WHERE org_id = ?`
16
+ - `WHERE org_id = ? AND status = ?`
17
+ - `WHERE org_id = ? AND status = ? ORDER BY created_at`
18
+ - *It does NOT accelerate:* `WHERE status = ?` alone. Order columns by cardinality and filter frequency.
19
+
20
+ ### 1.2 Partial Indexes
21
+ Save index size and write overhead by indexing only active rows:
22
+ ```sql
23
+ -- Accelerates lookups for active users without indexing millions of deleted rows
24
+ CREATE INDEX idx_users_active_email ON users (email) WHERE deleted_at IS NULL;
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 2. N+1 Query Prevention
30
+
31
+ Never execute database queries inside an application loop:
32
+
33
+ ```typescript
34
+ // BANNED: 1 initial query + N separate queries for authors
35
+ const posts = await db.posts.findMany();
36
+ for (const post of posts) {
37
+ post.author = await db.users.findUnique({ where: { id: post.authorId } });
38
+ }
39
+
40
+ // ENFORCED: 1 query with join or batch preload
41
+ const posts = await db.posts.findMany({
42
+ include: { author: true }
43
+ });
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 3. Transaction Boundaries & Concurrency Control
49
+
50
+ Any operation modifying more than one table, or reading state to calculate a mutation, must be guarded by an ACID transaction.
51
+
52
+ ### 3.1 Lost Update Prevention (Pessimistic Locking)
53
+ When decrementing balances or claiming inventory, reading then writing in two queries creates a race condition:
54
+
55
+ ```sql
56
+ -- BANNED: Two concurrent requests read balance = 100, both deduct 50, final balance 50 instead of 0
57
+ SELECT balance FROM accounts WHERE id = 1;
58
+ UPDATE accounts SET balance = balance - 50 WHERE id = 1;
59
+
60
+ -- ENFORCED: Pessimistic Row Lock inside transaction
61
+ BEGIN;
62
+ SELECT balance FROM accounts WHERE id = 1 FOR UPDATE;
63
+ -- Validate balance >= 50
64
+ UPDATE accounts SET balance = balance - 50 WHERE id = 1;
65
+ COMMIT;
66
+ ```
67
+
68
+ ---
69
+
70
+ ## 4. Zero-Downtime Migrations: The Expand-and-Contract Pattern
71
+
72
+ Never perform breaking schema alterations (renaming columns, changing column types, deleting columns) in a single deployment step. Use the Expand-and-Contract pattern across three deployments:
73
+
74
+ ```
75
+ Deployment 1 (Expand) Deployment 2 (Migrate & Read) Deployment 3 (Contract)
76
+ ────────────────────── ──────────────────────────── ───────────────────────
77
+ Add new column `new_col` Application writes both cols Drop old column `old_col`
78
+ Application writes both Reads from `new_col` Remove dual-write logic
79
+ Backfill historical data All code points to `new_col` Migration complete
80
+ ```
81
+
82
+ ### 4.1 Migration Invariants
83
+ - **Non-blocking Index Creation:** In PostgreSQL, always use `CREATE INDEX CONCURRENTLY` to avoid locking the table against writes. Set a statement lock timeout: `SET lock_timeout = '5s'`.
84
+ - **Never Edit Merged Migrations:** Once a migration has been committed and run in shared environments, treat it as immutable. Author a new corrective migration instead.
85
+ - **Reversibility:** Every migration must provide a valid `down` step that reverses schema modifications cleanly.
86
+
87
+ ---
88
+
89
+ ## 5. Data Types: Precision & Time
90
+
91
+ 1. **Monetary Amounts:**
92
+ - **Strictly Banned:** `FLOAT`, `DOUBLE`, `REAL`. Floating-point arithmetic produces rounding inaccuracies (`0.1 + 0.2 = 0.30000000000000004`).
93
+ - **Enforced:** Integer minor units (e.g. storing USD as integer cents: `$19.99` $\to$ `1999`) or exact fixed-point `NUMERIC(18, 4)`.
94
+ 2. **Timestamps:**
95
+ - Store all timestamps in UTC with timezone: `TIMESTAMPTZ` (Postgres) or ISO-8601 UTC strings (`2026-11-04T10:00:00Z`).
96
+ - Never store naive local times without timezone offset.
97
+