Guidelines
104 documents
Code Quality
Bulk operation verification
After any operation touching 5+ files, run a verification pass for stale references before marking complete.
Linting from day one
All projects MUST include linting configured from initial generation:
Scope discipline
Only modify what was requested. State the goal before starting. Note but do not fix adjacent issues.
Small, atomic commits
One logical change per commit. A change may touch multiple files if they are part of the same concept. Commits should...
Concurrency
Immutability
Mutable shared state is the root cause of most concurrency bugs. Default to immutable values; introduce mutability on...
No blocking the main thread
All lengthy work must run on background threads/tasks using platform async primitives:
Feature Management
A/B testing
Features that may need experimentation SHOULD support variant assignment via an `ExperimentProvider` interface (`vari...
Debug mode
Apps MUST include a debug-only configuration panel (not in release builds):
Feature flags
All features MUST be gated behind feature flags from initial implementation. Define a `FeatureFlagProvider` interface...
Internationalization
Language
Dependency Injection
Constructor injection via `Microsoft.Extensions.DependencyInjection`. Use interface types for dependencies, not concr...
Naming
- `PascalCase` for types, methods, properties, public fields, constants, namespaces
Nullable Reference Types
Enable `<Nullable>enable</Nullable>` in all projects. Treat warnings as design signals — `string` means non-null, `st...
Font Scaling
Layouts MUST NOT break at 2x font size. Check `Configuration.fontScale` and test with large font settings enabled.
Dashboard service is display-only
The dashboard service is a generic API and UI layer. It has no knowledge of git, files, or roadmap structure. Agents ...
Database
Use SQLite with WAL mode for concurrent read access. No ORM — use direct SQL via the `sqlite3` standard library module.
Deterministic IDs
Always use the roadmap file's own UUID from its YAML frontmatter. Never generate random UUIDs. IDs must be determinis...
File paths
Use `pathlib.Path`, not `os.path`. All path manipulation should go through `pathlib`.
No external dependencies in core libraries
`roadmap_lib` uses the standard library only. Do not add PyYAML, requests, or other third-party packages to core libr...
Shell scripts
Shell script `main()` functions must only call other functions — no inline logic. Keep scripts composable and testable.
Type hints
Type hints are welcome but not required. Maintain Python 3.9 compatibility — use `from __future__ import annotations`...
Use roadmap_lib
Use functions from `roadmap_lib` for all roadmap operations (reading state, parsing frontmatter, finding steps, etc.)...
Web services
Use Flask for web services. The dashboard service runs on Flask with a REST API and SSE/polling for live updates.
YAML frontmatter
Parse YAML frontmatter with the built-in frontmatter parser in `roadmap_lib`. Do not add a PyYAML dependency. The par...
Dynamic Type
Layouts MUST NOT break at larger text sizes. Use Dynamic Type throughout — avoid fixed font sizes. Custom fonts must ...
Use AppKit and UIKit, not SwiftUI
Use AppKit (macOS) and UIKit (iOS) for all UI. Use SwiftUI only where Apple requires it.
Logging
Analytics
All significant user actions MUST be instrumented via an `AnalyticsProvider` interface (`track(event, properties)`). ...
Instrumented logging
Every component and flow must be instrumented with structured logging using the platform's best-in-class framework:
Networking
API Design
Use REST with consistent conventions. Follow the platform API guidelines (Microsoft, Google,
Caching
Use HTTP caching headers. The server controls cache policy; the client honors it.
Error Responses
Use [RFC 9457 Problem Details](https://www.rfc-editor.org/rfc/rfc9457) format with
Offline and Connectivity
For apps that must work offline, design for local-first with background sync.
Pagination
Prefer **cursor pagination** for most APIs — stable under concurrent mutations, consistent
Rate Limiting
Respect server rate limits. Handle 429 responses gracefully.
Real-Time Communication
Choose the simplest technique that meets your needs.
References
1. [Microsoft REST API Guidelines](https://github.com/microsoft/api-guidelines)
Retry and Resilience
Not every failure is permanent. Retry transient failures with exponential backoff and jitter.
Timeouts
Always set both connection and read timeouts. Never use infinite timeouts.
Platform
Architecture
Use MVVM with [CommunityToolkit.Mvvm](https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/) — source-gener...
Design-Time Data
- Use `d:DataContext` and `d:DesignInstance` for XAML designer preview data
Fluent Design
Use built-in WinUI 3 controls — they implement Fluent 2 natively. Never custom-draw what a standard control can do.
High DPI / Display Scaling
XAML layout uses effective pixels (epx) — scaling is automatic for all XAML-rendered content.
MSIX Packaging
- Use the single-project MSIX packaging model
Theming
WinUI 3 supports tri-state theming: Light, Dark, and High Contrast.
Background tasks
Apps that sync data, process uploads, or maintain state SHOULD use platform background execution APIs rather than relying on foreground presence.
Deep linking
All significant feature points and views MUST be deep linkable using the platform's native URL/deep link mechanism:
Handoff and continuity
Apps available on multiple devices SHOULD support continuity features so users can start work on one device and resume on another.
Notifications
Apps SHOULD use the platform notification system for timely, actionable alerts that respect user preferences.
Scriptable and automatable
Components and flows SHOULD be scriptable where the platform supports it:
Search integration
App content SHOULD be discoverable through the platform's system search, enabling users to find content without opening the app.
Share and inter-app data flow
Apps SHOULD participate in the platform's share and inter-app data exchange mechanisms to integrate with other apps and workflows.
Widgets and glanceable surfaces
Apps with time-sensitive or frequently checked data SHOULD provide widgets and glanceable surfaces on platforms that support them.
Security
Authentication
Use OAuth 2.0 / OpenID Connect with PKCE for all public clients. The Implicit flow is
Authorization
**Server-side authorization is the only real authorization.** Client-side checks (hiding
Content Security Policy
Prevent XSS and injection with a strict CSP. Web apps only.
CORS
Cross-Origin Resource Sharing — get it right or don't enable it.
Dependency Security
Your dependencies are your attack surface. Manage them actively.
Input Validation
**Never trust client input.** Client-side validation is a UX feature, not a security control.
Privacy and security by default
Collect only what is needed. Prefer on-device processing.
References
1. [OWASP Top 10 (2021)](https://owasp.org/www-project-top-ten/)
Secure Storage
Tokens, credentials, and any sensitive data MUST use platform secure storage. Never store secrets in plaintext config...
Security Headers Checklist
Every web application should set these response headers:
Sensitive Data
Minimize what you collect, encrypt what you keep, never log what you shouldn't.
Token Handling
Short-lived (5-15 min). Include only necessary claims — no PII in JWTs
Transport Security
**TLS 1.2 minimum**, prefer TLS 1.3. Disable TLS 1.0 and 1.1 entirely.
Skills And Agents
Agent Lint Checklist
Comprehensive lint checklist for validating Claude Code agent structure, content quality, and best practices
Agent Structure Reference
Reference for Claude Code agent file format, frontmatter fields, tool access patterns, and permission modes
Authoring Skills and Rules
Best practices for creating Claude Code skills, agents, and rule files.
Performance: Speed and Token Efficiency
Optimize Claude Code extensions for speed and token efficiency through shell scripts, model selection, and progressive disclosure.
Rule Lint Checklist
Comprehensive lint checklist for validating Claude Code rule file content quality, best practices, and optimization
Rule Structure Reference
Reference for Claude Code rule file format, quality criteria, optimization guidelines, and comparison with skills and agents
Skill Lint Checklist
Comprehensive lint checklist for validating Claude Code skill structure, content quality, and best practices
Skill Structure Reference
Reference for Claude Code skill directory layout, frontmatter fields, string substitutions, and invocation control
Testing
Comprehensive unit testing
Prioritize unit tests over integration tests. Test state transitions, edge cases, serialization round-trips. Every im...
Flaky Test Prevention
Flaky tests destroy confidence. Quarantine them immediately — fix or delete, never ignore.
Mutation Testing
Mutation testing validates that your tests actually catch bugs — not just achieve coverage.
Post-generation verification
Every generated artifact MUST be verified:
Properties of Good Tests
From Kent Beck's Test Desiderata — tests should be:
Property-Based Testing
When to use: parsers, serializers, data transformers, encoders/decoders, validators — anything
References
1. [Google SWE Book Ch. 11: Testing Overview](https://abseil.io/resources/swe-book/html/ch11.html)
Security Testing
Run security scans as part of post-generation verification (agentic-cookbook://guidelines/testing/post-generation-verification). These a...
Test Data
**Construct what you need, per test.** Large shared fixture files SHOULD be avoided.
Test Doubles
Use [Martin Fowler's taxonomy](https://martinfowler.com/bliki/TestDouble.html):
Test Pyramid
Projects SHOULD follow the Google SWE Book ratio: **80% unit / 15% integration / 5% E2E**.
The Testing Workflow
The recommended Claude Code testing workflow, combining all tools:
Unit Test Patterns
**Structure — Arrange, Act, Assert (AAA):**
Ui
Always show progress
When the UI is waiting on an async task:
Animation & Motion
Motion should be purposeful — guide attention, show spatial relationships, and provide
Color
Use color with intention — never as the sole means of conveying information.
Data Display
Choose the right pattern for the content type and user task.
Feedback Patterns
Every user action should have visible feedback. The weight of the feedback should match
Form Design
Forms are where users do real work. Reduce friction at every step.
Iconography
Icons supplement text — they do not replace it (except for universally understood symbols
Layout
Design for the content, not a fixed screen size. Layouts should adapt gracefully from
Platform Design Languages
Defer to these canonical sources before applying the defaults in this file:
Previews
All UI components MUST include preview declarations for rapid visual verification during development. Previews should...
Spacing
Use a consistent spatial scale based on a **4px base unit** (8px primary grid). All spacing,
State Design
Every view that loads data or can be empty must handle all four states explicitly. Never
Touch & Click Targets
Interactive elements MUST be large enough to tap or click accurately. Defer to the platform
Typography
Use the platform's system font. Establish a type scale with clear roles — don't invent
Visual Hierarchy
Establish clear importance through size, weight, color, and spacing. Every screen should