agentleFS
QBall-IncQBall-Inc/the-bulwark/skills/component-patterns/SKILL.md

component-patterns

Skill8 starsChanged 5 months agoMITView on GitHub

Per-component-type verification approaches. Use when generating verification scripts for different component types.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read the appropriate pattern file from references/:

    line 71
  2. Distinctive:

    Generic/Other: Use Bash template

    line 82
  3. Distinctive:

    All patterns follow the same principle: verify observable output, not mock calls.

    line 112
  4. Very specific:

    Write diagnostic output to logs/diagnostics/component-patterns-{YYYYMMDD-HHMMSS}.yaml:

    line 125

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Component Patterns

Purpose

Provide verification strategies for different component types. This skill defines how to test real behavior for CLIs, servers, parsers, processes, databases, and external APIs.

When to Use

Load this skill when:

  • Generating verification scripts via bulwark-verify skill
  • Determining how to test a specific component type
  • Implementing test-audit Step 7 rewrites

Component Type Detection

Analyze the code to determine component type based on these indicators:

IndicatorsComponent TypePattern Reference
Imports child_process, has spawn/exec/execSyncProcess Spawnerreferences/pattern-process-spawner.md
Imports http/https/express/fastify/koa, has listen()HTTP Serverreferences/pattern-http-server.md
Imports fs, reads/parses files, has parse functionsFile Parserreferences/pattern-file-parser.md
Has CLI argument parsing (process.argv, yargs, commander, argparse)CLI Commandreferences/pattern-cli-command.md
Imports database driver (pg, mysql, mongoose, sqlite, prisma)Databasereferences/pattern-database.md
Makes outbound HTTP calls (fetch, axios, got, requests)External APIreferences/pattern-external-api.md

Pattern Reference Files

Each pattern reference contains:

  • Strategy: High-level approach for testing the component type
  • Templates: Ready-to-use verification script templates in Bash, Node/Jest, and Python/pytest
  • Placeholders: Variables to substitute with component-specific values

Available Patterns

PatternFileLanguages
CLI Commandreferences/pattern-cli-command.mdBash, Node, Python
HTTP Serverreferences/pattern-http-server.mdBash, Node (supertest), Python
File Parserreferences/pattern-file-parser.mdBash, Node, Python
Process Spawnerreferences/pattern-process-spawner.mdBash, Node
Databasereferences/pattern-database.mdNode, Python, Bash (SQLite)
External APIreferences/pattern-external-api.mdNode (MSW), Python (responses)

Usage Instructions

Step 1: Detect Component Type

Analyze the target component code using the detection table above.

Step 2: Load Pattern Reference

Read the appropriate pattern file from references/:

Read skills/component-patterns/references/pattern-{type}.md

Step 3: Select Template

Choose the template that matches the project language:

  • Node projects (package.json present): Use Node/Jest template
  • Python projects (pyproject.toml or setup.py present): Use Python/pytest template
  • Generic/Other: Use Bash template

Step 4: Substitute Placeholders

Replace all {placeholder} values with component-specific information:

Common PlaceholdersDescription
{component_name}Name of the component being tested
{component_path}Import path to the module
{port}Network port (for servers/processes)
{expected_value}Expected output to verify

Quick Reference: Component to Pattern

Component TypeVerification StrategyKey Assertion
CLI CommandSpawn, capture stdout/stderrExit code + output text
HTTP ServerStart, HTTP request, verify responseStatus code + response body
File ParserCreate input, parse, check structureParsed fields + values
Process SpawnerSpawn, check port/pid, verify behaviorProcess alive + responds
DatabaseSetup DB, execute ops, query stateRecords exist/modified
External APIMSW intercept, real fetch, check resultResponse data matches

Key Principle: Real Verification

All patterns follow the same principle: verify observable output, not mock calls.

Anti-PatternReal Pattern
expect(spawn).toHaveBeenCalled()expect(await checkPort(8080)).toBe(true)
expect(fs.writeFile).toHaveBeenCalled()expect(fs.existsSync(path)).toBe(true)
expect(fetch).toHaveBeenCalledWith(url)const resp = await fetch(url); expect(resp.status).toBe(200)
expect(db.save).toHaveBeenCalled()const found = await db.find(id); expect(found).toBeDefined()

Diagnostic Output

Write diagnostic output to logs/diagnostics/component-patterns-{YYYYMMDD-HHMMSS}.yaml:

skill: component-patterns
timestamp: {ISO-8601}
diagnostics:
  component_type_detected: cli|http|file-parser|process|database|api
  pattern_applied: "CLI Command Verification"
  template_language: bash|node|python
  files_analyzed: 1
  completion_status: success

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.