con un clic
feature-knowledge
Structures codebase exploration into a feature knowledge base
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Structures codebase exploration into a feature knowledge base
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Canonical algorithm for consuming DECISIONS_CONTEXT index — scan index, identify relevant entries, Read full bodies on demand, cite verbatim IDs inline.
This skill should be used when evaluating implementation quality before submission, checking correctness, security, and simplicity.
This skill should be used when performing a code review to apply the standard 6-step review process.
This skill should be used when the user asks to "add accessibility", "check ARIA", "handle keyboard navigation", "add focus management", or creates UI components, forms, or interactive elements. Provides WCAG 2.2 AA patterns for keyboard navigation, ARIA roles and states, focus management, color contrast, and screen reader support.
Consumption algorithm for FEATURE_KNOWLEDGE variable — pre-computed feature context
This skill should be used when reviewing code for SOLID violations, tight coupling, or layering issues.
| name | feature-knowledge |
| description | Structures codebase exploration into a feature knowledge base |
| user-invocable | false |
| allowed-tools | ["Read","Grep","Glob","Write"] |
Capture the institutional knowledge that lives in developers' heads — the things obvious to them but invisible to newcomers.
A feature knowledge entry exists to save the NEXT agent from rediscovering patterns that span multiple files, modules, or layers. If it's obvious from a single file read, don't capture it.
Follow these four phases in order. Do not skip ahead.
Map the landscape. Get a high-level understanding before going deep.
Glob to discover directory structure and file organizationGoal: Answer "Where does the code related to this area live, and how is it structured?"
Go deep. Read the actual code and pull out the real patterns.
ReadGrep to find recurring patterns across the codebaseFor complex domains, go further:
Self-check before moving on:
Organize and validate findings. Raw observations become structured knowledge.
Choose a knowledge category:
| The knowledge is about... | Category | Language Style |
|---|---|---|
| How the overall system is designed | architecture | Descriptive — explains what systems are and why they exist |
| Patterns followed across the whole project | conventions | Prescriptive — "Do this," "Avoid that" |
| How a specific type of component works | component-patterns | Prescriptive — enforces conventions |
| A specific business domain or module | domain-knowledge | Descriptive — builds mental models |
| Hard-won lessons from incidents or edge cases | lessons-learned | Narrative — tells the story of discovery |
Validate each finding:
Write the knowledge file. Follow the output format exactly.
---
feature: {slug}
name: {human-readable name}
description: "Use when [specific scenarios]. Keywords: [relevant terms]."
category: [architecture | conventions | component-patterns | domain-knowledge | lessons-learned]
directories: [{dir prefixes}]
created: {ISO date}
updated: {ISO date}
---
# {Feature Area Name}
## Overview
[1-2 paragraphs: what this knowledge covers and why it matters for this codebase]
## [Main Sections — vary by category, see Category Templates below]
## Anti-Patterns
[What to avoid and why — with explanation of consequences]
## Gotchas
[Non-obvious behaviors, edge cases, things that break silently]
## Key Files
[Most important files with one-line descriptions]
## Related
[Links to ADR/PF entries, other feature knowledge entries, key source files]
Use the matching template as your main sections. Anti-Patterns, Gotchas, Key Files, and Related are shared across all categories.
Architecture:
Conventions:
Component Patterns:
Domain Knowledge:
Lessons Learned:
The description field is how this feature knowledge entry gets discovered. It must:
Good: "Use when adding a new vendor integration, implementing API clients, or connecting to external services. Keywords: integration, vendor, API client, webhook."
Bad: "Integration stuff"
Knowledge files must not exist in isolation. The Related section must link to:
References should be bidirectional — when creating a new feature knowledge entry that relates to an existing one, note the connection.
Every code example must have three parts:
Before including an example, verify it adds significant unique value beyond what descriptive text alone provides. If the pattern can be fully explained in a sentence, skip the code block. Only show codebase-specific patterns — never generic language features.
Never include bare code snippets without context.
| Red Flag | What It Indicates |
|---|---|
| "Always follow best practices" | Generic, not codebase-specific |
| No code examples at all | Insufficient actionable guidance |
| Examples without inline comments | Missing required context |
| "In the future, we might..." | Speculative — remove it |
| 500+ lines in a single file | Should be split into focused files |
| No cross-references in Related | Isolated knowledge island |
Run through this before writing. If any check fails, go back and fix it.
Content:
Examples:
Structure:
Connections:
After writing KNOWLEDGE.md, update the index cache directly:
File: {worktree}/.devflow/features/index.md
Operation: Read-modify-write — replace the existing line for this slug if present, or append.
Line format:
- **{slug}** — {areas} — {Use-when description}
Where:
{slug} matches the feature: frontmatter field{areas} is a comma-separated summary of the directories: frontmatter field{Use-when description} is the description: frontmatter field value (the full "Use when..." sentence)If index.md does not exist, create it with just this line. If the file already has an entry for this slug, replace that line in-place. This is the discoverable cache read by knowledge_load() — the KNOWLEDGE.md frontmatter is always authoritative.
This is what a complete, well-structured feature knowledge entry looks like. Use it as a reference for quality and format.
---
feature: integrations
name: Third-Party Integrations
description: "Use when adding a new vendor integration, implementing API clients, or connecting to external services. Keywords: integration, vendor, API client, webhook, spawn, config."
category: component-patterns
directories: [src/lib/]
created: 2026-04-30
updated: 2026-04-30
---
# Third-Party Integrations
## Overview
This project integrates with external systems in three ways: spawning CLI processes, fetching files from remote registries, and writing to directories that AI editors watch. Each integration lives in its own module under `src/lib/` and is wired into a command in `src/commands/`. All external constants are centralized in `src/lib/config.ts`.
The key cross-cutting pattern is the separation between lib modules (which integrate) and commands (which orchestrate). Violating this creates coupling that breaks the error handling model.
## Core Responsibilities
- Lib modules: integrate with external systems, export async functions, throw on failure
- Commands: orchestrate lib modules, catch errors, route to UI via `showError()`
- Config: centralize all external constants, expose env var overrides
## Standard Structure
Every integration follows the same file organization. This example shows the pattern that all three existing integrations (Claude CLI, GitHub, AI editors) follow:
```
src/lib/
claude.ts # Claude Code CLI (spawn + stream JSON)
skill-installer.ts # GitHub (git clone, sparse checkout)
deploy.ts # AI editors (.claude/, .cursor/ dirs)
config.ts # All constants for the above
```
A new integration means a new file here. The module exports async functions, imports from `config.ts`, and never imports from `src/ui/` or `src/commands/`.
### Config Centralization
URLs, subpaths, install directories — these change together. One file to update when an upstream moves:
All constants use `SCREAMING_SNAKE_CASE` with a descriptive prefix. If a value can be overridden by the user, expose an env var with a sensible default.
## Anti-Patterns
- **Putting fetch logic in a command file** — breaks the lib/command separation and makes the integration untestable in isolation.
- **Hardcoding URLs in lib modules** — always use `config.ts`. Scattered strings become stale and hard to find.
- **Calling `showError()` from a lib module** — lib modules throw; commands catch and display.
## Gotchas
- `spawn` requires the binary on PATH. If integrating a tool that may not be globally installed, detect `ENOENT` and provide an install URL.
- Temp files use `Date.now()`. If two processes run simultaneously, add a random suffix to avoid collisions.
## Key Files
- `src/lib/config.ts` — add constants here before writing integration code
- `src/lib/claude.ts` — reference implementation for spawn-and-stream pattern
- `src/lib/skill-installer.ts` — reference implementation for fetch-from-remote pattern
## Related
- ADR-003: Lib/command separation principle
- PF-001: Config drift when constants are scattered
Only document what you can verify in the codebase. When you encounter:
Acknowledge the limitation clearly and focus on what IS extractable. Never fill gaps with generic knowledge or speculation.