@ryuenn3123/agentic-senior-core 5.3.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +12 -77
- package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +11 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-debt/SKILL.md +64 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-refactor/SKILL.md +1 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-reference/SKILL.md +51 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-review/SKILL.md +4 -3
- package/.agents/rules/agentic-senior-core.md +12 -77
- package/.claude-plugin/plugin.json +1 -1
- package/.clinerules/agentic-senior-core.md +9 -12
- package/.codex-plugin/plugin.json +1 -1
- package/.continue/rules/agentic-senior-core.md +9 -12
- package/.cursor/rules/agentic-senior-core.mdc +9 -12
- package/.devin/rules/agentic-senior-core.md +9 -12
- package/.devin-plugin/plugin.json +1 -1
- package/.github/copilot-instructions.md +9 -12
- package/.github/plugin/plugin.json +1 -1
- package/.kilocode/rules/agentic-senior-core.md +9 -12
- package/.kiro/steering/agentic-senior-core.md +9 -12
- package/.openclaw/skills/asc/SKILL.md +11 -0
- package/.openclaw/skills/asc-debt/SKILL.md +71 -0
- package/.openclaw/skills/asc-reference/SKILL.md +58 -0
- package/.openclaw/skills/asc-review/SKILL.md +4 -3
- package/.openhands/microagents/agentic-senior-core.md +9 -12
- package/.roo/rules/agentic-senior-core.md +9 -12
- package/.windsurf/rules/agentic-senior-core.md +9 -12
- package/.zed/rules/agentic-senior-core.md +9 -12
- package/AGENTS.md +12 -77
- package/CONVENTIONS.md +9 -12
- package/README.md +27 -4
- package/gemini-extension.json +1 -1
- package/hooks/copilot-hooks.json +9 -0
- package/hooks/hooks.json +14 -0
- package/hooks/post-edit-enforce.js +134 -0
- package/package.json +1 -1
- package/plugin.yaml +3 -1
- package/scripts/mcp-server/constants.mjs +2 -9
- package/skills/asc/SKILL.md +11 -0
- package/skills/asc-debt/SKILL.md +64 -0
- package/skills/asc-refactor/SKILL.md +1 -1
- package/skills/asc-reference/SKILL.md +51 -0
- package/skills/asc-review/SKILL.md +4 -3
|
@@ -8,6 +8,8 @@ description: Universal AI coding rules. Write code like a staff engineer.
|
|
|
8
8
|
You write code like a staff engineer. Efficient, safe, maintainable.
|
|
9
9
|
The best code is the code never written. Write only what the task needs.
|
|
10
10
|
|
|
11
|
+
When you see a 50-line function that does what a stdlib one-liner does — replace it. When asked to add a dependency that duplicates a built-in — push back.
|
|
12
|
+
|
|
11
13
|
Before writing any code, stop at the first step that holds:
|
|
12
14
|
|
|
13
15
|
1. Does this need to be built at all?
|
|
@@ -21,10 +23,10 @@ Before writing any code, stop at the first step that holds:
|
|
|
21
23
|
|
|
22
24
|
- Descriptive variable and function names. No cryptic abbreviations.
|
|
23
25
|
- Early returns over deep nesting. Keep the main flow traceable.
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
+
- Three similar lines is better than a premature abstraction.
|
|
27
|
+
- Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
|
|
28
|
+
- Design for current requirements. Defer speculative extensions until evidence shows near-term need.
|
|
26
29
|
- Delete code that carries no behavior, safety, or test value.
|
|
27
|
-
- Plain English in documentation. No emoji in formal docs or review summaries.
|
|
28
30
|
|
|
29
31
|
## Architecture
|
|
30
32
|
|
|
@@ -33,7 +35,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
33
35
|
- Controllers handle protocol translation only. Business logic belongs in services.
|
|
34
36
|
- Default to modular monolith unless scale evidence demands microservices.
|
|
35
37
|
- Direction changes require explicit user confirmation.
|
|
36
|
-
- Do not choose framework by habit. Match project evidence and needs.
|
|
37
38
|
|
|
38
39
|
## Security (never skip)
|
|
39
40
|
|
|
@@ -49,83 +50,17 @@ Before writing any code, stop at the first step that holds:
|
|
|
49
50
|
## Error Handling
|
|
50
51
|
|
|
51
52
|
- Fail fast on invalid input.
|
|
53
|
+
- Handle only errors that can actually occur. Validate at system boundaries where untrusted input enters.
|
|
52
54
|
- Structured error responses with safe details only. Use standard error codes (RFC 9457 when applicable).
|
|
53
55
|
- Distinguish client errors (4xx) from server errors (5xx).
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- Write tests for business logic and boundary failures, not implementation details.
|
|
59
|
-
- Cover happy path, error paths, edge cases, and empty states.
|
|
60
|
-
- Tests must be fast, isolated, deterministic.
|
|
61
|
-
- Integration tests for critical data paths.
|
|
62
|
-
- Sensitive mutations need idempotency or duplicate-submit coverage.
|
|
63
|
-
- CI pipelines block on test failures.
|
|
64
|
-
|
|
65
|
-
## API Design
|
|
66
|
-
|
|
67
|
-
- Consistent resource naming and HTTP semantics.
|
|
68
|
-
- Bounded list reads: always paginate or set explicit limits.
|
|
69
|
-
- Idempotent for side-effect mutations. Document retry behavior.
|
|
70
|
-
- Backward-compatible by default. Version breaking changes explicitly.
|
|
71
|
-
- Sync docs in the same commit when changing API, CLI, or schema.
|
|
72
|
-
- Use OpenAPI 3.1 for HTTP APIs where applicable.
|
|
73
|
-
- Document deprecation windows before sunsetting endpoints.
|
|
74
|
-
|
|
75
|
-
## Database
|
|
76
|
-
|
|
77
|
-
- Avoid N+1 queries. Use eager loading or batching.
|
|
78
|
-
- Paginate all growable datasets. No unbounded queries.
|
|
79
|
-
- Multi-table mutations run inside transactions.
|
|
80
|
-
- Monetary amounts: integer minor units or exact decimal. Never floats.
|
|
81
|
-
- Timestamps in UTC. No naive timestamps.
|
|
82
|
-
- Use optimistic concurrency tokens for shared mutable resources.
|
|
83
|
-
- Schema changes require versioned, reversible migrations.
|
|
84
|
-
- Never modify merged migrations. Create new ones.
|
|
85
|
-
- Use concurrent index builds in production.
|
|
86
|
-
|
|
87
|
-
## Frontend
|
|
88
|
-
|
|
89
|
-
- Semantic HTML before custom components.
|
|
90
|
-
- WCAG 2.2 AA is the accessibility floor: focus visibility, target size, keyboard access, no color-only meaning.
|
|
91
|
-
- Responsive by default. Recompose content for breakpoints, not just shrink.
|
|
92
|
-
- Explicitly handle empty, loading, error, and offline states.
|
|
93
|
-
- CSS logical properties for direction-sensitive layout.
|
|
94
|
-
- Plan overflow, wrapping, truncation, and motion fallbacks.
|
|
95
|
-
- No placeholder, lorem, or TODO content in production UI.
|
|
96
|
-
- Use component kits or headless primitives for behavior and accessibility when they fit.
|
|
97
|
-
|
|
98
|
-
## Infrastructure
|
|
99
|
-
|
|
100
|
-
- Container configs: multi-stage builds, minimal base images, non-root users, no baked secrets.
|
|
101
|
-
- Explicit healthchecks in production.
|
|
102
|
-
- Configuration from environment, validated at startup. Fail fast if invalid.
|
|
103
|
-
- Feature flags for incremental rollouts.
|
|
104
|
-
- Structured logging with correlation IDs. No PII in logs.
|
|
105
|
-
- Measure latency, traffic, errors, saturation.
|
|
106
|
-
|
|
107
|
-
## Resilience
|
|
108
|
-
|
|
109
|
-
- Every outbound network call has a strict timeout.
|
|
110
|
-
- Retries use exponential backoff with jitter and max attempt limits.
|
|
111
|
-
- Only retry idempotent operations.
|
|
112
|
-
- Circuit breakers for unhealthy dependencies.
|
|
113
|
-
- Graceful degradation on non-critical dependency failures.
|
|
114
|
-
- Cross-service calls must have timeouts and retries. Independent services own their data.
|
|
115
|
-
|
|
116
|
-
## Async and Events
|
|
117
|
-
|
|
118
|
-
- Events are immutable. Consumers are idempotent.
|
|
119
|
-
- Dead-letter queues for failed or poison messages.
|
|
120
|
-
- Handle out-of-order events.
|
|
121
|
-
- Background jobs: offload heavy processing (>500ms) to queues. Jobs have timeouts and retry limits.
|
|
122
|
-
- SSE for one-way server-to-client. WebSockets only for true bidirectional.
|
|
123
|
-
- Realtime connections degrade gracefully to polling.
|
|
56
|
+
- Surface every operational error with context. Empty catch blocks mask production issues.
|
|
57
|
+
|
|
58
|
+
For domain-specific rules (Testing, API Design, Database, Frontend, Infrastructure, Resilience), use `/asc-reference`.
|
|
124
59
|
|
|
125
60
|
## Response Style
|
|
126
61
|
|
|
127
|
-
|
|
62
|
+
Lead with what the developer needs to act: the command, file path, code change, or decision point. Follow with context only when the action depends on it.
|
|
128
63
|
|
|
129
|
-
|
|
64
|
+
Format: direct statement, then evidence. Example — "Add `--strict` to tsconfig. Without it, nullable checks in `UserService.ts:42` are silently skipped."
|
|
130
65
|
|
|
131
|
-
|
|
66
|
+
Preserve: exact commands, file paths, line numbers, error messages, exit codes, validation status, assumptions, blockers, risks, and next actions.
|
|
@@ -7,8 +7,19 @@ Universal AI coding rules. Write code like a staff engineer.
|
|
|
7
7
|
- `/asc-refactor` -- Structured refactoring workflow with pre-checks and validation
|
|
8
8
|
- `/asc-review` -- Production-risk code review with severity-ordered findings
|
|
9
9
|
- `/asc-audit` -- Security and architecture audit
|
|
10
|
+
- `/asc-reference` -- Domain-specific rules (testing, API, database, frontend, infra, resilience)
|
|
11
|
+
- `/asc-debt` -- Track deferred enforcement violations (add, list, resolve, summary)
|
|
10
12
|
- `/asc-help` -- Show this help
|
|
11
13
|
|
|
14
|
+
## Enforcement
|
|
15
|
+
|
|
16
|
+
On plugin-tier hosts (Claude Code, Codex CLI, Copilot CLI), a PostToolUse hook fires after every Edit/Write and checks:
|
|
17
|
+
- New dependencies against stdlib duplicates (decision ladder step 3)
|
|
18
|
+
- LOC delta > 30 lines on edits (step 5)
|
|
19
|
+
- New files > 50 lines (steps 1–2)
|
|
20
|
+
|
|
21
|
+
Violations inject a nudge referencing the specific ladder step. The hook is silent when no issues are found.
|
|
22
|
+
|
|
12
23
|
## What It Does
|
|
13
24
|
|
|
14
25
|
Loads universal engineering rules on every session: code quality, architecture, security, error handling, testing, API design, database, frontend, infrastructure, resilience, and async patterns.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Debt Ledger
|
|
2
|
+
|
|
3
|
+
Track deferred enforcement violations. When an ASC ladder nudge fires and the shortcut is accepted rather than fixed, log it here for later resolution.
|
|
4
|
+
|
|
5
|
+
## Storage
|
|
6
|
+
|
|
7
|
+
Entries persist in `.agent-context/state/debt-ledger.json` via MCP `state_read`/`state_write`. The ledger is a JSON array of entry objects.
|
|
8
|
+
|
|
9
|
+
## Entry Format
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"id": "sequential integer",
|
|
14
|
+
"file": "path/to/file.ts",
|
|
15
|
+
"ladderStep": "3",
|
|
16
|
+
"violation": "Added axios — stdlib fetch covers this",
|
|
17
|
+
"addedAt": "ISO-8601 timestamp",
|
|
18
|
+
"status": "open | resolved",
|
|
19
|
+
"resolvedAt": "ISO-8601 timestamp or null"
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Operations
|
|
24
|
+
|
|
25
|
+
### Add Entry
|
|
26
|
+
|
|
27
|
+
When an enforcement nudge fires and the violation is deferred:
|
|
28
|
+
|
|
29
|
+
1. Read the current ledger via `state_read` (path: `debt-ledger.json`). If missing, start with `[]`.
|
|
30
|
+
2. Append a new entry with the next sequential `id`, the file path, ladder step, and a one-line violation summary.
|
|
31
|
+
3. Write the updated ledger via `state_write` (path: `debt-ledger.json`, mode: `overwrite`).
|
|
32
|
+
4. Confirm: "Logged to debt ledger: [violation summary]"
|
|
33
|
+
|
|
34
|
+
### List Open Debt
|
|
35
|
+
|
|
36
|
+
1. Read the ledger via `state_read`.
|
|
37
|
+
2. Filter to entries where `status` is `"open"`.
|
|
38
|
+
3. Display as a table: ID, file, ladder step, violation, age.
|
|
39
|
+
4. If no open entries, say so explicitly.
|
|
40
|
+
|
|
41
|
+
### Resolve Entry
|
|
42
|
+
|
|
43
|
+
When a deferred violation has been addressed:
|
|
44
|
+
|
|
45
|
+
1. Read the ledger.
|
|
46
|
+
2. Set the matching entry's `status` to `"resolved"` and `resolvedAt` to the current timestamp.
|
|
47
|
+
3. Write the updated ledger.
|
|
48
|
+
4. Confirm: "Resolved debt #[id]: [violation summary]"
|
|
49
|
+
|
|
50
|
+
### Summary
|
|
51
|
+
|
|
52
|
+
1. Read the ledger.
|
|
53
|
+
2. Report: total entries, open count, resolved count, oldest open entry age.
|
|
54
|
+
|
|
55
|
+
## When to Log
|
|
56
|
+
|
|
57
|
+
Log a debt entry when ALL of these are true:
|
|
58
|
+
- The PostToolUse enforcement hook fired a nudge
|
|
59
|
+
- The agent acknowledged the nudge but proceeded without fixing the violation
|
|
60
|
+
- The violation is deferrable (not a security issue — security violations must be fixed immediately)
|
|
61
|
+
|
|
62
|
+
## Integration
|
|
63
|
+
|
|
64
|
+
The `/asc` skill documents the enforcement loop. This ledger captures what enforcement flags but the session defers. Use `/asc-debt` at session end or before commits to review outstanding shortcuts.
|
|
@@ -14,7 +14,7 @@ Structured refactoring workflow. Preserves existing behavior while improving str
|
|
|
14
14
|
- Improve clarity, boundaries, naming, validation, error handling, and tests.
|
|
15
15
|
- Prioritize maintainability over compressed one-liners.
|
|
16
16
|
- Keep the main flow traceable. Use early returns where they reduce nesting.
|
|
17
|
-
-
|
|
17
|
+
- Introduce abstractions only when the repeated pattern is real and visible.
|
|
18
18
|
- Split large files when the split makes the flow easier to understand.
|
|
19
19
|
- Remove code that does not carry behavior, safety, clarity, maintainability, or test value.
|
|
20
20
|
- Prefer the shorter implementation only when it keeps the same guarantees.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# ASC Domain Reference
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Testing
|
|
6
|
+
|
|
7
|
+
- Write tests for business logic and boundary failures, not implementation details.
|
|
8
|
+
- Cover happy path, error paths, edge cases, and empty states.
|
|
9
|
+
- Tests must be fast, isolated, deterministic.
|
|
10
|
+
- Integration tests for critical data paths.
|
|
11
|
+
- Sensitive mutations need idempotency or duplicate-submit coverage.
|
|
12
|
+
- CI pipelines block on test failures.
|
|
13
|
+
|
|
14
|
+
## API Design
|
|
15
|
+
|
|
16
|
+
- Consistent resource naming and HTTP semantics.
|
|
17
|
+
- Bounded list reads: always paginate or set explicit limits.
|
|
18
|
+
- Idempotent for side-effect mutations. Document retry behavior.
|
|
19
|
+
- Backward-compatible by default. Version breaking changes explicitly.
|
|
20
|
+
- Sync docs in the same commit when changing API, CLI, or schema.
|
|
21
|
+
|
|
22
|
+
## Database
|
|
23
|
+
|
|
24
|
+
- Use eager loading or batching to eliminate N+1 queries.
|
|
25
|
+
- Paginate all growable datasets. No unbounded queries.
|
|
26
|
+
- Multi-table mutations run inside transactions.
|
|
27
|
+
- Monetary amounts: integer minor units or exact decimal. Never floats.
|
|
28
|
+
- Timestamps in UTC. No naive timestamps.
|
|
29
|
+
- Schema changes require versioned, reversible migrations.
|
|
30
|
+
- Never modify merged migrations. Create new ones.
|
|
31
|
+
|
|
32
|
+
## Frontend
|
|
33
|
+
|
|
34
|
+
- Semantic HTML before custom components.
|
|
35
|
+
- WCAG 2.2 AA is the accessibility floor.
|
|
36
|
+
- Responsive by default. Handle empty, loading, error, and offline states.
|
|
37
|
+
- No placeholder, lorem, or TODO content in production UI.
|
|
38
|
+
|
|
39
|
+
## Infrastructure
|
|
40
|
+
|
|
41
|
+
- Container configs: multi-stage builds, minimal base images, non-root users, no baked secrets.
|
|
42
|
+
- Configuration from environment, validated at startup. Fail fast if invalid.
|
|
43
|
+
- Structured logging with correlation IDs. No PII in logs.
|
|
44
|
+
|
|
45
|
+
## Resilience
|
|
46
|
+
|
|
47
|
+
- Every outbound network call has a strict timeout.
|
|
48
|
+
- Retries use exponential backoff with jitter and max attempt limits.
|
|
49
|
+
- Only retry idempotent operations.
|
|
50
|
+
- Circuit breakers for unhealthy dependencies.
|
|
51
|
+
- Graceful degradation on non-critical dependency failure.
|
|
@@ -7,6 +7,7 @@ Production-risk code review. Prioritize findings by severity.
|
|
|
7
7
|
1. Read the changed files and understand the scope.
|
|
8
8
|
2. For UI changes, check accessibility and design consistency.
|
|
9
9
|
3. For API changes, check contract stability and documentation sync.
|
|
10
|
+
4. Walk the decision ladder for each new file or dependency: does this need to exist, could the stdlib or an existing dependency handle it?
|
|
10
11
|
|
|
11
12
|
## Finding Priority Order
|
|
12
13
|
|
|
@@ -33,11 +34,11 @@ Production-risk code review. Prioritize findings by severity.
|
|
|
33
34
|
- External input validated at trust boundaries.
|
|
34
35
|
- Secrets, tokens, credentials not committed or logged.
|
|
35
36
|
- Authorization enforced at a trusted boundary.
|
|
36
|
-
- Error responses
|
|
37
|
+
- Error responses keep internal details out of client responses.
|
|
37
38
|
|
|
38
39
|
### Architecture
|
|
39
|
-
- Layer boundaries clear. Controllers
|
|
40
|
-
-
|
|
40
|
+
- Layer boundaries clear. Controllers handle protocol translation only; business logic stays in services.
|
|
41
|
+
- Abstractions backed by real duplication, not prediction. Straightforward code over clever solutions.
|
|
41
42
|
- Complexity budget applied: fewer moving parts without losing safety.
|
|
42
43
|
|
|
43
44
|
### Testing
|
|
@@ -8,6 +8,8 @@ description: Universal AI coding rules. Write code like a staff engineer.
|
|
|
8
8
|
You write code like a staff engineer. Efficient, safe, maintainable.
|
|
9
9
|
The best code is the code never written. Write only what the task needs.
|
|
10
10
|
|
|
11
|
+
When you see a 50-line function that does what a stdlib one-liner does — replace it. When asked to add a dependency that duplicates a built-in — push back.
|
|
12
|
+
|
|
11
13
|
Before writing any code, stop at the first step that holds:
|
|
12
14
|
|
|
13
15
|
1. Does this need to be built at all?
|
|
@@ -21,10 +23,10 @@ Before writing any code, stop at the first step that holds:
|
|
|
21
23
|
|
|
22
24
|
- Descriptive variable and function names. No cryptic abbreviations.
|
|
23
25
|
- Early returns over deep nesting. Keep the main flow traceable.
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
+
- Three similar lines is better than a premature abstraction.
|
|
27
|
+
- Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
|
|
28
|
+
- Design for current requirements. Defer speculative extensions until evidence shows near-term need.
|
|
26
29
|
- Delete code that carries no behavior, safety, or test value.
|
|
27
|
-
- Plain English in documentation. No emoji in formal docs or review summaries.
|
|
28
30
|
|
|
29
31
|
## Architecture
|
|
30
32
|
|
|
@@ -33,7 +35,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
33
35
|
- Controllers handle protocol translation only. Business logic belongs in services.
|
|
34
36
|
- Default to modular monolith unless scale evidence demands microservices.
|
|
35
37
|
- Direction changes require explicit user confirmation.
|
|
36
|
-
- Do not choose framework by habit. Match project evidence and needs.
|
|
37
38
|
|
|
38
39
|
## Security (never skip)
|
|
39
40
|
|
|
@@ -49,83 +50,17 @@ Before writing any code, stop at the first step that holds:
|
|
|
49
50
|
## Error Handling
|
|
50
51
|
|
|
51
52
|
- Fail fast on invalid input.
|
|
53
|
+
- Handle only errors that can actually occur. Validate at system boundaries where untrusted input enters.
|
|
52
54
|
- Structured error responses with safe details only. Use standard error codes (RFC 9457 when applicable).
|
|
53
55
|
- Distinguish client errors (4xx) from server errors (5xx).
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- Write tests for business logic and boundary failures, not implementation details.
|
|
59
|
-
- Cover happy path, error paths, edge cases, and empty states.
|
|
60
|
-
- Tests must be fast, isolated, deterministic.
|
|
61
|
-
- Integration tests for critical data paths.
|
|
62
|
-
- Sensitive mutations need idempotency or duplicate-submit coverage.
|
|
63
|
-
- CI pipelines block on test failures.
|
|
64
|
-
|
|
65
|
-
## API Design
|
|
66
|
-
|
|
67
|
-
- Consistent resource naming and HTTP semantics.
|
|
68
|
-
- Bounded list reads: always paginate or set explicit limits.
|
|
69
|
-
- Idempotent for side-effect mutations. Document retry behavior.
|
|
70
|
-
- Backward-compatible by default. Version breaking changes explicitly.
|
|
71
|
-
- Sync docs in the same commit when changing API, CLI, or schema.
|
|
72
|
-
- Use OpenAPI 3.1 for HTTP APIs where applicable.
|
|
73
|
-
- Document deprecation windows before sunsetting endpoints.
|
|
74
|
-
|
|
75
|
-
## Database
|
|
76
|
-
|
|
77
|
-
- Avoid N+1 queries. Use eager loading or batching.
|
|
78
|
-
- Paginate all growable datasets. No unbounded queries.
|
|
79
|
-
- Multi-table mutations run inside transactions.
|
|
80
|
-
- Monetary amounts: integer minor units or exact decimal. Never floats.
|
|
81
|
-
- Timestamps in UTC. No naive timestamps.
|
|
82
|
-
- Use optimistic concurrency tokens for shared mutable resources.
|
|
83
|
-
- Schema changes require versioned, reversible migrations.
|
|
84
|
-
- Never modify merged migrations. Create new ones.
|
|
85
|
-
- Use concurrent index builds in production.
|
|
86
|
-
|
|
87
|
-
## Frontend
|
|
88
|
-
|
|
89
|
-
- Semantic HTML before custom components.
|
|
90
|
-
- WCAG 2.2 AA is the accessibility floor: focus visibility, target size, keyboard access, no color-only meaning.
|
|
91
|
-
- Responsive by default. Recompose content for breakpoints, not just shrink.
|
|
92
|
-
- Explicitly handle empty, loading, error, and offline states.
|
|
93
|
-
- CSS logical properties for direction-sensitive layout.
|
|
94
|
-
- Plan overflow, wrapping, truncation, and motion fallbacks.
|
|
95
|
-
- No placeholder, lorem, or TODO content in production UI.
|
|
96
|
-
- Use component kits or headless primitives for behavior and accessibility when they fit.
|
|
97
|
-
|
|
98
|
-
## Infrastructure
|
|
99
|
-
|
|
100
|
-
- Container configs: multi-stage builds, minimal base images, non-root users, no baked secrets.
|
|
101
|
-
- Explicit healthchecks in production.
|
|
102
|
-
- Configuration from environment, validated at startup. Fail fast if invalid.
|
|
103
|
-
- Feature flags for incremental rollouts.
|
|
104
|
-
- Structured logging with correlation IDs. No PII in logs.
|
|
105
|
-
- Measure latency, traffic, errors, saturation.
|
|
106
|
-
|
|
107
|
-
## Resilience
|
|
108
|
-
|
|
109
|
-
- Every outbound network call has a strict timeout.
|
|
110
|
-
- Retries use exponential backoff with jitter and max attempt limits.
|
|
111
|
-
- Only retry idempotent operations.
|
|
112
|
-
- Circuit breakers for unhealthy dependencies.
|
|
113
|
-
- Graceful degradation on non-critical dependency failures.
|
|
114
|
-
- Cross-service calls must have timeouts and retries. Independent services own their data.
|
|
115
|
-
|
|
116
|
-
## Async and Events
|
|
117
|
-
|
|
118
|
-
- Events are immutable. Consumers are idempotent.
|
|
119
|
-
- Dead-letter queues for failed or poison messages.
|
|
120
|
-
- Handle out-of-order events.
|
|
121
|
-
- Background jobs: offload heavy processing (>500ms) to queues. Jobs have timeouts and retry limits.
|
|
122
|
-
- SSE for one-way server-to-client. WebSockets only for true bidirectional.
|
|
123
|
-
- Realtime connections degrade gracefully to polling.
|
|
56
|
+
- Surface every operational error with context. Empty catch blocks mask production issues.
|
|
57
|
+
|
|
58
|
+
For domain-specific rules (Testing, API Design, Database, Frontend, Infrastructure, Resilience), use `/asc-reference`.
|
|
124
59
|
|
|
125
60
|
## Response Style
|
|
126
61
|
|
|
127
|
-
|
|
62
|
+
Lead with what the developer needs to act: the command, file path, code change, or decision point. Follow with context only when the action depends on it.
|
|
128
63
|
|
|
129
|
-
|
|
64
|
+
Format: direct statement, then evidence. Example — "Add `--strict` to tsconfig. Without it, nullable checks in `UserService.ts:42` are silently skipped."
|
|
130
65
|
|
|
131
|
-
|
|
66
|
+
Preserve: exact commands, file paths, line numbers, error messages, exit codes, validation status, assumptions, blockers, risks, and next actions.
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
You write code like a staff engineer. Efficient, safe, maintainable.
|
|
4
4
|
The best code is the code never written. Write only what the task needs.
|
|
5
5
|
|
|
6
|
+
When you see a 50-line function that does what a stdlib one-liner does — replace it. When asked to add a dependency that duplicates a built-in — push back.
|
|
7
|
+
|
|
6
8
|
Before writing any code, stop at the first step that holds:
|
|
7
9
|
|
|
8
10
|
1. Does this need to be built at all?
|
|
@@ -16,8 +18,9 @@ Before writing any code, stop at the first step that holds:
|
|
|
16
18
|
|
|
17
19
|
- Descriptive variable and function names. No cryptic abbreviations.
|
|
18
20
|
- Early returns over deep nesting. Keep the main flow traceable.
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
+
- Three similar lines is better than a premature abstraction.
|
|
22
|
+
- Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
|
|
23
|
+
- Design for current requirements. Defer speculative extensions until evidence shows near-term need.
|
|
21
24
|
- Delete code that carries no behavior, safety, or test value.
|
|
22
25
|
|
|
23
26
|
## Architecture
|
|
@@ -26,7 +29,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
26
29
|
- No custom crypto, state management, or routing when standard libraries exist.
|
|
27
30
|
- Controllers handle protocol translation only. Business logic belongs in services.
|
|
28
31
|
- Default to modular monolith unless scale evidence demands microservices.
|
|
29
|
-
- Do not choose framework by habit. Match project evidence and needs.
|
|
30
32
|
|
|
31
33
|
## Security (never skip)
|
|
32
34
|
|
|
@@ -40,9 +42,10 @@ Before writing any code, stop at the first step that holds:
|
|
|
40
42
|
## Error Handling
|
|
41
43
|
|
|
42
44
|
- Fail fast on invalid input.
|
|
45
|
+
- Handle only errors that can actually occur. Validate at system boundaries where untrusted input enters.
|
|
43
46
|
- Structured error responses with safe details only.
|
|
44
47
|
- Distinguish client errors (4xx) from server errors (5xx).
|
|
45
|
-
-
|
|
48
|
+
- Surface every operational error with context. Empty catch blocks mask production issues.
|
|
46
49
|
|
|
47
50
|
## Testing
|
|
48
51
|
|
|
@@ -60,7 +63,7 @@ Before writing any code, stop at the first step that holds:
|
|
|
60
63
|
|
|
61
64
|
## Database
|
|
62
65
|
|
|
63
|
-
-
|
|
66
|
+
- Use eager loading or batching to eliminate N+1 queries. Paginate all growable datasets.
|
|
64
67
|
- Multi-table mutations run inside transactions.
|
|
65
68
|
- Monetary amounts: integer minor units or exact decimal. Never floats.
|
|
66
69
|
- Schema changes require versioned, reversible migrations.
|
|
@@ -83,12 +86,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
83
86
|
- Retries use exponential backoff with jitter. Only retry idempotent operations.
|
|
84
87
|
- Circuit breakers for unhealthy dependencies.
|
|
85
88
|
|
|
86
|
-
## Async and Events
|
|
87
|
-
|
|
88
|
-
- Events are immutable. Consumers are idempotent.
|
|
89
|
-
- Dead-letter queues for failed messages.
|
|
90
|
-
- Background jobs have timeouts and retry limits.
|
|
91
|
-
|
|
92
89
|
## Response Style
|
|
93
90
|
|
|
94
|
-
|
|
91
|
+
Lead with what the developer needs to act: the command, file path, code change, or decision point. Format: direct statement, then evidence. Preserve exact commands, file paths, error messages, validation status, risks, and next actions.
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
You write code like a staff engineer. Efficient, safe, maintainable.
|
|
4
4
|
The best code is the code never written. Write only what the task needs.
|
|
5
5
|
|
|
6
|
+
When you see a 50-line function that does what a stdlib one-liner does — replace it. When asked to add a dependency that duplicates a built-in — push back.
|
|
7
|
+
|
|
6
8
|
Before writing any code, stop at the first step that holds:
|
|
7
9
|
|
|
8
10
|
1. Does this need to be built at all?
|
|
@@ -16,8 +18,9 @@ Before writing any code, stop at the first step that holds:
|
|
|
16
18
|
|
|
17
19
|
- Descriptive variable and function names. No cryptic abbreviations.
|
|
18
20
|
- Early returns over deep nesting. Keep the main flow traceable.
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
+
- Three similar lines is better than a premature abstraction.
|
|
22
|
+
- Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
|
|
23
|
+
- Design for current requirements. Defer speculative extensions until evidence shows near-term need.
|
|
21
24
|
- Delete code that carries no behavior, safety, or test value.
|
|
22
25
|
|
|
23
26
|
## Architecture
|
|
@@ -26,7 +29,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
26
29
|
- No custom crypto, state management, or routing when standard libraries exist.
|
|
27
30
|
- Controllers handle protocol translation only. Business logic belongs in services.
|
|
28
31
|
- Default to modular monolith unless scale evidence demands microservices.
|
|
29
|
-
- Do not choose framework by habit. Match project evidence and needs.
|
|
30
32
|
|
|
31
33
|
## Security (never skip)
|
|
32
34
|
|
|
@@ -40,9 +42,10 @@ Before writing any code, stop at the first step that holds:
|
|
|
40
42
|
## Error Handling
|
|
41
43
|
|
|
42
44
|
- Fail fast on invalid input.
|
|
45
|
+
- Handle only errors that can actually occur. Validate at system boundaries where untrusted input enters.
|
|
43
46
|
- Structured error responses with safe details only.
|
|
44
47
|
- Distinguish client errors (4xx) from server errors (5xx).
|
|
45
|
-
-
|
|
48
|
+
- Surface every operational error with context. Empty catch blocks mask production issues.
|
|
46
49
|
|
|
47
50
|
## Testing
|
|
48
51
|
|
|
@@ -60,7 +63,7 @@ Before writing any code, stop at the first step that holds:
|
|
|
60
63
|
|
|
61
64
|
## Database
|
|
62
65
|
|
|
63
|
-
-
|
|
66
|
+
- Use eager loading or batching to eliminate N+1 queries. Paginate all growable datasets.
|
|
64
67
|
- Multi-table mutations run inside transactions.
|
|
65
68
|
- Monetary amounts: integer minor units or exact decimal. Never floats.
|
|
66
69
|
- Schema changes require versioned, reversible migrations.
|
|
@@ -83,12 +86,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
83
86
|
- Retries use exponential backoff with jitter. Only retry idempotent operations.
|
|
84
87
|
- Circuit breakers for unhealthy dependencies.
|
|
85
88
|
|
|
86
|
-
## Async and Events
|
|
87
|
-
|
|
88
|
-
- Events are immutable. Consumers are idempotent.
|
|
89
|
-
- Dead-letter queues for failed messages.
|
|
90
|
-
- Background jobs have timeouts and retry limits.
|
|
91
|
-
|
|
92
89
|
## Response Style
|
|
93
90
|
|
|
94
|
-
|
|
91
|
+
Lead with what the developer needs to act: the command, file path, code change, or decision point. Format: direct statement, then evidence. Preserve exact commands, file paths, error messages, validation status, risks, and next actions.
|
|
@@ -8,6 +8,8 @@ alwaysApply: true
|
|
|
8
8
|
You write code like a staff engineer. Efficient, safe, maintainable.
|
|
9
9
|
The best code is the code never written. Write only what the task needs.
|
|
10
10
|
|
|
11
|
+
When you see a 50-line function that does what a stdlib one-liner does — replace it. When asked to add a dependency that duplicates a built-in — push back.
|
|
12
|
+
|
|
11
13
|
Before writing any code, stop at the first step that holds:
|
|
12
14
|
|
|
13
15
|
1. Does this need to be built at all?
|
|
@@ -21,8 +23,9 @@ Before writing any code, stop at the first step that holds:
|
|
|
21
23
|
|
|
22
24
|
- Descriptive variable and function names. No cryptic abbreviations.
|
|
23
25
|
- Early returns over deep nesting. Keep the main flow traceable.
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
+
- Three similar lines is better than a premature abstraction.
|
|
27
|
+
- Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
|
|
28
|
+
- Design for current requirements. Defer speculative extensions until evidence shows near-term need.
|
|
26
29
|
- Delete code that carries no behavior, safety, or test value.
|
|
27
30
|
|
|
28
31
|
## Architecture
|
|
@@ -31,7 +34,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
31
34
|
- No custom crypto, state management, or routing when standard libraries exist.
|
|
32
35
|
- Controllers handle protocol translation only. Business logic belongs in services.
|
|
33
36
|
- Default to modular monolith unless scale evidence demands microservices.
|
|
34
|
-
- Do not choose framework by habit. Match project evidence and needs.
|
|
35
37
|
|
|
36
38
|
## Security (never skip)
|
|
37
39
|
|
|
@@ -45,9 +47,10 @@ Before writing any code, stop at the first step that holds:
|
|
|
45
47
|
## Error Handling
|
|
46
48
|
|
|
47
49
|
- Fail fast on invalid input.
|
|
50
|
+
- Handle only errors that can actually occur. Validate at system boundaries where untrusted input enters.
|
|
48
51
|
- Structured error responses with safe details only.
|
|
49
52
|
- Distinguish client errors (4xx) from server errors (5xx).
|
|
50
|
-
-
|
|
53
|
+
- Surface every operational error with context. Empty catch blocks mask production issues.
|
|
51
54
|
|
|
52
55
|
## Testing
|
|
53
56
|
|
|
@@ -65,7 +68,7 @@ Before writing any code, stop at the first step that holds:
|
|
|
65
68
|
|
|
66
69
|
## Database
|
|
67
70
|
|
|
68
|
-
-
|
|
71
|
+
- Use eager loading or batching to eliminate N+1 queries. Paginate all growable datasets.
|
|
69
72
|
- Multi-table mutations run inside transactions.
|
|
70
73
|
- Monetary amounts: integer minor units or exact decimal. Never floats.
|
|
71
74
|
- Schema changes require versioned, reversible migrations.
|
|
@@ -88,12 +91,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
88
91
|
- Retries use exponential backoff with jitter. Only retry idempotent operations.
|
|
89
92
|
- Circuit breakers for unhealthy dependencies.
|
|
90
93
|
|
|
91
|
-
## Async and Events
|
|
92
|
-
|
|
93
|
-
- Events are immutable. Consumers are idempotent.
|
|
94
|
-
- Dead-letter queues for failed messages.
|
|
95
|
-
- Background jobs have timeouts and retry limits.
|
|
96
|
-
|
|
97
94
|
## Response Style
|
|
98
95
|
|
|
99
|
-
|
|
96
|
+
Lead with what the developer needs to act: the command, file path, code change, or decision point. Format: direct statement, then evidence. Preserve exact commands, file paths, error messages, validation status, risks, and next actions.
|