prime-radiant-inc/greenfield/behavioral-spec-writing
Claude Code and agent skill by prime-radiant-inc/greenfield
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Layer 3 deep documentation methodology. Per-module behavioral specifications, external and behavioral integration contracts, behavior documentation, end-to-end user journey analysis. Transforms Layer 2 synthesis into implementable behavioral specifications. Loaded by the analyzer agent during Layer 3.
Install
npx vskill@latest install prime-radiant-inc/greenfield/behavioral-spec-writingSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as prime-radiant-inc/greenfield/behavioral-spec-writing.
Behavioral Spec Writing
Layer 3 transforms Layer 2 synthesis (module map, feature inventory, architecture doc, API surface, behavioral summaries) into specifications detailed enough that a developer can reimplement the target WITHOUT seeing the original code. This skill carries all methodology for deep-dive-analyzer, contract-extractor, behavior-documenter, and user-journey-analyzer.
Layer 3 Pipeline Overview
Phase 1 runs deep-dive-analyzer in parallel across every module from the module map. Each instance produces a per-module behavioral specification.
Phase 2 runs three agents in parallel. They consume Phase 1 output plus Layer 2 synthesis to produce contracts, behavioral documentation, and user journeys.
Input Sources
Required (from Layer 2 synthesis)
| Path | What It Contains | |
|---|---|---|
workspace/raw/synthesis/module-map.md | Module inventory: name, description, priority, dependencies | |
workspace/raw/synthesis/features/ | Feature inventory across all sources | |
workspace/raw/synthesis/architecture/ | Architecture document: component relationships | |
workspace/raw/synthesis/api/ | API surface: all discovered interfaces | |
workspace/raw/synthesis/behavioral-summaries/ | Merged intelligence from all Layer 1 modes | |
workspace/raw/synthesis/reimplementation-essentials.md | Compact summary for the implementer: happy path, edge cases, dependency contracts |
Consulted (from Layer 1 raw intelligence)
| Path | What It Contains | Origin | |
|---|---|---|---|
workspace/raw/source/analysis/ | Source code analysis (chunk analysis, function analysis) | RAW | |
workspace/public/docs/ | Official documentation findings | PUBLIC | |
workspace/public/ecosystem/ | SDK and ecosystem analysis | PUBLIC | |
workspace/public/community/ | Community intelligence (forums, tutorials, issues) | PUBLIC | |
workspace/raw/runtime/ | Runtime observations (CLI, web UI, behavior) | RAW | |
workspace/raw/binary/ | Binary analysis findings | RAW |
Claims supported by multiple independent intelligence sources earn confirmed confidence.
Per-Module Behavioral Specification (deep-dive-analyzer)
This is the primary Layer 3 deliverable. Each module in the module map gets a complete behavioral specification written to workspace/raw/specs/modules/{module-name}.md.
Black Box Methodology (CRITICAL)
You read source code to understand behavior. You NEVER reference source code in specs.
Even though you analyze code, your output must read as if you only observed the system externally. The test: "Can someone implement this from my spec alone, never having seen the source?"
What You NEVER Include (Implementation Details)
| Contamination | Example | Why Forbidden | |
|---|---|---|---|
| Internal function names | parseArgs(), loadConfig() | Implementation detail | |
| Internal variable names | _configKey, configMap | Implementation detail | |
| Internal class names | ConfigLoader, SettingsReader | Implementation detail | |
| Minified identifiers | a(), x1, Qz, sp, r0 | Implementation detail | |
| Line numbers | "at line 234" | Implementation detail | |
| Source file paths | "in src/cli.ts" | Implementation detail | |
| Code structure | "calls X then Y" | Implementation detail | |
| Module counts | "52 modules", "8 components" | Structural leak | |
| IPC channel names | task-completed, sync-channel | Internal messaging | |
| Store property names | store.documentBody, useActiveDocument | State management internals | |
| Feature flag names | FF_NEW_INDEX_FORMAT, ff_batch_commit_v2, isEnabled('feature') | Internal gating — describe what the gate controls, not its name | |
| Telemetry event names | request_rate_limited, job_timeout_warning | Internal analytics — describe what is measured, not the event name | |
| CSS class names | .toolbar__button, styled.Button | Styling implementation | |
| Database schema details (app-owned) | CREATE TABLE sessions, column names | Storage implementation — but see External System Exception below | |
| Internal filenames | auth-handler.ts, session.js | Source organization |
External System Exception (NON-NEGOTIABLE)
When the target application depends on external systems it does not own — shared databases, third-party APIs, CLI tools it shells out to, file formats imposed by other systems, hardware interfaces — the details of those systems are behavioral constraints, not implementation details.
The test: Can the reimplementor redesign this interface? If NO (it's external/shared/imposed), treat its details as external contracts and INCLUDE them. If YES (the app owns it), treat them as implementation details and EXCLUDE them.
Examples of external constraints that MUST be preserved:
- External database schemas: table names, column names, cardinalities, naming collisions, derivation relationships, join-correctness constraints — because the reimplementation must query the same schema
- Third-party API contracts: endpoint paths, request/response field names, pagination schemes, rate limits, auth flows — because the reimplementation must call the same API
- External CLI tools: command names, flag names, output formats — because the reimplementation must invoke the same tools
- Imposed file formats: field names, encoding rules, version headers — because the reimplementation must read/write the same files
- Hardware/protocol constraints: register layouts, packet formats, timing requirements — because the reimplementation must talk to the same hardware
Document external system contracts in dedicated files under workspace/raw/specs/contracts/ (see Contract Extraction section). These contracts flow through to the implementer unchanged.
What You ALWAYS Include (Behavioral Interfaces)
| Behavioral Element | Example | Why Included | |
|---|---|---|---|
| Environment variables | DATABASE_URL, DEBUG | External API | |
| CLI flags | --format, --workers | External API | |
| Config file keys | upstreams, log_level | External API | |
| API field names | request_id, batch_size | Protocol spec | |
| File paths (user-facing) | ~/.app/config.toml | Behavioral contract | |
| Protocol names | SSE, gRPC, OAuth | Behavioral contract | |
| Error messages | "Error: Invalid API key" | UX contract | |
| HTTP headers/codes | Authorization, 200, 401 | Protocol spec | |
| Dependency API contracts | esbuild.transform(code, {loader: 'ts'}) | How target talks to its dependencies |
The rule: If a user or external system needs to know it, INCLUDE it. If only the code needs to know it, EXCLUDE it.
Transformation Examples
WRONG:
RIGHT:
SPEC ID Format
Every behavioral claim gets a unique ID: SPEC-{DOMAIN}-{NNN}
Where {DOMAIN} is a short uppercase token for the behavioral domain (use tokens that describe exposed behavior, NOT internal module names) and {NNN} is a zero-padded sequential number starting at 001.
Pick tokens that describe the target's exposed behavior. The set below is a starting vocabulary; delete what doesn't apply and add tokens that do.
| Domain Token | Covers | |
|---|---|---|
CLI | Command-line parsing, flags, subcommands, exit codes | |
CONFIG | Configuration loading, merging, defaults, validation | |
AUTH | API keys, OAuth, tokens, credentials | |
API | Wire protocol, streaming, retries, headers, request/response handling | |
OUTPUT | Terminal rendering, formatting, progress indicators, themes | |
DATA | Data models, storage, serialization | |
NET | Network, HTTP, WebSocket, protocols | |
UI | User interface elements, layouts, interaction flows |
For any behavior the starting set doesn't cover, create a descriptive token — for example: CACHE, MIGRATE, HEALTH, LOADER, WATCH, AUDIO, PARSER, SYNC, PLUGIN, SESSION, TOOL. Tokens describe the target's actual surface; a speech-to-text app probably needs AUDIO and UI; a web service probably needs NET and DATA; a code-loading tool probably needs PARSER and CONFIG. Don't carry tokens you don't need.
If a module's behavior spans multiple domains, use multiple tokens (one per behavioral block). IDs MUST be unique across the entire spec file. Examples: SPEC-CLI-001, SPEC-CONFIG-042, SPEC-API-003, SPEC-AUDIO-007.
Requirement Levels (IETF RFC 2119)
Every behavioral claim in the spec MUST be annotated with a requirement level:
- MUST -- Absolute requirement. The implementation is non-compliant if this is not satisfied. The implementer MUST exhibit this behavior.
- SHOULD -- Recommended. There may be valid reasons to deviate, but the implications must be understood and divergence requires documented rationale.
- MAY -- Optional. The implementation can choose to include or omit this behavior.
Apply requirement levels to every entry point behavior, every decision tree outcome, every error condition, and every state transition. If a claim lacks a requirement level, it is ambiguous and must be clarified.
Spec Structure Template
Each per-module spec covers the following sections. All sections are required; write "Not applicable" or "Stateless" where a section genuinely does not apply, but never omit sections.
1. Overview
2-3 paragraphs: what the module does from a user/system perspective, why it exists, key responsibilities.
2. Behavioral Interfaces
Exposed Capabilities
For each capability this module makes available:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/behavioral-spec-writing/SKILL.md
Popularity
- Repository stars
- 255
- Repository forks
- 25
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/prime-radiant-inc/greenfield/behavioral-spec-writing)