@agentyx/core 0.1.1 → 0.3.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/README.md +28 -47
- package/dist/index.d.mts +396 -155
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +777 -226
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/schema/agentyx.schema.json +11 -7
- package/skills/angular-architecture/SKILL.md +29 -0
- package/skills/angular-modern/SKILL.md +12 -30
- package/skills/angular-signals/SKILL.md +23 -0
- package/skills/angular-testing/SKILL.md +24 -0
- package/skills/api-design/SKILL.md +29 -0
- package/skills/api-documentation/SKILL.md +34 -0
- package/skills/aria-patterns/SKILL.md +36 -0
- package/skills/auth-patterns/SKILL.md +35 -0
- package/skills/brainstorming/SKILL.md +12 -0
- package/skills/branching-strategy/SKILL.md +34 -0
- package/skills/ci-pipelines/SKILL.md +34 -0
- package/skills/code-quality/SKILL.md +28 -0
- package/skills/code-review/SKILL.md +23 -0
- package/skills/commit-hygiene/SKILL.md +34 -0
- package/skills/concise-output/SKILL.md +24 -0
- package/skills/containerization/SKILL.md +38 -0
- package/skills/context-efficient-development/SKILL.md +24 -0
- package/skills/data-modeling/SKILL.md +34 -0
- package/skills/decision-records/SKILL.md +34 -0
- package/skills/dependency-hygiene/SKILL.md +34 -0
- package/skills/dependency-security/SKILL.md +35 -0
- package/skills/deployment-safety/SKILL.md +33 -0
- package/skills/e2e-testing/SKILL.md +34 -0
- package/skills/engineering-principles/SKILL.md +34 -0
- package/skills/flaky-tests/SKILL.md +29 -0
- package/skills/focused-verification/SKILL.md +22 -0
- package/skills/incident-response/SKILL.md +34 -0
- package/skills/infrastructure-as-code/SKILL.md +34 -0
- package/skills/keyboard-navigation/SKILL.md +34 -0
- package/skills/legacy-code/SKILL.md +34 -0
- package/skills/metrics-and-tracing/SKILL.md +33 -0
- package/skills/parallel-work/SKILL.md +12 -0
- package/skills/performance-profiling/SKILL.md +34 -0
- package/skills/pull-requests/SKILL.md +34 -0
- package/skills/query-performance/SKILL.md +34 -0
- package/skills/refactoring-safely/SKILL.md +34 -0
- package/skills/requesting-code-review/SKILL.md +13 -0
- package/skills/schema-migrations/SKILL.md +34 -0
- package/skills/secrets-handling/SKILL.md +34 -0
- package/skills/secure-coding/SKILL.md +33 -0
- package/skills/semantic-html/SKILL.md +34 -0
- package/skills/structured-logging/SKILL.md +34 -0
- package/skills/subagent-driven-development/SKILL.md +13 -0
- package/skills/targeted-exploration/SKILL.md +24 -0
- package/skills/technical-writing/SKILL.md +34 -0
- package/skills/test-doubles/SKILL.md +30 -0
- package/skills/test-strategy/SKILL.md +35 -0
- package/skills/transactions-and-consistency/SKILL.md +34 -0
- package/skills/typescript-modeling/SKILL.md +23 -0
- package/skills/typescript-modern/SKILL.md +15 -27
- package/skills/typescript-strict/SKILL.md +23 -0
- package/skills/web-vitals/SKILL.md +34 -0
- package/skills/worktree-workflow/SKILL.md +12 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flaky-tests
|
|
3
|
+
description: Diagnose and fix non-deterministic tests instead of retrying them.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Flaky tests
|
|
7
|
+
|
|
8
|
+
A test that passes and fails without a code change destroys trust in the whole suite. Treat it as a
|
|
9
|
+
defect, not as noise.
|
|
10
|
+
|
|
11
|
+
## Never paper over it
|
|
12
|
+
|
|
13
|
+
Do not add a retry, a longer timeout or a skip as the fix. Retries hide real race conditions that
|
|
14
|
+
will surface in production, and a skipped test is a deleted test that still costs time to run.
|
|
15
|
+
|
|
16
|
+
## Find the source of non-determinism
|
|
17
|
+
|
|
18
|
+
The usual causes are time, ordering, concurrency, shared state, network and randomness. Pin clocks,
|
|
19
|
+
seed randomness, isolate state, and await every asynchronous operation explicitly.
|
|
20
|
+
|
|
21
|
+
## Reproduce before fixing
|
|
22
|
+
|
|
23
|
+
Run the test repeatedly, in random order and in parallel until the failure is reliable. A fix applied
|
|
24
|
+
to a failure you cannot reproduce is a guess.
|
|
25
|
+
|
|
26
|
+
## Quarantine with a deadline
|
|
27
|
+
|
|
28
|
+
If a flaky test must leave the critical path immediately, record why and when it will be fixed. An
|
|
29
|
+
unbounded quarantine list becomes permanent, and the coverage it represented is silently gone.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: focused-verification
|
|
3
|
+
description: Choose narrow checks while iterating and full required gates before completion.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Focused verification
|
|
7
|
+
|
|
8
|
+
Match checks to risk and phase.
|
|
9
|
+
|
|
10
|
+
## During iteration
|
|
11
|
+
|
|
12
|
+
Run the smallest check that can fail for the code you just changed. Prefer a focused test, typecheck
|
|
13
|
+
for one package, or a direct command that exercises the behavior.
|
|
14
|
+
|
|
15
|
+
## Before completion
|
|
16
|
+
|
|
17
|
+
Run the repository or product gate required for the touched surface. Include manual checks for CLI
|
|
18
|
+
output, generated files, migrations, or UI behavior that automated tests do not cover.
|
|
19
|
+
|
|
20
|
+
## Reporting
|
|
21
|
+
|
|
22
|
+
Report the exact checks you ran. If a check fails or cannot be run, say that plainly with the reason.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: incident-response
|
|
3
|
+
description: Restore service first, diagnose second, and learn without blame.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Incident response
|
|
7
|
+
|
|
8
|
+
During an incident the goal is to stop the harm. Understanding the cause is important, but it comes
|
|
9
|
+
after recovery.
|
|
10
|
+
|
|
11
|
+
## Mitigate before diagnosing
|
|
12
|
+
|
|
13
|
+
Roll back, disable the feature flag, shed load or fail over. A full explanation is worth far less
|
|
14
|
+
than a working system, and the evidence will still be there afterwards.
|
|
15
|
+
|
|
16
|
+
## Assign roles early
|
|
17
|
+
|
|
18
|
+
Name someone to coordinate and someone to communicate, separate from those investigating. Without
|
|
19
|
+
this split, either the investigation or the communication is dropped.
|
|
20
|
+
|
|
21
|
+
## Keep a timeline
|
|
22
|
+
|
|
23
|
+
Record what was observed, what was changed and when, as it happens. Memory reconstructs incidents
|
|
24
|
+
inaccurately, and the timeline is the basis of the review.
|
|
25
|
+
|
|
26
|
+
## Change one thing at a time
|
|
27
|
+
|
|
28
|
+
Simultaneous fixes make it impossible to know what worked, and can deepen the outage. Announce each
|
|
29
|
+
change before making it.
|
|
30
|
+
|
|
31
|
+
## Review without blame
|
|
32
|
+
|
|
33
|
+
Examine the conditions that let the failure happen and reach production: missing tests, absent
|
|
34
|
+
alerts, unclear ownership. Blaming an individual guarantees the next incident is reported later.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: infrastructure-as-code
|
|
3
|
+
description: Define infrastructure declaratively, in version control, applied automatically.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Infrastructure as code
|
|
7
|
+
|
|
8
|
+
Infrastructure that exists only as manual console changes cannot be reviewed, reproduced or
|
|
9
|
+
recovered.
|
|
10
|
+
|
|
11
|
+
## Declare the desired state
|
|
12
|
+
|
|
13
|
+
Describe what the infrastructure should be and let the tool determine the steps. Declarative
|
|
14
|
+
definitions converge from any starting point; imperative scripts assume one.
|
|
15
|
+
|
|
16
|
+
## Never change production by hand
|
|
17
|
+
|
|
18
|
+
Manual edits create drift that the next automated apply will undo or conflict with. When an emergency
|
|
19
|
+
forces a manual change, bring it back into code immediately.
|
|
20
|
+
|
|
21
|
+
## Review the plan before applying
|
|
22
|
+
|
|
23
|
+
Read the diff of what will be created, changed and destroyed. Replacement of a stateful resource is
|
|
24
|
+
the failure mode that turns a routine change into data loss.
|
|
25
|
+
|
|
26
|
+
## Isolate environments
|
|
27
|
+
|
|
28
|
+
Keep separate state and credentials per environment, sharing definitions through parameters rather
|
|
29
|
+
than copies. Shared state is how a staging change reaches production.
|
|
30
|
+
|
|
31
|
+
## Protect the state and the secrets
|
|
32
|
+
|
|
33
|
+
Store state remotely with locking and restricted access — it contains sensitive values. Reference
|
|
34
|
+
secrets from a secret manager instead of committing them alongside the definitions.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: keyboard-navigation
|
|
3
|
+
description: Make every interaction reachable, visible and escapable by keyboard.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Keyboard navigation
|
|
7
|
+
|
|
8
|
+
Anything achievable with a pointer must be achievable with a keyboard alone. This is the fastest
|
|
9
|
+
accessibility check available: put the mouse away and use the feature.
|
|
10
|
+
|
|
11
|
+
## Keep order logical
|
|
12
|
+
|
|
13
|
+
Tab order should follow the visual and logical reading order. Positive tab index values override
|
|
14
|
+
document order and create sequences nobody can predict — leave them alone.
|
|
15
|
+
|
|
16
|
+
## Make focus visible
|
|
17
|
+
|
|
18
|
+
Every focusable element needs a clearly visible focus indicator with sufficient contrast. Removing
|
|
19
|
+
default outlines without replacing them makes the interface unusable for keyboard users.
|
|
20
|
+
|
|
21
|
+
## Never trap focus unintentionally
|
|
22
|
+
|
|
23
|
+
Focus must be able to leave every component. Deliberate trapping belongs only in modal dialogs, and
|
|
24
|
+
must always offer an escape.
|
|
25
|
+
|
|
26
|
+
## Support the expected keys
|
|
27
|
+
|
|
28
|
+
Enter and Space activate controls, Escape dismisses overlays, and arrow keys move within composite
|
|
29
|
+
widgets such as menus, tabs and grids. Follow platform conventions rather than inventing shortcuts.
|
|
30
|
+
|
|
31
|
+
## Offer a skip link
|
|
32
|
+
|
|
33
|
+
Let users bypass repeated navigation to reach main content. Without it, every page begins with the
|
|
34
|
+
same long traversal.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legacy-code
|
|
3
|
+
description: Work safely in unfamiliar code with weak or missing tests.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Working with legacy code
|
|
7
|
+
|
|
8
|
+
Legacy code is code you are afraid to change. The goal of each visit is to leave it slightly less
|
|
9
|
+
frightening than you found it.
|
|
10
|
+
|
|
11
|
+
## Characterize before changing
|
|
12
|
+
|
|
13
|
+
When behavior is undocumented and untested, write tests that capture what the code does today, even
|
|
14
|
+
where that looks wrong. Those tests describe reality, and reality is what callers depend on.
|
|
15
|
+
|
|
16
|
+
## Find a seam
|
|
17
|
+
|
|
18
|
+
Introduce a boundary where a dependency can be substituted, so a piece becomes testable without
|
|
19
|
+
rewriting the whole. A narrow seam beats a broad refactor performed blind.
|
|
20
|
+
|
|
21
|
+
## Assume the strangeness has a reason
|
|
22
|
+
|
|
23
|
+
Odd conditionals and special cases usually encode a real requirement or an old incident. Find out why
|
|
24
|
+
before deleting; unexplained code is not the same as unnecessary code.
|
|
25
|
+
|
|
26
|
+
## Improve what you touch
|
|
27
|
+
|
|
28
|
+
Leave the area you worked in better: a name clarified, a test added, dead code removed. Repository-
|
|
29
|
+
wide cleanup campaigns stall, while incremental improvement compounds.
|
|
30
|
+
|
|
31
|
+
## Do not rewrite by default
|
|
32
|
+
|
|
33
|
+
A rewrite discards embedded knowledge and restarts the bug-discovery process from zero. Prefer
|
|
34
|
+
strangling the old implementation behind a stable interface, one piece at a time.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: metrics-and-tracing
|
|
3
|
+
description: Instrument systems so failures are visible before users report them.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Metrics and tracing
|
|
7
|
+
|
|
8
|
+
Instrumentation should answer whether the system is healthy, and if not, where it broke.
|
|
9
|
+
|
|
10
|
+
## Measure what users experience
|
|
11
|
+
|
|
12
|
+
Track request rate, error rate, latency and saturation at the boundaries users touch. Internal
|
|
13
|
+
counters that no symptom maps to generate noise rather than signal.
|
|
14
|
+
|
|
15
|
+
## Use percentiles, never averages
|
|
16
|
+
|
|
17
|
+
Averages conceal the tail where the damage is. Watch the high percentiles, because those are the
|
|
18
|
+
requests people notice and complain about.
|
|
19
|
+
|
|
20
|
+
## Trace across service boundaries
|
|
21
|
+
|
|
22
|
+
Distributed traces show where time is spent in a request that crosses processes. In any system of
|
|
23
|
+
more than a couple of services, this is the only practical way to locate latency.
|
|
24
|
+
|
|
25
|
+
## Alert on symptoms, not causes
|
|
26
|
+
|
|
27
|
+
Alert when users are affected, and let dashboards explain why. Cause-based alerts fire on conditions
|
|
28
|
+
that are frequently harmless, and their volume trains people to ignore them.
|
|
29
|
+
|
|
30
|
+
## Make every alert actionable
|
|
31
|
+
|
|
32
|
+
An alert nobody can act on is noise that erodes attention. Each one needs an owner, a clear
|
|
33
|
+
meaning and a documented first response.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: parallel-work
|
|
3
|
+
description: Split independent coding-agent work safely when tasks do not overlap.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Parallel work
|
|
7
|
+
|
|
8
|
+
Use parallel work only for independent tasks with clear boundaries.
|
|
9
|
+
|
|
10
|
+
Define each task's files, inputs, expected output, and verification. Avoid parallel edits to the
|
|
11
|
+
same files or closely coupled behavior. Integrate deliberately: review outputs, reconcile conflicts,
|
|
12
|
+
run the shared checks, and keep the parent agent responsible for the final result.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: performance-profiling
|
|
3
|
+
description: Measure before optimizing and confirm the gain after.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Performance profiling
|
|
7
|
+
|
|
8
|
+
Optimization without measurement is guesswork that costs readability. Find the bottleneck, then fix
|
|
9
|
+
the bottleneck.
|
|
10
|
+
|
|
11
|
+
## Measure first
|
|
12
|
+
|
|
13
|
+
Profile under conditions that resemble production: realistic data volume, realistic concurrency, a
|
|
14
|
+
production build. Development builds and toy datasets hide the actual cost.
|
|
15
|
+
|
|
16
|
+
## Set a target
|
|
17
|
+
|
|
18
|
+
Define what fast enough means before starting — a latency budget, a percentile, a throughput figure.
|
|
19
|
+
Without a target, optimization has no finish line.
|
|
20
|
+
|
|
21
|
+
## Fix the dominant cost
|
|
22
|
+
|
|
23
|
+
Work on the largest contributor first. An improvement to code that accounts for two percent of
|
|
24
|
+
runtime cannot matter, however large the factor.
|
|
25
|
+
|
|
26
|
+
## Prefer algorithmic wins
|
|
27
|
+
|
|
28
|
+
Removing repeated work, unnecessary round trips and quadratic behavior beats micro-optimization.
|
|
29
|
+
Caching is a last resort, not a first move: it adds invalidation as a new class of bug.
|
|
30
|
+
|
|
31
|
+
## Verify and keep the number
|
|
32
|
+
|
|
33
|
+
Re-measure after the change and record the result. Track the metric so a regression is caught by the
|
|
34
|
+
build rather than by users.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pull-requests
|
|
3
|
+
description: Size and present changes so they can actually be reviewed.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pull requests
|
|
7
|
+
|
|
8
|
+
Review quality falls sharply with size. A pull request is a request for someone's attention, so make
|
|
9
|
+
that attention easy to give.
|
|
10
|
+
|
|
11
|
+
## Keep them small
|
|
12
|
+
|
|
13
|
+
Prefer a few hundred changed lines over a thousand. Large pull requests receive approval rather than
|
|
14
|
+
review, which is the opposite of the intended effect.
|
|
15
|
+
|
|
16
|
+
## Do one thing
|
|
17
|
+
|
|
18
|
+
Cover a single feature, fix or refactor. When a change touches many areas for different reasons,
|
|
19
|
+
split it into a sequence that each stand on their own.
|
|
20
|
+
|
|
21
|
+
## Write the description for the reviewer
|
|
22
|
+
|
|
23
|
+
State what changes, why, and what to look at closely. Note what you are unsure about — that is where
|
|
24
|
+
review is most valuable and where reviewers most often stay silent.
|
|
25
|
+
|
|
26
|
+
## Make it verifiable
|
|
27
|
+
|
|
28
|
+
Include the tests that prove the change and say how to exercise it manually where that applies. A
|
|
29
|
+
reviewer should not have to reconstruct how you convinced yourself.
|
|
30
|
+
|
|
31
|
+
## Respond to every comment
|
|
32
|
+
|
|
33
|
+
Address or explicitly decline each point. Silently ignoring a comment wastes the reviewer's effort
|
|
34
|
+
and discourages careful review next time.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: query-performance
|
|
3
|
+
description: Diagnose slow database access with query plans, indexes and access patterns.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Query performance
|
|
7
|
+
|
|
8
|
+
Most application slowness is data access. Read the query plan before changing the query.
|
|
9
|
+
|
|
10
|
+
## Read the plan
|
|
11
|
+
|
|
12
|
+
The execution plan shows what the database actually does: scans, joins, sorts and row estimates. A
|
|
13
|
+
large gap between estimated and actual rows usually means stale statistics or an unsuitable index.
|
|
14
|
+
|
|
15
|
+
## Index for the access pattern
|
|
16
|
+
|
|
17
|
+
Index the columns used to filter, join and order, and put the most selective column first in a
|
|
18
|
+
composite index. Every index costs write throughput and storage, so add them for measured queries
|
|
19
|
+
rather than speculatively.
|
|
20
|
+
|
|
21
|
+
## Eliminate N+1 access
|
|
22
|
+
|
|
23
|
+
Loading a collection and then querying once per element is the most common performance defect in
|
|
24
|
+
application code. Fetch related data in a single query or a batched load.
|
|
25
|
+
|
|
26
|
+
## Fetch only what you need
|
|
27
|
+
|
|
28
|
+
Select the required columns and paginate large result sets with a stable key. Requesting entire rows
|
|
29
|
+
and filtering in application code moves the work to the slowest place.
|
|
30
|
+
|
|
31
|
+
## Watch the pool and the transaction
|
|
32
|
+
|
|
33
|
+
Long transactions hold locks and connections, turning a slow query into a system-wide stall. Keep
|
|
34
|
+
transactions short and do external calls outside them.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refactoring-safely
|
|
3
|
+
description: Change structure without changing behavior, in reversible steps.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Refactoring safely
|
|
7
|
+
|
|
8
|
+
Refactoring changes structure while behavior stays identical. The moment behavior changes it is no
|
|
9
|
+
longer refactoring, and it needs its own review and its own tests.
|
|
10
|
+
|
|
11
|
+
## Secure the behavior first
|
|
12
|
+
|
|
13
|
+
Ensure tests cover the current behavior before restructuring. Without that net, a refactor is an
|
|
14
|
+
untested rewrite and any difference goes unnoticed.
|
|
15
|
+
|
|
16
|
+
## Separate the commits
|
|
17
|
+
|
|
18
|
+
Never mix refactoring with a feature or a fix in one commit. Mixed changes make review hard and make
|
|
19
|
+
a clean revert impossible when something breaks.
|
|
20
|
+
|
|
21
|
+
## Move in small steps
|
|
22
|
+
|
|
23
|
+
Take one transformation at a time and keep the suite green between steps. A long sequence of
|
|
24
|
+
unverified edits is where the untraceable regression enters.
|
|
25
|
+
|
|
26
|
+
## Follow the pain
|
|
27
|
+
|
|
28
|
+
Refactor where change is actually difficult and where work is actually happening. Restructuring
|
|
29
|
+
stable code nobody touches spends risk with no return.
|
|
30
|
+
|
|
31
|
+
## Know when to stop
|
|
32
|
+
|
|
33
|
+
Stop when the code is clear enough for the change you came to make. Refactoring is preparation for
|
|
34
|
+
work, not the work itself.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: requesting-code-review
|
|
3
|
+
description: Request independent review after meaningful implementation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Requesting code review
|
|
7
|
+
|
|
8
|
+
Ask for review when a change affects behavior, public APIs, security, data integrity, or several
|
|
9
|
+
modules.
|
|
10
|
+
|
|
11
|
+
Provide the requirement, changed files, verification performed, and known risks. Ask the reviewer to
|
|
12
|
+
focus on requirement compliance, correctness, regressions, tests, security, and unnecessary
|
|
13
|
+
complexity. Treat findings as inputs to resolve, not as a substitute for your own judgment.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: schema-migrations
|
|
3
|
+
description: Evolve a live schema without downtime or data loss.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Schema migrations
|
|
7
|
+
|
|
8
|
+
A migration runs once against real data that cannot be recreated. Treat it with more care than the
|
|
9
|
+
code that prompted it.
|
|
10
|
+
|
|
11
|
+
## Make migrations additive first
|
|
12
|
+
|
|
13
|
+
Add columns and tables before anything reads them, and remove old structures only after nothing
|
|
14
|
+
references them. During deployment both versions of the application run at once.
|
|
15
|
+
|
|
16
|
+
## Expand, migrate, contract
|
|
17
|
+
|
|
18
|
+
Add the new shape, backfill it, switch reads and writes over, then drop the old shape in a later
|
|
19
|
+
release. Attempting all three at once forces downtime and leaves no safe point to stop.
|
|
20
|
+
|
|
21
|
+
## Backfill in batches
|
|
22
|
+
|
|
23
|
+
Update large tables in bounded chunks with pauses between them. A single statement over millions of
|
|
24
|
+
rows holds locks and can stall the application entirely.
|
|
25
|
+
|
|
26
|
+
## Keep them reversible
|
|
27
|
+
|
|
28
|
+
Provide a tested rollback, or design the change so the previous version still works against the new
|
|
29
|
+
schema. A migration you cannot undo turns a small mistake into an incident.
|
|
30
|
+
|
|
31
|
+
## Test against production-like data
|
|
32
|
+
|
|
33
|
+
Verify on a realistic copy for both correctness and duration. Migrations that finish instantly in
|
|
34
|
+
development regularly run for hours in production.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: secrets-handling
|
|
3
|
+
description: Keep credentials out of source, logs and client bundles.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Secrets handling
|
|
7
|
+
|
|
8
|
+
A secret in version control is compromised the moment it is pushed, and rewriting history does not
|
|
9
|
+
undo it.
|
|
10
|
+
|
|
11
|
+
## Keep secrets out of the repository
|
|
12
|
+
|
|
13
|
+
Load credentials from environment variables or a secret manager. Commit a documented example file
|
|
14
|
+
with placeholder values, never the real ones.
|
|
15
|
+
|
|
16
|
+
## Rotate on exposure
|
|
17
|
+
|
|
18
|
+
Treat any secret that reached a repository, log, ticket or chat message as leaked. Rotate it before
|
|
19
|
+
removing it — deletion without rotation leaves the credential valid.
|
|
20
|
+
|
|
21
|
+
## Never log or serialize them
|
|
22
|
+
|
|
23
|
+
Redact credentials, tokens and keys in logs, error messages and crash reports. Review debug output
|
|
24
|
+
and third-party error reporters, which capture more surrounding context than expected.
|
|
25
|
+
|
|
26
|
+
## Understand the client boundary
|
|
27
|
+
|
|
28
|
+
Anything shipped to a browser or mobile app is public, regardless of build-time substitution. Only
|
|
29
|
+
publishable identifiers belong in client code; every real secret stays server side.
|
|
30
|
+
|
|
31
|
+
## Scan continuously
|
|
32
|
+
|
|
33
|
+
Run secret scanning in pre-commit hooks and in CI. Detection after the fact is far cheaper than an
|
|
34
|
+
incident, and cheaper still before the push.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: secure-coding
|
|
3
|
+
description: Apply input validation, output encoding and least privilege by default.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Secure coding
|
|
7
|
+
|
|
8
|
+
Treat every input crossing a trust boundary as hostile, including input from your own other services.
|
|
9
|
+
|
|
10
|
+
## Validate at the boundary
|
|
11
|
+
|
|
12
|
+
Validate structure, type, range and length where untrusted data enters, and reject what does not
|
|
13
|
+
conform. Allow-lists beat deny-lists: enumerate what is valid rather than guessing what is dangerous.
|
|
14
|
+
|
|
15
|
+
## Never build queries or commands by concatenation
|
|
16
|
+
|
|
17
|
+
Use parameterized queries and argument arrays. String interpolation into SQL, shell commands,
|
|
18
|
+
templates or file paths is the root of injection.
|
|
19
|
+
|
|
20
|
+
## Encode for the destination
|
|
21
|
+
|
|
22
|
+
Escaping depends on where the value lands: HTML body, attribute, URL, SQL, shell and JSON all differ.
|
|
23
|
+
Encode at the point of output, not on the way in.
|
|
24
|
+
|
|
25
|
+
## Apply least privilege
|
|
26
|
+
|
|
27
|
+
Give every process, token and database role the narrowest permissions that let it work. Scope
|
|
28
|
+
credentials per environment so a leak in one does not compromise the others.
|
|
29
|
+
|
|
30
|
+
## Fail closed
|
|
31
|
+
|
|
32
|
+
On error, deny access and log the reason. An exception path that falls through to permitted access is
|
|
33
|
+
a vulnerability, not a bug.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: semantic-html
|
|
3
|
+
description: Use native elements and structure so accessibility works by default.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Semantic markup
|
|
7
|
+
|
|
8
|
+
The accessible behavior of a native element is free and correct. Recreating it is expensive and
|
|
9
|
+
rarely complete.
|
|
10
|
+
|
|
11
|
+
## Use the element that means it
|
|
12
|
+
|
|
13
|
+
Buttons, links, form controls, lists and headings carry role, keyboard behavior and state to
|
|
14
|
+
assistive technology. A styled container with a click handler carries none of it.
|
|
15
|
+
|
|
16
|
+
## Distinguish links from buttons
|
|
17
|
+
|
|
18
|
+
A link navigates, a button performs an action. Choosing by appearance breaks expectations for
|
|
19
|
+
keyboard, screen reader and browser features such as opening in a new tab.
|
|
20
|
+
|
|
21
|
+
## Structure with headings and landmarks
|
|
22
|
+
|
|
23
|
+
Use one descriptive page title, a logical heading order without skipped levels, and landmark regions
|
|
24
|
+
for navigation, main content and complements. Many users navigate by these alone.
|
|
25
|
+
|
|
26
|
+
## Label every control
|
|
27
|
+
|
|
28
|
+
Associate a visible label with each input. Placeholders disappear on entry and are not labels;
|
|
29
|
+
icon-only controls need an accessible name.
|
|
30
|
+
|
|
31
|
+
## Describe meaningful images
|
|
32
|
+
|
|
33
|
+
Give informative images alt text conveying their purpose, and mark decorative images as such. Alt
|
|
34
|
+
text should say what the image communicates, not what it depicts.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: structured-logging
|
|
3
|
+
description: Emit machine-readable logs with the context needed to diagnose incidents.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Structured logging
|
|
7
|
+
|
|
8
|
+
Logs exist to answer questions during an incident. Write them for the person querying at three in
|
|
9
|
+
the morning.
|
|
10
|
+
|
|
11
|
+
## Log structured events, not sentences
|
|
12
|
+
|
|
13
|
+
Emit key-value fields rather than interpolated prose. Structured records can be filtered, aggregated
|
|
14
|
+
and correlated; free text can only be searched by substring.
|
|
15
|
+
|
|
16
|
+
## Carry correlation identifiers
|
|
17
|
+
|
|
18
|
+
Propagate a request or trace identifier through every layer, including asynchronous work. Without
|
|
19
|
+
it, reconstructing one operation across services is guesswork.
|
|
20
|
+
|
|
21
|
+
## Use levels with discipline
|
|
22
|
+
|
|
23
|
+
Error means someone must act, warn means a degraded path was taken, info records significant state
|
|
24
|
+
changes, and debug is for development. When everything is an error, the level conveys nothing.
|
|
25
|
+
|
|
26
|
+
## Never log sensitive data
|
|
27
|
+
|
|
28
|
+
Credentials, tokens, personal data and payment details must not reach logs, which are widely
|
|
29
|
+
readable and long-lived. Redact at the logging boundary rather than trusting call sites.
|
|
30
|
+
|
|
31
|
+
## Log decisions, not control flow
|
|
32
|
+
|
|
33
|
+
Record what was decided and why — inputs, chosen branch, outcome. Tracing every function entry
|
|
34
|
+
produces volume without insight and buries the events that matter.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: subagent-driven-development
|
|
3
|
+
description: Coordinate scoped subagent work when the current provider supports it.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Subagent-driven development
|
|
7
|
+
|
|
8
|
+
Use subagents when the task benefits from independent investigation, implementation, or review and
|
|
9
|
+
the current provider supports them.
|
|
10
|
+
|
|
11
|
+
Give each subagent a narrow objective, relevant context, boundaries, and expected output. Do not
|
|
12
|
+
spawn agents for trivial work. Prefer fresh-context reviewers for meaningful changes. The parent
|
|
13
|
+
agent remains responsible for integration, verification, and the final answer.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: targeted-exploration
|
|
3
|
+
description: Explore codebases through search, relevant ranges, and module ownership.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Targeted exploration
|
|
7
|
+
|
|
8
|
+
Explore from signal to context.
|
|
9
|
+
|
|
10
|
+
## Flow
|
|
11
|
+
|
|
12
|
+
Search for the name, command, schema, error, or behavior. Read the relevant symbol or range. Then
|
|
13
|
+
read nearby callers or tests. Open the whole file when the range does not reveal ownership or
|
|
14
|
+
invariants.
|
|
15
|
+
|
|
16
|
+
## Search
|
|
17
|
+
|
|
18
|
+
Prefer structural or code-aware search when available. Use text search for identifiers and output
|
|
19
|
+
strings. Avoid dumping unrelated files into context.
|
|
20
|
+
|
|
21
|
+
## Stop condition
|
|
22
|
+
|
|
23
|
+
Stop exploring when you can name the owning module, the expected behavior, the likely change, and
|
|
24
|
+
the checks that will verify it.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: technical-writing
|
|
3
|
+
description: Write documentation that answers the reader's question quickly.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Technical writing
|
|
7
|
+
|
|
8
|
+
Documentation is read under pressure by someone trying to accomplish something. Optimize for their
|
|
9
|
+
task, not for completeness.
|
|
10
|
+
|
|
11
|
+
## Lead with the answer
|
|
12
|
+
|
|
13
|
+
Put the conclusion, the command or the decision first, then the explanation. Readers stop as soon as
|
|
14
|
+
they have what they need, and background before the answer wastes that attention.
|
|
15
|
+
|
|
16
|
+
## Write for a specific reader
|
|
17
|
+
|
|
18
|
+
Decide whether the audience is a newcomer, an integrator or a maintainer, and commit. Text that
|
|
19
|
+
serves everyone equally usually serves nobody.
|
|
20
|
+
|
|
21
|
+
## Separate the kinds
|
|
22
|
+
|
|
23
|
+
A tutorial teaches, a how-to solves one problem, a reference describes the surface, an explanation
|
|
24
|
+
gives context. Mixing them in one document makes it useless for all four purposes.
|
|
25
|
+
|
|
26
|
+
## Show the real thing
|
|
27
|
+
|
|
28
|
+
Include commands and examples that run as written. An example that has drifted from the code is
|
|
29
|
+
worse than no example, because it is trusted.
|
|
30
|
+
|
|
31
|
+
## Prune on every change
|
|
32
|
+
|
|
33
|
+
Delete what is obsolete rather than appending corrections. Documentation loses value through
|
|
34
|
+
accumulation, and stale instructions cost more than missing ones.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-doubles
|
|
3
|
+
description: Use fakes, stubs and mocks deliberately instead of mocking everything.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test doubles
|
|
7
|
+
|
|
8
|
+
Replace a real dependency only when using it makes the test slow, non-deterministic, or impossible
|
|
9
|
+
to run.
|
|
10
|
+
|
|
11
|
+
## Prefer the real thing
|
|
12
|
+
|
|
13
|
+
Use the real implementation when it is fast and deterministic. In-memory databases, temporary
|
|
14
|
+
directories and local fakes usually beat a mock, because they exercise the actual contract.
|
|
15
|
+
|
|
16
|
+
## Match the double to the need
|
|
17
|
+
|
|
18
|
+
Use a stub to supply input, a fake for a working lightweight implementation, and a mock only when
|
|
19
|
+
the interaction itself is the behavior under test. Asserting on calls to a dependency that is not
|
|
20
|
+
the subject couples the test to implementation.
|
|
21
|
+
|
|
22
|
+
## Double boundaries you own
|
|
23
|
+
|
|
24
|
+
Replace your own abstraction over a third-party client rather than the client internals. When the
|
|
25
|
+
library changes shape, one adapter moves instead of every test.
|
|
26
|
+
|
|
27
|
+
## Keep doubles honest
|
|
28
|
+
|
|
29
|
+
A double that accepts calls the real dependency would reject turns a passing test into false
|
|
30
|
+
confidence. Verify the contract against the real implementation at least once.
|