agentleFS
LiriRaidLiriRaid/waymark/skills/dept-data/SKILL.md

dept-data

Skill1 starsChanged 58 days agoMITView on GitHub

Waymark · Data & State department. Use FIRST for schema, queries and state: \"migración\", \"nueva tabla\", \"columna\", \"índice\", \"consulta lenta\", \"N+1\", \"cache\", \"Redis\", \"modelo\", \"store\", \"estado global\", SQL, ORM, seed.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Mission: Keep data correct, consistent and fast, from the database schema to the client-side store.

    line 9
  2. Very specific:

    Run the *Waymark protocol → Entry* from the instructions file (already in context.

    line 15
  3. Very specific:

    Does not own: endpoints and handlers → dept-backend · UI components → dept-frontend · authn/authz policy, secrets → dept-security · …

    line 33
  4. Distinctive:

    MUST: keep migrations zero-downtime: old code must run against the new schema during deploy.

    line 48
  5. Distinctive:

    MUST: use parameterized queries.

    line 51
  6. Distinctive:

    MUST: keep one source of truth per piece of client state.

    line 54
  7. Very specific:

    SHOULD: follow the stack's naming convention (e.g.

    line 55
  8. Distinctive:

    SHOULD: prefer the simplest reactive primitive.

    line 56
  9. Distinctive:

    SHOULD: use soft delete or archival only when a requirement asks for it.

    line 57
  10. Very specific:

    MUST NOT: use loose types (any-like) in models.

    line 61
  11. Distinctive:

    MUST NOT: run long data backfills inside a schema migration on large tables.

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Data Engineering & State Management

Quick ref

Mission: Keep data correct, consistent and fast, from the database schema to the client-side store. Must: migrations reversible and zero-downtime · index foreign keys and filtered columns · every cache has a key scheme, TTL and invalidation · single source of truth for client state · no secrets in client storage Skills by default: library-docs · code-review · Explore · engram (MCP) DoD: gates green · migration rollback tested · query plan checked · cache invalidation defined · state derived, not duplicated

Entry

Run the Waymark protocol → Entry from the instructions file (already in context; do not load the waymark skill for it). No Waymark block in context (guest) → Guest entry, ../waymark/references/coexistence.md §3. Department-specific reads:

  • Learnings: ~/.waymark/learnings/dept-data.md if it exists.
  • Stack profile: L1 Commands + Data/State, L2+ full.
  • Tools: the Tools table below. Open ../waymark/skill-registry.md only if a capability there has no installed provider.

Brief questions

The brief must answer before the first edit:

  1. What — which table/column/index/query/cache/store changes, and the exact shape (types, nullability, constraints, keys).
  2. Why / for whom — which feature or measured problem (latency, N+1, inconsistency) it serves; for caches, the measurement that justifies it.
  3. Where — migration, model, repository, cache and store locations per the architecture profile; who owns the data (one feature or shared).
  4. Change class — additive or destructive; if destructive, the expand/contract steps and release in which each runs.
  5. Integrity & access — constraints in the database, tenant/owner scoping, row-level policy, PII columns.
  6. Performance — indexes needed, expected row counts, EXPLAIN plan, pagination strategy, lock risk on large tables.
  7. Consistency — cache key scheme, TTL, invalidation trigger; client state owner, derived values, stale-event handling.
  8. How / done — procedure below, skills and MCP chosen, rollback proof and tests (zero/one/many rows, hit/miss/invalidation).

Scope

  • Owns: schema design, migrations, indexes, constraints, query performance, row-level access rules as data policy, server caches, client state stores, derived state, client persistence, data models and types, seeds and fixtures.
  • Does not own: endpoints and handlers → dept-backend · UI components → dept-frontend · authn/authz policy, secrets → dept-security · backups, DB provisioning → dept-devops · module boundaries → dept-architecture.

Procedures

Detailed steps live in procedures.md (same folder). Read only the section you need: search its heading, read that block, not the whole file. Anti-patterns and references are at the end of that file.

  • Schema migration
  • New query or repository method
  • Server cache
  • Client state store
  • Client persistence
  • Bug fix (data or state)
  • Refactor

Rules

  • MUST make every migration reversible, or document why it is irreversible and how to restore.
  • MUST keep migrations zero-downtime: old code must run against the new schema during deploy.
  • MUST index foreign keys and frequently filtered/sorted columns; add unique constraints for business uniqueness.
  • MUST enforce integrity in the database (constraints) in addition to application validation.
  • MUST use parameterized queries; no string-built SQL with input.
  • MUST scope every query on multi-tenant or user-owned data by tenant/owner, via row-level policies or a mandatory query scope.
  • MUST give every cache entry a namespaced key, explicit TTL and an invalidation trigger.
  • MUST keep one source of truth per piece of client state; derive, do not duplicate.
  • SHOULD follow the stack's naming convention (e.g. snake_case columns) and singular/plural consistently.
  • SHOULD prefer the simplest reactive primitive; use stream libraries only for real event streams (sockets, debounced input, cancellation).
  • SHOULD use soft delete or archival only when a requirement asks for it.
  • SHOULD measure (EXPLAIN, profiler) before optimizing.
  • MUST NOT edit or delete a migration already applied in a shared environment.
  • MUST NOT store tokens, secrets or PII in browser storage.
  • MUST NOT use loose types (any-like) in models; use precise types and narrow unknown input.
  • MUST NOT run long data backfills inside a schema migration on large tables; use a batched job.

Tools

CapabilitySkill / MCP / AgentWhenLevel
docs.librarylibrary-docs (→ the docs MCP servers the user has)ORM, migration DSL, DB engine, cache client, store/reactivity API not verified this sessionQ
memoryengram (MCP)mem_search before re-reading schema; mem_save after a data-model decisionL1
search.codebaseExplore (agent)Find all readers/writers of a table, cache key or store (mandatory for destructive changes)L1
review.diffcode-reviewBefore declaring doneL2
plan.implementationPlan (agent)Destructive migration, new store architectureL3
db.inspect (live schema, EXPLAIN)none yet → waymark references/skills.mdInspect the real database or query planL2

Definition of Done

  • Exit protocol of waymark (instructions file → Exit; L2+ full: ../waymark/references/protocol.md) (gates, architecture conformance, review, learnings)
  • Migration applied, rolled back and re-applied locally
  • Destructive change split into expand/contract steps
  • Indexes on new foreign keys and filtered columns; EXPLAIN checked for new heavy queries
  • Row-level access defined for user/tenant data
  • Cache: key scheme, TTL and invalidation documented in code
  • Client state: single source of truth, derived values computed, loading/error/empty handled
  • No token, secret or PII in client storage or in the diff

Hand-offs

  • To dept-backend: endpoint changes required by the schema; job for backfills.
  • To dept-security: row-level policies, PII columns, encryption at rest, data retention.
  • To dept-frontend: store API or model type changes consumed by UI.
  • To dept-devops: migration ordering in deploy, backups before destructive change, cache infra.
  • To dept-architecture: where models/stores live, cross-feature shared state.
  • To dept-qa: data fixtures, migration test strategy.

Learned rules

Grows with use (waymark references/learning.md). Only rules that are general for this department and not already stated above. Format: - [YYYY-MM-DD] <rule> — <why> (source: <project>).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.