AgentSkillsCN

lev-portable

便携式架构思维工具包。规格守卫、剪切层分类器, 多视角思辨、跨 IDE 技能搜索,以及轻量级生命周期路由器。 无需框架依赖——可在任意 AI IDE 上运行。 触发条件:“守卫”、“层”、“思考便携”、“寻找便携”、“便携工作”, “规格检查”、“分类”、“视角”、“Lev 便携”

SKILL.md
--- frontmatter
name: lev-portable
description: |
  Portable architectural thinking toolkit. Spec guard, shearing layers classifier,
  multi-perspective deliberation, cross-IDE skill search, and lightweight lifecycle router.
  No framework dependencies — works on any AI IDE.

  Triggers: "guard", "layers", "think portable", "find portable", "work portable",
  "spec check", "classify", "perspectives", "lev-portable"
version: 1.0.0
triggers:
  - guard
  - layers
  - think portable
  - find portable
  - work portable
  - spec check
  - classify
  - perspectives
  - lev-portable
compatibility:
  - claude-code
  - cursor
  - windsurf
  - continue-dev
  - cline
  - roo-code

lev-portable — Architectural Thinking Toolkit

One skill, five capabilities. Portable spec guard, shearing layers classifier, multi-perspective deliberation, cross-IDE skill search, and lightweight lifecycle router. Zero framework dependencies.

Quick Decision Tree

code
Input received →
│
├─ Vague / underspecified?
│  └─→ GUARD — Detect gaps, ask structured questions
│
├─ Need to classify where this fits architecturally?
│  └─→ LAYERS — Brand shearing layers × L0-L3 depth
│
├─ Need multiple perspectives before deciding?
│  └─→ THINK — 5 CDO roles deliberate sequentially
│
├─ Need to find existing skills / prior art?
│  └─→ FIND — rg across IDE skill paths
│
└─ Ready to execute structured work?
   └─→ WORK — 3-phase FSM: Plan → Execute → Validate

Sub-Route Overview

RoutePurposeTrigger KeywordsRef
guardDetect underspecified inputs"guard", "spec check", "vague"references/guard.md
layersClassify by velocity/depth/persistence"layers", "classify", "shearing"references/layers.md
thinkMulti-perspective deliberation"think", "perspectives", "deliberate"references/think.md
findCross-IDE skill search"find portable", "search skills"references/find.md
workLifecycle FSM router"work portable", "execute"references/work.md

guard — Spec Guard

Detects underspecified inputs using 6 categories from the Trail of Bits audit checklist merged with structured interview frameworks.

6 Detection Categories

#CategoryQuestion PatternWeight
1ObjectiveWhat specific outcome is expected?20%
2ScopeWhat's included/excluded? Boundaries?20%
3ConstraintsTime, tech, budget, compatibility limits?15%
4EnvironmentWhere does this run? What exists already?15%
5DependenciesWhat must exist first? What breaks?15%
6Success CriteriaHow do we know it's done and correct?15%

Underspec Score

code
For each category:
  MISSING (no info)     → +full weight
  PARTIAL (implied)     → +half weight
  PRESENT (explicit)    → +0

Score = sum of weights → 0-100%

Auto-Trigger Rules

code
Score > 30%  → Trigger guard automatically
Score > 60%  → Block execution until resolved
Score ≤ 30%  → Pass through (sufficient spec)

Fast-Path Questions

When triggered, ask only missing categories using this format:

code
🛡️ Guard detected gaps in: {list missing categories}

q{n}) {Category}: {Specific question}
   Context: {Why this matters for the task}
   Default: {Reasonable assumption if user skips}

Skip Conditions

  • Explicit file paths provided → skip (scope is clear)
  • Multi-turn conversation with established context → skip
  • User flag: --no-guard → skip
  • Score ≤ 30% → skip

Full reference: references/guard.md


layers — Shearing Layers Classifier

Classifies changes using Stewart Brand's "How Buildings Learn" framework crossed with the L0-L3 depth model. Answers: where does this change live, how fast does it move, and how permanent is it?

3-Question Classifier

