Coding standards discovery and documentation expert. Analyzes codebase to detect naming conventions, patterns, anti-patterns, and best practices. Generates or updates coding standards documentation in .specweave/docs/internal/governance/. Detects ESLint/Prettier configs, analyzes TypeScript/JavaScript patterns, finds security issues, and creates evidence-based standards with confidence levels. Activates for analyze coding standards, discover conventions, code style analysis, detect patterns, coding guidelines, what are the standards, code quality check, naming conventions, linting rules, best practices analysis, standards audit, code review standards, detect anti-patterns.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
Purpose: Discover, document, and maintain coding standards from existing codebases using evidence-based analysis.
Philosophy: Standards should reflect REALITY (what the code actually does) not ASPIRATIONS (what we wish it did). Measure, then document.
Keywords: analyze coding standards, discover conventions, code style, detect patterns, coding guidelines, what are the standards, naming conventions, best practices, code quality, standards audit, anti-patterns
User Requests:
.specweave/docs/internal/governance/coding-standards.md.eslintrc.json, .eslintrc.js).prettierrc, .prettierrc.json)tsconfig.json).editorconfig)CLAUDE.md, CONTRIBUTING.mdany usage, interface vs type preference)console.* usage in production codeany type overuseSources Checked:
.specweave/docs/internal/governance/coding-standards.md (HIGH confidence)CLAUDE.md (HIGH confidence - AI instructions).eslintrc.json (ENFORCED by tooling).prettierrc (ENFORCED by tooling)tsconfig.json (ENFORCED by compiler).editorconfig (ENFORCED by editor)CONTRIBUTING.md (MEDIUM confidence - may be outdated)Output:
## Explicit Standards Found
✅ .eslintrc.json (ENFORCED - ESLint active)
✅ .prettierrc (ENFORCED - Prettier active)
✅ tsconfig.json (ENFORCED - TypeScript compiler)
✅ CLAUDE.md (HIGH - AI development rules)
⚠️ CONTRIBUTING.md (MEDIUM - human guidelines)
❌ No .specweave/docs/internal/governance/coding-standards.md
Analysis Performed:
src/**/*.{ts,js,tsx,jsx} filesExample Output:
## Detected Patterns
### Naming Conventions (Confidence: 95%)
- Variables: camelCase (1,234 samples, 98% compliance)
- Functions: camelCase (567 samples, 100% compliance)
- Classes: PascalCase (89 samples, 100% compliance)
- Constants: UPPER_SNAKE_CASE (234 samples, 92% compliance)
⚠️ 8% use camelCase (inconsistency detected)
### Import Patterns (Confidence: 100%)
- Extensions: .js suffix required (100% compliance)
- Order: external → internal → types (87% compliance)
### Function Characteristics
- Average length: 35 lines
- Max length: 156 lines (src/core/analyzer.ts:45)
- Style: Arrow functions (78%), Regular (22%)
### Type Safety (Confidence: 85%)
- any usage: 12 instances (REVIEW NEEDED)
- Preference: Interfaces (89%) over Types (11%)
Checks Performed:
Example Output:
## Issues Found
### 🔴 CRITICAL (2 issues)
- Hardcoded Secrets: 2 instances
- src/config/api.ts:12
- src/utils/auth.ts:45
Fix: Use process.env variables
### 🟠 HIGH (5 issues)
- console.* Usage: 5 instances in src/
- src/core/analyzer.ts:67
Fix: Use logger abstraction
### 🟡 MEDIUM (12 issues)
- Large Files: 3 files > 500 lines
- src/core/orchestrator.ts (678 lines)
Fix: Split into modules
Merge Strategy:
Output: .specweave/docs/internal/governance/coding-standards-analysis.md
Automatic: Runs as part of brownfield analysis
User: "Analyze this brownfield project"
Workflow:
1. Scan project structure
2. Classify documents
3. Detect external tools
4. → RUN code-standards-detective agent
5. → GENERATE coding-standards.md
6. Generate migration plan
Reference: Standards included in technical constraints
## Technical Constraints
Coding Standards: .specweave/docs/internal/governance/coding-standards.md
- Naming: camelCase (vars), PascalCase (classes)
- Functions: < 50 lines target
- No console.* - use logger
Optional: Re-analyze on increment done
/sw:done 0046 --update-standards
User: "What are the coding standards for this project?"
Skill: code-standards-analyzer
Actions:
1. Check for existing standards (none found)
2. Parse .eslintrc.json, .prettierrc
3. Analyze 1,234 TypeScript files
4. Detect patterns with 95% confidence
5. Generate standards document
Output:
"✅ Analysis complete! Generated coding standards at:
.specweave/docs/internal/governance/coding-standards-analysis.md
Key findings:
- Naming: 98% camelCase compliance
- Imports: 100% use .js extensions
- Issues: 5 console.* usages, 2 hardcoded secrets
- Recommendation: Formalize detected patterns as official standards"
User: "Check if we're following our declared standards"
Skill: code-standards-analyzer
Actions:
1. Read existing coding-standards.md
2. Analyze current codebase
3. Compare declared vs actual
4. Report violations
Output:
"📊 Standards Compliance: 87%
✅ Passing:
- Naming conventions: 98% compliant
- Import patterns: 100% compliant
⚠️ Violations:
- console.* usage: 12 instances (should be 0)
- Large files: 3 files > 500 lines (should be 0)
Recommendation: Fix violations or update standards to reflect reality"
User: "I'm new to this codebase. What conventions should I follow?"
Skill: code-standards-analyzer
Actions:
1. Load existing coding-standards.md
2. Extract key rules with examples
3. Highlight SpecWeave-specific patterns
Output:
"📚 Coding Standards Summary
1. Naming:
- Variables: camelCase (e.g., `userId`, `isActive`)
- Functions: camelCase (e.g., `getUserById()`)
- Classes: PascalCase (e.g., `UserService`)
2. Imports:
- Always use .js extensions
- Example: import { foo } from './bar.js'
3. Error Handling:
- Use custom error types
- Example: throw new UserNotFoundError(id)
4. Logging:
- NEVER use console.*
- Use logger abstraction instead
Full standards: .specweave/docs/internal/governance/coding-standards.md"
# Full analysis
/sw:analyze-standards
# Drift detection only
/sw:analyze-standards --drift
# Update existing standards
/sw:analyze-standards --update
coding-standards-analysis.md (Auto-Generated)Location: .specweave/docs/internal/governance/coding-standards-analysis.md
Purpose: Latest analysis report (gitignored, temporary)
Contents:
coding-standards.md (Source of Truth)Location: .specweave/docs/internal/governance/coding-standards.md
Purpose: Official coding standards (git-tracked, manual + auto)
Contents:
coding-standards-history.md (Change Log)Location: .specweave/docs/internal/governance/coding-standards-history.md
Purpose: Track standard evolution over time
Contents:
Naming Convention Detection:
Anti-Pattern Detection:
Confidence Levels:
Status: ✅ Implemented (increment 0122-multi-technology-governance)
| Technology | Config Files | Status |
|---|---|---|
| TypeScript/JavaScript | .eslintrc.*, .prettierrc, tsconfig.json | ✅ Implemented |
| Python | pyproject.toml, .pylintrc, ruff.toml, .flake8, mypy.ini | ✅ Implemented |
| Go | go.mod, .golangci.yml, staticcheck.conf | ✅ Implemented |
| Java/Kotlin | checkstyle.xml, pmd.xml, spotbugs.xml, detekt.yml | ✅ Implemented |
| C#/.NET | .editorconfig, StyleCop.json, Directory.Build.props | ✅ Implemented |
| Rust | rustfmt.toml, clippy.toml, Cargo.toml | ✅ Implemented |
| React | ESLint + plugin:react/*, package.json | ✅ Implemented |
| Angular | angular.json, .eslintrc | ✅ Implemented |
| Vue | ESLint + plugin:vue/*, vite.config.* | ✅ Implemented |
| Svelte | svelte.config.js, package.json | ✅ Implemented |
Output Structure:
.specweave/docs/internal/governance/
├── coding-standards.md # Unified summary of ALL technologies
├── shared-conventions.md # EditorConfig, Git conventions
└── standards/
├── typescript.md
├── python.md
├── golang.md
├── java.md
├── react.md
├── angular.md
├── vue.md
└── svelte.md
Usage:
import {
detectEcosystems,
parsePythonStandards,
parseGoStandards,
parseJavaStandards,
parseFrontendStandards,
generateStandardsMarkdown,
generateUnifiedSummary
} from 'src/core/living-docs/governance/index.js';