maintainability-criteria
Define maintainability criteria for a codebase or service. Covers code complexity caps (cyclomatic / cognitive / file size), test coverage thresholds (unit / integration / E2E), documentation requirements, modularity rules, review gates, refactoring budget, dependency policy, and deprecation playbook. Wires to CI checks and review process.
What this skill does
# Maintainability Criteria
You define measurable maintainability criteria for a codebase or service. Output is a set of enforceable rules (CI-checkable where possible), with explicit tolerance for legacy code and a refactoring budget.
## Core rules
- **Measurable**: every criterion maps to a metric or CI check
- **Stack-aware**: thresholds tuned to language/framework norms
- **Legacy tolerance**: existing violations grandfathered with a drawdown schedule — no boiling-the-ocean
- **Refactoring budget**: named share of each iteration
- **No vanity coverage**: coverage thresholds by test layer and risk, not blanket 80%
- **No fabricated industry averages**: comparisons grounded or labeled `[Assumed]`
## Input handling
| Dimension | Required | Default |
|---|---|---|
| **Codebase / service** | Yes | — |
| **Language / stack** | Yes | — |
| **Team size** | No | Asked |
| **Existing CI tooling** | No | Asked |
| **Legacy state** | No | Greenfield default |
## Phase 1 — Setup
```
**Codebase**: [name]
**Language / stack**: [e.g., TypeScript + React + Node]
**Team size**: [N]
**Existing CI tooling**: [list]
**State**: [greenfield / existing]
```
Ask render mode per `diagram-rendering` mixin and output path (default: `/documentation/[case]/maintainability-criteria/`).
## Phase 2 — Complexity caps
| Metric | Threshold (default) | Tool |
|---|---|---|
| Cyclomatic complexity per function | ≤ 10 (CI warn at 8) | ESLint complexity / flake8 mccabe / SonarQube |
| Cognitive complexity | ≤ 15 | SonarQube cognitive |
| File length | ≤ 500 lines | lint rule |
| Function length | ≤ 50 lines | lint rule |
| Module depth (nesting) | ≤ 4 | lint rule |
| Parameters per function | ≤ 4 | lint rule |
Adjust per stack:
- Strongly-typed languages may allow higher function length
- Test files exempt from some rules
## Phase 3 — Test coverage
Per test layer:
| Layer | Coverage target | Rationale |
|---|---|---|
| Unit | ≥ 70% statements, ≥ 60% branches | Fast feedback; catches logic bugs |
| Integration | ≥ critical path coverage (declare paths) | Detects wiring issues |
| E2E | Cover top user journeys (enumerate) | User-visible regression |
| Contract | All external API contracts | Prevents cross-service breakage |
Rule: don't aim for 100% on any layer; diminishing returns, encourages gaming.
Critical-path coverage means named paths are covered, not just a %.
## Phase 4 — Documentation requirements
| Artifact | When required |
|---|---|
| README | Every repo / service |
| ADR (Architecture Decision Record) | Non-reversible architectural choices |
| API docs | Every public / internal-shared API |
| Runbook | Every on-call-paged service |
| Onboarding | Update quarterly or on major change |
## Phase 5 — Modularity rules
- **Bounded contexts**: named boundaries; no cross-import of internals
- **Dependency direction**: acyclic (detect with tooling, e.g., madge / deptree)
- **Public API**: explicit exports; internal marked private
- **Coupling metric**: afferent × efferent watched; avoid god modules
## Phase 6 — Review gates
| Gate | Required check |
|---|---|
| PR | ≥ 1 reviewer (≥ 2 for sensitive paths) |
| Tests | New code has tests; no net-decrease in coverage |
| Complexity | CI fails if thresholds exceeded on new code |
| Docs | If behavior changes, docs updated |
| Performance | Budget check (link `performance-budgeting`) |
| Security | SAST + dependency audit on PR |
Legacy code exceptions allowed but tracked.
## Phase 7 — Refactoring budget
Declare a share of each iteration for maintenance work:
| Work type | Share |
|---|---|
| Features | ~70% |
| Refactoring | ~15% |
| Tech debt reduction | ~10% |
| Upkeep (deps, minor fixes) | ~5% |
Rule: never 0% on maintenance; short-term wins become medium-term paralysis.
## Phase 8 — Dependency policy
- **Version pinning**: exact for libraries; ranges allowed for dev tooling
- **License allow-list**: declared (e.g., MIT / Apache-2.0 / BSD / ISC)
- **Deprecated / unmaintained flagging**: scanning (e.g., npm audit / deprecated flag)
- **Review cadence**: dependency updates weekly / monthly
- **Security advisories**: patched within SLA (critical ≤ 7 days, high ≤ 30 days)
- **SBOM**: generated on build (especially for regulated products)
## Phase 9 — Deprecation playbook
For internal APIs / modules / services being phased out:
- **Deprecation notice**: minimum N months warning
- **Migration guide**: provided
- **Sunset date**: named
- **Removal criteria**: metrics on usage to justify removal
- **Communication plan**: internal + external
## Phase 10 — Legacy tolerance & drawdown
For existing codebase with violations:
- Grandfather existing violations — don't boil the ocean
- CI checks apply to new + modified code only
- Drawdown schedule: violation count decreases over time
- Named hot-spots get priority (high-complexity + high-change files)
## Phase 11 — Diagrams
### 1. Coverage targets per layer
```mermaid
xychart-beta
title "Coverage targets per layer (%)"
x-axis ["Unit", "Integration", "E2E critical paths", "Contract"]
y-axis "%" 0 --> 100
bar [70, 85, 100, 100]
```
### 2. Refactoring budget
```mermaid
pie title Iteration allocation
"Features" : 70
"Refactoring" : 15
"Tech debt" : 10
"Upkeep" : 5
```
### 3. Legacy drawdown (if existing product)
```mermaid
xychart-beta
title "Complexity violations over quarters"
x-axis ["Now", "Q1", "Q2", "Q3", "Q4"]
y-axis "Violations" 0 --> 200
line [180, 150, 120, 90, 60]
```
## Phase 12 — Diagram rendering
Per `diagram-rendering` mixin. File names:
- `coverage-targets.mmd` / `.png`
- `refactoring-budget.mmd` / `.png`
- `legacy-drawdown.mmd` / `.png` (if existing)
## Phase 13 — Report assembly and approval
```markdown
# Maintainability Criteria: [Codebase]
**Date**: [date]
**Language / stack**: [stack]
**Team size**: [N]
**State**: [greenfield / existing]
## Scope
[Codebase, stack, team, CI tooling, state]
## Complexity Caps
[Metrics + thresholds + tool]
## Test Coverage
[Per layer with rationale]
## Documentation Requirements
[Artifact → when required]
## Modularity Rules
[Boundaries, dependency direction, public API, coupling]
## Review Gates
[PR / tests / complexity / docs / perf / security]
## Refactoring Budget
[Share per iteration]
## Dependency Policy
[Pinning, license allow-list, vulnerability SLAs, SBOM]
## Deprecation Playbook
[Notice, guide, sunset, communication]
## Legacy Tolerance & Drawdown
[Grandfathering + schedule]
## Diagrams
[Coverage + budget + optional drawdown]
## Assumptions & Limitations
[Stack-specific adjustments, CI-tooling gaps]
```
Present for user approval. Save only after confirmation.
## Generation + planning rules
- Every criterion measurable / CI-checkable where possible
- Thresholds tuned to stack
- Legacy tolerance explicit
- Refactoring budget non-zero
- No fabricated industry averages
## Failure behavior
| Situation | Behavior |
|---|---|
| No codebase or stack | Interview mode (§7) |
| Greenfield without standards | Propose defaults for the stack |
| Existing codebase with deep debt | Tolerance + drawdown rather than uniform enforcement |
| Zero refactoring budget proposed | Push back; require non-zero |
| CI tooling absent | List as prerequisite |
| mmdc failure | See `diagram-rendering` mixin |
| Out-of-scope (e.g., "refactor now") | "Criteria only; refactoring is engineering work." |
## Self-check
```
[] Stack-tuned thresholds
[] Coverage per layer with rationale
[] Critical paths named for E2E / integration
[] Review gates concrete
[] Refactoring budget non-zero
[] Dependency policy with SLAs
[] Deprecation playbook
[] Legacy tolerance + drawdown if existing
[] All metrics map to CI tooling
[] Diagrams valid
[] No fabricated industry averages
[] Report follows output contract
```
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.