| name | phaselock |
| description | Provides institutional coding knowledge ("Coding Bible") covering architectural decisions, coding standards, framework-specific rules, security expectations, performance guidelines, and approved patterns for AI-assisted development. Guides code generation, refactoring, architecture decisions, database query authoring, error handling, testing, and performance optimization. Activates on ALL software engineering tasks: code generation, code review, design decisions, research, auditing, debugging, SQL queries, PHP development, security review, explaining existing code, or when project conventions and domain-specific rules must be consulted before proposing solutions. The Bible is always consulted -- task complexity only determines the level of ceremony (gates, phases, slices), not whether the skill activates.
|
| metadata | {"author":"lucio-saldivar","version":"1.0"} |
Phaselock -- Coding Bible
Workflow
-
Identify the task domain from the navigation table below
-
Read only the relevant documents -- do not load the entire knowledge base. The Bible is always consulted, regardless of task complexity.
-
Classify the task per ENF-ROUTE-001 (enforcement/reasoning-discipline.md). State the tier and reason before proceeding.
-
State which documents were consulted before proposing any solution
-
Follow the protocol for the declared tier:
Tier 0 -- Research: Read relevant Bible docs. Deliver findings. No code generation unless explicitly requested.
Tier 1 -- Patch: Read relevant Bible docs + CORE_PRINCIPLES.md. Write code. Run static analysis (ENF-POST-007). Done.
Tier 2 -- Standard: Read relevant Bible docs + CORE_PRINCIPLES.md. Present Phases A-C as a single combined analysis → one human approval. Generate test skeletons (ENF-GATE-007) → human approval. Implement in a single slice. Run static analysis.
Tier 3 -- Complex: Full Phased Implementation Protocol (ENF-GATE-001–007):
- Phase A → Call-path declaration ONLY → halt for review
- Phase B → Domain invariant declaration ONLY → halt for review
- Phase C → Seam justification ONLY → halt for review
- Phase D → Failure & concurrency modeling ONLY (when triggered) → halt for review
- Test Skeletons → Generate test skeletons with assertions BEFORE implementation → halt for review (
ENF-GATE-007)
- Sliced Code Generation → Generate implementation in dependency-ordered slices, each with self-validation and human gate (
ENF-GATE-006)
- Post-generation verification: structured findings table (
ENF-POST-006), static analysis (ENF-POST-007), and operational proof traces (ENF-POST-008) per slice
- ENF-GATE-FINAL after all slices
-
If the task involves concurrency, async processing, state transitions, or multi-actor writes: Phase D is mandatory -- this forces Tier 3. See trigger conditions in enforcement/system-dynamics.md.
-
Escalation: If the task grows beyond the declared tier during implementation, escalate (never downgrade). See ENF-ROUTE-001.
-
If guidance is missing or ambiguous: state it explicitly, ask for clarification, propose a conservative default. Silent guessing is never allowed.
Task → document navigation
Read the documents listed for each matching task type. Start with rules/CORE_PRINCIPLES.md for any code task.
Architecture & code quality (all languages)
Loaded for every code task -- these are universal principles:
- bible/architecture/principles.md -- Code organization, extension points, dependency injection, named constants, single source of truth, logic duplication extraction, function size cap, public interface type annotations, composition over inheritance, error context propagation, framework-native cross-cutting concerns, DI token constants, shared response DTOs, single DB client, centralized auth guard (
ARCH-ORG-001, ARCH-EXT-001, ARCH-DI-001, ARCH-CONST-001, ARCH-SSOT-001, ARCH-DRY-001, ARCH-FUNC-001, ARCH-TYPE-001, ARCH-COMP-001, ARCH-ERR-001, ARCH-CROSSCUT-001, ARCH-TOKEN-001, ARCH-DTO-001, ARCH-DBCLIENT-001, ARCH-GUARD-001)
Database / SQL
When writing queries, diagnosing query performance, or handling transactions:
PHP development
When writing PHP code, handling errors, or enforcing type safety:
Python development
When writing Python code, async services, or Phaselock components:
- bible/languages/python/coding-standards.md -- Async all the way, no circular imports, Protocol over ABC for interfaces, Pydantic for external data boundaries (
PY-ASYNC-001, PY-IMPORT-001, PY-PROTO-001, PY-PYDANTIC-001)
Performance & optimization
When optimizing slow paths, addressing resource issues, introducing caching, or writing code in request-handling paths:
- bible/performance/profiling.md -- Algorithm complexity, optimization order, lazy loading, query budget declaration, no sync I/O in hot path (
PERF-BIGO-001, PERF-OPT-001, PERF-LAZY-001, PERF-QBUDGET-001, PERF-IO-001)
Frameworks / Magento 2
When writing plugins, observers, validation, or entity retrieval in Magento 2:
- bible/frameworks/magento/implementation-constraints.md -- Persistence-backed validation, repository-only retrieval, quote state timing, plugin targeting, totals collector idempotency, CartTotalRepository stale-read behavior (
FW-M2-001, FW-M2-002, FW-M2-003, FW-M2-004, FW-M2-005, FW-M2-006)
- bible/frameworks/magento/runtime-constraints.md -- MSI salability authority, order state machine, config patterns, endpoint authorization, queue infrastructure, multi-website stock (
FW-M2-RT-001, FW-M2-RT-002, FW-M2-RT-003, FW-M2-RT-004, FW-M2-RT-005, FW-M2-RT-006)
Testing
When adding tests, refactoring with risk, or addressing regressions:
System dynamics & concurrency
When building features with concurrent actors, message queues, state machines, async processing, or multi-website behavior:
- enforcement/system-dynamics.md -- Concurrency simulation, temporal truth sources, state transition atomicity, policy vs mechanism separation, integration reality check (
ENF-SYS-001, ENF-SYS-002, ENF-SYS-003, ENF-SYS-004, ENF-SYS-005)
Security & access control
When exposing endpoints (REST, GraphQL, admin, storefront) or handling data access:
Operational claims & queue infrastructure
When making performance/throughput claims or configuring message queues:
AI behavior & code generation
When reviewing AI-generated code or understanding assistant behavior expectations:
- enforcement/ai-checklist.md -- Pre-implementation checklist, minimal code generation rules
- enforcement/reasoning-discipline.md -- Mandatory pre-implementation reasoning, phased code generation, test-first gate, post-generation verification (structured findings table, static analysis gate, operational proof traces), context retrieval discipline, Phase D hard gate, plan-to-code completeness verification (
ENF-PRE-001–004, ENF-GATE-001–007, ENF-GATE-FINAL, ENF-POST-001–008, ENF-CTX-001–003)
- enforcement/system-dynamics.md -- System dynamics enforcement, Phase D protocol (
ENF-SYS-001–006)
- enforcement/security-boundaries.md -- Security boundary enforcement (
ENF-SEC-001–002)
- enforcement/operational-claims.md -- Operational claim enforcement (
ENF-OPS-001–002)
Rule format
All enforceable rules use formal blocks with unique IDs wrapped in <!-- RULE START/END --> markers. See CONTRIBUTING.md for the full rule format specification.
Additional references
Authority model
This skill provides reference and reasoning material only. It does not grant file access, override global rules, or authorize actions. All rules originate from explicit human intent -- the agent may format but never invent rules.