trackfw 2.16.0 → 3.1.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 +18 -2
- package/package.json +1 -1
- package/src/commands/discover.js +18 -0
- package/src/commands/index.js +2 -0
- package/src/commands/init.js +50 -4
- package/src/commands/integrations.js +75 -4
- package/src/commands/log.js +2 -1
- package/src/commands/note.js +24 -0
- package/src/commands/req.js +7 -1
- package/src/commands/roadmap.js +4 -3
- package/src/commands/ship.js +49 -0
- package/src/config/index.js +5 -2
- package/src/forge/adapter.js +189 -0
- package/src/forge/resolve.js +191 -0
- package/src/generators/adr.js +13 -4
- package/src/generators/date.js +23 -0
- package/src/generators/init.js +133 -8
- package/src/generators/note.js +154 -0
- package/src/generators/req.js +88 -5
- package/src/generators/roadmap.js +96 -20
- package/src/i18n/locales/en-US.json +2 -1
- package/src/i18n/locales/es-ES.json +2 -1
- package/src/i18n/locales/pt-BR.json +2 -1
- package/src/identity/preset.js +22 -0
- package/src/integrations/assets/agents/architect.md +32 -0
- package/src/integrations/assets/agents/backend.md +32 -0
- package/src/integrations/assets/agents/code-quality.md +29 -0
- package/src/integrations/assets/agents/data.md +32 -0
- package/src/integrations/assets/agents/dba.md +32 -0
- package/src/integrations/assets/agents/frontend.md +32 -0
- package/src/integrations/assets/agents/iac.md +46 -0
- package/src/integrations/assets/agents/infra.md +34 -0
- package/src/integrations/assets/agents/qa.md +32 -0
- package/src/integrations/assets/agents/security.md +29 -0
- package/src/integrations/assets/agents/tooling.md +47 -0
- package/src/integrations/assets/agents/ux.md +29 -0
- package/src/integrations/assets/catalog.json +16 -2
- package/src/integrations/assets/skills/architecture.md +66 -0
- package/src/integrations/assets/skills/backend.md +67 -0
- package/src/integrations/assets/skills/code-quality.md +78 -0
- package/src/integrations/assets/skills/data.md +75 -0
- package/src/integrations/assets/skills/dba.md +77 -0
- package/src/integrations/assets/skills/frontend.md +70 -0
- package/src/integrations/assets/skills/iac.md +90 -0
- package/src/integrations/assets/skills/infra.md +62 -0
- package/src/integrations/assets/skills/qa.md +63 -0
- package/src/integrations/assets/skills/security.md +74 -0
- package/src/integrations/assets/skills/tooling.md +80 -0
- package/src/integrations/assets/skills/ux.md +70 -0
- package/src/integrations/render.js +57 -6
- package/src/ship/runner.js +454 -0
- package/src/validator/index.js +321 -111
- package/src/validator/traceid.js +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trackfw-code-quality-skill
|
|
3
|
+
description: Maintainability metrics, quality gates, static analysis and refactoring discipline.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Quality as a Constraint
|
|
7
|
+
|
|
8
|
+
Quality gates are binary: the build either passes or fails. "Mostly passing" is not a gate.
|
|
9
|
+
Define thresholds before writing a line of code; retroactive enforcement is culturally harder.
|
|
10
|
+
|
|
11
|
+
Core gates:
|
|
12
|
+
- **Coverage**: ≥ 85% on the service/domain layer; measured per PR, not only on trunk.
|
|
13
|
+
- **Duplication**: < 5% code duplication across the codebase.
|
|
14
|
+
- **Cognitive complexity**: ≤ 15 per method/function (Sonar metric).
|
|
15
|
+
- **Cyclomatic complexity**: ≤ 10 per method (McCabe); lower is better.
|
|
16
|
+
- **Reliability rating**: A or B; no unresolved blocker or critical bugs.
|
|
17
|
+
|
|
18
|
+
## Static Analysis
|
|
19
|
+
|
|
20
|
+
Static analysis is the fastest feedback loop. Run it before tests, not after:
|
|
21
|
+
- Linters enforce style and catch common mistakes without executing the code.
|
|
22
|
+
- Security-focused analyzers (Semgrep, CodeQL) detect injection patterns, misuse of
|
|
23
|
+
cryptographic APIs and permission escalation.
|
|
24
|
+
- Language-specific tools provide deeper analysis than generic linters.
|
|
25
|
+
|
|
26
|
+
Apply the same analysis categories regardless of language:
|
|
27
|
+
- Dead code detection: exported symbols with no callers are maintenance overhead.
|
|
28
|
+
- Type coverage: avoid `any` / untyped in strongly-typed languages.
|
|
29
|
+
- Copy-paste detection: duplicated blocks are candidates for extraction.
|
|
30
|
+
|
|
31
|
+
## Refactoring Discipline
|
|
32
|
+
|
|
33
|
+
Refactor in isolation from feature work; separate commits, separate PRs when possible.
|
|
34
|
+
Never refactor and change behaviour in the same commit.
|
|
35
|
+
|
|
36
|
+
Common high-value refactoring moves:
|
|
37
|
+
- **Extract Method**: reduces cognitive complexity and enables unit testing of the extracted logic.
|
|
38
|
+
- **Replace Conditional with Polymorphism**: eliminates `switch` statements that grow with
|
|
39
|
+
every new type.
|
|
40
|
+
- **Extract Class (God Class)**: a class with Weighted Methods per Class > 47 or > 7
|
|
41
|
+
public methods is doing too much.
|
|
42
|
+
- **Introduce Parameter Object**: more than 3 parameters to a function signal that a value
|
|
43
|
+
object is missing.
|
|
44
|
+
|
|
45
|
+
## Architecture Fitness Functions
|
|
46
|
+
|
|
47
|
+
Architecture rules are code, not documentation:
|
|
48
|
+
- Enforce layer dependency direction (domain must not import infrastructure).
|
|
49
|
+
- Forbid cross-context imports between bounded contexts.
|
|
50
|
+
- Enforce naming conventions per layer (handler/controller, service, repository).
|
|
51
|
+
- Run as part of the CI test suite; a failing fitness function blocks merge.
|
|
52
|
+
|
|
53
|
+
## Conventional Commits
|
|
54
|
+
|
|
55
|
+
Every commit message follows the Conventional Commits specification:
|
|
56
|
+
`<type>(<scope>): <short description>`
|
|
57
|
+
|
|
58
|
+
Types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `build`, `ci`, `perf`, `style`.
|
|
59
|
+
|
|
60
|
+
The commit message explains **why**, not what — the diff shows what.
|
|
61
|
+
Breaking changes are marked with `!` after the type or with `BREAKING CHANGE:` in the footer.
|
|
62
|
+
Use commitlint in pre-commit hooks to enforce the format automatically.
|
|
63
|
+
|
|
64
|
+
## Mutation Testing
|
|
65
|
+
|
|
66
|
+
Mutation testing measures the effectiveness of the test suite by introducing deliberate
|
|
67
|
+
defects and checking whether tests catch them. A kill rate ≥ 80% is the target.
|
|
68
|
+
|
|
69
|
+
A test suite with high coverage but low mutation score is testing execution paths, not
|
|
70
|
+
correctness. Mutation testing surfaces untested assertions.
|
|
71
|
+
|
|
72
|
+
## Technical Debt Management
|
|
73
|
+
|
|
74
|
+
- Quantify debt as remediation effort (hours), not subjective "bad code" labels.
|
|
75
|
+
- Prioritize debt that sits on the critical path of active development.
|
|
76
|
+
- A technical debt item with no owner and no resolution date is not managed — it is ignored.
|
|
77
|
+
- Budget 10–20% of sprint capacity for debt reduction when the codebase is under active
|
|
78
|
+
development; higher when the debt is blocking feature velocity.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trackfw-data-skill
|
|
3
|
+
description: Data pipelines, quality contracts, lakehouse patterns and MLOps.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Pipeline Design Principles
|
|
7
|
+
|
|
8
|
+
- **Idempotent**: running a pipeline twice with the same inputs produces the same outputs with
|
|
9
|
+
no side effects. Idempotency enables safe retries and backfills.
|
|
10
|
+
- **Observable**: every pipeline run emits metrics (rows processed, duration, error count)
|
|
11
|
+
and structured logs. Silent pipelines hide data quality problems.
|
|
12
|
+
- **Incremental by default**: process only new or changed data; full reloads are expensive and
|
|
13
|
+
error-prone. Implement watermark or change-data-capture (CDC) patterns.
|
|
14
|
+
- **Testable**: test transformations with deterministic fixtures. A pipeline that cannot be
|
|
15
|
+
run locally with sample data is hard to debug.
|
|
16
|
+
|
|
17
|
+
## Data Contracts
|
|
18
|
+
|
|
19
|
+
A data contract is a versioned schema agreement between a data producer and its consumers.
|
|
20
|
+
Breaking schema changes require a new contract version and a migration window:
|
|
21
|
+
- Define contracts before building pipelines, not after.
|
|
22
|
+
- Validate incoming data against the contract on ingestion; reject or quarantine violations.
|
|
23
|
+
- Version schemas explicitly (SemVer or a sequential version field).
|
|
24
|
+
- Treat a schema change that breaks downstream consumers as a breaking change — the same way
|
|
25
|
+
an API breaking change is treated.
|
|
26
|
+
|
|
27
|
+
## ELT / Transformation
|
|
28
|
+
|
|
29
|
+
- Prefer ELT (Extract, Load, Transform) over ETL when the target system can handle the
|
|
30
|
+
transformation cost; push compute to where the data lives.
|
|
31
|
+
- SQL transformations with dbt are version-controlled, testable and self-documenting.
|
|
32
|
+
- Model data in layers: raw (landing, immutable), staged (typed, deduplicated), marts
|
|
33
|
+
(business-aligned aggregations). Never query raw data directly in reports.
|
|
34
|
+
- Materialized models for expensive aggregations; incremental models for large tables.
|
|
35
|
+
|
|
36
|
+
## Streaming and Real-Time
|
|
37
|
+
|
|
38
|
+
- Use a durable, partitioned log (Kafka, Pulsar) for event streaming; producers and consumers
|
|
39
|
+
are decoupled in time and scale independently.
|
|
40
|
+
- Guarantee semantics: at-least-once is the safe default; exactly-once requires coordinated
|
|
41
|
+
transactions between the broker and the sink.
|
|
42
|
+
- Windowing functions (tumbling, sliding, session) for time-based aggregations in stream
|
|
43
|
+
processing.
|
|
44
|
+
- Monitor consumer lag continuously; unprocessed lag accumulation is an early warning of
|
|
45
|
+
a performance or capacity problem.
|
|
46
|
+
|
|
47
|
+
## Data Quality
|
|
48
|
+
|
|
49
|
+
- Data quality checks belong in the pipeline, not in the dashboard. Fail fast, fail clearly.
|
|
50
|
+
- Test categories: **schema** (types, nullability, column existence), **integrity** (referential
|
|
51
|
+
keys, uniqueness), **freshness** (last-updated within expected window), **statistical**
|
|
52
|
+
(distribution drift, unexpected nulls or zeros).
|
|
53
|
+
- Quarantine rows that fail quality checks rather than silently dropping them; dropped rows
|
|
54
|
+
hide data completeness problems.
|
|
55
|
+
- SLA: define freshness and completeness SLAs per dataset; alert on SLA breach, not on
|
|
56
|
+
arbitrary thresholds.
|
|
57
|
+
|
|
58
|
+
## Lakehouse and Storage
|
|
59
|
+
|
|
60
|
+
- Store raw data in an open, columnar format (Parquet) in object storage; this decouples
|
|
61
|
+
compute from storage and avoids vendor lock-in.
|
|
62
|
+
- Table formats (Delta Lake, Apache Iceberg) add ACID transactions, schema evolution and
|
|
63
|
+
time travel to object storage. Use them for tables that require updates or deletes.
|
|
64
|
+
- Partition large tables by a time dimension and a high-cardinality business key to enable
|
|
65
|
+
efficient pruning.
|
|
66
|
+
|
|
67
|
+
## MLOps
|
|
68
|
+
|
|
69
|
+
- Feature stores decouple feature engineering from model training; online serving and offline
|
|
70
|
+
training use the same feature definitions (point-in-time correctness).
|
|
71
|
+
- Track every experiment: hyperparameters, dataset version, metrics, artifact location.
|
|
72
|
+
Reproducibility requires logging, not memory.
|
|
73
|
+
- Model deployment is a software deployment: versioned, tested, monitored, rollback-capable.
|
|
74
|
+
- Monitor model performance in production: data drift, prediction drift, and business metric
|
|
75
|
+
correlation. Retraining triggers are defined by drift thresholds, not by calendar.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trackfw-dba-skill
|
|
3
|
+
description: Database modeling, query optimization, high availability and vector data patterns.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Modeling
|
|
7
|
+
|
|
8
|
+
Choose the data model based on access patterns, not familiarity:
|
|
9
|
+
- **Relational (SQL)**: normalized schemas, foreign key integrity, ACID transactions. Best when
|
|
10
|
+
relationships are complex and consistency is paramount.
|
|
11
|
+
- **Document**: flexible schema for hierarchical, polymorphic data. Beware of embedding without
|
|
12
|
+
considering update patterns.
|
|
13
|
+
- **Key-Value / Wide-Column**: for high-throughput reads/writes with simple access patterns.
|
|
14
|
+
Design the key structure before creating the table — it cannot be changed cheaply.
|
|
15
|
+
- **Graph**: for highly connected data where traversal depth and relationship types vary.
|
|
16
|
+
|
|
17
|
+
Model for queries, not for purity. A schema that cannot be queried efficiently without
|
|
18
|
+
full-table scans has the wrong design.
|
|
19
|
+
|
|
20
|
+
## Indexing
|
|
21
|
+
|
|
22
|
+
- Create indexes to support the actual query patterns in the application; unused indexes
|
|
23
|
+
consume write overhead and space.
|
|
24
|
+
- Composite indexes: column order matters. The most selective column first, then the columns
|
|
25
|
+
used in equality filters, then range predicates.
|
|
26
|
+
- Partial indexes (filtered indexes) reduce index size and improve write throughput when a
|
|
27
|
+
significant fraction of rows never appear in queries.
|
|
28
|
+
- Validate index usage with execution plans (`EXPLAIN ANALYZE`); an index that the optimizer
|
|
29
|
+
ignores is waste.
|
|
30
|
+
|
|
31
|
+
## Query Optimization
|
|
32
|
+
|
|
33
|
+
- Read the execution plan for every slow query; identify table scans, nested loops and
|
|
34
|
+
sort operations that could be eliminated.
|
|
35
|
+
- Avoid `SELECT *`; project only the columns the application uses.
|
|
36
|
+
- Parameterize queries; never concatenate user input into SQL strings.
|
|
37
|
+
- Push filters as early as possible in query pipelines (aggregations, joins).
|
|
38
|
+
- Analyze and update table statistics regularly; stale statistics cause bad query plans.
|
|
39
|
+
|
|
40
|
+
## High Availability and Replication
|
|
41
|
+
|
|
42
|
+
- Define RTO and RPO per service tier before choosing an HA architecture.
|
|
43
|
+
- Read replicas for read-heavy workloads; route analytics queries away from the primary.
|
|
44
|
+
- Point-in-time recovery (PITR) is mandatory for production databases.
|
|
45
|
+
- Test backup restoration on a schedule; a backup that has never been restored is
|
|
46
|
+
unverified and therefore unreliable.
|
|
47
|
+
- Cross-region replication for disaster recovery; understand replication lag and its
|
|
48
|
+
impact on read-after-write consistency.
|
|
49
|
+
|
|
50
|
+
## Cache Integration
|
|
51
|
+
|
|
52
|
+
- **Cache-aside**: application reads from cache; on miss, reads from database and populates
|
|
53
|
+
cache. Simple and explicit. Handles cache invalidation at write time.
|
|
54
|
+
- **Write-through**: write to both cache and database atomically. Keeps cache consistent at
|
|
55
|
+
the cost of write latency.
|
|
56
|
+
- Set TTLs on every cache entry; unbounded cache growth leads to eviction unpredictability.
|
|
57
|
+
- Cache only safe data (no PII without appropriate controls); audit what is cached.
|
|
58
|
+
|
|
59
|
+
## Vector Databases
|
|
60
|
+
|
|
61
|
+
For AI/ML retrieval workloads:
|
|
62
|
+
- **Index choice**: HNSW (Hierarchical Navigable Small World) for low-latency ANN search;
|
|
63
|
+
IVFFlat for higher-recall bulk workloads.
|
|
64
|
+
- **Hybrid search**: combine dense vector search with sparse (BM25) text search using
|
|
65
|
+
Reciprocal Rank Fusion (RRF). Pure dense search underperforms on keyword-heavy queries.
|
|
66
|
+
- **Reranking**: apply a cross-encoder reranker after initial retrieval to improve top-k
|
|
67
|
+
precision without the cost of reranking the full corpus.
|
|
68
|
+
- Match the embedding model dimensionality to the index; switching models requires
|
|
69
|
+
re-embedding the entire corpus.
|
|
70
|
+
|
|
71
|
+
## Analytics and Columnar Storage
|
|
72
|
+
|
|
73
|
+
- Columnar engines (ClickHouse, DuckDB, BigQuery) are optimized for aggregations over a
|
|
74
|
+
subset of columns in large tables; do not use them for OLTP row-level operations.
|
|
75
|
+
- Materialized views pre-aggregate expensive queries; refresh strategy (incremental vs full)
|
|
76
|
+
depends on freshness requirements and write volume.
|
|
77
|
+
- Partition large tables by time or a high-cardinality dimension to enable partition pruning.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trackfw-frontend-skill
|
|
3
|
+
description: Accessible, performant and internationalizable user interfaces.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Core Principles
|
|
7
|
+
|
|
8
|
+
- **Web-first**: design for the browser platform first; native equivalents are additive.
|
|
9
|
+
- **Progressive enhancement**: core functionality works without JavaScript; enhancements layer on top.
|
|
10
|
+
- **Accessibility is not optional**: WCAG 2.2 AA is the minimum bar for every user-facing interface.
|
|
11
|
+
- **Performance is a feature**: Core Web Vitals (LCP < 2.5 s, CLS < 0.1, INP < 200 ms) are
|
|
12
|
+
production quality gates, not post-launch concerns.
|
|
13
|
+
|
|
14
|
+
## Component Architecture
|
|
15
|
+
|
|
16
|
+
Build components at the atomic level (atoms → molecules → organisms → pages). Each component
|
|
17
|
+
has a single, well-defined responsibility. Compose, do not inherit.
|
|
18
|
+
|
|
19
|
+
Separate concerns clearly:
|
|
20
|
+
- **Data fetching** lives outside components (query layer, data hooks, server components).
|
|
21
|
+
- **State** is as local as possible; lift only when two components genuinely share it.
|
|
22
|
+
- **UI logic** stays in the component; business rules belong in services or server-side code.
|
|
23
|
+
|
|
24
|
+
## Accessibility (WCAG 2.2 AA)
|
|
25
|
+
|
|
26
|
+
- Use semantic HTML as the foundation; ARIA supplements, never replaces, semantics.
|
|
27
|
+
- Every interactive element is keyboard-navigable with a visible focus indicator.
|
|
28
|
+
- Color contrast ratio ≥ 4.5:1 for normal text, ≥ 3:1 for large text.
|
|
29
|
+
- Support `prefers-reduced-motion`; do not auto-play animations.
|
|
30
|
+
- Test with at least one screen reader (VoiceOver, NVDA) during development.
|
|
31
|
+
- Integrate `axe-core` in CI to catch regressions automatically.
|
|
32
|
+
|
|
33
|
+
## Performance
|
|
34
|
+
|
|
35
|
+
- Lazy-load routes and heavy components; code-split at meaningful boundaries.
|
|
36
|
+
- Optimize images: responsive sizes, modern formats (WebP/AVIF), explicit `width` and `height`
|
|
37
|
+
to avoid layout shift.
|
|
38
|
+
- Virtual scrolling for lists with more than a few hundred items.
|
|
39
|
+
- Monitor performance budgets in CI with Lighthouse; fail the build on regressions.
|
|
40
|
+
|
|
41
|
+
## Internationalisation (i18n)
|
|
42
|
+
|
|
43
|
+
- Externalize all user-visible strings at the start; retrofitting is expensive.
|
|
44
|
+
- Use ICU message format for pluralization and gender rules.
|
|
45
|
+
- RTL layout support requires logical CSS properties (`margin-inline-start` over `margin-left`).
|
|
46
|
+
- Locale-aware date, number and currency formatting — never hand-roll these.
|
|
47
|
+
|
|
48
|
+
## State Management
|
|
49
|
+
|
|
50
|
+
Choose the simplest state model that fits the problem:
|
|
51
|
+
- Local component state for ephemeral UI.
|
|
52
|
+
- Server-state cache (e.g., query libraries with stale-while-revalidate) for remote data.
|
|
53
|
+
- Client-side global state only when truly shared across unrelated subtrees.
|
|
54
|
+
- Finite state machines for complex multi-step flows to make impossible states impossible.
|
|
55
|
+
|
|
56
|
+
## Testing
|
|
57
|
+
|
|
58
|
+
- Web-first assertions: assert on visible state and accessibility, not internal implementation.
|
|
59
|
+
- Do not use `waitForTimeout`; await stable DOM state or network idle instead.
|
|
60
|
+
- Component tests verify rendered output and user interactions (click, type, submit).
|
|
61
|
+
- E2E tests cover critical paths with real browser automation (Playwright).
|
|
62
|
+
- Visual regression for design-system components.
|
|
63
|
+
|
|
64
|
+
## Design Systems
|
|
65
|
+
|
|
66
|
+
- Design tokens (W3C DTCG format) are the single source of truth for spacing, color and
|
|
67
|
+
typography. Tokens propagate to both design tools and code.
|
|
68
|
+
- Document components in isolation; a component that cannot be demonstrated in isolation
|
|
69
|
+
is too tightly coupled.
|
|
70
|
+
- Maintain a clear Figma → dev handoff contract; use Dev Mode or equivalent tooling.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trackfw-iac-skill
|
|
3
|
+
description: Declarative infrastructure provisioning, state management, policy-as-code and immutability.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Foundational Principles
|
|
7
|
+
|
|
8
|
+
Infrastructure as Code means the repository is the authoritative source of truth for every
|
|
9
|
+
provisioned resource. If it is not in code, it does not officially exist.
|
|
10
|
+
|
|
11
|
+
- **Declarative over imperative**: describe the desired end state; let the tool reconcile.
|
|
12
|
+
- **Idempotent by design**: applying the same configuration twice must produce the same result.
|
|
13
|
+
- **Immutable infrastructure**: replace, do not patch. Mutable drift between nodes is a source
|
|
14
|
+
of undocumented operational risk.
|
|
15
|
+
- **Least privilege**: every resource receives the minimum permissions required, nothing more.
|
|
16
|
+
Wildcard actions combined with wildcard resources are forbidden.
|
|
17
|
+
|
|
18
|
+
## File and Module Structure
|
|
19
|
+
|
|
20
|
+
Organize files by concern, not by resource count. In Terraform/OpenTofu:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
infra/<environment>/
|
|
24
|
+
├── main.tf # primary resources
|
|
25
|
+
├── variables.tf # typed, described, validated inputs
|
|
26
|
+
├── outputs.tf # values consumed by other configurations
|
|
27
|
+
├── versions.tf # required_version and required_providers (pinned)
|
|
28
|
+
├── locals.tf # computed values, naming conventions, shared tags
|
|
29
|
+
└── data.tf # data sources, separate from managed resources
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Never put everything in `main.tf`. One file per concern makes diffs reviewable and
|
|
33
|
+
`terraform plan` output readable.
|
|
34
|
+
|
|
35
|
+
Module decisions:
|
|
36
|
+
- Create a local module when a pattern repeats three or more times in the same project.
|
|
37
|
+
- Prefer a well-maintained registry module over a custom one for complex resources.
|
|
38
|
+
- Always pin module versions: `version = "~> 4.0"`. Unpinned modules are a supply-chain risk.
|
|
39
|
+
|
|
40
|
+
## State Management
|
|
41
|
+
|
|
42
|
+
Remote state is mandatory for team and production environments:
|
|
43
|
+
- Store in a managed backend with encryption at rest and distributed locking.
|
|
44
|
+
- Never commit `terraform.tfstate` or `*.tfvars` containing secrets.
|
|
45
|
+
- Use workspaces or separate state files per environment; mixing environments in a single
|
|
46
|
+
state file is an operational hazard.
|
|
47
|
+
- Enable state file backup and versioning on the storage backend.
|
|
48
|
+
|
|
49
|
+
## Plan, Review and Apply
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
1. terraform fmt -check -recursive # style
|
|
53
|
+
2. terraform validate # syntax and provider schema
|
|
54
|
+
3. policy-as-code scan (Checkov, Trivy config) # security gates
|
|
55
|
+
4. cost estimation (Infracost) # visibility before apply
|
|
56
|
+
5. terraform plan -out=plan.tfplan # deterministic plan
|
|
57
|
+
6. human review of plan # mandatory for production
|
|
58
|
+
7. terraform apply plan.tfplan # apply the reviewed plan
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Never apply to production without a reviewed, saved plan.** Ad-hoc `terraform apply` in
|
|
62
|
+
production bypasses the review gate and defeats reproducibility.
|
|
63
|
+
|
|
64
|
+
## Policy-as-Code
|
|
65
|
+
|
|
66
|
+
Automated policy checks run before `apply`, not after:
|
|
67
|
+
- Reject resources with encryption disabled (storage, databases, secrets).
|
|
68
|
+
- Reject IAM policies with `"*"` on both action and resource simultaneously.
|
|
69
|
+
- Require mandatory tags (environment, team, cost-centre) on all taggable resources.
|
|
70
|
+
- Enforce minimum TLS versions and private endpoint requirements.
|
|
71
|
+
- HIGH and CRITICAL policy violations block the pipeline; they are not warnings.
|
|
72
|
+
|
|
73
|
+
## Configuration Management (Ansible)
|
|
74
|
+
|
|
75
|
+
- Every task must be idempotent: running the playbook twice must not change the system on the
|
|
76
|
+
second run.
|
|
77
|
+
- Use `no_log: true` on every task that handles secrets or credentials.
|
|
78
|
+
- Store secrets in a secrets manager or vault; never in playbook variables or inventory files.
|
|
79
|
+
- Use dynamic inventory sources; never hardcode hostnames or IP addresses.
|
|
80
|
+
- Name every task descriptively; unnamed tasks make failure logs unreadable.
|
|
81
|
+
|
|
82
|
+
## Anti-Patterns
|
|
83
|
+
|
|
84
|
+
The following are always wrong:
|
|
85
|
+
- `apply` in production without a human-reviewed plan.
|
|
86
|
+
- Secrets in `.tfvars`, environment variables without a secrets manager, or hardcoded values.
|
|
87
|
+
- `"*"` in both `actions` and `resources` of an IAM statement.
|
|
88
|
+
- Unpinned module or provider versions.
|
|
89
|
+
- `null_resource` or `local-exec` for business logic that a provider resource can handle.
|
|
90
|
+
- Manual changes to resources managed by IaC (infrastructure drift).
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trackfw-infra-skill
|
|
3
|
+
description: Cloud platforms, Kubernetes operations, CI/CD, observability and reliability.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Kubernetes Operations
|
|
7
|
+
|
|
8
|
+
- GitOps is the source of truth: cluster state is declared in a repository and reconciled
|
|
9
|
+
continuously by a controller (ArgoCD, Flux). Manual `kubectl apply` in production is an
|
|
10
|
+
anti-pattern.
|
|
11
|
+
- Use readiness and liveness probes on every workload; tune them to reflect actual service
|
|
12
|
+
health, not just process health.
|
|
13
|
+
- Resource requests and limits are mandatory; workloads without them destabilize the
|
|
14
|
+
node's QoS. Rightsize with Vertical Pod Autoscaler metrics, not guesses.
|
|
15
|
+
- RBAC: least privilege per ServiceAccount. Never use the `cluster-admin` role for workloads.
|
|
16
|
+
- Pod Security Standards (restricted profile) as the default; relax per workload only with
|
|
17
|
+
documented justification.
|
|
18
|
+
|
|
19
|
+
## CI/CD
|
|
20
|
+
|
|
21
|
+
- Pipelines are code: version-controlled, reviewable, tested.
|
|
22
|
+
- Use environment-specific deployment gates; production deployments require explicit approval.
|
|
23
|
+
- Separate build from deploy: the same artifact that passed staging is promoted to production
|
|
24
|
+
(immutable artifact principle).
|
|
25
|
+
- Reusable workflows reduce duplication; extract common steps (lint, test, scan, notify).
|
|
26
|
+
- Dependency scanning and container image scanning run on every PR, not only on schedule.
|
|
27
|
+
|
|
28
|
+
## Observability
|
|
29
|
+
|
|
30
|
+
Instrument with OpenTelemetry as the vendor-neutral standard:
|
|
31
|
+
- **Metrics**: RED method (Rate, Errors, Duration) for services; USE method (Utilization,
|
|
32
|
+
Saturation, Errors) for resources.
|
|
33
|
+
- **Traces**: distributed trace context propagates across all service calls; sample based on
|
|
34
|
+
latency or error, not uniformly.
|
|
35
|
+
- **Logs**: structured JSON to stdout; correlate with trace ID.
|
|
36
|
+
- Define SLOs and error budgets before an incident, not during.
|
|
37
|
+
- Golden signals dashboard is the first screen in any incident response.
|
|
38
|
+
|
|
39
|
+
## Reliability
|
|
40
|
+
|
|
41
|
+
- Chaos engineering (controlled failure injection) validates reliability assumptions before
|
|
42
|
+
production incidents do. Start with single-node failures, then dependency outages.
|
|
43
|
+
- Disaster recovery: define RTO and RPO per service tier; test backup restoration on schedule
|
|
44
|
+
— untested backups are not backups.
|
|
45
|
+
- Multi-AZ for stateful workloads; cross-region only where business continuity justifies cost.
|
|
46
|
+
- Circuit breakers at the service mesh layer protect downstream services from cascading failures.
|
|
47
|
+
|
|
48
|
+
## Cloud Cost Optimization (FinOps)
|
|
49
|
+
|
|
50
|
+
- Tag every resource with team, environment and cost centre at provisioning time; retroactive
|
|
51
|
+
tagging is never complete.
|
|
52
|
+
- Spot/preemptible instances for stateless, fault-tolerant workloads; reserved capacity for
|
|
53
|
+
predictable baseline load.
|
|
54
|
+
- Rightsizing is a continuous process; review monthly, not quarterly.
|
|
55
|
+
- Cost visibility per team is a prerequisite for accountability.
|
|
56
|
+
|
|
57
|
+
## Supply Chain Security
|
|
58
|
+
|
|
59
|
+
- Sign container images with Sigstore/Cosign; verify signatures in admission controllers.
|
|
60
|
+
- Generate SBOM (CycloneDX or SPDX) on every build; store alongside the artifact.
|
|
61
|
+
- Pin base image digests, not tags; floating tags introduce silent updates.
|
|
62
|
+
- Scan dependencies for known CVEs at build time and on a regular schedule.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trackfw-qa-skill
|
|
3
|
+
description: Automated testing, quality gates, contract verification and coverage strategy.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Test Pyramid
|
|
7
|
+
|
|
8
|
+
Maintain a healthy ratio: approximately 70% unit tests, 20% integration tests, 10% E2E tests.
|
|
9
|
+
Unit tests give fast, precise feedback. Integration tests verify component boundaries and
|
|
10
|
+
database behaviour with real infrastructure. E2E tests cover critical user journeys end-to-end.
|
|
11
|
+
|
|
12
|
+
Deviating from the pyramid is a deliberate trade-off — document the reason.
|
|
13
|
+
|
|
14
|
+
## E2E Testing Principles
|
|
15
|
+
|
|
16
|
+
- **Web-first assertions**: assert on stable, observable state (element visible, text present,
|
|
17
|
+
URL changed) — never `waitForTimeout`, which is fragile and masks real timing issues.
|
|
18
|
+
- **Cross-browser matrix**: test Chromium, Firefox and WebKit; sharding keeps CI fast.
|
|
19
|
+
- **Real authentication**: use actual credentials stored in `storageState`; mock auth hides
|
|
20
|
+
permission bugs and token expiry issues that appear in production.
|
|
21
|
+
- **Trace on failure**: attach Playwright trace files to CI artifacts for deterministic replay.
|
|
22
|
+
- **Visual regression**: snapshot tests for design-system components; fail the PR on visual drift.
|
|
23
|
+
|
|
24
|
+
## Integration Testing
|
|
25
|
+
|
|
26
|
+
- Integration tests must hit a real database (via Testcontainers or an equivalent ephemeral
|
|
27
|
+
service). Mocked repositories hide driver/migration mismatches that cause production failures.
|
|
28
|
+
- Seed deterministic fixtures; avoid shared state between tests — parallel runs must not collide.
|
|
29
|
+
|
|
30
|
+
## Contract Testing
|
|
31
|
+
|
|
32
|
+
API contracts are a team boundary. Use schema-driven contract testing (e.g., Pact for
|
|
33
|
+
consumer-driven contracts, Spectral for OpenAPI lint) to catch breaking changes before
|
|
34
|
+
deployment, not after.
|
|
35
|
+
|
|
36
|
+
## Quality Gates
|
|
37
|
+
|
|
38
|
+
- Coverage thresholds enforced in CI (service layer ≥ 85%); fail the build on regression.
|
|
39
|
+
- Mutation testing score ≥ 80%: a test suite that does not kill mutations gives false
|
|
40
|
+
confidence.
|
|
41
|
+
- Flaky tests are quarantined immediately; a test with stability score < 95% is either fixed
|
|
42
|
+
or removed. Flaky tests erode trust in the entire suite.
|
|
43
|
+
- SonarQube or equivalent quality gate on every PR: coverage, duplication, critical issues.
|
|
44
|
+
|
|
45
|
+
## Bug Hunting
|
|
46
|
+
|
|
47
|
+
A bug report is only complete when it includes:
|
|
48
|
+
1. Deterministic reproduction steps.
|
|
49
|
+
2. Expected vs. actual behaviour.
|
|
50
|
+
3. Environment (OS, browser, version, test data).
|
|
51
|
+
|
|
52
|
+
Root-cause analysis must produce a regression test that would have caught the bug before
|
|
53
|
+
it reached production. Fix the test pyramid root cause, not just the symptom.
|
|
54
|
+
|
|
55
|
+
## Accessibility in QA
|
|
56
|
+
|
|
57
|
+
Integrate accessibility checks (`axe-core`, Lighthouse a11y) in CI. A WCAG 2.2 AA violation
|
|
58
|
+
is a defect with the same severity as a functional bug.
|
|
59
|
+
|
|
60
|
+
## Performance Budgets
|
|
61
|
+
|
|
62
|
+
Define Lighthouse performance budgets per route: LCP, CLS, INP thresholds. Run Lighthouse CI
|
|
63
|
+
on every PR targeting main; block merge on regression.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trackfw-security-skill
|
|
3
|
+
description: Threat modeling, DevSecOps controls, Zero Trust and supply chain security.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Shift-Left Security
|
|
7
|
+
|
|
8
|
+
Security controls belong in the development pipeline, not only at the perimeter. The later a
|
|
9
|
+
vulnerability is found, the more expensive it is to fix.
|
|
10
|
+
|
|
11
|
+
CI pipeline mandatory gates:
|
|
12
|
+
- **SAST** (Static Application Security Testing): scan source code on every PR.
|
|
13
|
+
- **SCA** (Software Composition Analysis): identify vulnerable dependencies; block on HIGH/CRITICAL.
|
|
14
|
+
- **Secrets scanning**: detect committed credentials before they reach the repository.
|
|
15
|
+
- **Container image scanning**: scan base images and final images; fail on HIGH/CRITICAL CVEs.
|
|
16
|
+
- **IaC security**: scan Terraform, Helm and Kubernetes manifests for misconfigurations.
|
|
17
|
+
|
|
18
|
+
## Threat Modeling
|
|
19
|
+
|
|
20
|
+
Model threats before writing code for any new feature that handles authentication, authorisation,
|
|
21
|
+
data storage or external integrations. Use STRIDE as the baseline framework:
|
|
22
|
+
|
|
23
|
+
| Threat | Example |
|
|
24
|
+
|---|---|
|
|
25
|
+
| Spoofing | Forged identity or token |
|
|
26
|
+
| Tampering | Modified request payload |
|
|
27
|
+
| Repudiation | Missing audit trail |
|
|
28
|
+
| Information Disclosure | Over-permissive API response |
|
|
29
|
+
| Denial of Service | Unbounded resource consumption |
|
|
30
|
+
| Elevation of Privilege | Broken access control |
|
|
31
|
+
|
|
32
|
+
Validate findings against OWASP Top 10 and ASVS (Application Security Verification Standard)
|
|
33
|
+
at the appropriate assurance level for the feature.
|
|
34
|
+
|
|
35
|
+
## Zero Trust Architecture
|
|
36
|
+
|
|
37
|
+
- **Never trust, always verify**: authenticate and authorize every request, regardless of network
|
|
38
|
+
origin. Internal services are not implicitly trusted.
|
|
39
|
+
- **mTLS** between services in a mesh: mutual authentication proves both sides hold valid certificates.
|
|
40
|
+
- **Least privilege at every layer**: IAM roles, Kubernetes RBAC, database users — minimum
|
|
41
|
+
permissions for the task, nothing more.
|
|
42
|
+
- **JIT (Just-in-Time) access**: elevate privilege for a bounded time window for administrative
|
|
43
|
+
tasks; revoke automatically.
|
|
44
|
+
|
|
45
|
+
## Identity and Access Management
|
|
46
|
+
|
|
47
|
+
- OAuth 2.0 with PKCE for public clients; validate `iss`, `aud` and `exp` on every JWT.
|
|
48
|
+
- RBAC for coarse-grained access; ABAC for attribute-based decisions.
|
|
49
|
+
- Rotate credentials on schedule and on any suspicion of compromise.
|
|
50
|
+
- Secrets management: use a dedicated secrets manager; never hardcode secrets in code,
|
|
51
|
+
configuration files or environment variables committed to a repository.
|
|
52
|
+
|
|
53
|
+
## Supply Chain Security
|
|
54
|
+
|
|
55
|
+
- Generate an SBOM (Software Bill of Materials) in CycloneDX or SPDX format on every build.
|
|
56
|
+
- Sign artifacts and container images (Sigstore/Cosign); verify signatures in admission
|
|
57
|
+
controllers before deploying to production.
|
|
58
|
+
- Pin dependency versions; review updates in PRs, not silently via floating ranges.
|
|
59
|
+
- Monitor for newly published CVEs against your SBOM continuously, not just at build time.
|
|
60
|
+
|
|
61
|
+
## API Security
|
|
62
|
+
|
|
63
|
+
Design APIs with OWASP API Security Top 10 in mind:
|
|
64
|
+
- Broken Object Level Authorization (BOLA) is the most common API vulnerability — validate
|
|
65
|
+
that the caller has access to the specific object, not just the endpoint.
|
|
66
|
+
- Rate-limiting and input validation are required on every public endpoint.
|
|
67
|
+
- Avoid exposing internal IDs directly; prefer opaque tokens or UUIDs.
|
|
68
|
+
|
|
69
|
+
## Incident Readiness
|
|
70
|
+
|
|
71
|
+
- Centralise logs and security events in a SIEM; define alerting thresholds before incidents occur.
|
|
72
|
+
- Maintain and rehearse an incident response playbook; detection-to-containment time (MTTC)
|
|
73
|
+
is the metric that matters.
|
|
74
|
+
- Conduct a post-incident review (PIR) after every significant security event; update controls.
|