code
Q1 — VELOCITY: How often does this change?
     Site (decades) | Structure (years) | Skin (seasons) |
     Services (months) | Space Plan (weeks) | Stuff (daily)

Q2 — DEPTH: What level of detail?
     L0 Overview | L1 Structure | L2 Details | L3 Runtime

Q3 — PERSISTENCE: System or ephemeral?
     System Graph (permanent, infrastructure) |
     CDO Graph (ephemeral, thinking artifact)

Decision Matrix

Change TypeLayerDepthPersistenceExample
Database schemaSiteL1SystemAdd users table
Auth systemStructureL1-L2SystemJWT → OAuth migration
API versioningStructureL1Systemv1 → v2 endpoint
UI frameworkSkinL1-L2SystemReact → Svelte
Component stylingSkinL2CDO→SystemButton redesign
Monitoring setupServicesL2SystemAdd Datadog
CI/CD pipelineServicesL2SystemGitHub Actions config
Feature flagSpace PlanL2-L3CDOA/B test toggle
Route configurationSpace PlanL2SystemAdd /settings page
Error message textStuffL2-L3CDO"Login failed" wording
Log formatStuffL3CDOJSON → structured
Env variableStuffL3CDOSet DEBUG=true

Architecture Implications

code
Site/Structure changes    → Need design review, migration plan
Skin changes              → Need visual review, backward compat
Services changes          → Need ops review, rollback plan
Space Plan changes        → Need user flow review, feature flags
Stuff changes             → Ship fast, iterate, minimal review

Full reference: references/layers.md


think — Multi-Perspective Deliberation

5 CDO roles applied sequentially to any problem. Portable version of the Thinking Parliament — single model, multiple perspectives, no external dispatch.

5 Roles

RoleLensAsks
AdvocateStrongest case FOR"Why is this the right move? What strengths does it build on?"
CriticStrongest case AGAINST"What could go wrong? What are we not seeing?"
SystemsSecond-order effects"What else does this touch? What emerges from the interaction?"
PragmatistImplementation reality"Can we actually build this? What constraints matter?"
Wild CardUnconsidered alternatives"What if we're asking the wrong question entirely?"

Application Pattern

code
For each role (sequential):
  1. State the role explicitly
  2. Apply role lens to the problem
  3. Produce 2-3 key insights
  4. Rate confidence (0-1) in those insights

After all 5 roles:
  → Synthesize: common ground + genuine tensions
  → If >70% agreement → trigger devil's advocate (re-run Critic harder)
  → Output: decision framework, not just recommendation

Layer-Weighted Application

The layers classifier influences which roles get emphasis:

code
Site/Structure  → Emphasize: Systems, Critic (high stakes)
Skin/Services   → Emphasize: Pragmatist, Advocate (execution focus)
Space Plan      → Balanced across all roles
Stuff           → Emphasize: Pragmatist, Wild Card (speed + creativity)

Full reference: references/think.md


find — Cross-IDE Skill Search

Searches for skills across all major AI IDE skill locations using rg (with grep fallback).

IDE Skill Paths

bash
SKILL_PATHS=(
  "$HOME/.claude/commands"          # Claude Code commands
  "$HOME/.claude/skills"            # Claude Code skills
  "$HOME/.agents/skills"            # Agent skills (canonical)
  "$HOME/.agents/skills-db"         # Skills database
  "$HOME/.cursor/rules"             # Cursor rules
  "$HOME/.cursor/skills"            # Cursor skills
  "$HOME/.windsurf/rules"           # Windsurf rules
  "$HOME/.continue"                 # Continue.dev
  "$HOME/.cline/rules"              # Cline rules
  "$HOME/.roo/rules"                # Roo Code rules
)

Search Patterns

bash
# By name
rg -l -i "{query}" --glob="SKILL.md" --glob="*.md" ${SKILL_PATHS[@]}

# By trigger
rg -i "triggers?.*{query}" --glob="*.md" --glob="*.yaml" ${SKILL_PATHS[@]}

# By description
rg -i "description.*{query}" --glob="SKILL.md" ${SKILL_PATHS[@]}

Output Format

code
📂 {skill-name}
   Path: {full path}
   Description: {first line of description}
   Triggers: {trigger list}
---
Found {n} skills matching "{query}" across {m} IDE locations.

Fallback

When rg unavailable:

bash
find ${SKILL_PATHS[@]} -name "*.md" -exec grep -li "{query}" {} \; 2>/dev/null

Full reference: references/find.md


work — Lightweight Lifecycle Router

3-phase FSM that chains guard → layers → think → execute. Portable version of the full work skill — no BD tracking, no lev CLI.

FSM States

code
┌──────────┐    ┌───────────┐    ┌────────────┐
│ PLANNING │───▶│ EXECUTION │───▶│ VALIDATION │
└──────────┘    └───────────┘    └────────────┘
 guard            apply output     verify against
 layers           create artifacts guard criteria
 think            write files      check completeness

PLANNING Phase

code
1. GUARD   — Score input (0-100% underspec)
             Skip if score ≤ 30% or --no-guard
             Ask questions for missing categories

2. LAYERS  — Classify the work
             Determine: velocity, depth, persistence
             Informs review requirements

3. THINK   — Deliberate (if complexity warrants)
             Apply 5 roles sequentially
             Skip if trivial (Site/Stuff + L3 + CDO)
             Output: decision framework

EXECUTION Phase

code
Apply thinking output:
  - Simple (Stuff/L3)   → Direct execution, no artifact
  - Medium (Skin-Space)  → Create brief plan, then execute
  - Complex (Site-Struct) → Create full proposal, get approval, then execute

VALIDATION Phase

code
Check against guard criteria:
  ✓ Objective met?
  ✓ Scope respected?
  ✓ Constraints honored?
  ✓ Success criteria satisfied?

If validation fails → loop back to PLANNING with learned context
If validation passes → emit completion summary

Confidence Routing

code
Confidence ≥ 0.90 → Direct execution (skip think)
Confidence ≥ 0.80 → Light think (Advocate + Critic only)
Confidence ≥ 0.60 → Full think (all 5 roles)
Confidence < 0.60 → Full think + extended guard + human review

Session Management

code
On interrupt: save state to ./tmp/lev-portable-{timestamp}.md
On resume: detect saved state, offer to continue
State includes: FSM phase, guard score, layer classification, think output

Full reference: references/work.md


Integration Notes

Cross-IDE Compatibility

This skill uses zero framework dependencies:

  • No lev CLI required
  • No bd (beads) required
  • No custom daemons or services
  • Search uses rg with grep fallback
  • All state is markdown files in ./tmp/

Installation

bash
# Via skills marketplace
npx skills add lev-os/lev-portable

# Manual: copy to any IDE skill location
cp -r lev-portable/ ~/.claude/commands/lev-portable/   # Claude Code
cp -r lev-portable/ ~/.cursor/skills/lev-portable/     # Cursor
cp -r lev-portable/ ~/.agents/skills/lev-portable/     # Universal

Escape Hatches

SituationEscape
Guard too aggressive--no-guard or provide explicit file paths
Layers classification wrongOverride manually: "treat this as {layer}"
Think taking too long"just Advocate + Critic" for fast deliberation
Find not finding skillsProvide path directly: "search in {path}"
Work FSM stuck"skip to execution" to bypass planning

Composability

Each sub-route works standalone:

code
/guard "add auth"           → Just run spec guard
/layers "migrate database"  → Just classify the change
/think "add caching"        → Just run 5 perspectives
/find "interview"           → Just search for skills
/work "add dark mode"       → Full chain: guard → layers → think → execute

Relationship to Full Lev

This is the thinking model extracted from Lev, without the runtime:

lev-portableFull Lev Equivalent
guardlev-cdo DoR gates + interview framework
layersdocs/01-architecture.md L0-L3 + Brand theory
thinkthinking-parliament (single-model portable)
findlev-find (rg-only, no vector index)
workwork skill (no BD, no team dispatch)

Status: v1.0.0 Source: Shearing layers audit → 75% alignment, 3 coupling inversions License: MIT